@xylabs/sdk-react 2.10.3 → 2.10.6

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.
Files changed (63) hide show
  1. package/dist/cjs5/index.js +19 -4
  2. package/dist/cjs5/index.js.map +1 -1
  3. package/dist/cjs5/lib/Tracking/Facebook/StandardEvents.d.ts +4 -0
  4. package/dist/cjs5/lib/isLocalHost.d.ts +1 -1
  5. package/dist/esm2015/index.js +19 -4
  6. package/dist/esm2015/index.js.map +1 -1
  7. package/dist/esm2015/lib/Tracking/Facebook/StandardEvents.d.ts +4 -0
  8. package/dist/esm2015/lib/isLocalHost.d.ts +1 -1
  9. package/dist/esm2017/index.js +19 -4
  10. package/dist/esm2017/index.js.map +1 -1
  11. package/dist/esm2017/lib/Tracking/Facebook/StandardEvents.d.ts +4 -0
  12. package/dist/esm2017/lib/isLocalHost.d.ts +1 -1
  13. package/dist/esm5/index.js +19 -4
  14. package/dist/esm5/index.js.map +1 -1
  15. package/dist/esm5/lib/Tracking/Facebook/StandardEvents.d.ts +4 -0
  16. package/dist/esm5/lib/isLocalHost.d.ts +1 -1
  17. package/dist/lib/Tracking/Drip/BaseEvent.js +4 -1
  18. package/dist/lib/Tracking/Drip/BaseEvent.js.map +1 -1
  19. package/dist/lib/Tracking/Facebook/Fbq.js +2 -1
  20. package/dist/lib/Tracking/Facebook/Fbq.js.map +1 -1
  21. package/dist/lib/Tracking/Facebook/StandardEvents.d.ts +4 -0
  22. package/dist/lib/Tracking/Facebook/StandardEvents.js.map +1 -1
  23. package/dist/lib/Tracking/Google/Gtag.js +4 -1
  24. package/dist/lib/Tracking/Google/Gtag.js.map +1 -1
  25. package/dist/lib/Tracking/Reddit/Rdt.js +2 -1
  26. package/dist/lib/Tracking/Reddit/Rdt.js.map +1 -1
  27. package/dist/lib/Tracking/Snapchat/Snaptr.js +2 -1
  28. package/dist/lib/Tracking/Snapchat/Snaptr.js.map +1 -1
  29. package/dist/lib/Tracking/Tapjoy/EF.js +2 -1
  30. package/dist/lib/Tracking/Tapjoy/EF.js.map +1 -1
  31. package/dist/lib/Tracking/Tiktok/Ttq.js +2 -1
  32. package/dist/lib/Tracking/Tiktok/Ttq.js.map +1 -1
  33. package/dist/lib/isLocalHost.d.ts +1 -1
  34. package/dist/lib/isLocalHost.js +1 -1
  35. package/dist/lib/isLocalHost.js.map +1 -1
  36. package/dist/node/index.js +19 -4
  37. package/dist/node/index.js.map +1 -1
  38. package/dist/node/lib/Tracking/Facebook/StandardEvents.d.ts +4 -0
  39. package/dist/node/lib/isLocalHost.d.ts +1 -1
  40. package/dist/node-esm/index.js +19 -4
  41. package/dist/node-esm/index.js.map +1 -1
  42. package/dist/node-esm/lib/Tracking/Facebook/StandardEvents.d.ts +4 -0
  43. package/dist/node-esm/lib/isLocalHost.d.ts +1 -1
  44. package/package.json +22 -22
  45. package/src/lib/Tracking/Drip/BaseEvent.ts +4 -2
  46. package/src/lib/Tracking/Facebook/Fbq.ts +2 -2
  47. package/src/lib/Tracking/Facebook/StandardEvents.ts +5 -0
  48. package/src/lib/Tracking/Google/Gtag.ts +4 -2
  49. package/src/lib/Tracking/Reddit/Rdt.ts +2 -2
  50. package/src/lib/Tracking/Snapchat/Snaptr.ts +2 -2
  51. package/src/lib/Tracking/Tapjoy/EF.ts +2 -1
  52. package/src/lib/Tracking/Tiktok/Ttq.ts +2 -2
  53. package/src/lib/isLocalHost.ts +8 -7
  54. package/dist/cjs5/lib/global.d.ts +0 -2
  55. package/dist/esm2015/lib/global.d.ts +0 -2
  56. package/dist/esm2017/lib/global.d.ts +0 -2
  57. package/dist/esm5/lib/global.d.ts +0 -2
  58. package/dist/lib/global.d.ts +0 -2
  59. package/dist/lib/global.js +0 -4
  60. package/dist/lib/global.js.map +0 -1
  61. package/dist/node/lib/global.d.ts +0 -2
  62. package/dist/node-esm/lib/global.d.ts +0 -2
  63. package/src/lib/global.ts +0 -4
