@adshift/react-native-plugin 1.0.0 → 2.1.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.
Files changed (180) hide show
  1. package/AdShiftReactNativePlugin.podspec +11 -7
  2. package/CHANGELOG.md +138 -0
  3. package/README.md +513 -542
  4. package/android/build.gradle +17 -3
  5. package/android/consumer-rules.pro +21 -0
  6. package/android/src/main/java/com/adshift/reactnativeplugin/AdShiftReactNativePluginModule.kt +786 -229
  7. package/android/src/test/java/com/adshift/reactnativeplugin/ConsentSnapshotTest.kt +180 -0
  8. package/android/src/test/java/com/adshift/reactnativeplugin/DeepLinkDeliveryTest.kt +146 -0
  9. package/android/src/test/java/com/adshift/reactnativeplugin/InitializeOrderingTest.kt +111 -0
  10. package/android/src/test/java/com/adshift/reactnativeplugin/IntentLinkDedupTest.kt +168 -0
  11. package/android/src/test/java/com/adshift/reactnativeplugin/LaunchIntentForwardingTest.kt +106 -0
  12. package/android/src/test/java/com/adshift/reactnativeplugin/ModuleTestSupport.kt +167 -0
  13. package/android/src/test/java/com/adshift/reactnativeplugin/StartVerdictTest.kt +164 -0
  14. package/ios/AdShiftReactNativePlugin.h +7 -7
  15. package/ios/AdShiftReactNativePlugin.mm +200 -181
  16. package/ios/AdShiftReactNativePluginHelper.swift +584 -286
  17. package/ios/Core/BridgeRules.swift +82 -0
  18. package/lib/commonjs/Adshift.js +1138 -0
  19. package/lib/commonjs/Adshift.js.map +1 -0
  20. package/lib/commonjs/NativeAdShiftReactNativePlugin.js +22 -0
  21. package/lib/commonjs/NativeAdShiftReactNativePlugin.js.map +1 -0
  22. package/lib/commonjs/index.js +94 -0
  23. package/lib/commonjs/index.js.map +1 -0
  24. package/lib/commonjs/jest/index.js +164 -0
  25. package/lib/commonjs/jest/index.js.map +1 -0
  26. package/lib/commonjs/nativeSdkVersions.js +17 -0
  27. package/lib/commonjs/nativeSdkVersions.js.map +1 -0
  28. package/lib/commonjs/package.json +1 -0
  29. package/lib/commonjs/types/AdshiftAdRevenue.js +47 -0
  30. package/lib/commonjs/types/AdshiftAdRevenue.js.map +1 -0
  31. package/lib/commonjs/types/AdshiftConfig.js +45 -0
  32. package/lib/commonjs/types/AdshiftConfig.js.map +1 -0
  33. package/lib/commonjs/types/AdshiftConsent.js +113 -0
  34. package/lib/commonjs/types/AdshiftConsent.js.map +1 -0
  35. package/lib/commonjs/types/AdshiftConsentSnapshot.js +69 -0
  36. package/lib/commonjs/types/AdshiftConsentSnapshot.js.map +1 -0
  37. package/lib/commonjs/types/AdshiftDeepLink.js +154 -0
  38. package/lib/commonjs/types/AdshiftDeepLink.js.map +1 -0
  39. package/lib/commonjs/types/AdshiftError.js +91 -0
  40. package/lib/commonjs/types/AdshiftError.js.map +1 -0
  41. package/lib/commonjs/types/AdshiftEventParam.js +140 -0
  42. package/lib/commonjs/types/AdshiftEventParam.js.map +1 -0
  43. package/lib/commonjs/types/AdshiftEventType.js +88 -0
  44. package/lib/commonjs/types/AdshiftEventType.js.map +1 -0
  45. package/lib/commonjs/types/AdshiftThirdPartySharing.js +70 -0
  46. package/lib/commonjs/types/AdshiftThirdPartySharing.js.map +1 -0
  47. package/lib/commonjs/types/index.js +123 -0
  48. package/lib/commonjs/types/index.js.map +1 -0
  49. package/lib/commonjs/version.js +9 -0
  50. package/lib/commonjs/version.js.map +1 -0
  51. package/lib/module/Adshift.js +962 -296
  52. package/lib/module/Adshift.js.map +1 -1
  53. package/lib/module/NativeAdShiftReactNativePlugin.js +10 -7
  54. package/lib/module/NativeAdShiftReactNativePlugin.js.map +1 -1
  55. package/lib/module/index.js +26 -25
  56. package/lib/module/index.js.map +1 -1
  57. package/lib/module/jest/index.js +144 -0
  58. package/lib/module/jest/index.js.map +1 -0
  59. package/lib/module/nativeSdkVersions.js +13 -0
  60. package/lib/module/nativeSdkVersions.js.map +1 -0
  61. package/lib/module/types/AdshiftAdRevenue.js +43 -0
  62. package/lib/module/types/AdshiftAdRevenue.js.map +1 -0
  63. package/lib/module/types/AdshiftConfig.js +23 -26
  64. package/lib/module/types/AdshiftConfig.js.map +1 -1
  65. package/lib/module/types/AdshiftConsent.js +57 -50
  66. package/lib/module/types/AdshiftConsent.js.map +1 -1
  67. package/lib/module/types/AdshiftConsentSnapshot.js +65 -0
  68. package/lib/module/types/AdshiftConsentSnapshot.js.map +1 -0
  69. package/lib/module/types/AdshiftDeepLink.js +97 -67
  70. package/lib/module/types/AdshiftDeepLink.js.map +1 -1
  71. package/lib/module/types/AdshiftError.js +87 -0
  72. package/lib/module/types/AdshiftError.js.map +1 -0
  73. package/lib/module/types/AdshiftEventParam.js +135 -0
  74. package/lib/module/types/AdshiftEventParam.js.map +1 -0
  75. package/lib/module/types/AdshiftEventType.js +11 -36
  76. package/lib/module/types/AdshiftEventType.js.map +1 -1
  77. package/lib/module/types/AdshiftThirdPartySharing.js +65 -0
  78. package/lib/module/types/AdshiftThirdPartySharing.js.map +1 -0
  79. package/lib/module/types/index.js +9 -7
  80. package/lib/module/types/index.js.map +1 -1
  81. package/lib/module/version.js +5 -0
  82. package/lib/module/version.js.map +1 -0
  83. package/lib/typescript/commonjs/package.json +1 -0
  84. package/lib/typescript/commonjs/src/Adshift.d.ts +314 -0
  85. package/lib/typescript/commonjs/src/Adshift.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts +102 -0
  87. package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -0
  88. package/lib/typescript/commonjs/src/index.d.ts +51 -0
  89. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/src/jest/index.d.ts +103 -0
  91. package/lib/typescript/commonjs/src/jest/index.d.ts.map +1 -0
  92. package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts +11 -0
  93. package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts +56 -0
  95. package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts.map +1 -0
  96. package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts +104 -0
  97. package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts.map +1 -0
  98. package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts +76 -0
  99. package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts.map +1 -0
  100. package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts +56 -0
  101. package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts.map +1 -0
  102. package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts +89 -0
  103. package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts.map +1 -0
  104. package/lib/typescript/commonjs/src/types/AdshiftError.d.ts +57 -0
  105. package/lib/typescript/commonjs/src/types/AdshiftError.d.ts.map +1 -0
  106. package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts +111 -0
  107. package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts.map +1 -0
  108. package/lib/typescript/{src → commonjs/src}/types/AdshiftEventType.d.ts +12 -35
  109. package/lib/typescript/commonjs/src/types/AdshiftEventType.d.ts.map +1 -0
  110. package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts +53 -0
  111. package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts.map +1 -0
  112. package/lib/typescript/commonjs/src/types/index.d.ts +17 -0
  113. package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -0
  114. package/lib/typescript/commonjs/src/version.d.ts +2 -0
  115. package/lib/typescript/commonjs/src/version.d.ts.map +1 -0
  116. package/lib/typescript/module/src/Adshift.d.ts +314 -0
  117. package/lib/typescript/module/src/Adshift.d.ts.map +1 -0
  118. package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts +102 -0
  119. package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -0
  120. package/lib/typescript/module/src/index.d.ts +51 -0
  121. package/lib/typescript/module/src/index.d.ts.map +1 -0
  122. package/lib/typescript/module/src/jest/index.d.ts +103 -0
  123. package/lib/typescript/module/src/jest/index.d.ts.map +1 -0
  124. package/lib/typescript/module/src/nativeSdkVersions.d.ts +11 -0
  125. package/lib/typescript/module/src/nativeSdkVersions.d.ts.map +1 -0
  126. package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts +56 -0
  127. package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts.map +1 -0
  128. package/lib/typescript/module/src/types/AdshiftConfig.d.ts +104 -0
  129. package/lib/typescript/module/src/types/AdshiftConfig.d.ts.map +1 -0
  130. package/lib/typescript/module/src/types/AdshiftConsent.d.ts +76 -0
  131. package/lib/typescript/module/src/types/AdshiftConsent.d.ts.map +1 -0
  132. package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts +56 -0
  133. package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts.map +1 -0
  134. package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts +89 -0
  135. package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts.map +1 -0
  136. package/lib/typescript/module/src/types/AdshiftError.d.ts +57 -0
  137. package/lib/typescript/module/src/types/AdshiftError.d.ts.map +1 -0
  138. package/lib/typescript/module/src/types/AdshiftEventParam.d.ts +111 -0
  139. package/lib/typescript/module/src/types/AdshiftEventParam.d.ts.map +1 -0
  140. package/lib/typescript/module/src/types/AdshiftEventType.d.ts +64 -0
  141. package/lib/typescript/module/src/types/AdshiftEventType.d.ts.map +1 -0
  142. package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts +53 -0
  143. package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts.map +1 -0
  144. package/lib/typescript/module/src/types/index.d.ts +17 -0
  145. package/lib/typescript/module/src/types/index.d.ts.map +1 -0
  146. package/lib/typescript/module/src/version.d.ts +2 -0
  147. package/lib/typescript/module/src/version.d.ts.map +1 -0
  148. package/package.json +50 -11
  149. package/src/Adshift.ts +1276 -342
  150. package/src/NativeAdShiftReactNativePlugin.ts +81 -115
  151. package/src/index.tsx +40 -25
  152. package/src/jest/index.ts +224 -0
  153. package/src/nativeSdkVersions.ts +10 -0
  154. package/src/types/AdshiftAdRevenue.ts +58 -0
  155. package/src/types/AdshiftConfig.ts +101 -53
  156. package/src/types/AdshiftConsent.ts +75 -72
  157. package/src/types/AdshiftConsentSnapshot.ts +103 -0
  158. package/src/types/AdshiftDeepLink.ts +123 -102
  159. package/src/types/AdshiftError.ts +107 -0
  160. package/src/types/AdshiftEventParam.ts +216 -0
  161. package/src/types/AdshiftEventType.ts +13 -35
  162. package/src/types/AdshiftThirdPartySharing.ts +63 -0
  163. package/src/types/index.ts +38 -6
  164. package/src/version.ts +2 -0
  165. package/lib/typescript/src/Adshift.d.ts +0 -335
  166. package/lib/typescript/src/Adshift.d.ts.map +0 -1
  167. package/lib/typescript/src/NativeAdShiftReactNativePlugin.d.ts +0 -143
  168. package/lib/typescript/src/NativeAdShiftReactNativePlugin.d.ts.map +0 -1
  169. package/lib/typescript/src/index.d.ts +0 -47
  170. package/lib/typescript/src/index.d.ts.map +0 -1
  171. package/lib/typescript/src/types/AdshiftConfig.d.ts +0 -74
  172. package/lib/typescript/src/types/AdshiftConfig.d.ts.map +0 -1
  173. package/lib/typescript/src/types/AdshiftConsent.d.ts +0 -88
  174. package/lib/typescript/src/types/AdshiftConsent.d.ts.map +0 -1
  175. package/lib/typescript/src/types/AdshiftDeepLink.d.ts +0 -93
  176. package/lib/typescript/src/types/AdshiftDeepLink.d.ts.map +0 -1
  177. package/lib/typescript/src/types/AdshiftEventType.d.ts.map +0 -1
  178. package/lib/typescript/src/types/index.d.ts +0 -5
  179. package/lib/typescript/src/types/index.d.ts.map +0 -1
  180. /package/lib/typescript/{package.json → module/package.json} +0 -0
