@artisan-commerce/analytics-rn 0.3.0-canary.91 → 0.3.0-canary.93

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.
package/dist/bundle.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Account, Vendor, Store, Catalogue, ArtisnPlatform, CurrencyCodes, Product, ShoppingCart, CartProduct, PriceCategoryType, ShippingAddress, BillingData, Order, Category } from '@artisan-commerce/types';
2
+ import { JsonMap, UserTraits, SegmentClient } from '@segment/analytics-react-native';
2
3
 
3
4
  /**
4
5
  * Analytics providers configurable options.
@@ -206,7 +207,16 @@ interface SegmentProvider extends Omit<AnalyticsProviderConstructor, "type">, Se
206
207
  * @since 0.1.0
207
208
  */
208
209
  interface SegmentProviderConfig {
210
+ /** Currency country codes, see {@link CurrencyCodes} */
209
211
  currency?: CurrencyCodes;
212
+ /** Segment track event, use event name and properties as parameters */
213
+ track?: (event: string, properties?: JsonMap) => Promise<void>;
214
+ /** Segment screen event, use screen name and properties as parameters */
215
+ screen?: (name: string, properties?: JsonMap) => Promise<void>;
216
+ /** Segment user identify handler, use user id and userTraits as parameters */
217
+ identify?: (userId?: string, userTraits?: UserTraits) => Promise<void>;
218
+ /** Segment reset handler, use reset anonymous id as parameter */
219
+ reset?: (resetAnonymousId?: boolean) => Promise<void>;
210
220
  }
211
221
  /**
212
222
  * Segment event shared parameters.
@@ -226,58 +236,6 @@ interface SegmentCommonEventParams extends EventCommonParams {
226
236
  interface SegmentCustomEventParams {
227
237
  [key: string]: any;
228
238
  }
229
- declare namespace Segment$1 {
230
- interface Product {
231
- product_id: string;
232
- sku?: string;
233
- category?: string;
234
- name?: string;
235
- brand?: string;
236
- variant?: string;
237
- price?: number;
238
- quantity?: number;
239
- coupon?: string;
240
- position?: number;
241
- url?: string;
242
- image_url?: string;
243
- }
244
- interface Address {
245
- city?: string;
246
- country?: string;
247
- postalCode?: string;
248
- state?: string;
249
- street?: string;
250
- [key: string]: any;
251
- }
252
- interface Company {
253
- name?: string;
254
- id?: string | number;
255
- industry?: string;
256
- employee_count?: number;
257
- plan?: string;
258
- [key: string]: any;
259
- }
260
- interface Traits {
261
- id: string;
262
- address?: Address;
263
- age?: number;
264
- avatar?: string;
265
- bithday?: string;
266
- company?: Company;
267
- createdAt?: string;
268
- description?: string;
269
- email?: string;
270
- firstName?: string;
271
- gender?: string;
272
- lastName?: string;
273
- name?: string;
274
- phone?: string;
275
- title?: string;
276
- username?: string;
277
- website?: string;
278
- [key: string]: any;
279
- }
280
- }
281
239
 
282
240
  /**
283
241
  * Shared params across every event.
@@ -406,8 +364,13 @@ declare class GoogleAnalytics extends AnalyticsProvider {
406
364
  declare class Segment extends AnalyticsProvider {
407
365
  private _writeKey;
408
366
  private _currency;
367
+ private _segmentClient?;
368
+ private _track;
369
+ private _screen;
370
+ private _identify;
371
+ private _reset;
409
372
  /**
410
- * Contructs a Segment Provider
373
+ * Constructs a Segment Provider
411
374
  *
412
375
  * @constructs
413
376
  * @since 0.1.0
@@ -419,6 +382,11 @@ declare class Segment extends AnalyticsProvider {
419
382
  * @since 0.1.0
420
383
  */
421
384
  init(): Promise<void>;
385
+ get segmentClient(): SegmentClient | undefined;
386
+ get track(): SegmentProvider["track"];
387
+ get screen(): SegmentProvider["screen"];
388
+ get identify(): SegmentProvider["identify"];
389
+ get reset(): SegmentProvider["reset"];
422
390
  /**
423
391
  * @override
424
392
  * @since 0.1.0
@@ -753,10 +721,10 @@ interface UpdateUserInfoParams$2 extends FacebookPixelCommonEventParams, Faceboo
753
721
  * @extends SegmentCommonEventParams
754
722
  * @extends SegmentCustomEventParams
755
723
  * @extends UpdateUserInfoCommonParams
756
- * @property {Segment.Traits} identify Pieces of information you know about a user that are included in an identify call
724
+ * @property {UserTraits} identify Pieces of information you know about a user that are included in an identify call
757
725
  */
758
726
  interface UpdateUserInfoParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, UpdateUserInfoCommonParams {
759
- identify?: Segment$1.Traits;
727
+ identify?: UserTraits;
760
728
  }
761
729
 
762
730
  /**
@@ -811,10 +779,10 @@ interface SetUserInfoParams$2 extends FacebookPixelCommonEventParams, FacebookPi
811
779
  * @extends SegmentCommonEventParams
812
780
  * @extends SegmentCustomEventParams
813
781
  * @extends SetUserInfoCommonParams
814
- * @property {Segment.Traits} identify Pieces of information you know about a user that are included in an identify call
782
+ * @property {UserTraits} identify Pieces of information you know about a user that are included in an identify call
815
783
  */