@@ -19,6 +19,9 @@ export interface FacebookCartProperties extends FacebookValueProperties, Faceboo
19
19
  contents?: FacebookContentsItem[];
20
20
  num_items?: number;
21
21
  }
22
+ export interface FacebookExternalId extends Record<string, string[] | undefined> {
23
+ external_id?: string[];
24
+ }
22
25
  export declare type FacebookAddPaymentInfo = FacebookCartProperties;
23
26
  export declare type FacebookAddToCart = FacebookCartProperties;
24
27
  export declare type FacebookAddToWishList = FacebookCartProperties;
@@ -37,6 +40,7 @@ export interface FacebookStartTrial extends FacebookValueProperties {
37
40
  }
38
41
  export interface FacebookSubscribe extends FacebookValueProperties {
39
42
  predicted_ltv?: string;
43
+ subscription_id?: string;
40
44
  }
41
45
  export declare type FacebookViewContent = FacebookCartProperties;
42
46
  export declare class FacebookStandardEvents<T extends Record<string, unknown>> {
@@ -1,2 +1,2 @@
1
- declare const isLocalhost: boolean;
1
+ declare const isLocalhost: () => boolean;
2
2
  export { isLocalhost };
package/package.json CHANGED
@@ -12,10 +12,10 @@
12
12
  "@emotion/react": "^11.8.2",
13
13
  "@emotion/styled": "^11.8.1",
14
14
  "@ethersproject/abstract-signer": "^5.6.0",
15
- "@ethersproject/providers": "^5.6.1",
15
+ "@ethersproject/providers": "^5.6.2",
16
16
  "@mui/icons-material": "^5.5.1",
17
- "@mui/material": "^5.5.2",
18
- "@mui/styles": "^5.5.1",
17
+ "@mui/material": "^5.5.3",
18
+ "@mui/styles": "^5.5.3",
19
19
  "@xylabs/pixel": "^1.3.7",
20
20
  "@xylabs/sdk-js": "^2.4.3",
21
21
  "axios": "^0.26.1",
@@ -28,7 +28,7 @@
28
28
  "react-dom": "^17.0.2",
29
29
  "react-helmet": "^6.1.0",
30
30
  "react-icons": "^4.3.1",
31
- "react-router-dom": "^6.2.2"
31
+ "react-router-dom": "^6.3.0"
32
32
  },
33
33
  "description": "Common React library for all XY Labs projects that use React",