@@ -1,101 +1,108 @@
1
1
  "use strict";
2
2
 
3
+ /**
4
+ * A single consent decision.
5
+ *
6
+ * `true` = granted, `false` = denied, `null` = not decided yet.
7
+ * Undecided flags are not sent to the backend.
8
+ */
9
+
3
10
  /**
4
11
  * User consent data for GDPR/DMA compliance.
5
12
  *
6
13
  * @example
7
14
  * ```typescript
8
- * // For GDPR users who accepted all
9
- * const consent = AdshiftConsent.forGDPRUser({
10
- * hasConsentForDataUsage: true,
11
- * hasConsentForAdsPersonalization: true,
12
- * hasConsentForAdStorage: true,
13
- * });
15
+ * // GDPR user who accepted everything
16
+ * Adshift.setConsentData(
17
+ * AdshiftConsent.forGDPRUser({
18
+ * hasConsentForDataUsage: true,
19
+ * hasConsentForAdsPersonalization: true,
20
+ * hasConsentForAdStorage: true,
21
+ * })
22
+ * );
14
23
  *
15
- * // For non-GDPR users
16
- * const consent = AdshiftConsent.forNonGDPRUser();
17
- *
18
- * await Adshift.setConsentData(consent);
24
+ * // Non-GDPR user
25
+ * Adshift.setConsentData(AdshiftConsent.forNonGDPRUser());
19
26
  * ```
20
27
  */
