@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
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.consentSnapshotFromMap = consentSnapshotFromMap;
7
+ /**
8
+ * Where the current consent state comes from.
9
+ *
10
+ * - `manual`: set through `Adshift.setConsentData()`
11
+ * - `tcf`: read from an IAB TCF v2.2 CMP
12
+ * - `gpp`: read from an IAB GPP string written by the CMP
13
+ * - `none`: no consent information available
14
+ */
15
+
16
+ /**
17
+ * Consent state as seen by the SDK, returned by `Adshift.refreshConsent()`.
18
+ */
19
+
20
+ const SOURCES = new Set(['manual', 'tcf', 'gpp', 'none']);
21
+
22
+ /**
23
+ * The platforms name the GPP source differently: Android reports `gpp_us_nat`,
24
+ * iOS reports `gpp`. Both mean the same axis, so they are reported as one value
25
+ * rather than leaving one platform to fall through to `none`.
26
+ *
27
+ * `gpp` is the name reported here because `gpp_us_nat` is one section of the
28
+ * framework — the US national one. A CMP writing a state section instead would
29
+ * make that name wrong, and the section actually read is a separate fact the
30
+ * backend already records. Naming the axis after the framework survives that.
31
+ */
32
+ const SOURCE_ALIASES = Object.freeze({
33
+ gpp_us_nat: 'gpp'
34
+ });
35
+
36
+ /**
37
+ * Builds a `ConsentSnapshot` from a native bridge object.
38
+ *
39
+ * @internal
40
+ */
41
+ function consentSnapshotFromMap(map) {
42
+ const rawSource = typeof map.source === 'string' ? map.source : 'none';
43
+ const aliased = SOURCE_ALIASES[rawSource] ?? rawSource;
44
+ const source = SOURCES.has(aliased) ? aliased : 'none';
45
+ const snapshot = {
46
+ source,
47
+ tcStringPresent: map.tcStringPresent === true,
48
+ cmpDetected: map.cmpDetected === true,
49
+ appliedAtMillis: typeof map.appliedAtMillis === 'number' ? map.appliedAtMillis : 0,
50
+ adIdentifiersAllowed: map.adIdentifiersAllowed === true
51
+ };
52
+ if (typeof map.gdprApplies === 'number') {
53
+ snapshot.gdprApplies = map.gdprApplies;
54
+ }
55
+ if (typeof map.gppPresent === 'boolean') {
56
+ snapshot.gppPresent = map.gppPresent;
57
+ }
58
+ if (typeof map.adUserDataEnabled === 'boolean') {
59
+ snapshot.adUserDataEnabled = map.adUserDataEnabled;
60
+ }
61
+ if (typeof map.adPersonalizationEnabled === 'boolean') {
62
+ snapshot.adPersonalizationEnabled = map.adPersonalizationEnabled;
63
+ }
64
+ if (typeof map.adStorageEnabled === 'boolean') {
65
+ snapshot.adStorageEnabled = map.adStorageEnabled;
66
+ }
67
+ return snapshot;
68
+ }
69
+ //# 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,OAA4B,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAuD,GAAGC,MAAM,CAACC,MAAM,CAAC;EAC5EC,UAAU,EAAE;AACd,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CACpCC,GAA4B,EACX;EACjB,MAAMC,SAAS,GAAG,OAAOD,GAAG,CAACE,MAAM,KAAK,QAAQ,GAAGF,GAAG,CAACE,MAAM,GAAG,MAAM;EACtE,MAAMC,OAAO,GAAGR,cAAc,CAACM,SAAS,CAAC,IAAIA,SAAS;EACtD,MAAMC,MAAM,GAAIT,OAAO,CAACW,GAAG,CAACD,OAAO,CAAC,GAAGA,OAAO,GAAG,MAAwB;EACzE,MAAME,QAAyB,GAAG;IAChCH,MAAM;IACNI,eAAe,EAAEN,GAAG,CAACM,eAAe,KAAK,IAAI;IAC7CC,WAAW,EAAEP,GAAG,CAACO,WAAW,KAAK,IAAI;IACrCC,eAAe,EACb,OAAOR,GAAG,CAACQ,eAAe,KAAK,QAAQ,GAAGR,GAAG,CAACQ,eAAe,GAAG,CAAC;IACnEC,oBAAoB,EAAET,GAAG,CAACS,oBAAoB,KAAK;EACrD,CAAC;EACD,IAAI,OAAOT,GAAG,CAACU,WAAW,KAAK,QAAQ,EAAE;IACvCL,QAAQ,CAACK,WAAW,GAAGV,GAAG,CAACU,WAAW;EACxC;EACA,IAAI,OAAOV,GAAG,CAACW,UAAU,KAAK,SAAS,EAAE;IACvCN,QAAQ,CAACM,UAAU,GAAGX,GAAG,CAACW,UAAU;EACtC;EACA,IAAI,OAAOX,GAAG,CAACY,iBAAiB,KAAK,SAAS,EAAE;IAC9CP,QAAQ,CAACO,iBAAiB,GAAGZ,GAAG,CAACY,iBAAiB;EACpD;EACA,IAAI,OAAOZ,GAAG,CAACa,wBAAwB,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":[]}
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdshiftDeepLinkStatus = exports.AdshiftDeepLink = void 0;
7
+ exports.deepLinkToMap = deepLinkToMap;
8
+ /**
9
+ * Status of a deep link result.
10
+ */
11
+ let AdshiftDeepLinkStatus = exports.AdshiftDeepLinkStatus = /*#__PURE__*/function (AdshiftDeepLinkStatus) {
12
+ /** The link was processed and delivered. */
13
+ AdshiftDeepLinkStatus["Found"] = "found";
14
+ /** No deep link was found (e.g. organic install, deferred lookup empty). */
15
+ AdshiftDeepLinkStatus["NotFound"] = "notFound";
16
+ /** An error occurred while resolving the deep link. */
17
+ AdshiftDeepLinkStatus["Error"] = "error";
18
+ return AdshiftDeepLinkStatus;
19
+ }({});
20
+ /**
21
+ * Deep link delivered through `Adshift.onDeepLink()`.
22
+ *
23
+ * Every link that enters the app and reaches the SDK produces a result with
24
+ * `status: 'found'`. Route on `deepLinkValue`, `params` or the URL itself.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * Adshift.onDeepLink((deepLink) => {
29
+ * if (deepLink.status === AdshiftDeepLinkStatus.Found) {
30
+ * const productId = deepLink.params?.product_id;
31
+ * }
32
+ * });
33
+ * ```
34
+ */
35
+ const SUB_KEYS = ['deepLinkSub1', 'deepLinkSub2', 'deepLinkSub3', 'deepLinkSub4', 'deepLinkSub5'];
36
+
37
+ /**
38
+ * Helper functions for creating `AdshiftDeepLink` objects.
39
+ */
40
+ const AdshiftDeepLink = exports.AdshiftDeepLink = {
41
+ found(options) {
42
+ const result = {
43
+ deepLink: options.deepLink,
44
+ isDeferred: options.isDeferred ?? false,
45
+ status: AdshiftDeepLinkStatus.Found
46
+ };
47
+ if (options.deepLinkValue !== undefined) {
48
+ result.deepLinkValue = options.deepLinkValue;
49
+ }
50
+ if (options.params !== undefined) {
51
+ result.params = options.params;
52
+ }
53
+ if (options.isFirstSession !== undefined) {
54
+ result.isFirstSession = options.isFirstSession;
55
+ }
56
+ for (const key of SUB_KEYS) {
57
+ const value = options[key];
58
+ if (value !== undefined) {
59
+ result[key] = value;
60
+ }
61
+ }
62
+ return result;
63
+ },
64
+ notFound() {
65
+ return {
66
+ isDeferred: false,
67
+ status: AdshiftDeepLinkStatus.NotFound
68
+ };
69
+ },
70
+ error(message) {
71
+ return {
72
+ isDeferred: false,
73
+ status: AdshiftDeepLinkStatus.Error,
74
+ errorMessage: message
75
+ };
76
+ },
77
+ /**
78
+ * Creates a deep link from a native bridge object.
79
+ *
80
+ * @internal
81
+ */
82
+ fromMap(map) {
83
+ const params = readParams(map.params);
84
+ const result = {
85
+ isDeferred: map.isDeferred === true,
86
+ status: readStatus(map.status)
87
+ };
88
+ if (typeof map.deepLink === 'string') {
89
+ result.deepLink = map.deepLink;
90
+ }
91
+ const value = map.deepLinkValue ?? params?.deep_link_value;
92
+ if (typeof value === 'string') {
93
+ result.deepLinkValue = value;
94
+ }
95
+ if (params !== undefined) {
96
+ result.params = params;
97
+ }
98
+ if (typeof map.errorMessage === 'string') {
99
+ result.errorMessage = map.errorMessage;
100
+ }
101
+ if (typeof map.isFirstSession === 'boolean') {
102
+ result.isFirstSession = map.isFirstSession;
103
+ }
104
+ SUB_KEYS.forEach((key, index) => {
105
+ const sub = map[key] ?? params?.[`deep_link_sub${index + 1}`];
106
+ if (typeof sub === 'string') {
107
+ result[key] = sub;
108
+ }
109
+ });
110
+ return result;
111
+ }
112
+ };
113
+ function readStatus(value) {
114
+ switch (value) {
115
+ case 'found':
116
+ return AdshiftDeepLinkStatus.Found;
117
+ case 'error':
118
+ return AdshiftDeepLinkStatus.Error;
119
+ default:
120
+ return AdshiftDeepLinkStatus.NotFound;
121
+ }
122
+ }
123
+ function readParams(value) {
124
+ if (typeof value !== 'object' || value === null) {
125
+ return undefined;
126
+ }
127
+ const out = {};
128
+ let count = 0;
129
+ for (const [key, raw] of Object.entries(value)) {
130
+ if (raw === null || raw === undefined) continue;
131
+ out[key] = typeof raw === 'string' ? raw : String(raw);
132
+ count++;
133
+ }
134
+ return count > 0 ? out : undefined;
135
+ }
136
+
137
+ /**
138
+ * Converts `AdshiftDeepLink` to a plain object.
139
+ *
140
+ * @internal
141
+ */
142
+ function deepLinkToMap(deepLink) {
143
+ const map = {
144
+ isDeferred: deepLink.isDeferred,
145
+ status: deepLink.status
146
+ };
147
+ for (const [key, value] of Object.entries(deepLink)) {
148
+ if (value !== undefined && !(key in map)) {
149
+ map[key] = value;
150
+ }
151
+ }
152
+ return map;
153
+ }
154
+ //# sourceMappingURL=AdshiftDeepLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AdshiftDeepLinkStatus","exports","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;AAFA,IAGYA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,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,MAAME,QAAQ,GAAG,CACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,CACN;;AAEV;AACA;AACA;AACO,MAAMC,eAAe,GAAAF,OAAA,CAAAE,eAAA,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,EAAET,qBAAqB,CAACU;IAChC,CAAC;IACD,IAAIL,OAAO,CAACM,aAAa,KAAKC,SAAS,EAAE;MACvCN,MAAM,CAACK,aAAa,GAAGN,OAAO,CAACM,aAAa;IAC9C;IACA,IAAIN,OAAO,CAACQ,MAAM,KAAKD,SAAS,EAAE;MAChCN,MAAM,CAACO,MAAM,GAAGR,OAAO,CAACQ,MAAM;IAChC;IACA,IAAIR,OAAO,CAACS,cAAc,KAAKF,SAAS,EAAE;MACxCN,MAAM,CAACQ,cAAc,GAAGT,OAAO,CAACS,cAAc;IAChD;IACA,KAAK,MAAMC,GAAG,IAAIb,QAAQ,EAAE;MAC1B,MAAMc,K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9B,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,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdshiftErrorCode = void 0;
7
+ exports.createAdshiftError = createAdshiftError;
8
+ exports.isAdshiftError = isAdshiftError;
9
+ exports.toAdshiftError = toAdshiftError;
10
+ /**
11
+ * Platform-neutral error codes used by every rejected promise and by
12
+ * `StartResult.errorCode`.
13
+ */
14
+ let AdshiftErrorCode = exports.AdshiftErrorCode = /*#__PURE__*/function (AdshiftErrorCode) {
15
+ /** `Adshift.initialize()` has not been called. */
16
+ AdshiftErrorCode["NotInitialized"] = "NOT_INITIALIZED";
17
+ /** The SDK is stopped; call `Adshift.start()` first. */
18
+ AdshiftErrorCode["NotStarted"] = "NOT_STARTED";
19
+ /** The API key was rejected by the AdShift backend. */
20
+ AdshiftErrorCode["InvalidApiKey"] = "INVALID_API_KEY";
21
+ /** Tracking is disabled for this app on the AdShift side. */
22
+ AdshiftErrorCode["OptedOut"] = "OPTED_OUT";
23
+ /** The event queue is full; the call was not accepted. */
24
+ AdshiftErrorCode["QueueFull"] = "QUEUE_FULL";
25
+ /** A parameter failed validation. */
26
+ AdshiftErrorCode["InvalidArgument"] = "INVALID_ARGUMENT";
27
+ /** Any other failure. See `userInfo.nativeCode` for the platform code. */
28
+ AdshiftErrorCode["Unknown"] = "UNKNOWN";
29
+ return AdshiftErrorCode;
30
+ }({});
31
+ /**
32
+ * Platform-specific details attached to an `AdshiftError`.
33
+ */
34
+ /**
35
+ * Error thrown or rejected by the AdShift plugin.
36
+ *
37
+ * `code` is always one of `AdshiftErrorCode`; the original native code, when
38
+ * there is one, is available in `userInfo.nativeCode`.
39
+ */
40
+ const CODES = new Set(Object.values(AdshiftErrorCode));
41
+
42
+ /**
43
+ * Type guard for errors produced by the plugin.
44
+ */
45
+ function isAdshiftError(error) {
46
+ return typeof error === 'object' && error !== null && typeof error.code === 'string' && CODES.has(error.code);
47
+ }
48
+
49
+ /**
50
+ * Builds an `AdshiftError` from a code and message.
51
+ *
52
+ * @internal
53
+ */
54
+ function createAdshiftError(code, message, userInfo = {}) {
55
+ const error = new Error(message);
56
+ error.name = 'AdshiftError';
57
+ error.code = code;
58
+ error.userInfo = userInfo;
59
+ return error;
60
+ }
61
+
62
+ /**
63
+ * Normalises a promise rejection coming from the native module into an
64
+ * `AdshiftError`. Native modules reject with `{ code, message, userInfo }`.
65
+ *
66
+ * @internal
67
+ */
68
+ function toAdshiftError(error) {
69
+ if (isAdshiftError(error)) {
70
+ if (!error.userInfo) {
71
+ error.userInfo = {};
72
+ }
73
+ return error;
74
+ }
75
+ const raw = error;
76
+ const message = typeof raw?.message === 'string' ? raw.message : 'Unknown error';
77
+ const info = {};
78
+ const nativeCode = raw?.userInfo?.nativeCode;
79
+ if (typeof nativeCode === 'number' || typeof nativeCode === 'string') {
80
+ info.nativeCode = nativeCode;
81
+ }
82
+ const nativeDomain = raw?.userInfo?.nativeDomain;
83
+ if (typeof nativeDomain === 'string') {
84
+ info.nativeDomain = nativeDomain;
85
+ }
86
+ if (info.nativeCode === undefined && typeof raw?.code === 'string') {
87
+ info.nativeCode = raw.code;
88
+ }
89
+ return createAdshiftError(AdshiftErrorCode.Unknown, message, info);
90
+ }
91
+ //# sourceMappingURL=AdshiftError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AdshiftErrorCode","exports","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;AAHA,IAIYA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,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,MAAME,KAAK,GAAG,IAAIC,GAAG,CAASC,MAAM,CAACC,MAAM,CAACL,gBAAgB,CAAC,CAAC;;AAE9D;AACA;AACA;AACO,SAASM,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;AACO,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;AACO,SAASQ,cAAcA,CAACR,KAAc,EAAgB;EAC3D,IAAID,cAAc,CAACC,KAAK,CAAC,EAAE;IACzB,IAAI,CAACA,KAAK,CAACK,QAAQ,EAAE;MACnBL,KAAK,CAACK,QAAQ,GAAG,CAAC,CAAC;IACrB;IACA,OAAOL,KAAK;EACd;EACA,MAAMS,GAAG,GAAGT,KAIJ;EACR,MAAMI,OAAO,GACX,OAAOK,GAAG,EAAEL,OAAO,KAAK,QAAQ,GAAGK,GAAG,CAACL,OAAO,GAAG,eAAe;EAClE,MAAMM,IAAsB,GAAG,CAAC,CAAC;EACjC,MAAMC,UAAU,GAAGF,GAAG,EAAEJ,QAAQ,EAAEM,UAAU;EAC5C,IAAI,OAAOA,UAAU,KAAK,QAAQ,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACpED,IAAI,CAACC,UAAU,GAAGA,UAAU;EAC9B;EACA,MAAMC,YAAY,GAAGH,GAAG,EAAEJ,QAAQ,EAAEO,YAAY;EAChD,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;IACpCF,IAAI,CAACE,YAAY,GAAGA,YAAY;EAClC;EACA,IAAIF,IAAI,CAACC,UAAU,KAAKE,SAAS,IAAI,OAAOJ,GAAG,EAAER,IAAI,KAAK,QAAQ,EAAE;IAClES,IAAI,CAACC,UAAU,GAAGF,GAAG,CAACR,IAAI;EAC5B;EACA,OAAOE,kBAAkB,CAACV,gBAAgB,CAACqB,OAAO,EAAEV,OAAO,EAAEM,IAAI,CAAC;AACpE","ignoreList":[]}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdshiftEventParam = void 0;
7
+ exports.getAllEventParams = getAllEventParams;
8
+ /**
9
+ * Standard parameter names for the `values` passed to `Adshift.trackEvent()`.
10
+ *
11
+ * Reports aggregate these names. Any other key is kept with the event as a
12
+ * custom parameter, so a misspelled or invented name is stored but never
13
+ * counted — use the constants for anything a report has to add up, revenue
14
+ * above all.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * await Adshift.trackEvent(AdshiftEventType.Purchase, {
19
+ * [AdshiftEventParam.Revenue]: 9.99,
20
+ * [AdshiftEventParam.Currency]: 'USD',
21
+ * [AdshiftEventParam.ContentId]: 'SKU123',
22
+ * size: 'XL', // custom parameters are fine alongside them
23
+ * });
24
+ * ```
25
+ */
26
+ const AdshiftEventParam = exports.AdshiftEventParam = {
27
+ // ============ Commerce ============
28
+
29
+ Price: 'as_price',
30
+ /** The number reports read as revenue. Always pair it with `Currency`. */
31
+ Revenue: 'as_revenue',
32
+ /** Revenue you expect rather than money already taken. */
33
+ ProjectedRevenue: 'as_projected_revenue',
34
+ /** ISO 4217 code, e.g. `USD`. */
35
+ Currency: 'as_currency',
36
+ Quantity: 'as_quantity',
37
+ ReceiptId: 'as_receipt_id',
38
+ /** Your own order identifier, for matching purchases with your records. */
39
+ OrderId: 'as_order_id',
40
+ CouponCode: 'as_coupon_code',
41
+ PaymentInfoAvailable: 'as_payment_info_available',
42
+ Validated: 'as_validated',
43
+ // ============ Content ============
44
+
45
+ ContentType: 'as_content_type',
46
+ ContentId: 'as_content_id',
47
+ ContentList: 'as_content_list',
48
+ Content: 'as_content',
49
+ Class: 'as_class',
50
+ Description: 'as_description',
51
+ SearchString: 'as_search_string',
52
+ // ============ Ratings and reviews ============
53
+
54
+ RatingValue: 'as_rating_value',
55
+ MaxRatingValue: 'as_max_rating_value',
56
+ ReviewText: 'as_review_text',
57
+ // ============ User and progress ============
58
+
59
+ CustomerUserId: 'as_customer_user_id',
60
+ RegistrationMethod: 'as_registration_method',
61
+ Level: 'as_level',
62
+ Score: 'as_score',
63
+ Success: 'as_success',
64
+ TutorialId: 'as_tutorial_id',
65
+ AchievementId: 'as_achievement_id',
66
+ VirtualCurrencyName: 'as_virtual_currency_name',
67
+ // ============ App and links ============
68
+
69
+ DeepLink: 'as_deep_link',
70
+ OldVersion: 'as_old_version',
71
+ NewVersion: 'as_new_version',
72
+ Channel: 'as_channel',
73
+ TouchObj: 'as_touch_obj',
74
+ // ============ Dates and places ============
75
+
76
+ DateA: 'as_date_a',
77
+ DateB: 'as_date_b',
78
+ EventStart: 'as_event_start',
79
+ EventEnd: 'as_event_end',
80
+ Latitude: 'as_lat',
81
+ Longitude: 'as_long',
82
+ City: 'as_city',
83
+ Region: 'as_region',
84
+ Country: 'as_country',
85
+ DestinationA: 'as_destination_a',
86
+ DestinationB: 'as_destination_b',
87
+ DestinationList: 'as_destination_list',
88
+ // ============ Travel ============
89
+
90
+ DepartingDepartureDate: 'as_departing_departure_date',
91
+ ReturningDepartureDate: 'as_returning_departure_date',
92
+ DepartingArrivalDate: 'as_departing_arrival_date',
93
+ ReturningArrivalDate: 'as_returning_arrival_date',
94
+ TravelStart: 'as_travel_start',
95
+ TravelEnd: 'as_travel_end',
96
+ SuggestedDestinations: 'as_suggested_destinations',
97
+ SuggestedHotels: 'as_suggested_hotels',
98
+ NumAdults: 'as_num_adults',
99
+ NumChildren: 'as_num_children',
100
+ NumInfants: 'as_num_infants',
101
+ UserScore: 'as_user_score',
102
+ HotelScore: 'as_hotel_score',
103
+ PurchaseCurrency: 'as_purchase_currency',
104
+ PreferredStarRatings: 'as_preferred_star_ratings',
105
+ PreferredPriceRange: 'as_preferred_price_range',
106
+ PreferredNeighborhoods: 'as_preferred_neighborhoods',
107
+ PreferredNumStops: 'as_preferred_num_stops',
108
+ // ============ Free-form slots ============
109
+
110
+ Param1: 'as_param_1',
111
+ Param2: 'as_param_2',
112
+ Param3: 'as_param_3',
113
+ Param4: 'as_param_4',
114
+ Param5: 'as_param_5',
115
+ Param6: 'as_param_6',
116
+ Param7: 'as_param_7',
117
+ Param8: 'as_param_8',
118
+ Param9: 'as_param_9',
119
+ Param10: 'as_param_10',
120
+ // ============ Ad revenue ============
121
+ // `logAdRevenue()` fills Revenue, Currency, AdRevenueSource and
122
+ // AdRevenueNetworkName from its own arguments and drops them from
123
+ // `additionalParameters`. The rest below are yours to pass.
124
+
125
+ AdRevenueSource: 'as_adrev_source',
126
+ AdRevenueNetworkName: 'as_adrev_network_name',
127
+ AdRevenueMediatedNetworkName: 'as_adrev_mediated_network_name',
128
+ AdRevenueAdType: 'as_adrev_ad_type',
129
+ AdRevenueAdSize: 'as_adrev_ad_size',
130
+ AdRevenuePlacementId: 'as_adrev_placement_id',
131
+ AdRevenueAdUnitId: 'as_adrev_ad_unit_id',
132
+ AdRevenuePrecision: 'as_adrev_precision'
133
+ };
134
+ /**
135
+ * Returns all standard parameter names as an array.
136
+ */
137
+ function getAllEventParams() {
138
+ return Object.values(AdshiftEventParam);
139
+ }
140
+ //# sourceMappingURL=AdshiftEventParam.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AdshiftEventParam","exports","Price","Revenue","ProjectedRevenue","Currency","Quantity","ReceiptId","OrderId","CouponCode","PaymentInfoAvailable","Validated","ContentType","ContentId","ContentList","Content","Class","Description","SearchString","RatingValue","MaxRatingValue","ReviewText","CustomerUserId","RegistrationMethod","Level","Score","Success","TutorialId","AchievementId","VirtualCurrencyName","DeepLink","OldVersion","NewVersion","Channel","TouchObj","DateA","DateB","EventStart","EventEnd","Latitude","Longitude","City","Region","Country","DestinationA","DestinationB","DestinationList","DepartingDepartureDate","ReturningDepartureDate","DepartingArrivalDate","ReturningArrivalDate","TravelStart","TravelEnd","SuggestedDestinations","SuggestedHotels","NumAdults","NumChildren","NumInfants","UserScore","HotelScore","PurchaseCurrency","PreferredStarRatings","PreferredPriceRange","PreferredNeighborhoods","PreferredNumStops","Param1","Param2","Param3","Param4","Param5","Param6","Param7","Param8","Param9","Param10","AdRevenueSource","AdRevenueNetworkName","AdRevenueMediatedNetworkName","AdRevenueAdType","AdRevenueAdSize","AdRevenuePlacementId","AdRevenueAdUnitId","AdRevenuePrecision","getAllEventParams","Object","values"],"sourceRoot":"../../../src","sources":["types/AdshiftEventParam.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAAA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,OAAOC,MAAM,CAACC,MAAM,CAACrF,iBAAiB,CAAC;AACzC","ignoreList":[]}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdshiftEventType = void 0;
7
+ exports.getAllEventTypes = getAllEventTypes;
8
+ /**
9
+ * Predefined event types for AdShift SDK.
10
+ *
11
+ * Use these constants for consistent event naming across your app.
12
+ *
13
+ * Pair them with `AdshiftEventParam` for the values.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * await Adshift.trackEvent(AdshiftEventType.AddToCart, {
18
+ * [AdshiftEventParam.ContentId]: 'SKU123',
19
+ * [AdshiftEventParam.Price]: 29.99,
20
+ * });
21
+ * ```
22
+ *
23
+ * You can also use custom event names as strings:
24
+ * ```typescript
25
+ * await Adshift.trackEvent('custom_event_name');
26
+ * ```
27
+ */
28
+ const AdshiftEventType = exports.AdshiftEventType = {
29
+ // ============ E-commerce Events ============
30
+
31
+ AddToCart: 'as_add_to_cart',
32
+ AddToWishList: 'as_add_to_wishlist',
33
+ AddPaymentInfo: 'as_add_payment_info',
34
+ InitiatedCheckout: 'as_initiated_checkout',
35
+ Purchase: 'as_purchase',
36
+ ContentView: 'as_content_view',
37
+ ListView: 'as_list_view',
38
+ Search: 'as_search',
39
+ // ============ User Lifecycle Events ============
40
+
41
+ CompleteRegistration: 'as_complete_registration',
42
+ Login: 'as_login',
43
+ TutorialCompletion: 'as_tutorial_completion',
44
+ Subscribe: 'as_subscribe',
45
+ StartTrial: 'as_start_trial',
46
+ // ============ Gaming Events ============
47
+
48
+ LevelAchieved: 'as_level_achieved',
49
+ AchievementUnlocked: 'as_achievement_unlocked',
50
+ /** Note the plural in the value; the key is singular for compatibility. */
51
+ SpentCredit: 'as_spent_credits',
52
+ // ============ Engagement Events ============
53
+
54
+ Rate: 'as_rate',
55
+ Share: 'as_share',
56
+ Invite: 'as_invite',
57
+ ReEngage: 'as_re_engage',
58
+ Update: 'as_update',
59
+ OpenedFromPushNotification: 'as_opened_from_push_notification',
60
+ // ============ Travel Events ============
61
+
62
+ TravelBooking: 'as_travel_booking',
63
+ // ============ Ad Events ============
64
+
65
+ AdClick: 'as_ad_click',
66
+ AdView: 'as_ad_view',
67
+ /** Ad revenue impression. Prefer `Adshift.logAdRevenue()`. */
68
+ AdRevenue: 'as_ad_revenue',
69
+ // ============ Location Events ============
70
+
71
+ /** Region or place the user moved to, as your own values. */
72
+ LocationChanged: 'as_location_changed',
73
+ /** Latitude and longitude. Send only what your privacy notice covers. */
74
+ LocationCoordinates: 'as_location_coordinates',
75
+ // ============ Other Events ============
76
+
77
+ /** Your order identifier, for matching purchases with your own records. */
78
+ OrderId: 'as_order_id',
79
+ /** Segment the user belongs to, for audience reporting. */
80
+ CustomerSegment: 'as_customer_segment'
81
+ };
82
+ /**
83
+ * Returns all predefined event types as an array.
84
+ */
85
+ function getAllEventTypes() {
86
+ return Object.values(AdshiftEventType);
87
+ }
88
+ //# sourceMappingURL=AdshiftEventType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AdshiftEventType","exports","AddToCart","AddToWishList","AddPaymentInfo","InitiatedCheckout","Purchase","ContentView","ListView","Search","CompleteRegistration","Login","TutorialCompletion","Subscribe","StartTrial","LevelAchieved","AchievementUnlocked","SpentCredit","Rate","Share","Invite","ReEngage","Update","OpenedFromPushNotification","TravelBooking","AdClick","AdView","AdRevenue","LocationChanged","LocationCoordinates","OrderId","CustomerSegment","getAllEventTypes","Object","values"],"sourceRoot":"../../../src","sources":["types/AdshiftEventType.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9B;;EAEAE,SAAS,EAAE,gBAAgB;EAE3BC,aAAa,EAAE,oBAAoB;EAEnCC,cAAc,EAAE,qBAAqB;EAErCC,iBAAiB,EAAE,uBAAuB;EAE1CC,QAAQ,EAAE,aAAa;EAEvBC,WAAW,EAAE,iBAAiB;EAE9BC,QAAQ,EAAE,cAAc;EAExBC,MAAM,EAAE,WAAW;EAEnB;;EAEAC,oBAAoB,EAAE,0BAA0B;EAEhDC,KAAK,EAAE,UAAU;EAEjBC,kBAAkB,EAAE,wBAAwB;EAE5CC,SAAS,EAAE,cAAc;EAEzBC,UAAU,EAAE,gBAAgB;EAE5B;;EAEAC,aAAa,EAAE,mBAAmB;EAElCC,mBAAmB,EAAE,yBAAyB;EAE9C;EACAC,WAAW,EAAE,kBAAkB;EAE/B;;EAEAC,IAAI,EAAE,SAAS;EAEfC,KAAK,EAAE,UAAU;EAEjBC,MAAM,EAAE,WAAW;EAEnBC,QAAQ,EAAE,cAAc;EAExBC,MAAM,EAAE,WAAW;EAEnBC,0BAA0B,EAAE,kCAAkC;EAE9D;;EAEAC,aAAa,EAAE,mBAAmB;EAElC;;EAEAC,OAAO,EAAE,aAAa;EAEtBC,MAAM,EAAE,YAAY;EAEpB;EACAC,SAAS,EAAE,eAAe;EAE1B;;EAEA;EACAC,eAAe,EAAE,qBAAqB;EAEtC;EACAC,mBAAmB,EAAE,yBAAyB;EAE9C;;EAEA;EACAC,OAAO,EAAE,aAAa;EAEtB;EACAC,eAAe,EAAE;AACnB,CAAU;AAKV;AACA;AACA;AACO,SAASC,gBAAgBA,CAAA,EAA4B;EAC1D,OAAOC,MAAM,CAACC,MAAM,CAAClC,gBAAgB,CAAC;AACxC","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdshiftThirdPartySharing = void 0;
7
+ exports.thirdPartySharingToMap = thirdPartySharingToMap;
8
+ /**
9
+ * What the app says about passing this user's data on to someone else.
10
+ *
11
+ * A separate question from {@link AdshiftConsent}, and one with the opposite
12
+ * default. Consent under GDPR must be affirmative, so a flag nobody set counts
13
+ * as no consent. Here nothing said means sharing is allowed — which is why this
14
+ * is not a fourth flag on the consent object: folding the two together would
15
+ * make one of them wrong.
16
+ *
17
+ * The three states live in the calls rather than in a nullable field. Never
18
+ * calling `Adshift.setThirdPartySharing()` leaves the question unanswered,
19
+ * `Adshift.clearThirdPartySharing()` returns to unanswered, and the value here
20
+ * is the answer itself.
21
+ *
22
+ * An object rather than a bare `boolean` so a field can be added later without
23
+ * breaking callers.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * // The user asked not to have their data passed on
28
+ * Adshift.setThirdPartySharing(AdshiftThirdPartySharing.optedOut());
29
+ *
30
+ * // The user was asked and did not opt out
31
+ * Adshift.setThirdPartySharing(AdshiftThirdPartySharing.allowed());
32
+ * ```
33
+ */
34
+
35
+ /**
36
+ * Helper functions for creating `AdshiftThirdPartySharing` objects.
37
+ */
38
+ const AdshiftThirdPartySharing = exports.AdshiftThirdPartySharing = {
39
+ /** The user asked not to have their data passed on. */
40
+ optedOut() {
41
+ return {
42
+ optOut: true
43
+ };
44
+ },
45
+ /**
46
+ * The user did not ask to be excluded.
47
+ *
48
+ * Only worth sending when the app has actually asked. Setting this at startup
49
+ * as a default is the one mistake to avoid here: a CMP answer arriving later
50
+ * cannot be undone for events already sent, and the declaration is recorded
51
+ * as the app's own rather than as the absence of one.
52
+ */
53
+ allowed() {
54
+ return {
55
+ optOut: false
56
+ };
57
+ }
58
+ };
59
+
60
+ /**
61
+ * Converts `AdshiftThirdPartySharing` to a plain object for the native bridge.
62
+ *
63
+ * @internal
64
+ */
65
+ function thirdPartySharingToMap(sharing) {
66
+ return {
67
+ optOut: sharing.optOut === true
68
+ };
69
+ }
70
+ //# sourceMappingURL=AdshiftThirdPartySharing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AdshiftThirdPartySharing","exports","optedOut","optOut","allowed","thirdPartySharingToMap","sharing"],"sourceRoot":"../../../src","sources":["types/AdshiftThirdPartySharing.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACO,MAAMA,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACtC;EACAE,QAAQA,CAAA,EAA6B;IACnC,OAAO;MAAEC,MAAM,EAAE;IAAK,CAAC;EACzB,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAAA,EAA6B;IAClC,OAAO;MAAED,MAAM,EAAE;IAAM,CAAC;EAC1B;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACO,SAASE,sBAAsBA,CACpCC,OAAiC,EACR;EACzB,OAAO;IAAEH,MAAM,EAAEG,OAAO,CAACH,MAAM,KAAK;EAAK,CAAC;AAC5C","ignoreList":[]}