34
34
  "devDependencies": {
@@ -38,40 +38,40 @@
38
38
  "@rollup/plugin-replace": "^4.0.0",
39
39
  "@rollup/plugin-strip": "^2.1.0",
40
40
  "@rollup/plugin-typescript": "^8.3.1",
41
- "@storybook/addon-actions": "^6.4.19",
42
- "@storybook/addon-docs": "^6.4.19",
43
- "@storybook/addon-essentials": "^6.4.19",
44
- "@storybook/addon-links": "^6.4.19",
45
- "@storybook/components": "^6.4.19",
46
- "@storybook/core-events": "^6.4.19",
47
- "@storybook/react": "^6.4.19",
41
+ "@storybook/addon-actions": "^6.4.20",
42
+ "@storybook/addon-docs": "^6.4.20",
43
+ "@storybook/addon-essentials": "^6.4.20",
44
+ "@storybook/addon-links": "^6.4.20",
45
+ "@storybook/components": "^6.4.20",
46
+ "@storybook/core-events": "^6.4.20",
47
+ "@storybook/react": "^6.4.20",
48
48
  "@types/bn.js": "^5.1.0",
49
- "@types/lodash": "^4.14.180",
49
+ "@types/lodash": "^4.14.181",
50
50
  "@types/md5": "^2.3.2",
51
- "@types/node": "^17.0.22",
51
+ "@types/node": "^17.0.23",
52
52
  "@types/numeral": "^2.0.2",
53
- "@types/react": "^17.0.41",
53
+ "@types/react": "^17.0.43",
54
54
  "@types/react-dom": "^17.0.14",
55
55
  "@types/react-helmet": "^6.1.5",
56
56
  "@xylabs/eslint-config-react": "^2.1.3",
57
- "@xylabs/rollup-config": "^1.1.10",
58
- "@xylabs/ts-scripts": "^1.0.48",
57
+ "@xylabs/rollup-config": "^1.1.15",
58
+ "@xylabs/ts-scripts": "^1.0.52",
59
59
  "@xylabs/tsconfig": "^1.0.12",
60
60
  "babel-loader": "^8.2.4",
61
61
  "copyfiles": "^2.4.1",
62
- "eslint": "^8.11.0",
62
+ "eslint": "^8.12.0",
63
63
  "eslint-plugin-prettier": "^4.0.0",
64
64
  "eslint-plugin-react": "^7.29.4",
65
- "eslint-plugin-react-hooks": "^4.3.0",
66
- "prettier": "^2.6.0",
65
+ "eslint-plugin-react-hooks": "^4.4.0",
66
+ "prettier": "^2.6.2",
67
67
  "rimraf": "^3.0.2",
68
68
  "rollbar": "^2.24.1",
69
69
  "rollup": "^2.70.1",
70
70
  "rollup-plugin-svg": "^2.0.0",
71
71
  "ts-node": "^10.7.0",
72
72
  "tslib": "^2.3.1",
73
- "typescript": "^4.6.2",
74
- "webpack": "^5.70.0"
73
+ "typescript": "^4.6.3",
74
+ "webpack": "^5.71.0"
75
75
  },
76
76
  "esm5": "dist/esm5/index.js",
77
77
  "exports": {
@@ -111,6 +111,6 @@
111
111
  },
112
112
  "sideEffects": false,
113
113
  "types": "dist/index.d.ts",
114
- "version": "2.10.3",
114
+ "version": "2.10.6",
115
115
  "packageManager": "yarn@3.1.1"
116
116
  }
@@ -1,7 +1,5 @@
1
1
  import { delay } from '@xylabs/sdk-js'
2
2
 
3
- import { global } from '../../global'
4
-
5
3
  type DripEvent<T extends Record<string, unknown>> = (string | T)[]
6
4
 