21
28
 
22
29
  /**
23
- * Helper functions for creating AdshiftConsent objects.
30
+ * Helper functions for creating `AdshiftConsent` objects.
24
31
  */
25
32
  export const AdshiftConsent = {
26
33
  /**
27
34
  * Creates consent for a user subject to GDPR.
28
35
  *
29
- * Use this when user is in a GDPR region and has provided explicit consent.
30
- *
31
- * @example
32
- * ```typescript
33
- * const consent = AdshiftConsent.forGDPRUser({
34
- * hasConsentForDataUsage: true,
35
- * hasConsentForAdsPersonalization: true,
36
- * hasConsentForAdStorage: true,
37
- * });
38
- * ```
36
+ * Flags that are omitted or `null` are treated as not decided.
39
37
  */
40
38
  forGDPRUser(options) {
41
39
  return {
42
40
  isUserSubjectToGDPR: true,
43
- hasConsentForDataUsage: options.hasConsentForDataUsage,
44
- hasConsentForAdsPersonalization: options.hasConsentForAdsPersonalization,
45
- hasConsentForAdStorage: options.hasConsentForAdStorage
41
+ hasConsentForDataUsage: options.hasConsentForDataUsage ?? null,
42
+ hasConsentForAdsPersonalization: options.hasConsentForAdsPersonalization ?? null,
43
+ hasConsentForAdStorage: options.hasConsentForAdStorage ?? null
46
44
  };
47
45
  },
48
46
  /**
49
47
  * Creates consent for a user NOT subject to GDPR.
50
48
  *
51
- * Use this when user is in a non-GDPR region (e.g., US, Asia).
52
- * All consent flags are set to true by default.
53
- *
54
- * @example
55
- * ```typescript
56
- * const consent = AdshiftConsent.forNonGDPRUser();
57
- * ```
49
+ * All processing is treated as permitted; individual flags are not sent.
58
50
  */
59
51
  forNonGDPRUser() {
60
52
  return {
61
- isUserSubjectToGDPR: false,
62
- hasConsentForDataUsage: true,
63
- hasConsentForAdsPersonalization: true,
64
- hasConsentForAdStorage: true
53
+ isUserSubjectToGDPR: false
65
54
  };
66
55
  },
67
56
  /**
68
- * Determines whether consent is granted for tracking.
69
- *
70
- * If user is not subject to GDPR, consent is assumed granted.
71
- * If subject to GDPR, both data usage and ad storage must be granted.
57
+ * Whether consent is granted for tracking, following the SDK rule:
58
+ * non-GDPR users are always granted; GDPR users need explicit consent to
59
+ * both data usage and ad storage.
72
60
  */
73
61
  isConsentGranted(consent) {
74
62
  if (!consent.isUserSubjectToGDPR) return true;
75
- return consent.hasConsentForDataUsage && consent.hasConsentForAdStorage;
63
+ return consent.hasConsentForDataUsage === true && consent.hasConsentForAdStorage === true;
76
64
  },
77
65
  /**
78
- * Creates consent from a plain object (native bridge response).
66
+ * Creates consent from a plain object.
67
+ *
68
+ * @internal
79
69
  */
80
70
  fromMap(map) {
71
+ const isGDPR = map.isUserSubjectToGDPR === true;
72
+ if (!isGDPR) {
73
+ return {
74
+ isUserSubjectToGDPR: false
75
+ };
76
+ }
81
77
  return {
82
- isUserSubjectToGDPR: map.isUserSubjectToGDPR ?? false,
83
- hasConsentForDataUsage: map.hasConsentForDataUsage ?? false,
84
- hasConsentForAdsPersonalization: map.hasConsentForAdsPersonalization ?? false,
85
- hasConsentForAdStorage: map.hasConsentForAdStorage ?? false
78
+ isUserSubjectToGDPR: true,
79
+ hasConsentForDataUsage: readFlag(map.hasConsentForDataUsage),
80
+ hasConsentForAdsPersonalization: readFlag(map.hasConsentForAdsPersonalization),
81
+ hasConsentForAdStorage: readFlag(map.hasConsentForAdStorage)
86
82
  };
87
83
  }
88
84
  };
