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 @@ -437,6 +437,50 @@ export interface SessionToken {
437
437
get ( ) : Promise < string > ;
438
438
}
439
439
440
+ export interface Analytics {
441
+ /**
442
+ * Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
443
+ */
444
+ publish ( name : string , data : Record < string , unknown > ) : Promise < boolean > ;
445
+
446
+ /**
447
+ * A method for capturing details about a visitor on the online store.
448
+ */
449
+ visitor ( data : { email ?: string ; phone ?: string } ) : Promise < VisitorResult > ;
450
+ }
451
+ /**
452
+ * Represents a visitor result.
453
+ */
454
+ export type VisitorResult = VisitorSuccess | VisitorError ;
455
+
456
+ /**
457
+ * Represents a successful visitor result.
458
+ */
459
+ export interface VisitorSuccess {
460
+ /**
461
+ * Indicates that the visitor information was validated and submitted.
462
+ */
463
+ type : 'success' ;
464
+ }
465
+
466
+ /**
467
+ * Represents an unsuccessful visitor result.
468
+ */
469
+ export interface VisitorError {
470
+ /**
471
+ * Indicates that the visitor information is invalid and wasn't submitted.
472
+ * Examples are using the wrong data type or missing a required property.
473
+ */
474
+ type : 'error' ;
475
+
476
+ /**
477
+ * A message that explains the error. This message is useful for debugging.
478
+ * It's **not** localized, and therefore should not be presented directly
479
+ * to the buyer.
480
+ */
481
+ message : string ;
482
+ }
483
+
440
484
export interface AllowedProcessing {
441
485
/**
442
486
* 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