@anker-in/shopify-react 0.1.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,550 @@
1
+ import { NormalizedCart, NormalizedProduct, NormalizedProductVariant } from '@anker-in/shopify-sdk';
2
+
3
+ /**
4
+ * Tracking Types
5
+ * Type definitions for analytics and tracking
6
+ */
7
+
8
+ interface TrackingLineItem {
9
+ variant?: {
10
+ id: string;
11
+ sku?: string;
12
+ title?: string;
13
+ name?: string;
14
+ price?: {
15
+ amount: string;
16
+ currencyCode: string;
17
+ };
18
+ finalPrice?: {
19
+ amount: string;
20
+ };
21
+ product?: {
22
+ title?: string;
23
+ name?: string;
24
+ vendor?: string;
25
+ productType?: string;
26
+ metafields?: {
27
+ global?: {
28
+ trafficType?: string;
29
+ };
30
+ };
31
+ };
32
+ };
33
+ quantity?: number;
34
+ finalPrice?: {
35
+ amount: string;
36
+ };
37
+ }
38
+ interface GtmParams {
39
+ pageGroup?: string;
40
+ position?: string;
41
+ brand?: string;
42
+ ga4Params?: Record<string, any>;
43
+ }
44
+ interface TrackingOptions {
45
+ /** Enable Google Analytics tracking */
46
+ enableGA?: boolean;
47
+ /** Enable Facebook Pixel tracking */
48
+ enableFBQ?: boolean;
49
+ /** GTM parameters */
50
+ gtmParams?: GtmParams;
51
+ /** Brand name for tracking */
52
+ brand?: string;
53
+ }
54
+ interface TrackingAdapter {
55
+ /** Track add to cart event */
56
+ trackAddToCart?: (params: {
57
+ cart: NormalizedCart;
58
+ lineItems: TrackingLineItem[];
59
+ gtmParams?: GtmParams;
60
+ brand?: string;
61
+ }) => void;
62
+ /** Track remove from cart event */
63
+ trackRemoveFromCart?: (params: {
64
+ cart: NormalizedCart;
65
+ lineItems: TrackingLineItem[];
66
+ gtmParams?: GtmParams;
67
+ brand?: string;
68
+ }) => void;
69
+ /** Track begin checkout event */
70
+ trackBeginCheckout?: (params: {
71
+ cart: NormalizedCart;
72
+ gtmParams?: GtmParams;
73
+ brand?: string;
74
+ }) => void;
75
+ }
76
+
77
+ /**
78
+ * Google Analytics Tracking
79
+ * GA4 event tracking utilities
80
+ */
81
+
82
+ declare global {
83
+ interface Window {
84
+ dataLayer?: any[];
85
+ gtag?: (...args: any) => void;
86
+ }
87
+ }
88
+ /**
89
+ * Push event to GA4 dataLayer
90
+ */
91
+ declare const gaTrack: (data: any) => void;
92
+ /**
93
+ * Track add to cart event in GA4
94
+ */
95
+ declare const trackAddToCartGA: ({ lineItems, gtmParams, brand, }: {
96
+ lineItems: TrackingLineItem[];
97
+ gtmParams?: GtmParams;
98
+ brand?: string;
99
+ }) => void;
100
+ /**
101
+ * Track begin checkout event in GA4
102
+ */
103
+ declare const trackBeginCheckoutGA: ({ lineItems, currencyCode, totalPrice, gtmParams, brand, }: {
104
+ lineItems: TrackingLineItem[];
105
+ currencyCode?: string;
106
+ totalPrice?: number;
107
+ gtmParams?: GtmParams;
108
+ brand?: string;
109
+ }) => void;
110
+ /**
111
+ * Track buy now event in GA4
112
+ * This triggers begin_checkout event for buy now actions
113
+ */
114
+ declare const trackBuyNowGA: ({ lineItems, gtmParams, brand, }: {
115
+ lineItems: TrackingLineItem[];
116
+ gtmParams?: GtmParams;
117
+ brand?: string;
118
+ }) => void;
119
+
120
+ /**
121
+ * Facebook Pixel Tracking
122
+ * FBQ event tracking utilities
123
+ */
124
+
125
+ declare global {
126
+ interface Window {
127
+ fbq?: (...args: any[]) => void;
128
+ gtag?: (...args: any[]) => void;
129
+ }
130
+ }
131
+ /**
132
+ * Track add to cart event in Facebook Pixel
133
+ */
134
+ declare const trackAddToCartFBQ: ({ lineItems }: {
135
+ lineItems: TrackingLineItem[];
136
+ }) => void;
137
+ /**
138
+ * Configuration for Buy Now tracking events
139
+ */
140
+ interface BuyNowTrackConfig {
141
+ /** Google Tag ID */
142
+ gtagId?: string;
143
+ /** Facebook Pixel custom event name */
144
+ fbqBuyNowEvent?: string;
145
+ /** Google Tag conversion label */
146
+ gtagBuyNowLabel?: string;
147
+ /** Google Tag conversion action (default: 'conversion') */
148
+ gtagBuyNowConversion?: string;
149
+ }
150
+ /**
151
+ * Track buy now event in Facebook Pixel and Google Tag
152
+ */
153
+ declare const trackBuyNowFBQ: ({ trackConfig }: {
154
+ trackConfig?: BuyNowTrackConfig;
155
+ }) => void;
156
+
157
+ /**
158
+ * Plus Member Types
159
+ * Type definitions for Plus Member functionality
160
+ */
161
+
162
+ declare enum PLUS_MEMBER_TYPE {
163
+ FREE = 0,// 免费会员
164
+ MONTHLY = 1,// 月费会员
165
+ ANNUAL = 2
166
+ }
167
+ declare enum PlusMemberMode {
168
+ MONTHLY = "monthly",
169
+ ANNUAL = "annual"
170
+ }
171
+ declare enum DeliveryPlusType {
172
+ FREE = "free",
173
+ MONTHLY = "monthly",
174
+ ANNUAL = "annual"
175
+ }
176
+ declare enum ShippingMethodMode {
177
+ FREE = "free",
178
+ TDD = "tdd",
179
+ NDD = "ndd"
180
+ }
181
+ type PlusMemberShippingMethodMetafields = {
182
+ __mode: ShippingMethodMode;
183
+ __code: string;
184
+ title: string;
185
+ subtitle: string;
186
+ price: number;
187
+ weight_low?: number | null;
188
+ weight_high?: number | null;
189
+ __plus?: boolean;
190
+ };
191
+ type PlusMemberShippingMethodConfig = PlusMemberShippingMethodMetafields & {
192
+ id: string;
193
+ disabled?: boolean;
194
+ useCoupon?: boolean;
195
+ coupon?: string;
196
+ };
197
+ type PlusMemberSettingsMetafields = {
198
+ join_member: string;
199
+ join_plus_member: string;
200
+ member_extra: string;
201
+ member_price: string;
202
+ plus_member_price: string;
203
+ will_save: string;
204
+ total_save: string;
205
+ with_member: string;
206
+ with_plus_member: string;
207
+ save_with_plus: string;
208
+ discount_box: {
209
+ plus_member: string;
210
+ money: string;
211
+ month: string;
212
+ saving: string;
213
+ worth: string;
214
+ other: string;
215
+ };
216
+ plus_monthly_product: {
217
+ handle: string;
218
+ sku: string;
219
+ };
220
+ plus_annual_product: {
221
+ handle: string;
222
+ sku: string;
223
+ };
224
+ thank: {
225
+ success: {
226
+ title: string;
227
+ line1: string;
228
+ line2: string;
229
+ button: string;
230
+ link_text: string;
231
+ link: string;
232
+ };
233
+ warn: {
234
+ title: string;
235
+ };
236
+ error: {
237
+ title: string;
238
+ button: string;
239
+ };
240
+ };
241
+ agreeBox: {
242
+ text: string;
243
+ error_text: string;
244
+ };
245
+ shippingMethod: {
246
+ cancelCodeTip: string;
247
+ addCodeTip: string;
248
+ overWeight_ndd: number;
249
+ overWeight_tdd: number;
250
+ overWeight_ndd_tip: string;
251
+ specialTip: string;
252
+ learnMore: string;
253
+ specialModal: Array<{
254
+ title_del: string;
255
+ content: string;
256
+ }>;
257
+ };
258
+ cart: {
259
+ tip: string;
260
+ credits_times: number;
261
+ title: string;
262
+ subtitle: string;
263
+ };
264
+ plus_member: {
265
+ title: string;
266
+ box: {
267
+ title: string;
268
+ description: string;
269
+ learn_more: string;
270
+ trade_desc?: string;
271
+ };
272
+ type: Array<{
273
+ title: string;
274
+ subtitle: string;
275
+ __mode: DeliveryPlusType;
276
+ save?: string;
277
+ price?: string;
278
+ compare_price?: string;
279
+ tagImg?: string;
280
+ }>;
281
+ };
282
+ member_benefits: {
283
+ title: string;
284
+ subtitle: string;
285
+ list: Array<{
286
+ icon: string;
287
+ title: string;
288
+ subtitle: string;
289
+ }>;
290
+ annually: {
291
+ title: string;
292
+ list: Array<{
293
+ icon: string;
294
+ title: string;
295
+ subtitle: string;
296
+ }>;
297
+ };
298
+ ankerCredits: {
299
+ text: string;
300
+ url: string;
301
+ };
302
+ };
303
+ shipping_policy: {
304
+ title: string;
305
+ shipping_coupon: {
306
+ title: string;
307
+ list: string[];
308
+ };
309
+ shipping_service: {
310
+ title: string;
311
+ list: Array<{
312
+ title: string;
313
+ list: string[];
314
+ }>;
315
+ };
316
+ terms: {
317
+ text: string;
318
+ url: string;
319
+ };
320
+ };
321
+ shipping_check: {
322
+ title: string;
323
+ label: string;
324
+ placeholder: string;
325
+ cancel: string;
326
+ available: string;
327
+ here: {
328
+ text: string;
329
+ url: string;
330
+ };
331
+ save: string;
332
+ apply: string;
333
+ };
334
+ plus_shipping: {
335
+ title: string;
336
+ policy: string;
337
+ more_option: string;
338
+ view_less: string;
339
+ buy_directly: string;
340
+ used_up_all: string;
341
+ used_up_ndd: string;
342
+ delivers_to: string;
343
+ edit: string;
344
+ out_ndd_shipping: string;
345
+ out_tdd_shipping: string;
346
+ plus: string;
347
+ directly: string;
348
+ shipping_methods: PlusMemberShippingMethodMetafields[];
349
+ };
350
+ shipping: {
351
+ shipping_benefits: string;
352
+ shipping_address: string;
353
+ seeAvailableShippingAreas: string;
354
+ modify: string;
355
+ enter: string;
356
+ click: string;
357
+ fill: string;
358
+ plus: string;
359
+ use_coupon: string;
360
+ no_coupon: string;
361
+ get_address: string;
362
+ confirm: string;
363
+ shipping_not_support: string;
364
+ faq_link: string;
365
+ fields: Array<{
366
+ __key: string;
367
+ required: boolean;
368
+ title: string;
369
+ placeholder: string;
370
+ }>;
371
+ shipping_methods: Array<{
372
+ __mode: string;
373
+ __code: string;
374
+ title: string;
375
+ subtitle: string;
376
+ tip?: string;
377
+ outRange?: string;
378
+ rule?: {
379
+ '<22': number;
380
+ '>=22': number;
381
+ };
382
+ __weight?: string;
383
+ }>;
384
+ join_member: {
385
+ join: string;
386
+ text: string;
387
+ tip: string;
388
+ };
389
+ discount_not_support_address: string;
390
+ };
391
+ listingEntryCard: {
392
+ showEntry: boolean;
393
+ EntryCardBgi: string;
394
+ EntryCardMobBgi: string;
395
+ EntryCardPadBgi: string;
396
+ EntryCardSmBgi: string;
397
+ EntryCardicon: string;
398
+ EntryCardtitle: string;
399
+ EntryCardcontent: string;
400
+ EntryCardbuttonText: string;
401
+ };
402
+ noLogin: {
403
+ recommend: string;
404
+ content: Array<{
405
+ title: string;
406
+ list: Array<{
407
+ icon: string;
408
+ recommend: boolean;
409
+ title: string;
410
+ description: string;
411
+ subTitle?: string;
412
+ }>;
413
+ note?: string;
414
+ }>;
415
+ head: {
416
+ img: string;
417
+ padImg: string;
418
+ mobImg: string;
419
+ title: string;
420
+ mobTitle: string;
421
+ pay: string;
422
+ subTitle: string;
423
+ icon: string;
424
+ };
425
+ headAnnual: {
426
+ img: string;
427
+ padImg: string;
428
+ mobImg: string;
429
+ title: string;
430
+ pay: string;
431
+ subTitle: string;
432
+ icon: string;
433
+ };
434
+ main: {
435
+ title: string;
436
+ };
437
+ };
438
+ loginedExpiredMember: {
439
+ content: Array<{
440
+ img: string;
441
+ mobImg: string;
442
+ text: string;
443
+ }>;
444
+ head: {
445
+ img: string;
446
+ mobImg: string;
447
+ title: string;
448
+ subTitle: string;
449
+ };
450
+ main: {
451
+ text: string;
452
+ title: string;
453
+ };
454
+ };
455
+ loginedFreeMember: {
456
+ table: Array<{
457
+ plus: string;
458
+ normal: string;
459
+ plusColor: string;
460
+ normalColor: string;
461
+ }>;
462
+ tableTab: {
463
+ tab1: string;
464
+ tab2: string;
465
+ tab3: string;
466
+ };
467
+ head: {
468
+ img: string;
469
+ mobImg: string;
470
+ padImg: string;
471
+ icon: string;
472
+ title: string;
473
+ mobTitle: string;
474
+ pay: string;
475
+ subTitle: string;
476
+ };
477
+ headAnnual: {
478
+ img: string;
479
+ mobImg: string;
480
+ padImg: string;
481
+ icon: string;
482
+ title: string;
483
+ pay: string;
484
+ subTitle: string;
485
+ };
486
+ midTitle: string;
487
+ };
488
+ memberCard: {
489
+ header: {
490
+ text: string;
491
+ };
492
+ footer: {
493
+ buttonText: string[];
494
+ moreInformation: string;
495
+ moreInformationUrl: string;
496
+ };
497
+ };
498
+ memberRegisterCard: {
499
+ title: string;
500
+ bannerBgPc: string;
501
+ bannerBgMob: string;
502
+ backgroundColor: string;
503
+ };
504
+ memberSuperposed: {
505
+ title: string;
506
+ content: string;
507
+ cancelBtn: string;
508
+ confirmBtn: string;
509
+ monthly: string;
510
+ annual: string;
511
+ };
512
+ memberCannotSuperposed: {
513
+ title: string;
514
+ content: string;
515
+ confirmBtn: string;
516
+ };
517
+ };
518
+ type SelectedPlusMemberProduct = {
519
+ product: NormalizedProduct;
520
+ variant: NormalizedProductVariant;
521
+ } | null;
522
+ type DeliveryOption = string;
523
+ type DeliveryCustomData = {
524
+ discount_code?: string[];
525
+ allow_nextday_delivery?: boolean;
526
+ allow_thirdday_delivery?: boolean;
527
+ selected_delivery_option?: DeliveryOption;
528
+ is_presale?: boolean;
529
+ plus_type?: DeliveryPlusType;
530
+ };
531
+ type MailingAddress = {
532
+ address1?: string | null;
533
+ address2?: string | null;
534
+ city?: string | null;
535
+ company?: string | null;
536
+ country?: string | null;
537
+ countryCode?: string | null;
538
+ firstName?: string | null;
539
+ lastName?: string | null;
540
+ phone?: string | null;
541
+ province?: string | null;
542
+ provinceCode?: string | null;
543
+ zip?: string | null;
544
+ };
545
+ type DeliveryData = {
546
+ deliveryAddress: MailingAddress;
547
+ deliveryCustomData: DeliveryCustomData;
548
+ };
549
+
550
+ export { type BuyNowTrackConfig as B, DeliveryPlusType as D, type GtmParams as G, type MailingAddress as M, PLUS_MEMBER_TYPE as P, ShippingMethodMode as S, type TrackingLineItem as T, PlusMemberMode as a, type PlusMemberShippingMethodMetafields as b, type PlusMemberShippingMethodConfig as c, type PlusMemberSettingsMetafields as d, type SelectedPlusMemberProduct as e, type DeliveryOption as f, type DeliveryCustomData as g, type DeliveryData as h, type TrackingOptions as i, type TrackingAdapter as j, gaTrack as k, trackBeginCheckoutGA as l, trackBuyNowGA as m, trackAddToCartFBQ as n, trackBuyNowFBQ as o, trackAddToCartGA as t };