85
+ function readFlag(value) {
86
+ return typeof value === 'boolean' ? value : null;
87
+ }
89
88
 
90
89
  /**
91
- * Converts AdshiftConsent to a plain object for native bridge communication.
90
+ * Converts `AdshiftConsent` to a plain object for the native bridge.
91
+ * Undecided flags are sent as `null`.
92
+ *
93
+ * @internal
92
94
  */
93
95
  export function consentToMap(consent) {
96
+ if (!consent.isUserSubjectToGDPR) {
97
+ return {
98
+ isUserSubjectToGDPR: false
99
+ };
100
+ }
94
101
  return {
95
- isUserSubjectToGDPR: consent.isUserSubjectToGDPR,
96
- hasConsentForDataUsage: consent.hasConsentForDataUsage,
97
- hasConsentForAdsPersonalization: consent.hasConsentForAdsPersonalization,
98
- hasConsentForAdStorage: consent.hasConsentForAdStorage
102
+ isUserSubjectToGDPR: true,
103
+ hasConsentForDataUsage: consent.hasConsentForDataUsage ?? null,
104
+ hasConsentForAdsPersonalization: consent.hasConsentForAdsPersonalization ?? null,
105
+ hasConsentForAdStorage: consent.hasConsentForAdStorage ?? null
99
106
  };
100
107
  }
101
108
  //# sourceMappingURL=AdshiftConsent.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AdshiftConsent","forGDPRUser","options","isUserSubjectToGDPR","hasConsentForDataUsage","hasConsentForAdsPersonalization","hasConsentForAdStorage","forNonGDPRUser","isConsentGranted","consent","fromMap","map","consentToMap"],"sourceRoot":"../../../src","sources":["types/AdshiftConsent.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuBA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,GAAG;EAC5B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,OAIX,EAAkB;IACjB,OAAO;MACLC,mBAAmB,EAAE,IAAI;MACzBC,sBAAsB,EAAEF,OAAO,CAACE,sBAAsB;MACtDC,+BAA+B,EAAEH,OAAO,CAACG,+BAA+B;MACxEC,sBAAsB,EAAEJ,OAAO,CAACI;IAClC,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,cAAcA,CAAA,EAAmB;IAC/B,OAAO;MACLJ,mBAAmB,EAAE,KAAK;MAC1BC,sBAAsB,EAAE,IAAI;MAC5BC,+BAA+B,EAAE,IAAI;MACrCC,sBAAsB,EAAE;IAC1B,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEE,gBAAgBA,CAACC,OAAuB,EAAW;IACjD,IAAI,CAACA,OAAO,CAACN,mBAAmB,EAAE,OAAO,IAAI;IAC7C,OAAOM,OAAO,CAACL,sBAAsB,IAAIK,OAAO,CAACH,sBAAsB;EACzE,CAAC;EAED;AACF;AACA;EACEI,OAAOA,CAACC,GAA4B,EAAkB;IACpD,OAAO;MACLR,mBAAmB,EAAGQ,GAAG,CAACR,mBAAmB,IAAgB,KAAK;MAClEC,sBAAsB,EAAGO,GAAG,CAACP,sBAAsB,IAAgB,KAAK;MACxEC,+BAA+B,EAC5BM,GAAG,CAACN,+BAA+B,IAAgB,KAAK;MAC3DC,sBAAsB,EAAGK,GAAG,CAACL,sBAAsB,IAAgB;IACrE,CAAC;EACH;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,SAASM,YAAYA,CAACH,OAAuB,EAA2B;EAC7E,OAAO;IACLN,mBAAmB,EAAEM,OAAO,CAACN,mBAAmB;IAChDC,sBAAsB,EAAEK,OAAO,CAACL,sBAAsB;IACtDC,+BAA+B,EAAEI,OAAO,CAACJ,+BAA+B;IACxEC,sBAAsB,EAAEG,OAAO,CAACH;EAClC,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["AdshiftConsent","forGDPRUser","options","isUserSubjectToGDPR","hasConsentForDataUsage","hasConsentForAdsPersonalization","hasConsentForAdStorage","forNonGDPRUser","isConsentGranted","consent","fromMap","map","isGDPR","readFlag","value","consentToMap"],"sourceRoot":"../../../src","sources":["types/AdshiftConsent.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,GAAG;EAC5B;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAACC,OAIX,EAAkB;IACjB,OAAO;MACLC,mBAAmB,EAAE,IAAI;MACzBC,sBAAsB,EAAEF,OAAO,CAACE,sBAAsB,IAAI,IAAI;MAC9DC,+BAA+B,EAC7BH,OAAO,CAACG,+BAA+B,IAAI,IAAI;MACjDC,sBAAsB,EAAEJ,OAAO,CAACI,sBAAsB,IAAI;IAC5D,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,cAAcA,CAAA,EAAmB;IAC/B,OAAO;MAAEJ,mBAAmB,EAAE;IAAM,CAAC;EACvC,CAAC;EAED;AACF;AACA;AACA;AACA;EACEK,gBAAgBA,CAACC,OAAuB,EAAW;IACjD,IAAI,CAACA,OAAO,CAACN,mBAAmB,EAAE,OAAO,IAAI;IAC7C,OACEM,OAAO,CAACL,sBAAsB,KAAK,IAAI,IACvCK,OAAO,CAACH,sBAAsB,KAAK,IAAI;EAE3C,CAAC;EAED;AACF;AACA;AACA;AACA;EACEI,OAAOA,CAACC,GAA4B,EAAkB;IACpD,MAAMC,MAAM,GAAGD,GAAG,CAACR,mBAAmB,KAAK,IAAI;IAC/C,IAAI,CAACS,MAAM,EAAE;MACX,OAAO;QAAET,mBAAmB,EAAE;MAAM,CAAC;IACvC;IACA,OAAO;MACLA,mBAAmB,EAAE,IAAI;MACzBC,sBAAsB,EAAES,QAAQ,CAACF,GAAG,CAACP,sBAAsB,CAAC;MAC5DC,+BAA+B,EAAEQ,QAAQ,CACvCF,GAAG,CAACN,+BACN,CAAC;MACDC,sBAAsB,EAAEO,QAAQ,CAACF,GAAG,CAACL,sBAAsB;IAC7D,CAAC;EACH;AACF,CAAC;AAED,SAASO,QAAQA,CAACC,KAAc,EAAe;EAC7C,OAAO,OAAOA,KAAK,KAAK,SAAS,GAAGA,KAAK,GAAG,IAAI;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAC1BN,OAAuB,EACS;EAChC,IAAI,CAACA,OAAO,CAACN,mBAAmB,EAAE;IAChC,OAAO;MAAEA,mBAAmB,EAAE;IAAM,CAAC;EACvC;EACA,OAAO;IACLA,mBAAmB,EAAE,IAAI;IACzBC,sBAAsB,EAAEK,OAAO,CAACL,sBAAsB,IAAI,IAAI;IAC9DC,+BAA+B,EAC7BI,OAAO,CAACJ,+BAA+B,IAAI,IAAI;IACjDC,sBAAsB,EAAEG,OAAO,CAACH,sBAAsB,IAAI;EAC5D,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Where the current consent state comes from.