816
784
  interface SetUserInfoParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, SetUserInfoCommonParams {
817
- identify?: Segment$1.Traits;
785
+ identify?: UserTraits;
818
786
  }
819
787
 
820
788
  /**
@@ -1529,10 +1497,10 @@ interface UpdateShippingAddressParams$2 extends FacebookPixelCommonEventParams,
1529
1497
  * @extends SegmentCommonEventParams
1530
1498
  * @extends SegmentCustomEventParams
1531
1499
  * @extends UpdateShippingAddressCommonParams
1532
- * @property {Segment.Traits} identify Pieces of information you know about a user that are included in an identify call
1500
+ * @property {UserTraits} identify Pieces of information you know about a user that are included in an identify call
1533
1501
  */
1534
1502
  interface UpdateShippingAddressParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, UpdateShippingAddressCommonParams {
1535
- identify?: Segment$1.Traits;
1503
+ identify?: UserTraits;
1536
1504
  }
1537
1505
 
1538
1506
  /**
@@ -1589,10 +1557,10 @@ interface SelectShippingAddressParams$2 extends FacebookPixelCommonEventParams,
1589
1557
  * @extends SegmentCommonEventParams
1590
1558
  * @extends SegmentCustomEventParams
1591
1559
  * @extends SelectShippingAddressCommonParams
1592
- * @property {Segment.Traits} identify Pieces of information you know about a user that are included in an identify call
1560
+ * @property {UserTraits} identify Pieces of information you know about a user that are included in an identify call
1593
1561
  */
1594
1562
  interface SelectShippingAddressParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, SelectShippingAddressCommonParams {
1595
- identify?: Segment$1.Traits;
1563
+ identify?: UserTraits;
1596
1564
  }
1597
1565
 
1598
1566
  /**
@@ -1655,10 +1623,10 @@ interface AddShippingAddressParams$2 extends FacebookPixelCommonEventParams, Fac
1655
1623
  * @extends SegmentCommonEventParams
1656
1624
  * @extends SegmentCustomEventParams
1657
1625
  * @extends AddShippingAddressCommonParams
1658
- * @property {Segment.Traits} identify Pieces of information you know about a user that are included in an identify call
1626
+ * @property {UserTraits} identify Pieces of information you know about a user that are included in an identify call
1659
1627
  */
1660
1628
  interface AddShippingAddressParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, AddShippingAddressCommonParams {
1661
- identify?: Segment$1.Traits;
1629
+ identify?: UserTraits;
1662
1630
  }
1663
1631
 
1664
1632
  /**
@@ -4951,12 +4919,12 @@ interface SignUpParams$2 extends FacebookPixelCommonEventParams, FacebookPixelCu
4951
4919
  * @extends SignUpCommonParams
4952
4920
  * @property {string} name The user's name
4953
4921
  * @property {string} email The user's email
4954
- * @property {Segment.Traits} identify Pieces of information you know about a user that are included in an identify call
4922
+ * @property {UserTraits} identify Pieces of information you know about a user that are included in an identify call
4955
4923
  */
4956
4924
  interface SignUpParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, SignUpCommonParams {
4957
4925
  name: string;
4958
4926
  email: string;
4959
- identify?: Segment$1.Traits;
4927
+ identify?: UserTraits;
4960
4928
  }
4961
4929
 
4962
4930
  /**
@@ -5066,11 +5034,11 @@ interface SignInParams$2 extends FacebookPixelCommonEventParams, FacebookPixelCu
5066
5034
  * @extends SegmentCustomEventParams
5067
5035
  * @extends SignInCommonParams
5068
5036
  * @property {string} name The user's name
5069
- * @property {Segment.Traits} identify Pieces of information you know about a user that are included in an identify call
5037
+ * @property {UserTraits} identify Pieces of information you know about a user that are included in an identify call
5070
5038
  */
5071
5039
  interface SignInParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, SignInCommonParams {
5072
5040
  name: string;
5073
- identify?: Segment$1.Traits;
5041
+ identify?: UserTraits;
5074
5042
  }
5075
5043
 
5076
5044
  /**
@@ -5456,12 +5424,4 @@ declare const events: {
5456
5424
  */
5457
5425
  declare const updateActiveVendor: (vendor: Vendor | Vendor["id"] | -1 | undefined) => void;
5458
5426
 
5459
- /**
5460
- * Utility function to identify a user across Segment destinations.
5461
- *
5462
- * @since 0.1.0
5463
- * @param {Segment.Traits} identify Pieces of information you know about a user that are included in an identify call
5464
- */
5465
- declare const identifyUser: (identify: Segment$1.Traits) => void;
5466
-
5467
- export { AnalyticsMeta, AuthProviderMethods, FacebookPixelCommonEventParams, FacebookPixelCustomEventParams, FacebookPixelProvider, FacebookPixelProviderConfig, GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, GoogleAnalyticsProvider, GoogleAnalyticsProviderConfig, Gtag, InitAnalyticsConfig, InitAnalyticsConfigMeta, Providers, SupportedProviders, events, identifyUser, initAnalytics, updateActiveVendor };
5427
+ export { AnalyticsMeta, AuthProviderMethods, FacebookPixelCommonEventParams, FacebookPixelCustomEventParams, FacebookPixelProvider, FacebookPixelProviderConfig, GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, GoogleAnalyticsProvider, GoogleAnalyticsProviderConfig, Gtag, InitAnalyticsConfig, InitAnalyticsConfigMeta, Providers, SupportedProviders, events, initAnalytics, updateActiveVendor };