@amplytools/react-native-amply-sdk 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AmplyReactNative.podspec +1 -1
- package/README.md +41 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/tools/amply/sdk/reactnative/AmplyModule.kt +22 -0
- package/android/src/main/java/tools/amply/sdk/reactnative/core/AmplyClient.kt +11 -0
- package/android/src/main/java/tools/amply/sdk/reactnative/core/DefaultAmplyClient.kt +29 -0
- package/android/src/main/java/tools/amply/sdk/reactnative/model/CampaignTouchPayload.kt +12 -0
- package/android/src/newarch/java/tools/amply/sdk/reactnative/NativeAmplyModuleSpec.java +8 -0
- package/android/src/newarch/jni/AmplyReactNative-generated.cpp +12 -0
- package/dist/cjs/campaignTouch.js +44 -0
- package/dist/cjs/campaignTouch.js.map +1 -0
- package/dist/cjs/hooks/useAmplySystemEvents.js +60 -0
- package/dist/cjs/hooks/useAmplySystemEvents.js.map +1 -0
- package/dist/cjs/index.js +723 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/nativeModule.js +55 -0
- package/dist/cjs/nativeModule.js.map +1 -0
- package/dist/cjs/nativeSpecs/NativeAmplyModule.js +5 -0
- package/dist/cjs/nativeSpecs/NativeAmplyModule.js.map +1 -0
- package/dist/cjs/systemEventUtils.js +47 -0
- package/dist/cjs/systemEventUtils.js.map +1 -0
- package/dist/cjs/systemEvents.js +27 -0
- package/dist/cjs/systemEvents.js.map +1 -0
- package/dist/src/campaignTouch.d.ts +36 -0
- package/dist/src/campaignTouch.d.ts.map +1 -0
- package/dist/src/campaignTouch.js +39 -0
- package/dist/src/index.d.ts +35 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +120 -0
- package/dist/src/nativeSpecs/NativeAmplyModule.d.ts +28 -0
- package/dist/src/nativeSpecs/NativeAmplyModule.d.ts.map +1 -1
- package/dist/src/systemEventUtils.d.ts.map +1 -1
- package/dist/src/systemEventUtils.js +3 -1
- package/docs/ARCHITECTURE.md +28 -19
- package/docs/DEVELOPMENT.md +2 -1
- package/ios/Sources/AmplyReactNative/AmplyModule.mm +56 -0
- package/ios/Sources/AmplyReactNative/AmplyReactNative/AmplyReactNative-generated.mm +14 -0
- package/ios/Sources/AmplyReactNative/AmplyReactNative/AmplyReactNative.h +4 -0
- package/package.json +12 -6
- package/scripts/check-package.js +159 -0
- package/src/campaignTouch.ts +74 -0
- package/src/index.ts +124 -0
- package/src/nativeSpecs/NativeAmplyModule.ts +29 -0
- package/src/systemEventUtils.ts +3 -1
- package/dist/index.js +0 -272
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -234
- package/dist/index.mjs.map +0 -1
- package/dist/plugin/index.d.ts +0 -6
- package/dist/plugin/index.d.ts.map +0 -1
- package/dist/plugin/index.js +0 -186
- package/dist/plugin/index.js.map +0 -1
- package/dist/plugin/index.mjs +0 -169
- package/dist/plugin/index.mjs.map +0 -1
- package/dist/plugin/withAmply.d.ts +0 -12
- package/dist/plugin/withAmply.d.ts.map +0 -1
- package/dist/src/__tests__/appLanguage.test.d.ts +0 -43
- package/dist/src/__tests__/appLanguage.test.d.ts.map +0 -1
- package/dist/src/__tests__/appLanguage.test.js +0 -211
- package/dist/src/__tests__/campaignResolved.test.d.ts +0 -2
- package/dist/src/__tests__/campaignResolved.test.d.ts.map +0 -1
- package/dist/src/__tests__/campaignResolved.test.js +0 -208
- package/dist/src/__tests__/gateRegistrationLifecycle.test.d.ts +0 -2
- package/dist/src/__tests__/gateRegistrationLifecycle.test.d.ts.map +0 -1
- package/dist/src/__tests__/gateRegistrationLifecycle.test.js +0 -215
- package/dist/src/__tests__/index.test.d.ts +0 -2
- package/dist/src/__tests__/index.test.d.ts.map +0 -1
- package/dist/src/__tests__/index.test.js +0 -204
- package/dist/src/__tests__/systemEventUtils.test.d.ts +0 -2
- package/dist/src/__tests__/systemEventUtils.test.d.ts.map +0 -1
- package/dist/src/__tests__/systemEventUtils.test.js +0 -56
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/plugin/tsconfig.tsbuildinfo +0 -1
- package/src/__tests__/appLanguage.test.ts +0 -296
- package/src/__tests__/campaignResolved.test.ts +0 -294
- package/src/__tests__/gateRegistrationLifecycle.test.ts +0 -281
- package/src/__tests__/index.test.ts +0 -258
- package/src/__tests__/systemEventUtils.test.ts +0 -75
package/src/index.ts
CHANGED
|
@@ -3,6 +3,9 @@ import {addSystemEventListenerRaw, addSystemEventListener as addSystemEventListe
|
|
|
3
3
|
export {useAmplySystemEvents} from './hooks/useAmplySystemEvents';
|
|
4
4
|
export {formatSystemEventLabel} from './systemEventUtils';
|
|
5
5
|
export type {FormatOptions} from './systemEventUtils';
|
|
6
|
+
import {assertValidWithinMs, toCampaignTouch} from './campaignTouch';
|
|
7
|
+
import type {CampaignTouch} from './campaignTouch';
|
|
8
|
+
export type {CampaignTouch, CampaignTouchKind} from './campaignTouch';
|
|
6
9
|
import type {
|
|
7
10
|
CampaignResult,
|
|
8
11
|
GateDecision,
|
|
@@ -238,6 +241,9 @@ export async function initialize(config: AmplyInitializationConfig): Promise<voi
|
|
|
238
241
|
try {
|
|
239
242
|
await getNativeModule().initialize(withParkedAppLanguage(config, parked));
|
|
240
243
|
} catch (error) {
|
|
244
|
+
// A debug link parked for a failed start has nothing to open; replaying it later would
|
|
245
|
+
// surprise a retry that the user did not scan for.
|
|
246
|
+
parkedDebugUrl = null;
|
|
241
247
|
// Nothing reached the SDK, so the call still has to — unless a newer one replaced it.
|
|
242
248
|
if (parkedAppLanguage == null && isLatestLanguageWrite(parked)) {
|
|
243
249
|
parkedAppLanguage = parked;
|
|
@@ -251,6 +257,7 @@ export async function initialize(config: AmplyInitializationConfig): Promise<voi
|
|
|
251
257
|
getNativeModule().setAppLanguage(null);
|
|
252
258
|
}
|
|
253
259
|
flushParkedAppLanguage();
|
|
260
|
+
flushParkedDebugUrl();
|
|
254
261
|
// Anything the host registered before this point was parked rather than lost.
|
|
255
262
|
replayPendingRegistrations();
|
|
256
263
|
}
|
|
@@ -334,6 +341,92 @@ export function setAppLanguage(tag: string | null): void {
|
|
|
334
341
|
parkedAppLanguage = {tag, seq: languageWriteSeq};
|
|
335
342
|
}
|
|
336
343
|
|
|
344
|
+
/** A debug link that arrived before the SDK was up. At most one: a newer link replaces it. */
|
|
345
|
+
let parkedDebugUrl: string | null = null;
|
|
346
|
+
|
|
347
|
+
const URL_SCHEME_PREFIX = /^[A-Za-z][A-Za-z0-9+.-]*:\/\//;
|
|
348
|
+
const DEBUG_LINK_HOST = 'amply-debug';
|
|
349
|
+
const DEBUG_LINK_PATH = '/campaign';
|
|
350
|
+
const DEBUG_LINK_TOKEN_PARAM = 't';
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* True for `<any scheme>://amply-debug/campaign?t=<non-empty>`. Parsed by hand, without decoding,
|
|
354
|
+
* so a malformed string is just "not a debug link" and can never throw.
|
|
355
|
+
*/
|
|
356
|
+
function isDebugLink(url: string): boolean {
|
|
357
|
+
const scheme = URL_SCHEME_PREFIX.exec(url);
|
|
358
|
+
if (scheme == null) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
const rest = url.slice(scheme[0].length).split('#')[0];
|
|
362
|
+
const queryStart = rest.indexOf('?');
|
|
363
|
+
if (queryStart < 0) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
const target = rest.slice(0, queryStart);
|
|
367
|
+
const slash = target.indexOf('/');
|
|
368
|
+
if (slash < 0 || target.slice(0, slash) !== DEBUG_LINK_HOST) {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
if (target.slice(slash).replace(/\/+$/, '') !== DEBUG_LINK_PATH) {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
return rest
|
|
375
|
+
.slice(queryStart + 1)
|
|
376
|
+
.split('&')
|
|
377
|
+
.some(pair => {
|
|
378
|
+
const eq = pair.indexOf('=');
|
|
379
|
+
return eq > 0 && pair.slice(0, eq) === DEBUG_LINK_TOKEN_PARAM && eq < pair.length - 1;
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function flushParkedDebugUrl(): void {
|
|
384
|
+
const url = parkedDebugUrl;
|
|
385
|
+
parkedDebugUrl = null;
|
|
386
|
+
if (url == null) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
try {
|
|
390
|
+
getNativeModule().handleUrl?.(url);
|
|
391
|
+
} catch (error) {
|
|
392
|
+
console.warn('[Amply] Failed to replay a debug link parked until initialize', error);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Hand an incoming URL to Amply. Call it for every link your app is opened with — cold start
|
|
398
|
+
* and while running — before your own routing; when it returns `true` Amply recognised the
|
|
399
|
+
* link as its own and took it over, so your app should not route it.
|
|
400
|
+
*
|
|
401
|
+
* Safe to call before {@link initialize}, which is how a cold-start link arrives: an Amply debug
|
|
402
|
+
* link is held (the newest one) and opened once initialization succeeds, and `true` is returned.
|
|
403
|
+
*
|
|
404
|
+
* Synchronous. Returns `false` for any other URL, for a non-string, and when the installed
|
|
405
|
+
* native SDK predates this method; it never throws.
|
|
406
|
+
* @param url The full incoming URL
|
|
407
|
+
*/
|
|
408
|
+
export function handleUrl(url: string): boolean {
|
|
409
|
+
if (typeof url !== 'string') {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
try {
|
|
413
|
+
if (!isSdkUp()) {
|
|
414
|
+
if (!isDebugLink(url)) {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
parkedDebugUrl = url;
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
const nativeModule = getNativeModule();
|
|
421
|
+
if (typeof nativeModule.handleUrl !== 'function') {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
return nativeModule.handleUrl(url) === true;
|
|
425
|
+
} catch {
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
337
430
|
/**
|
|
338
431
|
* Set the user ID for analytics. Pass null to clear.
|
|
339
432
|
* @param userId The user ID to set, or null to clear
|
|
@@ -612,6 +705,35 @@ export async function getRecentEvents(limit: number): Promise<EventRecord[]> {
|
|
|
612
705
|
return getNativeModule().getRecentEvents(limit);
|
|
613
706
|
}
|
|
614
707
|
|
|
708
|
+
/**
|
|
709
|
+
* The campaign the user was most recently touched by — shown, or completed — at most `withinMs`
|
|
710
|
+
* ago, or `null` if there was none.
|
|
711
|
+
*
|
|
712
|
+
* Use it to attribute a purchase (or any conversion) in your own analytics to the campaign that
|
|
713
|
+
* preceded it, including one made from somewhere other than the campaign's link:
|
|
714
|
+
*
|
|
715
|
+
* ```ts
|
|
716
|
+
* const touch = await Amply.getLastCampaignTouch(30 * 60 * 1000);
|
|
717
|
+
* analytics.track('Purchase', {sku, amply_campaign_id: touch?.campaignId});
|
|
718
|
+
* ```
|
|
719
|
+
*
|
|
720
|
+
* One touch per campaign, the newer of a show and a completion. `withinMs` is inclusive and
|
|
721
|
+
* capped at 30 days by the SDK. Resolves `null` before {@link initialize}, while the SDK's storage
|
|
722
|
+
* is off, and if the native call fails — it rejects only for a `withinMs` that is not a finite
|
|
723
|
+
* number >= 0, which is a bug at the call site.
|
|
724
|
+
*/
|
|
725
|
+
export async function getLastCampaignTouch(withinMs: number): Promise<CampaignTouch | null> {
|
|
726
|
+
assertValidWithinMs(withinMs);
|
|
727
|
+
try {
|
|
728
|
+
return toCampaignTouch(await getNativeModule().getLastCampaignTouch(withinMs));
|
|
729
|
+
} catch (error) {
|
|
730
|
+
// The SDK answers null for every state it can be in; a rejection here is the bridge itself
|
|
731
|
+
// failing, and an analytics lookup must never break the purchase flow that asked.
|
|
732
|
+
console.warn('[Amply] getLastCampaignTouch failed; resolving null', error);
|
|
733
|
+
return null;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
615
737
|
export async function getDataSetSnapshot(type: DataSetType): Promise<DataSetSnapshot> {
|
|
616
738
|
return getNativeModule().getDataSetSnapshot(type);
|
|
617
739
|
}
|
|
@@ -733,6 +855,7 @@ export default {
|
|
|
733
855
|
trackGated,
|
|
734
856
|
registerGate,
|
|
735
857
|
getRecentEvents,
|
|
858
|
+
getLastCampaignTouch,
|
|
736
859
|
getDataSetSnapshot,
|
|
737
860
|
addDeepLinkListener,
|
|
738
861
|
addSystemEventListener,
|
|
@@ -740,6 +863,7 @@ export default {
|
|
|
740
863
|
removeAllListeners,
|
|
741
864
|
setUserId,
|
|
742
865
|
setAppLanguage,
|
|
866
|
+
handleUrl,
|
|
743
867
|
setLogLevel,
|
|
744
868
|
getLogLevel,
|
|
745
869
|
setCustomProperty,
|
|
@@ -69,8 +69,24 @@ export type EventRecord = {
|
|
|
69
69
|
properties: JsonMap;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* A system event from the SDK. `CampaignShown` and `CampaignResolved` carry `campaignId` and,
|
|
74
|
+
* from SDK 0.15.0, `campaignName` in `properties`.
|
|
75
|
+
*/
|
|
72
76
|
export type SystemEventPayload = EventRecord;
|
|
73
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Wire shape of a campaign touch as the native bridges send it. `kind` is `'shown'` or
|
|
80
|
+
* `'engaged'`; the public `CampaignTouch` type narrows it. Kept a plain string here so the
|
|
81
|
+
* codegen contract does not change if the SDK ever adds a kind.
|
|
82
|
+
*/
|
|
83
|
+
export type CampaignTouchPayload = {
|
|
84
|
+
campaignId: string;
|
|
85
|
+
campaignName: string;
|
|
86
|
+
kind: string;
|
|
87
|
+
atMs: number;
|
|
88
|
+
};
|
|
89
|
+
|
|
74
90
|
export type TriggeredEventCountStrategy = 'global' | 'session';
|
|
75
91
|
|
|
76
92
|
export type TriggeredEventParam = {
|
|
@@ -201,6 +217,12 @@ export interface Spec extends TurboModule {
|
|
|
201
217
|
*/
|
|
202
218
|
unregisterGate(baseUrl: string): void;
|
|
203
219
|
getRecentEvents(limit: number): Promise<EventRecord[]>;
|
|
220
|
+
/**
|
|
221
|
+
* The campaign the user was most recently touched by (shown, or completed) at most `withinMs`
|
|
222
|
+
* ago, or null. Never rejects for "not initialised" — that resolves null, as in the SDK.
|
|
223
|
+
* `withinMs` is clamped natively to [0, 30 days].
|
|
224
|
+
*/
|
|
225
|
+
getLastCampaignTouch(withinMs: number): Promise<CampaignTouchPayload | null>;
|
|
204
226
|
getDataSetSnapshot(type: DataSetType): Promise<DataSetSnapshot>;
|
|
205
227
|
registerDeepLinkListener(): void;
|
|
206
228
|
/**
|
|
@@ -214,6 +236,13 @@ export interface Spec extends TurboModule {
|
|
|
214
236
|
* @param tag The language tag, or null to clear
|
|
215
237
|
*/
|
|
216
238
|
setAppLanguage(tag: string | null): void;
|
|
239
|
+
/**
|
|
240
|
+
* Hand an incoming URL to the SDK. Returns true when the SDK recognised it as its own
|
|
241
|
+
* (a test-launch link) and took it over; false for any other URL, or when the SDK is not
|
|
242
|
+
* initialized.
|
|
243
|
+
* @param url The full incoming URL
|
|
244
|
+
*/
|
|
245
|
+
handleUrl(url: string): boolean;
|
|
217
246
|
/**
|
|
218
247
|
* Set the log level at runtime.
|
|
219
248
|
* @param level The log level to set
|
package/src/systemEventUtils.ts
CHANGED
|
@@ -27,8 +27,10 @@ export function formatSystemEventLabel(
|
|
|
27
27
|
}
|
|
28
28
|
if (event.name === 'CampaignShown') {
|
|
29
29
|
const campaignId = event.properties.campaignId as string | undefined;
|
|
30
|
+
// Sent by SDK 0.15.0 and later (on CampaignShown and CampaignResolved alike).
|
|
31
|
+
const campaignName = event.properties.campaignName as string | undefined;
|
|
30
32
|
const source = event.properties.source as string | undefined;
|
|
31
|
-
return `Campaign shown${campaignId ? ` (${campaignId})` : ''}${
|
|
33
|
+
return `Campaign shown${campaignName ? ` "${campaignName}"` : ''}${campaignId ? ` (${campaignId})` : ''}${
|
|
32
34
|
source ? ` via ${source}` : ''
|
|
33
35
|
}`;
|
|
34
36
|
}
|
package/dist/index.js
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
addDeepLinkListener: () => addDeepLinkListener,
|
|
24
|
-
addSystemEventListener: () => addSystemEventListener2,
|
|
25
|
-
addSystemEventsListener: () => addSystemEventsListener,
|
|
26
|
-
default: () => src_default,
|
|
27
|
-
formatSystemEventLabel: () => formatSystemEventLabel,
|
|
28
|
-
getDataSetSnapshot: () => getDataSetSnapshot,
|
|
29
|
-
getRecentEvents: () => getRecentEvents,
|
|
30
|
-
initialize: () => initialize,
|
|
31
|
-
isInitialized: () => isInitialized,
|
|
32
|
-
removeAllListeners: () => removeAllListeners,
|
|
33
|
-
systemEvents: () => systemEvents,
|
|
34
|
-
track: () => track,
|
|
35
|
-
useAmplySystemEvents: () => useAmplySystemEvents
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(src_exports);
|
|
38
|
-
|
|
39
|
-
// src/nativeModule.ts
|
|
40
|
-
var import_react_native = require("react-native");
|
|
41
|
-
var MODULE_NAME = "Amply";
|
|
42
|
-
var cachedModule = null;
|
|
43
|
-
var attemptedTurboLookup = false;
|
|
44
|
-
var resolvedTurboModule = null;
|
|
45
|
-
function loadModule() {
|
|
46
|
-
const globalWithTurbo = globalThis;
|
|
47
|
-
if (globalWithTurbo.__turboModuleProxy != null) {
|
|
48
|
-
if (!attemptedTurboLookup) {
|
|
49
|
-
attemptedTurboLookup = true;
|
|
50
|
-
try {
|
|
51
|
-
resolvedTurboModule = import_react_native.TurboModuleRegistry.getEnforcing(MODULE_NAME);
|
|
52
|
-
} catch (error) {
|
|
53
|
-
resolvedTurboModule = null;
|
|
54
|
-
if (__DEV__) {
|
|
55
|
-
console.warn(
|
|
56
|
-
"[Amply] TurboModule lookup failed; falling back to legacy NativeModules. " + (error instanceof Error ? error.message : String(error))
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (resolvedTurboModule) {
|
|
62
|
-
return resolvedTurboModule;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const legacyModule = import_react_native.NativeModules[MODULE_NAME];
|
|
66
|
-
if (legacyModule) {
|
|
67
|
-
return legacyModule;
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
function getNativeModule() {
|
|
72
|
-
if (cachedModule) {
|
|
73
|
-
return cachedModule;
|
|
74
|
-
}
|
|
75
|
-
const module2 = loadModule();
|
|
76
|
-
if (!module2) {
|
|
77
|
-
throw new Error(
|
|
78
|
-
`Amply native module '${MODULE_NAME}' not found. Ensure the module is properly linked and new architecture is enabled.`
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
cachedModule = module2;
|
|
82
|
-
return cachedModule;
|
|
83
|
-
}
|
|
84
|
-
var nativeModule_default = getNativeModule;
|
|
85
|
-
|
|
86
|
-
// src/systemEvents.ts
|
|
87
|
-
async function addSystemEventListener(listener) {
|
|
88
|
-
const subscription = nativeModule_default().onSystemEvent(listener);
|
|
89
|
-
return () => {
|
|
90
|
-
var _a;
|
|
91
|
-
return (_a = subscription == null ? void 0 : subscription.remove) == null ? void 0 : _a.call(subscription);
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// src/hooks/useAmplySystemEvents.ts
|
|
96
|
-
var import_react = require("react");
|
|
97
|
-
function useAmplySystemEvents(options = {}) {
|
|
98
|
-
const { maxEntries = 50, dedupe = true, onEvent } = options;
|
|
99
|
-
const [events, setEvents] = (0, import_react.useState)([]);
|
|
100
|
-
const seenKeysRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
101
|
-
const handlerRef = (0, import_react.useRef)(onEvent);
|
|
102
|
-
(0, import_react.useEffect)(() => {
|
|
103
|
-
handlerRef.current = onEvent;
|
|
104
|
-
}, [onEvent]);
|
|
105
|
-
(0, import_react.useEffect)(() => {
|
|
106
|
-
let unsubscribe;
|
|
107
|
-
let isMounted = true;
|
|
108
|
-
addSystemEventListener((event) => {
|
|
109
|
-
var _a;
|
|
110
|
-
if (!isMounted) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if (dedupe) {
|
|
114
|
-
const key = `${event.name}-${event.timestamp}`;
|
|
115
|
-
if (seenKeysRef.current.has(key)) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
seenKeysRef.current.add(key);
|
|
119
|
-
}
|
|
120
|
-
(_a = handlerRef.current) == null ? void 0 : _a.call(handlerRef, event);
|
|
121
|
-
setEvents((prev) => {
|
|
122
|
-
const next = [...prev, event];
|
|
123
|
-
if (next.length > maxEntries) {
|
|
124
|
-
next.splice(0, next.length - maxEntries);
|
|
125
|
-
}
|
|
126
|
-
return next;
|
|
127
|
-
});
|
|
128
|
-
}).then((unsub) => {
|
|
129
|
-
if (!isMounted) {
|
|
130
|
-
unsub();
|
|
131
|
-
} else {
|
|
132
|
-
unsubscribe = unsub;
|
|
133
|
-
}
|
|
134
|
-
}).catch((error) => {
|
|
135
|
-
console.warn("[Amply] system event listener error", error);
|
|
136
|
-
});
|
|
137
|
-
return () => {
|
|
138
|
-
isMounted = false;
|
|
139
|
-
unsubscribe == null ? void 0 : unsubscribe();
|
|
140
|
-
};
|
|
141
|
-
}, [dedupe, maxEntries]);
|
|
142
|
-
const reset = (0, import_react.useCallback)(() => {
|
|
143
|
-
seenKeysRef.current.clear();
|
|
144
|
-
setEvents([]);
|
|
145
|
-
}, []);
|
|
146
|
-
return { events, reset };
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// src/systemEventUtils.ts
|
|
150
|
-
var DEFAULT_LABELS = {
|
|
151
|
-
SdkInitialized: "SDK initialized",
|
|
152
|
-
ConfigFetchStarted: "Config fetch started",
|
|
153
|
-
ConfigFetchFinished: "Config fetch finished",
|
|
154
|
-
SessionStarted: "Session started",
|
|
155
|
-
SessionFinished: "Session finished",
|
|
156
|
-
CampaignShown: "Campaign shown",
|
|
157
|
-
EventTriggered: "Event triggered",
|
|
158
|
-
CampaignStarted: "Campaign processing started",
|
|
159
|
-
CampaignFinished: "Campaign finished"
|
|
160
|
-
};
|
|
161
|
-
function formatSystemEventLabel(event) {
|
|
162
|
-
var _a, _b;
|
|
163
|
-
if (event.name === "CampaignShown") {
|
|
164
|
-
const campaignId = event.properties.campaignId;
|
|
165
|
-
const source = event.properties.source;
|
|
166
|
-
return `Campaign shown${campaignId ? ` (${campaignId})` : ""}${source ? ` via ${source}` : ""}`;
|
|
167
|
-
}
|
|
168
|
-
if (event.name === "EventTriggered") {
|
|
169
|
-
const source = event.properties.sourceEvent;
|
|
170
|
-
return source ? `Event triggered (${source})` : (_a = DEFAULT_LABELS[event.name]) != null ? _a : event.name;
|
|
171
|
-
}
|
|
172
|
-
if (event.name === "ConfigFetchFinished") {
|
|
173
|
-
const success = event.properties.success;
|
|
174
|
-
const campaignCount = event.properties.campaignCount;
|
|
175
|
-
const countLabel = typeof campaignCount === "number" ? ` (${campaignCount} campaigns)` : "";
|
|
176
|
-
return success === false ? "Config fetch failed" : `Config fetch finished${countLabel}`;
|
|
177
|
-
}
|
|
178
|
-
return (_b = DEFAULT_LABELS[event.name]) != null ? _b : `System event ${event.name}`;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// src/index.ts
|
|
182
|
-
var deepLinkRegistered = false;
|
|
183
|
-
var deepLinkSubscriptions = /* @__PURE__ */ new Set();
|
|
184
|
-
async function ensureDeepLinkRegistration() {
|
|
185
|
-
if (!deepLinkRegistered) {
|
|
186
|
-
console.log("[Amply] Calling registerDeepLinkListener on native module");
|
|
187
|
-
nativeModule_default().registerDeepLinkListener();
|
|
188
|
-
deepLinkRegistered = true;
|
|
189
|
-
console.log("[Amply] registerDeepLinkListener completed");
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function trackDeepLinkSubscription(subscription) {
|
|
193
|
-
let removed = false;
|
|
194
|
-
const unsubscribe = () => {
|
|
195
|
-
var _a;
|
|
196
|
-
if (removed) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
removed = true;
|
|
200
|
-
(_a = subscription == null ? void 0 : subscription.remove) == null ? void 0 : _a.call(subscription);
|
|
201
|
-
deepLinkSubscriptions.delete(unsubscribe);
|
|
202
|
-
};
|
|
203
|
-
deepLinkSubscriptions.add(unsubscribe);
|
|
204
|
-
return unsubscribe;
|
|
205
|
-
}
|
|
206
|
-
async function initialize(config) {
|
|
207
|
-
await nativeModule_default().initialize(config);
|
|
208
|
-
}
|
|
209
|
-
function isInitialized() {
|
|
210
|
-
return nativeModule_default().isInitialized();
|
|
211
|
-
}
|
|
212
|
-
async function track(payload) {
|
|
213
|
-
await nativeModule_default().track(payload);
|
|
214
|
-
}
|
|
215
|
-
async function getRecentEvents(limit) {
|
|
216
|
-
return nativeModule_default().getRecentEvents(limit);
|
|
217
|
-
}
|
|
218
|
-
async function getDataSetSnapshot(type) {
|
|
219
|
-
return nativeModule_default().getDataSetSnapshot(type);
|
|
220
|
-
}
|
|
221
|
-
async function addDeepLinkListener(listener) {
|
|
222
|
-
await ensureDeepLinkRegistration();
|
|
223
|
-
const subscription = nativeModule_default().onDeepLink(listener);
|
|
224
|
-
return trackDeepLinkSubscription(subscription);
|
|
225
|
-
}
|
|
226
|
-
async function addSystemEventListener2(listener) {
|
|
227
|
-
return addSystemEventListener(listener);
|
|
228
|
-
}
|
|
229
|
-
function removeAllListeners() {
|
|
230
|
-
deepLinkSubscriptions.forEach((unsubscribe) => {
|
|
231
|
-
try {
|
|
232
|
-
unsubscribe();
|
|
233
|
-
} catch (error) {
|
|
234
|
-
console.warn("[Amply] Failed to remove deep link listener", error);
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
deepLinkSubscriptions.clear();
|
|
238
|
-
}
|
|
239
|
-
function addSystemEventsListener(listener) {
|
|
240
|
-
return addSystemEventListener2(listener);
|
|
241
|
-
}
|
|
242
|
-
var systemEvents = {
|
|
243
|
-
addListener: addSystemEventsListener
|
|
244
|
-
};
|
|
245
|
-
var src_default = {
|
|
246
|
-
initialize,
|
|
247
|
-
isInitialized,
|
|
248
|
-
track,
|
|
249
|
-
getRecentEvents,
|
|
250
|
-
getDataSetSnapshot,
|
|
251
|
-
addDeepLinkListener,
|
|
252
|
-
addSystemEventListener: addSystemEventListener2,
|
|
253
|
-
addSystemEventsListener,
|
|
254
|
-
removeAllListeners,
|
|
255
|
-
systemEvents
|
|
256
|
-
};
|
|
257
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
258
|
-
0 && (module.exports = {
|
|
259
|
-
addDeepLinkListener,
|
|
260
|
-
addSystemEventListener,
|
|
261
|
-
addSystemEventsListener,
|
|
262
|
-
formatSystemEventLabel,
|
|
263
|
-
getDataSetSnapshot,
|
|
264
|
-
getRecentEvents,
|
|
265
|
-
initialize,
|
|
266
|
-
isInitialized,
|
|
267
|
-
removeAllListeners,
|
|
268
|
-
systemEvents,
|
|
269
|
-
track,
|
|
270
|
-
useAmplySystemEvents
|
|
271
|
-
});
|
|
272
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/nativeModule.ts","../src/systemEvents.ts","../src/hooks/useAmplySystemEvents.ts","../src/systemEventUtils.ts"],"sourcesContent":["import getNativeModule from './nativeModule';\nimport {addSystemEventListener as addSystemEventListenerInternal} from './systemEvents';\nexport {useAmplySystemEvents} from './hooks/useAmplySystemEvents';\nexport {formatSystemEventLabel} from './systemEventUtils';\nimport type {\n AmplyInitializationConfig,\n DataSetSnapshot,\n DataSetType,\n DeepLinkEvent,\n EventRecord,\n TrackEventPayload,\n} from './nativeSpecs/NativeAmplyModule';\n\nlet deepLinkRegistered = false;\nconst deepLinkSubscriptions = new Set<() => void>();\n\nasync function ensureDeepLinkRegistration(): Promise<void> {\n if (!deepLinkRegistered) {\n console.log('[Amply] Calling registerDeepLinkListener on native module');\n getNativeModule().registerDeepLinkListener();\n deepLinkRegistered = true;\n console.log('[Amply] registerDeepLinkListener completed');\n }\n}\n\nfunction trackDeepLinkSubscription(subscription?: {remove?: () => void}): () => void {\n let removed = false;\n const unsubscribe = () => {\n if (removed) {\n return;\n }\n removed = true;\n subscription?.remove?.();\n deepLinkSubscriptions.delete(unsubscribe);\n };\n deepLinkSubscriptions.add(unsubscribe);\n return unsubscribe;\n}\n\nexport async function initialize(config: AmplyInitializationConfig): Promise<void> {\n await getNativeModule().initialize(config);\n}\n\nexport function isInitialized(): boolean {\n return getNativeModule().isInitialized();\n}\n\nexport async function track(payload: TrackEventPayload): Promise<void> {\n await getNativeModule().track(payload);\n}\n\nexport async function getRecentEvents(limit: number): Promise<EventRecord[]> {\n return getNativeModule().getRecentEvents(limit);\n}\n\nexport async function getDataSetSnapshot(type: DataSetType): Promise<DataSetSnapshot> {\n return getNativeModule().getDataSetSnapshot(type);\n}\n\nexport async function addDeepLinkListener(\n listener: (event: DeepLinkEvent) => void\n): Promise<() => void> {\n await ensureDeepLinkRegistration();\n const subscription = getNativeModule().onDeepLink(listener);\n return trackDeepLinkSubscription(subscription);\n}\n\nexport async function addSystemEventListener(\n listener: (event: EventRecord) => void\n): Promise<() => void> {\n return addSystemEventListenerInternal(listener);\n}\n\nexport function removeAllListeners(): void {\n deepLinkSubscriptions.forEach(unsubscribe => {\n try {\n unsubscribe();\n } catch (error) {\n console.warn('[Amply] Failed to remove deep link listener', error);\n }\n });\n deepLinkSubscriptions.clear();\n}\n\nexport type {\n AmplyInitializationConfig,\n DataSetSnapshot,\n DataSetType,\n DeepLinkEvent,\n EventRecord,\n TrackEventPayload,\n};\n\nexport function addSystemEventsListener(\n listener: (event: EventRecord) => void,\n): Promise<() => void> {\n return addSystemEventListener(listener);\n}\n\nexport const systemEvents = {\n addListener: addSystemEventsListener,\n};\n\nexport default {\n initialize,\n isInitialized,\n track,\n getRecentEvents,\n getDataSetSnapshot,\n addDeepLinkListener,\n addSystemEventListener,\n addSystemEventsListener,\n removeAllListeners,\n systemEvents,\n};\n","import {NativeModules, TurboModuleRegistry} from 'react-native';\nimport type {Spec} from './nativeSpecs/NativeAmplyModule';\n\nconst MODULE_NAME = 'Amply';\n\nlet cachedModule: Spec | null = null;\nlet attemptedTurboLookup = false;\nlet resolvedTurboModule: Spec | null = null;\n\nfunction loadModule(): Spec | null {\n const globalWithTurbo = globalThis as typeof globalThis & {\n __turboModuleProxy?: unknown;\n };\n\n if (globalWithTurbo.__turboModuleProxy != null) {\n if (!attemptedTurboLookup) {\n attemptedTurboLookup = true;\n try {\n resolvedTurboModule = TurboModuleRegistry.getEnforcing<Spec>(MODULE_NAME);\n } catch (error) {\n resolvedTurboModule = null;\n if (__DEV__) {\n console.warn(\n \"[Amply] TurboModule lookup failed; falling back to legacy NativeModules. \" +\n (error instanceof Error ? error.message : String(error))\n );\n }\n }\n }\n if (resolvedTurboModule) {\n return resolvedTurboModule;\n }\n }\n\n const legacyModule = NativeModules[MODULE_NAME] as Spec | undefined;\n if (legacyModule) {\n return legacyModule;\n }\n\n return null;\n}\n\nexport function getNativeModule(): Spec {\n if (cachedModule) {\n return cachedModule;\n }\n\n const module = loadModule();\n if (!module) {\n throw new Error(\n `Amply native module '${MODULE_NAME}' not found. ` +\n 'Ensure the module is properly linked and new architecture is enabled.'\n );\n }\n\n cachedModule = module;\n return cachedModule;\n}\n\n// Testing hook to override the resolved native module.\nexport function __setNativeModule(mock: Spec | null): void {\n cachedModule = mock;\n}\n\nexport default getNativeModule;\n","import getNativeModule from './nativeModule';\nimport type {SystemEventPayload} from './nativeSpecs/NativeAmplyModule';\n\nexport async function addSystemEventListener(\n listener: (event: SystemEventPayload) => void,\n): Promise<() => void> {\n const subscription = getNativeModule().onSystemEvent(listener);\n return () => subscription?.remove?.();\n}\n\nexport const systemEvents = {\n addListener: addSystemEventListener,\n};\n","import {useCallback, useEffect, useRef, useState} from 'react';\nimport type {EventRecord} from '../nativeSpecs/NativeAmplyModule';\nimport {addSystemEventListener} from '../systemEvents';\n\nexport type UseAmplySystemEventsOptions = {\n maxEntries?: number;\n dedupe?: boolean;\n onEvent?: (event: EventRecord) => void;\n};\n\nexport type UseAmplySystemEventsResult = {\n events: EventRecord[];\n reset: () => void;\n};\n\nexport function useAmplySystemEvents(\n options: UseAmplySystemEventsOptions = {},\n): UseAmplySystemEventsResult {\n const {maxEntries = 50, dedupe = true, onEvent} = options;\n const [events, setEvents] = useState<EventRecord[]>([]);\n const seenKeysRef = useRef<Set<string>>(new Set());\n const handlerRef = useRef<typeof onEvent>(onEvent);\n\n useEffect(() => {\n handlerRef.current = onEvent;\n }, [onEvent]);\n\n useEffect(() => {\n let unsubscribe: (() => void) | undefined;\n let isMounted = true;\n\n addSystemEventListener(event => {\n if (!isMounted) {\n return;\n }\n if (dedupe) {\n const key = `${event.name}-${event.timestamp}`;\n if (seenKeysRef.current.has(key)) {\n return;\n }\n seenKeysRef.current.add(key);\n }\n handlerRef.current?.(event);\n setEvents(prev => {\n const next = [...prev, event];\n if (next.length > maxEntries) {\n next.splice(0, next.length - maxEntries);\n }\n return next;\n });\n })\n .then(unsub => {\n if (!isMounted) {\n unsub();\n } else {\n unsubscribe = unsub;\n }\n })\n .catch(error => {\n console.warn('[Amply] system event listener error', error);\n });\n\n return () => {\n isMounted = false;\n unsubscribe?.();\n };\n }, [dedupe, maxEntries]);\n\n const reset = useCallback(() => {\n seenKeysRef.current.clear();\n setEvents([]);\n }, []);\n\n return {events, reset};\n}\n","import type {EventRecord} from './nativeSpecs/NativeAmplyModule';\n\nconst DEFAULT_LABELS: Record<string, string> = {\n SdkInitialized: 'SDK initialized',\n ConfigFetchStarted: 'Config fetch started',\n ConfigFetchFinished: 'Config fetch finished',\n SessionStarted: 'Session started',\n SessionFinished: 'Session finished',\n CampaignShown: 'Campaign shown',\n EventTriggered: 'Event triggered',\n CampaignStarted: 'Campaign processing started',\n CampaignFinished: 'Campaign finished',\n};\n\nexport function formatSystemEventLabel(event: EventRecord): string {\n if (event.name === 'CampaignShown') {\n const campaignId = event.properties.campaignId as string | undefined;\n const source = event.properties.source as string | undefined;\n return `Campaign shown${campaignId ? ` (${campaignId})` : ''}${\n source ? ` via ${source}` : ''\n }`;\n }\n if (event.name === 'EventTriggered') {\n const source = event.properties.sourceEvent as string | undefined;\n return source ? `Event triggered (${source})` : DEFAULT_LABELS[event.name] ?? event.name;\n }\n if (event.name === 'ConfigFetchFinished') {\n const success = event.properties.success as boolean | undefined;\n const campaignCount = event.properties.campaignCount as number | undefined;\n const countLabel =\n typeof campaignCount === 'number' ? ` (${campaignCount} campaigns)` : '';\n return success === false ? 'Config fetch failed' : `Config fetch finished${countLabel}`;\n }\n return DEFAULT_LABELS[event.name] ?? `System event ${event.name}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,gCAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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