5
+ *
6
+ * - `manual`: set through `Adshift.setConsentData()`
7
+ * - `tcf`: read from an IAB TCF v2.2 CMP
8
+ * - `gpp`: read from an IAB GPP string written by the CMP
9
+ * - `none`: no consent information available
10
+ */
11
+
12
+ /**
13
+ * Consent state as seen by the SDK, returned by `Adshift.refreshConsent()`.
14
+ */
15
+
16
+ const SOURCES = new Set(['manual', 'tcf', 'gpp', 'none']);
17
+
18
+ /**
19
+ * The platforms name the GPP source differently: Android reports `gpp_us_nat`,
20
+ * iOS reports `gpp`. Both mean the same axis, so they are reported as one value
21
+ * rather than leaving one platform to fall through to `none`.
22
+ *
23
+ * `gpp` is the name reported here because `gpp_us_nat` is one section of the
24
+ * framework — the US national one. A CMP writing a state section instead would
25
+ * make that name wrong, and the section actually read is a separate fact the
26
+ * backend already records. Naming the axis after the framework survives that.
27
+ */
28
+ const SOURCE_ALIASES = Object.freeze({
29
+ gpp_us_nat: 'gpp'
30
+ });
31
+
32
+ /**
33
+ * Builds a `ConsentSnapshot` from a native bridge object.
34
+ *
35
+ * @internal
36
+ */
37
+ export function consentSnapshotFromMap(map) {
38
+ const rawSource = typeof map.source === 'string' ? map.source : 'none';
39
+ const aliased = SOURCE_ALIASES[rawSource] ?? rawSource;
40
+ const source = SOURCES.has(aliased) ? aliased : 'none';
41
+ const snapshot = {
42
+ source,
43
+ tcStringPresent: map.tcStringPresent === true,
44
+ cmpDetected: map.cmpDetected === true,
45
+ appliedAtMillis: typeof map.appliedAtMillis === 'number' ? map.appliedAtMillis : 0,
46
+ adIdentifiersAllowed: map.adIdentifiersAllowed === true
47
+ };
48
+ if (typeof map.gdprApplies === 'number') {
49
+ snapshot.gdprApplies = map.gdprApplies;
50
+ }
51
+ if (typeof map.gppPresent === 'boolean') {
52
+ snapshot.gppPresent = map.gppPresent;
53
+ }
54
+ if (typeof map.adUserDataEnabled === 'boolean') {
55
+ snapshot.adUserDataEnabled = map.adUserDataEnabled;
56
+ }
57
+ if (typeof map.adPersonalizationEnabled === 'boolean') {
58
+ snapshot.adPersonalizationEnabled = map.adPersonalizationEnabled;
59
+ }
60
+ if (typeof map.adStorageEnabled === 'boolean') {
61
+ snapshot.adStorageEnabled = map.adStorageEnabled;
62
+ }
63
+ return snapshot;
64
+ }
65
+ //# sourceMappingURL=AdshiftConsentSnapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SOURCES","Set","SOURCE_ALIASES","Object","freeze","gpp_us_nat","consentSnapshotFromMap","map","rawSource","source","aliased","has","snapshot","tcStringPresent","cmpDetected","appliedAtMillis","adIdentifiersAllowed","gdprApplies","gppPresent","adUserDataEnabled","adPersonalizationEnabled","adStorageEnabled"],"sourceRoot":"../../../src","sources":["types/AdshiftConsentSnapshot.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAuCA,MAAMA,OA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BAAwB,KAAK,SAAS,EAAE;IACrDR,QAAQ,CAACQ,wBAAwB,GAAGb,GAAG,CAACa,wBAAwB;EAClE;EACA,IAAI,OAAOb,GAAG,CAACc,gBAAgB,KAAK,SAAS,EAAE;IAC7CT,QAAQ,CAACS,gBAAgB,GAAGd,GAAG,CAACc,gBAAgB;EAClD;EACA,OAAOT,QAAQ;AACjB","ignoreList":[]}
@@ -1,66 +1,69 @@
1
1
  "use strict";
2
2
 
3
3
  /**
4
- * Status of a deep link resolution.
4
+ * Status of a deep link result.
5
5
  */
