@amplytools/react-native-amply-sdk 0.13.0 → 0.15.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 (45) hide show
  1. package/AmplyReactNative.podspec +1 -1
  2. package/README.md +47 -0
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/tools/amply/sdk/reactnative/AmplyModule.kt +30 -0
  5. package/android/src/main/java/tools/amply/sdk/reactnative/core/AmplyClient.kt +13 -0
  6. package/android/src/main/java/tools/amply/sdk/reactnative/core/DefaultAmplyClient.kt +46 -0
  7. package/android/src/main/java/tools/amply/sdk/reactnative/model/AmplyInitializationOptions.kt +2 -0
  8. package/android/src/main/java/tools/amply/sdk/reactnative/model/CampaignTouchPayload.kt +12 -0
  9. package/android/src/newarch/java/tools/amply/sdk/reactnative/NativeAmplyModuleSpec.java +12 -0
  10. package/android/src/newarch/jni/AmplyReactNative-generated.cpp +18 -0
  11. package/dist/src/__tests__/appLanguage.test.d.ts +2 -0
  12. package/dist/src/__tests__/appLanguage.test.d.ts.map +1 -0
  13. package/dist/src/__tests__/appLanguage.test.js +211 -0
  14. package/dist/src/__tests__/handleUrl.test.d.ts +2 -0
  15. package/dist/src/__tests__/handleUrl.test.d.ts.map +1 -0
  16. package/dist/src/__tests__/handleUrl.test.js +114 -0
  17. package/dist/src/__tests__/lastCampaignTouch.test.d.ts +2 -0
  18. package/dist/src/__tests__/lastCampaignTouch.test.d.ts.map +1 -0
  19. package/dist/src/__tests__/lastCampaignTouch.test.js +119 -0
  20. package/dist/src/__tests__/systemEventUtils.test.js +16 -0
  21. package/dist/src/campaignTouch.d.ts +36 -0
  22. package/dist/src/campaignTouch.d.ts.map +1 -0
  23. package/dist/src/campaignTouch.js +39 -0
  24. package/dist/src/index.d.ts +50 -0
  25. package/dist/src/index.d.ts.map +1 -1
  26. package/dist/src/index.js +198 -1
  27. package/dist/src/nativeSpecs/NativeAmplyModule.d.ts +40 -0
  28. package/dist/src/nativeSpecs/NativeAmplyModule.d.ts.map +1 -1
  29. package/dist/src/systemEventUtils.d.ts.map +1 -1
  30. package/dist/src/systemEventUtils.js +3 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/docs/ARCHITECTURE.md +4 -0
  33. package/docs/DEVELOPMENT.md +2 -1
  34. package/ios/Sources/AmplyReactNative/AmplyModule.mm +81 -0
  35. package/ios/Sources/AmplyReactNative/AmplyReactNative/AmplyReactNative-generated.mm +21 -0
  36. package/ios/Sources/AmplyReactNative/AmplyReactNative/AmplyReactNative.h +11 -0
  37. package/package.json +1 -1
  38. package/src/__tests__/appLanguage.test.ts +298 -0
  39. package/src/__tests__/handleUrl.test.ts +155 -0
  40. package/src/__tests__/lastCampaignTouch.test.ts +151 -0
  41. package/src/__tests__/systemEventUtils.test.ts +22 -0
  42. package/src/campaignTouch.ts +74 -0
  43. package/src/index.ts +223 -1
  44. package/src/nativeSpecs/NativeAmplyModule.ts +41 -0
  45. package/src/systemEventUtils.ts +3 -1
package/dist/src/index.js CHANGED
@@ -2,6 +2,7 @@ import getNativeModule from './nativeModule';
2
2
  import { addSystemEventListenerRaw, addSystemEventListener as addSystemEventListenerInternal } from './systemEvents';
3
3
  export { useAmplySystemEvents } from './hooks/useAmplySystemEvents';
4
4
  export { formatSystemEventLabel } from './systemEventUtils';