7
5
  class DripBaseEvent<T extends Record<string, unknown>> {
@@ -27,6 +25,8 @@ class DripBaseEvent<T extends Record<string, unknown>> {
27
25
  }
28
26
 
29
27
  private getDcq() {
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ const global = window as any
30
30
  if (!global._dcq) {
31
31
  throw Error('DCQ not found')
32
32
  }
@@ -34,6 +34,8 @@ class DripBaseEvent<T extends Record<string, unknown>> {
34
34
  }
35
35
 
36
36
  private getDcs() {
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ const global = window as any
37
39
  if (!global._dcs) {
38
40
  throw Error('DCS not found')
39
41
  }
@@ -1,11 +1,11 @@
1
- import { global } from '../../global'
2
-
3
1
  class Fbq {
4
2
  public pixelId?: string
5
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
4
  public fbq?: any
7
5
 
8
6
  private constructor(pixelId: string) {
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ const global = window as any
9
9
  this.pixelId = pixelId
10
10
 
11
11
  this.fbq = function () {
@@ -24,6 +24,10 @@ export interface FacebookCartProperties extends FacebookValueProperties, Faceboo
24
24
  num_items?: number
25
25
  }
26
26
 
27
+ export interface FacebookExternalId extends Record<string, string[] | undefined> {
28
+ external_id?: string[]
29
+ }
30
+
27
31
  export type FacebookAddPaymentInfo = FacebookCartProperties
28
32
 
29
33
  export type FacebookAddToCart = FacebookCartProperties
@@ -50,6 +54,7 @@ export interface FacebookStartTrial extends FacebookValueProperties {
50
54
 
51
55
  export interface FacebookSubscribe extends FacebookValueProperties {
52
56
  predicted_ltv?: string
57
+ subscription_id?: string
53
58
  }
54
59
 
55
60
  export type FacebookViewContent = FacebookCartProperties
@@ -1,8 +1,6 @@
1
1
  import { assertEx } from '@xylabs/sdk-js'
2
2
  import { parse, stringify } from 'query-string'
3
3
 
4
- import { global } from '../../global'
5
-
6
4
  class Gtag {
7
5
  public updatePagePath(page_path: string) {
8
6
  const ga4id = assertEx(this.ga4id, 'Missing GA4ID')
@@ -21,6 +19,8 @@ class Gtag {
21
19
  this.ga4id = ga4id
22
20
  this.awid = awid
23
21
  this.domains = domains
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ const global = window as any
24
24
  global.dataLayer = global.dataLayer ?? []
25
25
  this.gtag =
26
26
  global.gtag ??
@@ -59,6 +59,8 @@ class Gtag {
59
59
  }
60
60
 
61
61
  public static clearDataLayer() {
62
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ const global = window as any
62
64
  const dataLayer = global.dataLayer as []
63
65
  dataLayer.length = 0
64
66
  }
@@ -1,5 +1,3 @@
1
- import { global } from '../../global'
2
-
3
1
  class Rdt {
4
2
  public static instance: Rdt
5
3
  public static init(pixelId: string) {
@@ -13,6 +11,8 @@ class Rdt {
13
11
  }
14
12
 
15
13
  private static getRdt() {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const global = window as any
16
16
  if (global.rdt) {
17
17
  return global.rdt
18
18
  }
@@ -1,9 +1,9 @@
1
1
  import { delay } from '@xylabs/sdk-js'
2
2
 
3
- import { global } from '../../global'
4
-
5
3
  class SnapTr {
6
4
  public static getSnapTr() {
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const global = window as any
7
7
  if (global.snaptr) {
8
8
  return global.snaptr
9
9
  }
@@ -1,4 +1,3 @@
1
- import { global } from '../../global'
2
1
  class EF {
3
2
  public static instance: EF
4
3
  public static init() {
@@ -9,6 +8,8 @@ class EF {
9
8
  }
10
9
  }
11
10
  public static getEF() {
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ const global = window as any
12
13
  if (global.EF) {
13
14
  return global.EF
14
15
  }
@@ -1,5 +1,3 @@
1
- import { global } from '../../global'
2
-
3
1
  class Ttq {
4
2
  public static instance: Ttq
5
3
  public static init(pixelId: string) {
@@ -13,6 +11,8 @@ class Ttq {
13
11
  }
14
12
 
15
13
  public static getTtq() {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const global = window as any
16
16
  if (global.ttq) {
17
17
  return global.ttq
18
18
  }
@@ -1,9 +1,10 @@
1
- const isLocalhost = !!(
2
- window.location.hostname === 'localhost' ||
3
- // [::1] is the IPv6 localhost address.
4
- window.location.hostname === '[::1]' ||
5
- // 127.0.0.0/8 are considered localhost for IPv4.
6
- window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
7
- )
1
+ const isLocalhost = () =>
2
+ !!(
3
+ window.location.hostname === 'localhost' ||
4
+ // [::1] is the IPv6 localhost address.
5
+ window.location.hostname === '[::1]' ||
6
+ // 127.0.0.0/8 are considered localhost for IPv4.
7
+ window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
8
+ )
8
9
 
9
10
  export { isLocalhost }
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,4 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
- const global = window;
3
- export { global };
4
- //# sourceMappingURL=global.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/lib/global.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,MAAM,GAAG,MAAa,CAAA;AAE5B,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
@@ -1,2 +0,0 @@
1
- declare const global: any;
2
- export { global };
package/src/lib/global.ts DELETED
@@ -1,4 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
- const global = window as any
3
-
4
- export { global }