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 {
66
66
Company ,
67
67
Customer ,
68
68
SessionToken ,
69
+ Analytics ,
69
70
ApplyTrackingConsentChangeType ,
70
71
CustomerPrivacy ,
71
72
TrackingConsentChangeResult ,
Original file line number Diff line number Diff line change @@ -184,11 +184,6 @@ export interface OrderStatusLocalization {
184
184
export type AuthenticationState = 'fully_authenticated' | 'pre_authenticated' ;
185
185
186
186
export 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
-
192
187
/**
193
188
* Gift Cards that have been applied to the order.
194
189
*/
@@ -952,13 +947,6 @@ export interface StoreCreditAccount {
952
947
balance : Money ;
953
948
}
954
949
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
-
962
950
/**
963
951
* Represents the delivery information and options available for one or
964
952
* more cart lines.
Original file line number Diff line number Diff line change @@ -448,6 +448,50 @@ export interface SessionToken {
448
448
get ( ) : Promise < string > ;
449
449
}
450
450
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
+
451
495
export interface AllowedProcessing {
452
496
/**
453
497
* 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 9
9
StorefrontApiVersion ,
10
10
Ui ,
11
11
SessionToken ,
12
+ Analytics ,
12
13
CustomerPrivacy ,
13
14
ApplyTrackingConsentChangeType ,
14
15
} from '../shared' ;
@@ -79,6 +80,11 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
79
80
*/
80
81
sessionToken : SessionToken ;
81
82
83
+ /**
84
+ * Methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
85
+ */
86
+ analytics : Analytics ;
87
+
82
88
/**
83
89
* The settings matching the settings definition written in the
84
90
* [`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