5
+ import { assertValidWithinMs, toCampaignTouch } from './campaignTouch';
5
6
  const REQUIRED_KEYS = ['appId', 'apiKeyPublic', 'apiKeySecret'];
6
7
  /** Rejection raised by {@link initialize} for a config the SDK cannot start with. */
7
8
  export class AmplyConfigError extends Error {
@@ -186,10 +187,174 @@ export async function initialize(config) {
186
187
  if (config.debug || config.logLevel) {
187
188
  ensureDebugLogListener();
188
189
  }
189
- await getNativeModule().initialize(config);
190
+ // Taken now, synchronously: a call made after this point is later than the config and must
191
+ // stay parked so it is applied after it.
192
+ const parked = takeParkedAppLanguage();
193
+ try {
194
+ await getNativeModule().initialize(withParkedAppLanguage(config, parked));
195
+ }
196
+ catch (error) {
197
+ // A debug link parked for a failed start has nothing to open; replaying it later would
198
+ // surprise a retry that the user did not scan for.
199
+ parkedDebugUrl = null;
200
+ // Nothing reached the SDK, so the call still has to — unless a newer one replaced it.
201
+ if (parkedAppLanguage == null && isLatestLanguageWrite(parked)) {
202
+ parkedAppLanguage = parked;
203
+ }
204
+ throw error;
205
+ }
206
+ // A parked clear cannot travel in the config, where null means "leave it alone". Replayed only
207
+ // if nothing newer came in while initialize was in flight: the native SDK reports itself up
208
+ // before this promise settles, and a call made in that window has already reached it.
209
+ if ((parked === null || parked === void 0 ? void 0 : parked.tag) === null && !hasText(config.appLanguage) && isLatestLanguageWrite(parked)) {
210
+ getNativeModule().setAppLanguage(null);
211
+ }
212
+ flushParkedAppLanguage();
213
+ flushParkedDebugUrl();
190
214
  // Anything the host registered before this point was parked rather than lost.
191
215
  replayPendingRegistrations();
192
216
  }
217
+ /**
218
+ * A {@link setAppLanguage} call made before the SDK was up. Boxed so that a parked `null` — a
219
+ * request to return to automatic detection — is distinguishable from nothing parked.
220
+ *
221
+ * The native bridges buffer such calls too, but replay them AFTER building the SDK, which applies
222
+ * the config's `appLanguage` first. An earlier call would then overwrite a later config value,
223
+ * the opposite of "last write wins". Parking it here lets {@link initialize} put the two in the
224
+ * order they were made.
225
+ */
226
+ let parkedAppLanguage = null;
227
+ /** Bumped by every {@link setAppLanguage} call, whether it is forwarded or held. */
228
+ let languageWriteSeq = 0;
229
+ function isLatestLanguageWrite(write) {
230
+ return write != null && write.seq === languageWriteSeq;
231
+ }
232
+ function hasText(value) {
233
+ return typeof value === 'string' && value.trim().length > 0;
234
+ }
235
+ function takeParkedAppLanguage() {
236
+ const parked = parkedAppLanguage;
237
+ parkedAppLanguage = null;
238
+ return parked;
239
+ }
240
+ /** The config's own appLanguage wins: initialize was called after the parked call. */
241
+ function withParkedAppLanguage(config, parked) {
242
+ if (hasText(config.appLanguage) || parked == null || parked.tag === null) {
243
+ return config;
244
+ }
245
+ return { ...config, appLanguage: parked.tag };
246
+ }
247
+ function flushParkedAppLanguage() {
248
+ const parked = takeParkedAppLanguage();
249
+ if (isLatestLanguageWrite(parked)) {
250
+ getNativeModule().setAppLanguage(parked.tag);
251
+ }
252
+ }
253
+ /**
254
+ * Tell Amply the language your app's UI is in, so sheets, stories and mini-apps show in the
255
+ * matching language and campaigns can target it. Use this when the app chooses its language
256
+ * itself (an in-app language picker, i18next, …) rather than following the device.
257
+ *
258
+ * Any common tag format works — `'pt_BR'`, `'pt-BR'`, `'zh-TW'`, `'fr'`, any case. A value that
259
+ * is not a language tag is ignored by the SDK with a warning log. The value is persisted across
260
+ * launches; pass `null` to return to automatic detection. The device language is never changed.
261
+ *
262
+ * Safe to call before {@link initialize}: the value is held and applied at initialization, and
263
+ * an `appLanguage` passed to a later `initialize` call wins over it.
264
+ * @param tag The language tag, or null to clear
265
+ */
266
+ export function setAppLanguage(tag) {
267
+ languageWriteSeq += 1;
268
+ if (isSdkUp()) {
269
+ getNativeModule().setAppLanguage(tag);
270
+ return;
271
+ }
272
+ parkedAppLanguage = { tag, seq: languageWriteSeq };
273
+ }
274
+ /** A debug link that arrived before the SDK was up. At most one: a newer link replaces it. */
275
+ let parkedDebugUrl = null;
276
+ const URL_SCHEME_PREFIX = /^[A-Za-z][A-Za-z0-9+.-]*:\/\//;
277
+ const DEBUG_LINK_HOST = 'amply-debug';
278
+ const DEBUG_LINK_PATH = '/campaign';
279
+ const DEBUG_LINK_TOKEN_PARAM = 't';
280
+ /**
281
+ * True for `<any scheme>://amply-debug/campaign?t=<non-empty>`. Parsed by hand, without decoding,
282
+ * so a malformed string is just "not a debug link" and can never throw.
283
+ */
284
+ function isDebugLink(url) {
285
+ const scheme = URL_SCHEME_PREFIX.exec(url);
286
+ if (scheme == null) {
287
+ return false;
288
+ }
289
+ const rest = url.slice(scheme[0].length).split('#')[0];
290
+ const queryStart = rest.indexOf('?');
291
+ if (queryStart < 0) {
292
+ return false;
293
+ }
294
+ const target = rest.slice(0, queryStart);
295
+ const slash = target.indexOf('/');
296
+ if (slash < 0 || target.slice(0, slash) !== DEBUG_LINK_HOST) {
297
+ return false;
298
+ }
299
+ if (target.slice(slash).replace(/\/+$/, '') !== DEBUG_LINK_PATH) {
300
+ return false;
301
+ }
302
+ return rest
303
+ .slice(queryStart + 1)
304
+ .split('&')
305
+ .some(pair => {
306
+ const eq = pair.indexOf('=');
307
+ return eq > 0 && pair.slice(0, eq) === DEBUG_LINK_TOKEN_PARAM && eq < pair.length - 1;
308
+ });
309
+ }
310
+ function flushParkedDebugUrl() {
311
+ var _a, _b;
312
+ const url = parkedDebugUrl;
313
+ parkedDebugUrl = null;
314
+ if (url == null) {
315
+ return;
316
+ }
317
+ try {
318
+ (_b = (_a = getNativeModule()).handleUrl) === null || _b === void 0 ? void 0 : _b.call(_a, url);
319
+ }
320
+ catch (error) {
321
+ console.warn('[Amply] Failed to replay a debug link parked until initialize', error);
322
+ }
323
+ }
324
+ /**
325
+ * Hand an incoming URL to Amply. Call it for every link your app is opened with — cold start
326
+ * and while running — before your own routing; when it returns `true` Amply recognised the
327
+ * link as its own and took it over, so your app should not route it.
328
+ *
329
+ * Safe to call before {@link initialize}, which is how a cold-start link arrives: an Amply debug
330
+ * link is held (the newest one) and opened once initialization succeeds, and `true` is returned.
331
+ *
332
+ * Synchronous. Returns `false` for any other URL, for a non-string, and when the installed
333
+ * native SDK predates this method; it never throws.
334
+ * @param url The full incoming URL
335
+ */
336
+ export function handleUrl(url) {
337
+ if (typeof url !== 'string') {
338
+ return false;
339
+ }
340
+ try {
341
+ if (!isSdkUp()) {
342
+ if (!isDebugLink(url)) {
343
+ return false;
344
+ }
345
+ parkedDebugUrl = url;
346
+ return true;
347
+ }
348
+ const nativeModule = getNativeModule();
349
+ if (typeof nativeModule.handleUrl !== 'function') {
350
+ return false;
351
+ }
352
+ return nativeModule.handleUrl(url) === true;
353
+ }
354
+ catch {
355
+ return false;
356
+ }
357
+ }
193
358
  /**
194
359
  * Set the user ID for analytics. Pass null to clear.
195
360
  * @param userId The user ID to set, or null to clear
@@ -386,6 +551,35 @@ export async function registerGate(baseUrl, presenter, opts) {
386
551
  export async function getRecentEvents(limit) {
387
552
  return getNativeModule().getRecentEvents(limit);
388
553
  }
554
+ /**
555
+ * The campaign the user was most recently touched by — shown, or completed — at most `withinMs`
556
+ * ago, or `null` if there was none.
557
+ *
558
+ * Use it to attribute a purchase (or any conversion) in your own analytics to the campaign that
559
+ * preceded it, including one made from somewhere other than the campaign's link:
560
+ *
561
+ * ```ts
562
+ * const touch = await Amply.getLastCampaignTouch(30 * 60 * 1000);
563
+ * analytics.track('Purchase', {sku, amply_campaign_id: touch?.campaignId});
564
+ * ```
565
+ *
566
+ * One touch per campaign, the newer of a show and a completion. `withinMs` is inclusive and
567
+ * capped at 30 days by the SDK. Resolves `null` before {@link initialize}, while the SDK's storage
568
+ * is off, and if the native call fails — it rejects only for a `withinMs` that is not a finite
569
+ * number >= 0, which is a bug at the call site.
570
+ */
571
+ export async function getLastCampaignTouch(withinMs) {
572
+ assertValidWithinMs(withinMs);
573
+ try {
574
+ return toCampaignTouch(await getNativeModule().getLastCampaignTouch(withinMs));
575
+ }
576
+ catch (error) {
577
+ // The SDK answers null for every state it can be in; a rejection here is the bridge itself
578
+ // failing, and an analytics lookup must never break the purchase flow that asked.
579
+ console.warn('[Amply] getLastCampaignTouch failed; resolving null', error);
580
+ return null;
581
+ }
582
+ }
389
583
  export async function getDataSetSnapshot(type) {
390
584
  return getNativeModule().getDataSetSnapshot(type);
391
585
  }
@@ -476,12 +670,15 @@ export default {
476
670
  trackGated,
477
671
  registerGate,
478
672
  getRecentEvents,
673
+ getLastCampaignTouch,
479
674
  getDataSetSnapshot,
480
675
  addDeepLinkListener,
481
676
  addSystemEventListener,
482
677
  addSystemEventsListener,
483
678
  removeAllListeners,
484
679
  setUserId,
680
+ setAppLanguage,
681
+ handleUrl,
485
682
  setLogLevel,
486
683
  getLogLevel,
487
684
  setCustomProperty,
@@ -44,6 +44,12 @@ export type AmplyInitializationConfig = {
44
44
  * Takes precedence over `debug` if both are specified.
45
45
  */
46
46
  logLevel?: LogLevel | null;
47
+ /**
48
+ * The language the app's UI is in, in any common format (`'pt_BR'`, `'zh-TW'`, `'fr'`).
49
+ * The same as calling `setAppLanguage` right after initialization, and persisted the same
50
+ * way. Omitted, null or blank leaves the current setting alone.
51
+ */
52
+ appLanguage?: string | null;
47
53
  };
48
54
  export type EventType = 'custom' | 'system';
49
55
  export type TrackEventPayload = {
@@ -57,7 +63,22 @@ export type EventRecord = {
57
63
  timestamp: number;
58
64
  properties: JsonMap;
59
65
  };
66
+ /**
67
+ * A system event from the SDK. `CampaignShown` and `CampaignResolved` carry `campaignId` and,
68
+ * from SDK 0.15.0, `campaignName` in `properties`.
69
+ */
60
70
  export type SystemEventPayload = EventRecord;
71
+ /**
72
+ * Wire shape of a campaign touch as the native bridges send it. `kind` is `'shown'` or
73
+ * `'engaged'`; the public `CampaignTouch` type narrows it. Kept a plain string here so the
74
+ * codegen contract does not change if the SDK ever adds a kind.
75
+ */
76
+ export type CampaignTouchPayload = {
77
+ campaignId: string;
78
+ campaignName: string;
79
+ kind: string;
80
+ atMs: number;
81
+ };
61
82
  export type TriggeredEventCountStrategy = 'global' | 'session';
62
83
  export type TriggeredEventParam = {
63
84
  name: string;
@@ -189,6 +210,12 @@ export interface Spec extends TurboModule {
189
210
  */
190
211
  unregisterGate(baseUrl: string): void;
191
212
  getRecentEvents(limit: number): Promise<EventRecord[]>;
213
+ /**
214
+ * The campaign the user was most recently touched by (shown, or completed) at most `withinMs`
215
+ * ago, or null. Never rejects for "not initialised" — that resolves null, as in the SDK.
216
+ * `withinMs` is clamped natively to [0, 30 days].
217
+ */
218
+ getLastCampaignTouch(withinMs: number): Promise<CampaignTouchPayload | null>;
192
219
  getDataSetSnapshot(type: DataSetType): Promise<DataSetSnapshot>;
193
220
  registerDeepLinkListener(): void;
194
221
  /**
@@ -196,6 +223,19 @@ export interface Spec extends TurboModule {
196
223
  * @param userId The user ID to set, or null to clear
197
224
  */
198
225
  setUserId(userId: string | null): void;
226
+ /**
227
+ * Set the language the app's UI is in. Any common tag format; null returns to automatic
228
+ * detection. Persisted by the SDK across launches.
229
+ * @param tag The language tag, or null to clear
230
+ */
231
+ setAppLanguage(tag: string | null): void;
232
+ /**
233
+ * Hand an incoming URL to the SDK. Returns true when the SDK recognised it as its own
234
+ * (a test-launch link) and took it over; false for any other URL, or when the SDK is not
235
+ * initialized.
236
+ * @param url The full incoming URL
237
+ */
238
+ handleUrl(url: string): boolean;
199
239
  /**
200
240
  * Set the log level at runtime.
201
241
  * @param level The log level to set
@@ -1 +1 @@
1
- {"version":3,"file":"NativeAmplyModule.d.ts","sourceRoot":"","sources":["../../../src/nativeSpecs/NativeAmplyModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,2CAA2C,CAAC;AAE5E,KAAK,OAAO,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpE,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,G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":"","sources":["../../src/systemEventUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,iCAAiC,CAAC;AAYjE,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAqCR"}
1
+ {"version":3,"file":"systemEventUtils.d.ts","sourceRoot":"","sources":["../../src/systemEventUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,iCAAiC,CAAC;AAYjE,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAuCR"}
@@ -16,8 +16,10 @@ export function formatSystemEventLabel(event, options = {}) {
16
16
  }
17
17
  if (event.name === 'CampaignShown') {
18
18
  const campaignId = event.properties.campaignId;
19
+ // Sent by SDK 0.15.0 and later (on CampaignShown and CampaignResolved alike).
20
+ const campaignName = event.properties.campaignName;
19
21
  const source = event.properties.source;
20
- return `Campaign shown${campaignId ? ` (${campaignId})` : ''}${source ? ` via ${source}` : ''}`;
22
+ return `Campaign shown${campaignName ? ` "${campaignName}"` : ''}${campaignId ? ` (${campaignId})` : ''}${source ? ` via ${source}` : ''}`;
21
23
  }
22
24
  if (event.name === 'EventTriggered') {
23
25
  const source = event.properties.sourceEvent;