6
6
  export let AdshiftDeepLinkStatus = /*#__PURE__*/function (AdshiftDeepLinkStatus) {
7
- /** Deep link was found and resolved successfully. */
7
+ /** The link was processed and delivered. */
8
8
  AdshiftDeepLinkStatus["Found"] = "found";
9
- /** No deep link was found (e.g., organic install). */
9
+ /** No deep link was found (e.g. organic install, deferred lookup empty). */
10
10
  AdshiftDeepLinkStatus["NotFound"] = "notFound";
11
- /** Error occurred while resolving deep link. */
11
+ /** An error occurred while resolving the deep link. */
12
12
  AdshiftDeepLinkStatus["Error"] = "error";
13
13
  return AdshiftDeepLinkStatus;
14
14
  }({});
15
15
 
16
16
  /**
17
- * Response from deep link handling.
17
+ * Deep link delivered through `Adshift.onDeepLink()`.
18
18
  *
19
- * Contains the resolved deep link URL, parameters, and status.
19
+ * Every link that enters the app and reaches the SDK produces a result with
20
+ * `status: 'found'`. Route on `deepLinkValue`, `params` or the URL itself.
20
21
  *
21
22
  * @example
22
23
  * ```typescript
23
- * const deepLink = await Adshift.handleDeepLink(url);
24
- * if (deepLink.status === AdshiftDeepLinkStatus.Found) {
25
- * const productId = deepLink.params?.['product_id'];
26
- * // Navigate to product
27
- * }
24
+ * Adshift.onDeepLink((deepLink) => {
25
+ * if (deepLink.status === AdshiftDeepLinkStatus.Found) {
26
+ * const productId = deepLink.params?.product_id;
27
+ * }
28
+ * });
28
29
  * ```
29
30
  */
30
31
 
32
+ const SUB_KEYS = ['deepLinkSub1', 'deepLinkSub2', 'deepLinkSub3', 'deepLinkSub4', 'deepLinkSub5'];
33
+
31
34
  /**
32
- * Helper functions for creating AdshiftDeepLink objects.
35
+ * Helper functions for creating `AdshiftDeepLink` objects.
33
36
  */
