File tree Expand file tree Collapse file tree 5 files changed +56
-12
lines changed
packages/ui-extensions/src/surfaces/customer-account Expand file tree Collapse file tree 5 files changed +56
-12
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @shopify/ui-extensions ' : patch
3+ ---
4+
5+ Move analytics api from osp api to standard api in customer account ui extension.
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ export type {
6666 Company ,
6767 Customer ,
6868 SessionToken ,
69+ Analytics ,
6970 ApplyTrackingConsentChangeType ,
7071 CustomerPrivacy ,
7172 TrackingConsentChangeResult ,
Original file line number Diff line number Diff line change @@ -184,11 +184,6 @@ export interface OrderStatusLocalization {
184184export type AuthenticationState = 'fully_authenticated' | 'pre_authenticated' ;
185185
186186export interface OrderStatusApi < Target extends ExtensionTarget > {
187- /**
188- * Methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
189- */
190- analytics : Analytics ;
191-
192187 /**
193188 * Gift Cards that have been applied to the order.
194189 */
@@ -952,13 +947,6 @@ export interface StoreCreditAccount {
952947 balance : Money ;
953948}
954949
955- export interface Analytics {
956- /**
957- * Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
958- */
959- publish ( name : string , data : { [ key : string ] : unknown } ) : Promise < boolean > ;
960- }
961-
962950/**
963951 * Represents the delivery information and options available for one or
964952 * more cart lines.
Original file line number Diff line number Diff line change @@ -448,6 +448,50 @@ export interface SessionToken {
448448 get ( ) : Promise < string > ;
449449}
450450
451+ export interface Analytics {
452+ /**
453+ * Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
454+ */
455+ publish ( name : string , data : Record < string , unknown > ) : Promise < boolean > ;
456+
457+ /**
458+ * A method for capturing details about a visitor on the online store.
459+ */
460+ visitor ( data : { email ?: string ; phone ?: string } ) : Promise < VisitorResult > ;
461+ }
462+ /**
463+ * Represents a visitor result.
464+ */
465+ export type VisitorResult = VisitorSuccess | VisitorError ;
466+
467+ /**
468+ * Represents a successful visitor result.
469+ */
470+ export interface VisitorSuccess {
471+ /**
472+ * Indicates that the visitor information was validated and submitted.
473+ */
474+ type : 'success' ;
475+ }
476+
477+ /**
478+ * Represents an unsuccessful visitor result.
479+ */
480+ export interface VisitorError {
481+ /**
482+ * Indicates that the visitor information is invalid and wasn't submitted.
483+ * Examples are using the wrong data type or missing a required property.
484+ */
485+ type : 'error' ;
486+
487+ /**
488+ * A message that explains the error. This message is useful for debugging.
489+ * It's **not** localized, and therefore should not be presented directly
490+ * to the buyer.
491+ */
492+ message : string ;
493+ }
494+
451495export interface AllowedProcessing {
452496 /**
453497 * Can collect customer analytics about how the shop was used and interactions made on the shop.
Original file line number Diff line number Diff line change 99 StorefrontApiVersion ,
1010 Ui ,
1111 SessionToken ,
12+ Analytics ,
1213 CustomerPrivacy ,
1314 ApplyTrackingConsentChangeType ,
1415} from '../shared' ;
@@ -79,6 +80,11 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
7980 */
8081 sessionToken : SessionToken ;
8182
83+ /**
84+ * Methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
85+ */
86+ analytics : Analytics ;
87+
8288 /**
8389 * The settings matching the settings definition written in the
8490 * [`shopify.ui.extension.toml`](https://shopify.dev/docs/api/customer-account-ui-extensions/configuration) file.
You can’t perform that action at this time.
0 commit comments