34
37
  export const AdshiftDeepLink = {
35
- /**
36
- * Creates a successful deep link response.
37
- */
38
38
  found(options) {
39
- return {
39
+ const result = {
40
40
  deepLink: options.deepLink,
41
- deepLinkValue: options.deepLinkValue,
42
- params: options.params,
43
41
  isDeferred: options.isDeferred ?? false,
44
- status: AdshiftDeepLinkStatus.Found,
45
- deepLinkSub1: options.deepLinkSub1,
46
- deepLinkSub2: options.deepLinkSub2,
47
- deepLinkSub3: options.deepLinkSub3,
48
- deepLinkSub4: options.deepLinkSub4,
49
- deepLinkSub5: options.deepLinkSub5
42
+ status: AdshiftDeepLinkStatus.Found
50
43
  };
44
+ if (options.deepLinkValue !== undefined) {
45
+ result.deepLinkValue = options.deepLinkValue;
46
+ }
47
+ if (options.params !== undefined) {
48
+ result.params = options.params;
49
+ }
50
+ if (options.isFirstSession !== undefined) {
51
+ result.isFirstSession = options.isFirstSession;
52
+ }
53
+ for (const key of SUB_KEYS) {
54
+ const value = options[key];
55
+ if (value !== undefined) {
56
+ result[key] = value;
57
+ }
58
+ }
59
+ return result;
51
60
  },
52
- /**
53
- * Creates a "not found" deep link response.
54
- */
55
61
  notFound() {
56
62
  return {
57
63
  isDeferred: false,
58
64
  status: AdshiftDeepLinkStatus.NotFound
59
65
  };
60
66
  },
61
- /**
62
- * Creates an error deep link response.
63
- */
64
67
  error(message) {
65
68
  return {
66
69
  isDeferred: false,
@@ -69,53 +72,80 @@ export const AdshiftDeepLink = {
69
72
  };
70
73
  },
71
74
  /**
72
- * Creates deep link from a plain object (native bridge response).
75
+ * Creates a deep link from a native bridge object.
76
+ *
77
+ * @internal
73
78
  */
74
79
  fromMap(map) {
75
- const statusStr = map.status ?? 'notFound';
76
- let status;
77
- switch (statusStr) {
78
- case 'found':
79
- status = AdshiftDeepLinkStatus.Found;
80
- break;
81
- case 'error':
82
- status = AdshiftDeepLinkStatus.Error;
83
- break;
84
- default:
85
- status = AdshiftDeepLinkStatus.NotFound;
86
- }
87
- return {
88
- deepLink: map.deepLink ?? map.deeplink,
89
- deepLinkValue: map.deepLinkValue ?? map.deep_link_value,
90
- params: map.params ?? map.queryParams,
91
- isDeferred: map.isDeferred ?? false,
92
- status,
93
- errorMessage: map.errorMessage ?? map.error,
94
- deepLinkSub1: map.deepLinkSub1 ?? map.deep_link_sub1 ?? map.sub1,
95
- deepLinkSub2: map.deepLinkSub2 ?? map.deep_link_sub2 ?? map.sub2,
96
- deepLinkSub3: map.deepLinkSub3 ?? map.deep_link_sub3 ?? map.sub3,
97
- deepLinkSub4: map.deepLinkSub4 ?? map.deep_link_sub4 ?? map.sub4,
98
- deepLinkSub5: map.deepLinkSub5 ?? map.deep_link_sub5 ?? map.sub5
80
+ const params = readParams(map.params);
81
+ const result = {
82
+ isDeferred: map.isDeferred === true,
83
+ status: readStatus(map.status)
99
84
  };
85
+ if (typeof map.deepLink === 'string') {
86
+ result.deepLink = map.deepLink;
87
+ }
88
+ const value = map.deepLinkValue ?? params?.deep_link_value;
89
+ if (typeof value === 'string') {
90
+ result.deepLinkValue = value;
91
+ }
92
+ if (params !== undefined) {
93
+ result.params = params;
94
+ }
95
+ if (typeof map.errorMessage === 'string') {
96
+ result.errorMessage = map.errorMessage;
97
+ }
98
+ if (typeof map.isFirstSession === 'boolean') {
99
+ result.isFirstSession = map.isFirstSession;
100
+ }
101
+ SUB_KEYS.forEach((key, index) => {
102
+ const sub = map[key] ?? params?.[`deep_link_sub${index + 1}`];
103
+ if (typeof sub === 'string') {
104
+ result[key] = sub;
105
+ }
106
+ });
107
+ return result;
100
108
  }
101
109
  };
110
+ function readStatus(value) {
111
+ switch (value) {
112
+ case 'found':
113
+ return AdshiftDeepLinkStatus.Found;
114
+ case 'error':
115
+ return AdshiftDeepLinkStatus.Error;
116
+ default:
117
+ return AdshiftDeepLinkStatus.NotFound;
118
+ }
119
+ }
120
+ function readParams(value) {
121
+ if (typeof value !== 'object' || value === null) {
122
+ return undefined;
123
+ }
124
+ const out = {};
125
+ let count = 0;
126
+ for (const [key, raw] of Object.entries(value)) {
127
+ if (raw === null || raw === undefined) continue;
128
+ out[key] = typeof raw === 'string' ? raw : String(raw);
129
+ count++;
130
+ }
131
+ return count > 0 ? out : undefined;
132
+ }
102
133
 
103
134
  /**
104
- * Converts AdshiftDeepLink to a plain object for native bridge communication.
135
+ * Converts `AdshiftDeepLink` to a plain object.
136
+ *
137
+ * @internal
105
138
  */
106
139
  export function deepLinkToMap(deepLink) {
107
- return {
108
- deepLink: deepLink.deepLink,
109
- deepLinkValue: deepLink.deepLinkValue,
110
- params: deepLink.params,
140
+ const map = {
111
141
  isDeferred: deepLink.isDeferred,
112
- status: deepLink.status,
113
- errorMessage: deepLink.errorMessage,
114
- deepLinkSub1: deepLink.deepLinkSub1,
115
- deepLinkSub2: deepLink.deepLinkSub2,
116
- deepLinkSub3: deepLink.deepLinkSub3,
117
- deepLinkSub4: deepLink.deepLinkSub4,
118
- deepLinkSub5: deepLink.deepLinkSub5
142
+ status: deepLink.status
119
143
  };
144
+ for (const [key, value] of Object.entries(deepLink)) {
145
+ if (value !== undefined && !(key in map)) {
146
+ map[key] = value;
147
+ }
148
+ }
149
+ return map;
120
150
  }
121
151
  //# sourceMappingURL=AdshiftDeepLink.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AdshiftDeepLinkStatus","AdshiftDeepLink","found","options","deepLink","deepLinkValue","params","isDeferred","status","Found","deepLinkSub1","deepLinkSub2","deepLinkSub3","deepLinkSub4","deepLinkSub5","notFound","NotFound","error","message","Error","errorMessage","fromMap","map","statusStr","deeplink","deep_link_value","queryParams","deep_link_sub1","sub1","deep_link_sub2","sub2","deep_link_sub3","sub3","deep_link_sub4","sub4","deep_link_sub5","sub5","deepLinkToMap"],"sourceRoot":"../../../src","sources":["types/AdshiftDeepLink.ts"],"mappings":";;AA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I,MAAM;IACvBY,YAAY,EAAEhB,QAAQ,CAACgB,YAAY;IACnCV,YAAY,EAAEN,QAAQ,CAACM,YAAY;IACnCC,YAAY,EAAEP,QAAQ,CAACO,YAAY;IACnCC,YAAY,EAAER,QAAQ,CAACQ,YAAY;IACnCC,YAAY,EAAET,QAAQ,CAACS,YAAY;IACnCC,YAAY,EAAEV,QAAQ,CAACU;EACzB,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["AdshiftDeepLinkStatus","SUB_KEYS","AdshiftDeepLink","found","options","result","deepLink","isDeferred","status","Found","deepLinkValue","undefined","params","isFirstSession","key","value","notFound","NotFound","error","message","Error","errorMessage","fromMap","map","readParams","readStatus","deep_link_value","forEach","index","sub","out","count","raw","Object","entries","String","deepLinkToMap"],"sourceRoot":"../../../src","sources":["types/AdshiftDeepLink.ts"],"mappings":";;AAAA;AACA;AACA;AACA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAC/B;EADUA,qBAAqB;EAI/B;EAJUA,qBAAqB;EAO/B;EAPUA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;;AAWjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4CA,MAAMC,QAAQ,GAAG,CACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,CACN;;AAEV;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAG;EAC7BC,KAAKA,CAACC,OAWL,EAAmB;IAClB,MAAMC,MAAuB,GAAG;MAC9BC,QAAQ,EAAEF,OAAO,CAACE,QAAQ;MAC1BC,UAAU,EAAEH,OAAO,CAACG,UAAU,IAAI,KAAK;MACvCC,MAAM,EAAER,qBAAqB,CAACS;IAChC,CAAC;IACD,IAAIL,OAAO,CAACM,aAAa,KAAKC,SAAS,EAAE;MACvCN,MAAM,CAACK,aAAa,GAAGN,OAAO,CAACM,aAAa;IAC9C;IACA,IAAIN,OAAO,CAACQ,MAAM,KA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AG,CAAChB,GAAG,CAAC,GAAG,OAAOkB,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAGG,MAAM,CAACH,GAAG,CAAC;IACtDD,KAAK,EAAE;EACT;EACA,OAAOA,KAAK,GAAG,CAAC,GAAGD,GAAG,GAAGnB,SAAS;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyB,aAAaA,CAC3B9B,QAAyB,EACA;EACzB,MAAMiB,GAA4B,GAAG;IACnChB,UAAU,EAAED,QAAQ,CAACC,UAAU;IAC/BC,MAAM,EAAEF,QAAQ,CAACE;EACnB,CAAC;EACD,KAAK,MAAM,CAACM,GAAG,EAAEC,KAAK,CAAC,IAAIkB,MAAM,CAACC,OAAO,CAAC5B,QAAQ,CAAC,EAAE;IACnD,IAAIS,KAAK,KAAKJ,SAAS,IAAI,EAAEG,GAAG,IAAIS,GAAG,CAAC,EAAE;MACxCA,GAAG,CAACT,GAAG,CAAC,GAAGC,KAAK;IAClB;EACF;EACA,OAAOQ,GAAG;AACZ","ignoreList":[]}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Platform-neutral error codes used by every rejected promise and by
5
+ * `StartResult.errorCode`.
6
+ */
7
+ export let AdshiftErrorCode = /*#__PURE__*/function (AdshiftErrorCode) {
8
+ /** `Adshift.initialize()` has not been called. */
9
+ AdshiftErrorCode["NotInitialized"] = "NOT_INITIALIZED";
10
+ /** The SDK is stopped; call `Adshift.start()` first. */
11
+ AdshiftErrorCode["NotStarted"] = "NOT_STARTED";
12
+ /** The API key was rejected by the AdShift backend. */
13
+ AdshiftErrorCode["InvalidApiKey"] = "INVALID_API_KEY";
14
+ /** Tracking is disabled for this app on the AdShift side. */
15
+ AdshiftErrorCode["OptedOut"] = "OPTED_OUT";
16
+ /** The event queue is full; the call was not accepted. */
17
+ AdshiftErrorCode["QueueFull"] = "QUEUE_FULL";
18
+ /** A parameter failed validation. */
19
+ AdshiftErrorCode["InvalidArgument"] = "INVALID_ARGUMENT";
20
+ /** Any other failure. See `userInfo.nativeCode` for the platform code. */
21
+ AdshiftErrorCode["Unknown"] = "UNKNOWN";
22
+ return AdshiftErrorCode;
23
+ }({});
24
+
25
+ /**
26
+ * Platform-specific details attached to an `AdshiftError`.
27
+ */
28
+
29
+ /**
30
+ * Error thrown or rejected by the AdShift plugin.
31
+ *
32
+ * `code` is always one of `AdshiftErrorCode`; the original native code, when
33
+ * there is one, is available in `userInfo.nativeCode`.
34
+ */
35
+
36
+ const CODES = new Set(Object.values(AdshiftErrorCode));
37
+
38
+ /**
39
+ * Type guard for errors produced by the plugin.
40
+ */
41
+ export function isAdshiftError(error) {
42
+ return typeof error === 'object' && error !== null && typeof error.code === 'string' && CODES.has(error.code);
43
+ }
44
+
45
+ /**
46
+ * Builds an `AdshiftError` from a code and message.
47
+ *
48
+ * @internal
49
+ */
50
+ export function createAdshiftError(code, message, userInfo = {}) {
51
+ const error = new Error(message);
52
+ error.name = 'AdshiftError';
53
+ error.code = code;
54
+ error.userInfo = userInfo;
55
+ return error;
56
+ }
57
+
58
+ /**
59
+ * Normalises a promise rejection coming from the native module into an
60
+ * `AdshiftError`. Native modules reject with `{ code, message, userInfo }`.
61
+ *
62
+ * @internal
63
+ */
64
+ export function toAdshiftError(error) {
65
+ if (isAdshiftError(error)) {
66
+ if (!error.userInfo) {
67
+ error.userInfo = {};
68
+ }
69
+ return error;
70
+ }
71
+ const raw = error;
72
+ const message = typeof raw?.message === 'string' ? raw.message : 'Unknown error';
73
+ const info = {};
74
+ const nativeCode = raw?.userInfo?.nativeCode;
75
+ if (typeof nativeCode === 'number' || typeof nativeCode === 'string') {
76
+ info.nativeCode = nativeCode;
77
+ }
78
+ const nativeDomain = raw?.userInfo?.nativeDomain;
79
+ if (typeof nativeDomain === 'string') {
80
+ info.nativeDomain = nativeDomain;
81
+ }
82
+ if (info.nativeCode === undefined && typeof raw?.code === 'string') {
83
+ info.nativeCode = raw.code;
84
+ }
85
+ return createAdshiftError(AdshiftErrorCode.Unknown, message, info);
86
+ }
87
+ //# sourceMappingURL=AdshiftError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AdshiftErrorCode","CODES","Set","Object","values","isAdshiftError","error","code","has","createAdshiftError","message","userInfo","Error","name","toAdshiftError","raw","info","nativeCode","nativeDomain","undefined","Unknown"],"sourceRoot":"../../../src","sources":["types/AdshiftError.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,WAAYA,gBAAgB,0BAAhBA,gBAAgB;EAC1B;EADUA,gBAAgB;EAG1B;EAHUA,gBAAgB;EAK1B;EALUA,gBAAgB;EAO1B;EAPUA,gBAAgB;EAS1B;EATUA,gBAAgB;EAW1B;EAXUA,gBAAgB;EAa1B;EAbUA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;;AAiB5B;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAMA,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAASC,MAAM,CAACC,MAAM,CAACJ,gBAAgB,CAAC,CAAC;;AAE9D;AACA;AACA;AACA,OAAO,SAASK,cAAcA,CAACC,KAAc,EAAyB;EACpE,OACE,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,KAAK,IAAI,IACd,OAAQA,KAAK,CAAwBC,IAAI,KAAK,QAAQ,IACtDN,KAAK,CAACO,GAAG,CAAEF,KAAK,CAAsBC,IAAI,CAAC;AAE/C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,kBAAkBA,CAChCF,IAAsB,EACtBG,OAAe,EACfC,QAA0B,GAAG,CAAC,CAAC,EACjB;EACd,MAAML,KAAK,GAAG,IAAIM,KAAK,CAACF,OAAO,CAAiB;EAChDJ,KAAK,CAACO,IAAI,GAAG,cAAc;EAC3BP,KAAK,CAACC,IAAI,GAAGA,IAAI;EACjBD,KAAK,CAACK,QAAQ,GAAGA,QAAQ;EACzB,OAAOL,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ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