@amplytools/react-native-amply-sdk 0.15.0 → 0.15.2
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/android/build.gradle +1 -1
- 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/docs/ARCHITECTURE.md +26 -19
- package/package.json +12 -6
- package/scripts/check-package.js +159 -0
- 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 -2
- 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__/handleUrl.test.d.ts +0 -2
- package/dist/src/__tests__/handleUrl.test.d.ts.map +0 -1
- package/dist/src/__tests__/handleUrl.test.js +0 -114
- 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__/lastCampaignTouch.test.d.ts +0 -2
- package/dist/src/__tests__/lastCampaignTouch.test.d.ts.map +0 -1
- package/dist/src/__tests__/lastCampaignTouch.test.js +0 -119
- 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 -72
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/plugin/tsconfig.tsbuildinfo +0 -1
- package/src/__tests__/appLanguage.test.ts +0 -298
- package/src/__tests__/campaignResolved.test.ts +0 -294
- package/src/__tests__/gateRegistrationLifecycle.test.ts +0 -281
- package/src/__tests__/handleUrl.test.ts +0 -155
- package/src/__tests__/index.test.ts +0 -258
- package/src/__tests__/lastCampaignTouch.test.ts +0 -151
- package/src/__tests__/systemEventUtils.test.ts +0 -97
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AA+NA,gCAuCC;AAwED,wCAOC;AAkED,8BAoBC;AAMD,8BAEC;AAMD,kCAKC;AAMD,kCAEC;AAED,sCAEC;AAUD,sBAEC;AAgED,gCAKC;AAcD,gCAsBC;AAoCD,oCA0FC;AAED,0CAEC;AAmBD,oDAUC;AAED,gDAEC;AAED,kDAMC;AAED,wDAIC;AAYD,8CAEC;AAMD,kDAEC;AAOD,8CAIC;AAMD,oDAEC;AAKD,sDAEC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C,CAAC;QACjE,CAAC;IACH,CAAC,CAAC,CAAC;IACH,8BAA8B,CAAC,KAAK,EAAE,CAAC;IAEvC,yFAAyF;IACzF,wFAAwF;IACxF,4FAA4F;IAC5F,mEAAmE;IACnE,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3D,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;AAClC,CAAC;AAYD,SAAgB,uBAAuB,CACrC,QAAsC;IAEtC,OAAO,sBAAsB,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAEY,QAAA,YAAY,GAAG;IAC1B,WAAW,EAAE,uBAAuB;CACrC,CAAC;AAEF,kBAAe;IACb,UAAU;IACV,aAAa;IACb,KAAK;IACL,UAAU;IACV,UAAU;IACV,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,kBAAkB;IAClB,mBAAmB;IACnB,sBAAsB;IACtB,uBAAuB;IACvB,kBAAkB;IAClB,SAAS;IACT,cAAc;IACd,SAAS;IACT,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,YAAY,EAAZ,oBAAY;CACb,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNativeModule = getNativeModule;
|
|
4
|
+
exports.__setNativeModule = __setNativeModule;
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const MODULE_NAME = 'Amply';
|
|
7
|
+
let cachedModule = null;
|
|
8
|
+
let attemptedTurboLookup = false;
|
|
9
|
+
let resolvedTurboModule = null;
|
|
10
|
+
function loadModule() {
|
|
11
|
+
const globalWithTurbo = globalThis;
|
|
12
|
+
if (globalWithTurbo.__turboModuleProxy != null) {
|
|
13
|
+
if (!attemptedTurboLookup) {
|
|
14
|
+
attemptedTurboLookup = true;
|
|
15
|
+
try {
|
|
16
|
+
resolvedTurboModule = react_native_1.TurboModuleRegistry.getEnforcing(MODULE_NAME);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
resolvedTurboModule = null;
|
|
20
|
+
if (__DEV__) {
|
|
21
|
+
console.warn("[Amply] TurboModule lookup failed; falling back to legacy NativeModules. " +
|
|
22
|
+
(error instanceof Error ? error.message : String(error)));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (resolvedTurboModule) {
|
|
27
|
+
return resolvedTurboModule;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const legacyModule = react_native_1.NativeModules[MODULE_NAME];
|
|
31
|
+
if (legacyModule) {
|
|
32
|
+
return legacyModule;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function getNativeModule() {
|
|
37
|
+
if (cachedModule) {
|
|
38
|
+
return cachedModule;
|
|
39
|
+
}
|
|
40
|
+
const module = loadModule();
|
|
41
|
+
if (!module) {
|
|
42
|
+
throw new Error(`Amply native module '${MODULE_NAME}' not found. ` +
|
|
43
|
+
'Ensure @amplytools/react-native-amply-sdk is installed, native dependencies are rebuilt, ' +
|
|
44
|
+
'and the package is registered by React Native autolinking ' +
|
|
45
|
+
'(Android: present in generated PackageList.java; iOS: pod installed and Pods rebuilt).');
|
|
46
|
+
}
|
|
47
|
+
cachedModule = module;
|
|
48
|
+
return cachedModule;
|
|
49
|
+
}
|
|
50
|
+
// Testing hook to override the resolved native module.
|
|
51
|
+
function __setNativeModule(mock) {
|
|
52
|
+
cachedModule = mock;
|
|
53
|
+
}
|
|
54
|
+
exports.default = getNativeModule;
|
|
55
|
+
//# sourceMappingURL=nativeModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeModule.js","sourceRoot":"","sources":["../../src/nativeModule.ts"],"names":[],"mappings":";;AA0CA,0CAiB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C3F,4DAA4D;YAC5D,wFAAwF,CAC3F,CAAC;IACJ,CAAC;IAED,YAAY,GAAG,MAAM,CAAC;IACtB,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,uDAAuD;AACvD,SAAgB,iBAAiB,CAAC,IAAiB;IACjD,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC;AAED,kBAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeAmplyModule.js","sourceRoot":"","sources":["../../../src/nativeSpecs/NativeAmplyModule.ts"],"names":[],"mappings":";;AACA,+CAAiD;AAyRjD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatSystemEventLabel = formatSystemEventLabel;
|
|
4
|
+
const DEFAULT_LABELS = {
|
|
5
|
+
SdkInitialized: 'SDK initialized',
|
|
6
|
+
ConfigFetchStarted: 'Config fetch started',
|
|
7
|
+
ConfigFetchFinished: 'Config fetch finished',
|
|
8
|
+
SessionStarted: 'Session started',
|
|
9
|
+
SessionFinished: 'Session finished',
|
|
10
|
+
CampaignShown: 'Campaign shown',
|
|
11
|
+
EventTriggered: 'Event triggered',
|
|
12
|
+
};
|
|
13
|
+
function formatSystemEventLabel(event, options = {}) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const { verbose = false } = options;
|
|
16
|
+
if (event.name === 'SessionStarted') {
|
|
17
|
+
const type = event.properties.type;
|
|
18
|
+
return type ? `Session started (${type})` : 'Session started';
|
|
19
|
+
}
|
|
20
|
+
if (event.name === 'CampaignShown') {
|
|
21
|
+
const campaignId = event.properties.campaignId;
|
|
22
|
+
// Sent by SDK 0.15.0 and later (on CampaignShown and CampaignResolved alike).
|
|
23
|
+
const campaignName = event.properties.campaignName;
|
|
24
|
+
const source = event.properties.source;
|
|
25
|
+
return `Campaign shown${campaignName ? ` "${campaignName}"` : ''}${campaignId ? ` (${campaignId})` : ''}${source ? ` via ${source}` : ''}`;
|
|
26
|
+
}
|
|
27
|
+
if (event.name === 'EventTriggered') {
|
|
28
|
+
const source = event.properties.sourceEvent;
|
|
29
|
+
return source ? `Event triggered (${source})` : (_a = DEFAULT_LABELS[event.name]) !== null && _a !== void 0 ? _a : event.name;
|
|
30
|
+
}
|
|
31
|
+
if (event.name === 'ConfigFetchFinished') {
|
|
32
|
+
const success = event.properties.success;
|
|
33
|
+
const campaignCount = event.properties.campaignCount;
|
|
34
|
+
const campaigns = event.properties.campaigns;
|
|
35
|
+
if (success === false) {
|
|
36
|
+
return 'Config fetch failed';
|
|
37
|
+
}
|
|
38
|
+
const countLabel = typeof campaignCount === 'number' ? `${campaignCount}` : '0';
|
|
39
|
+
if (verbose && campaigns && campaigns.length > 0) {
|
|
40
|
+
const campaignLines = campaigns.map(c => `- [${c.id}] ${c.name}`).join('\n');
|
|
41
|
+
return `Config fetch finished\nCampaigns: ${countLabel}\n${campaignLines}`;
|
|
42
|
+
}
|
|
43
|
+
return `Config fetch finished (${countLabel} campaigns)`;
|
|
44
|
+
}
|
|
45
|
+
return (_b = DEFAULT_LABELS[event.name]) !== null && _b !== void 0 ? _b : `System event ${event.name}`;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=systemEventUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemEventUtils.js","sourceRoot":"","sources":["../../src/systemEventUtils.ts"],"names":[],"mappings":";;AAiBA,wDA0CC;AAzDD,MAAM,cAAc,GAA2B;IAC7C,cAAc,EAAE,iBAAiB;IACjC,kBAAkB,EAAE,sBAAsB;IAC1C,mBAAmB,EAAE,uBAAuB;IAC5C,cAAc,EAAE,iBAAiB;IACjC,eAAe,EAAE,kBAAkB;IACnC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;CAClC,CAAC;AAOF,SAAgB,sBAA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M,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,aAAmC,CAAC;QAC3E,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,SAA0D,CAAC;QAE9F,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO,qBAAqB,CAAC;QAC/B,CAAC;QAED,MAAM,UAAU,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAEhF,IAAI,OAAO,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjD,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7E,OAAO,qCAAqC,UAAU,KAAK,aAAa,EAAE,CAAC;QAC7E,CAAC;QAED,OAAO,0BAA0B,UAAU,aAAa,CAAC;IAC3D,CAAC;IACD,OAAO,MAAA,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,gBAAgB,KAAK,CAAC,IAAI,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.systemEvents = void 0;
|
|
7
|
+
exports.addSystemEventListenerRaw = addSystemEventListenerRaw;
|
|
8
|
+
exports.addSystemEventListener = addSystemEventListener;
|
|
9
|
+
const nativeModule_1 = __importDefault(require("./nativeModule"));
|
|
10
|
+
/** Raw listener – receives ALL events including DebugLog. Internal use only. */
|
|
11
|
+
async function addSystemEventListenerRaw(listener) {
|
|
12
|
+
const subscription = (0, nativeModule_1.default)().onSystemEvent(listener);
|
|
13
|
+
return () => { var _a; return (_a = subscription === null || subscription === void 0 ? void 0 : subscription.remove) === null || _a === void 0 ? void 0 : _a.call(subscription); };
|
|
14
|
+
}
|
|
15
|
+
/** Public listener – filters out DebugLog events (handled by console output). */
|
|
16
|
+
async function addSystemEventListener(listener) {
|
|
17
|
+
return addSystemEventListenerRaw(event => {
|
|
18
|
+
if (event.name === 'DebugLog') {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
listener(event);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.systemEvents = {
|
|
25
|
+
addListener: addSystemEventListener,
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=systemEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemEvents.js","sourceRoot":"","sources":["../../src/systemEvents.ts"],"names":[],"mappings":";;;;;;AAIA,8DAKC;AAGD,wDASC;AArBD,kEAA6C;AAG7C,gFAAgF;AACzE,KAAK,UAAU,yBAAyB,CAC7C,QAA6C;IAE7C,MAAM,YAAY,GAAG,IAAA,sBAAe,GAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/D,OAAO,GAAG,EAAE,WAAC,OAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,4DAAI,CAAA,EAAA,CAAC;AACxC,CAAC;AAED,iFAAiF;AAC1E,KAAK,UAAU,sBAAsB,CAC1C,QAA6C;IAE7C,OAAO,yBAAyB,CAAC,KAAK,CAAC,EAAE;QACvC,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC9B,OAAO;QACT,CAAC;QACD,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,YAAY,GAAG;IAC1B,WAAW,EAAE,sBAAsB;CACpC,CAAC"}
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -598,20 +598,29 @@ yarn codegen
|
|
|
598
598
|
#### **2. JavaScript Bundling (TypeScript → JS)**
|
|
599
599
|
|
|
600
600
|
```bash
|
|
601
|
-
yarn build
|
|
602
|
-
#
|
|
601
|
+
yarn build:package
|
|
602
|
+
# rm -rf dist plugin/build, then expo-module build (tsc), expo-module build plugin,
|
|
603
|
+
# tsc -p tsconfig.cjs.json, then scripts/check-package.js
|
|
603
604
|
```
|
|
604
605
|
|
|
605
606
|
**What it does:**
|
|
606
|
-
-
|
|
607
|
-
-
|
|
608
|
-
-
|
|
609
|
-
-
|
|
607
|
+
- `expo-module build` runs `tsc` with `tsconfig.json`: ES modules plus `.d.ts` into `dist/src/` (and `dist/plugin/`)
|
|
608
|
+
- `expo-module build plugin` compiles the Expo plugin into `plugin/build/` (what `app.plugin.js` requires)
|
|
609
|
+
- `tsc -p tsconfig.cjs.json` writes a CommonJS copy of `src/` into `dist/cjs/`
|
|
610
|
+
- `scripts/check-package.js` checks the tarball `npm pack` would produce (below)
|
|
610
611
|
|
|
611
612
|
**Outputs:**
|
|
612
|
-
- `dist/index.js` – CommonJS
|
|
613
|
-
- `dist/index.
|
|
614
|
-
- `
|
|
613
|
+
- `dist/cjs/index.js` – `main`, CommonJS (Jest and anything else that `require`s the package)
|
|
614
|
+
- `dist/src/index.js` – `module`, ES modules (bundlers)
|
|
615
|
+
- `src/index.ts` – `react-native`; Metro compiles the source itself
|
|
616
|
+
- `dist/src/**/*.d.ts` – TypeScript declarations (`types`)
|
|
617
|
+
|
|
618
|
+
**The package check.** Until 0.15.0 `main` pointed at `dist/index.js`, a bundle from an early tsup build
|
|
619
|
+
that no later build rewrote or removed, so every release shipped the API of late 2025. Metro never
|
|
620
|
+
noticed (it reads `react-native`). `check-package.js` fails when an entry in package.json is not in the
|
|
621
|
+
tarball, when `main` does not export exactly what `src/index.ts` exports, or when a compiled file in the
|
|
622
|
+
tarball has no source file. `yarn test` runs it, and release.sh runs it before the release commit and
|
|
623
|
+
again right before `npm publish`.
|
|
615
624
|
|
|
616
625
|
**When to run:**
|
|
617
626
|
- After changing any TypeScript/JavaScript code
|
|
@@ -704,25 +713,23 @@ When you link the SDK to example apps, these are called automatically:
|
|
|
704
713
|
### Script Dependency Chain
|
|
705
714
|
|
|
706
715
|
```
|
|
707
|
-
developer runs yarn build
|
|
716
|
+
developer runs yarn build:package
|
|
717
|
+
↓
|
|
718
|
+
rm -rf dist plugin/build (no leftovers from an older build can ship)
|
|
708
719
|
↓
|
|
709
|
-
expo-module build (
|
|
720
|
+
expo-module build → tsc → dist/src/** (ESM + .d.ts), dist/plugin/**
|
|
710
721
|
↓
|
|
711
|
-
|
|
712
|
-
├─→ tsc (compile TS)
|
|
713
|
-
├─→ writes dist/index.js (CommonJS)
|
|
714
|
-
└─→ writes dist/index.mjs (ES Module)
|
|
722
|
+
expo-module build plugin → plugin/build/**
|
|
715
723
|
↓
|
|
716
|
-
tsc
|
|
717
|
-
└─→ writes dist/src/**/*.d.ts (type declarations)
|
|
724
|
+
tsc -p tsconfig.cjs.json → dist/cjs/** (CommonJS, main)
|
|
718
725
|
↓
|
|
719
|
-
|
|
726
|
+
scripts/check-package.js (entries ship, main == src/index.ts exports, no orphans)
|
|
720
727
|
```
|
|
721
728
|
|
|
722
729
|
### Why So Many Compile Steps?
|
|
723
730
|
|
|
724
731
|
1. **Codegen** – Generates native stubs (Java, C++, ObjC++)
|
|
725
|
-
2. **JS
|
|
732
|
+
2. **JS compile** – Converts TS to JS for Node/Jest (CommonJS) and bundlers (ESM)
|
|
726
733
|
3. **Type generation** – Creates `.d.ts` for consumers
|
|
727
734
|
4. **Plugin build** – Separate build for Expo plugin code
|
|
728
735
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplytools/react-native-amply-sdk",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "React Native SDK for Amply: Mobile SDK to orchestrate in-app experiences and campaigns remotely, without app releases",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/amply-tools/amply-react-native/issues"
|
|
13
13
|
},
|
|
14
|
-
"main": "dist/index.js",
|
|
15
|
-
"module": "dist/index.
|
|
14
|
+
"main": "dist/cjs/index.js",
|
|
15
|
+
"module": "dist/src/index.js",
|
|
16
16
|
"types": "dist/src/index.d.ts",
|
|
17
17
|
"react-native": "src/index.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
@@ -27,19 +27,25 @@
|
|
|
27
27
|
"react-native.config.js",
|
|
28
28
|
"app.plugin.js",
|
|
29
29
|
"README.md",
|
|
30
|
-
"docs/"
|
|
30
|
+
"docs/",
|
|
31
|
+
"!dist/**/__tests__",
|
|
32
|
+
"!src/**/__tests__",
|
|
33
|
+
"!**/*.tsbuildinfo"
|
|
31
34
|
],
|
|
32
35
|
"scripts": {
|
|
33
36
|
"build": "expo-module build",
|
|
34
37
|
"build:plugin": "expo-module build plugin",
|
|
38
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
39
|
+
"build:package": "rm -rf dist plugin/build && EXPO_NONINTERACTIVE=1 expo-module build && EXPO_NONINTERACTIVE=1 expo-module build plugin && tsc -p tsconfig.cjs.json && node scripts/check-package.js",
|
|
35
40
|
"clean": "expo-module clean",
|
|
36
|
-
"test": "node scripts/codegen.js --check && expo-module test && yarn check:seam-tokens && yarn check:sample-parity",
|
|
41
|
+
"test": "node scripts/codegen.js --check && expo-module test && yarn check:seam-tokens && yarn check:sample-parity && yarn build:package",
|
|
37
42
|
"prepare": "expo-module prepare",
|
|
38
43
|
"prepublishOnly": "expo-module prepublishOnly",
|
|
39
44
|
"codegen": "node scripts/codegen.js",
|
|
40
45
|
"codegen:check": "node scripts/codegen.js --check",
|
|
41
46
|
"check:seam-tokens": "bash scripts/check-seam-tokens.sh",
|
|
42
|
-
"check:sample-parity": "bash scripts/check-sample-parity.sh"
|
|
47
|
+
"check:sample-parity": "bash scripts/check-sample-parity.sh",
|
|
48
|
+
"check:package": "node scripts/check-package.js"
|
|
43
49
|
},
|
|
44
50
|
"peerDependencies": {
|
|
45
51
|
"expo": ">=54.0.0",
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Checks the tarball `npm publish` would ship, after a build: every entry point in package.json is
|
|
4
|
+
* in it, and every compiled file in it comes from a source file in this repo.
|
|
5
|
+
*
|
|
6
|
+
* Why: until 0.15.0 `main` pointed at `dist/index.js`, a bundle an early tsup build had
|
|
7
|
+
* left in the working tree. `expo-module build` writes to `dist/src/`, so nothing ever rebuilt or
|
|
8
|
+
* removed that file, and every release shipped it — `main` served the API of late 2025 (no
|
|
9
|
+
* `handleUrl`, no `getLastCampaignTouch`). Metro reads `react-native` and never noticed; Jest and
|
|
10
|
+
* anything else that resolves `main` did. A leftover like that has no source file behind it, which
|
|
11
|
+
* is what the second check looks for.
|
|
12
|
+
*
|
|
13
|
+
* `yarn build:package` runs it after a clean build; `yarn test` and release.sh (before anything is
|
|
14
|
+
* pushed, and again right before `npm publish`) run that.
|
|
15
|
+
* Exits non-zero and names each problem.
|
|
16
|
+
*/
|
|
17
|
+
const {execFileSync} = require('child_process');
|
|
18
|
+
const fs = require('fs');
|
|
19
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
const root = path.resolve(__dirname, '..');
|
|
22
|
+
process.chdir(root);
|
|
23
|
+
|
|
24
|
+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
25
|
+
|
|
26
|
+
// The tsc builds and where their sources live: `dist/cjs/` mirrors `src/` (tsconfig.cjs.json),
|
|
27
|
+
// the rest of `dist/` mirrors the repo root (rootDir "."), `plugin/build/` mirrors `plugin/src/`.
|
|
28
|
+
// First match wins, so the narrower `dist/cjs/` comes before `dist/`.
|
|
29
|
+
const OUTPUTS = [
|
|
30
|
+
{outDir: 'dist/cjs/', sourceDir: 'src/'},
|
|
31
|
+
{outDir: 'dist/', sourceDir: ''},
|
|
32
|
+
{outDir: 'plugin/build/', sourceDir: 'plugin/src/'},
|
|
33
|
+
];
|
|
34
|
+
const COMPILED = /(\.d\.ts\.map|\.d\.ts|\.js\.map|\.mjs\.map|\.js|\.mjs)$/;
|
|
35
|
+
const SOURCE_EXTENSIONS = ['.ts', '.tsx'];
|
|
36
|
+
|
|
37
|
+
const packed = JSON.parse(packList())[0].files.map((file) => file.path);
|
|
38
|
+
const shipped = new Set(packed);
|
|
39
|
+
|
|
40
|
+
const problems = [];
|
|
41
|
+
|
|
42
|
+
const entries = {
|
|
43
|
+
main: pkg.main,
|
|
44
|
+
types: pkg.types,
|
|
45
|
+
'react-native': pkg['react-native'],
|
|
46
|
+
source: pkg.source,
|
|
47
|
+
module: pkg.module,
|
|
48
|
+
'expo.plugin': pkg.expo?.plugin?.replace(/^\.\//, ''),
|
|
49
|
+
};
|
|
50
|
+
for (const [field, entry] of Object.entries(entries)) {
|
|
51
|
+
if (entry !== undefined && !shipped.has(entry)) {
|
|
52
|
+
problems.push(`package.json "${field}" points at ${entry}, which is not in the tarball`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// app.plugin.js is a one-line require of the compiled plugin; that target has to ship too.
|
|
57
|
+
const pluginTarget = /require\('\.\/([^']+)'\)/.exec(fs.readFileSync('app.plugin.js', 'utf8'))?.[1];
|
|
58
|
+
if (pluginTarget && !shipped.has(`${pluginTarget}/index.js`) && !shipped.has(`${pluginTarget}.js`)) {
|
|
59
|
+
problems.push(`app.plugin.js requires ./${pluginTarget}, which is not in the tarball`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// `main` must serve the API of this tree's src/index.ts, name for name. It is loaded the way Jest
|
|
63
|
+
// loads it (plain require), with the peers stubbed: nothing in the SDK touches native at import.
|
|
64
|
+
const sourceExports = exportedNames('src/index.ts');
|
|
65
|
+
const mainExports = requiredNames(pkg.main);
|
|
66
|
+
const missing = sourceExports.filter((name) => !mainExports.includes(name));
|
|
67
|
+
const extra = mainExports.filter((name) => !sourceExports.includes(name));
|
|
68
|
+
if (missing.length > 0 || extra.length > 0) {
|
|
69
|
+
problems.push(
|
|
70
|
+
`"main" (${pkg.main}) does not serve src/index.ts — missing: [${missing.join(', ')}], extra: [${extra.join(', ')}]`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
for (const file of packed) {
|
|
75
|
+
const output = OUTPUTS.find(({outDir}) => file.startsWith(outDir));
|
|
76
|
+
if (!output || !COMPILED.test(file)) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const stem = output.sourceDir + file.slice(output.outDir.length).replace(COMPILED, '');
|
|
80
|
+
if (!SOURCE_EXTENSIONS.some((extension) => fs.existsSync(stem + extension))) {
|
|
81
|
+
problems.push(`${file} has no source (${stem}.ts) — a leftover from an older build`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* `npm pack --dry-run --json`. The bare example's assembleDebug writes android/.cxx into the
|
|
87
|
+
* package root, and with it present npm 11 dies with "Exit handler never called!" (measured
|
|
88
|
+
* 2026-10-17: rc 1 with android/.cxx, rc 0 without it). That failure is npm's, not the package's —
|
|
89
|
+
* say so and name the way out instead of dying on a stack trace.
|
|
90
|
+
*/
|
|
91
|
+
function packList() {
|
|
92
|
+
try {
|
|
93
|
+
return execFileSync('npm', ['pack', '--dry-run', '--json', '--ignore-scripts'], {
|
|
94
|
+
encoding: 'utf8',
|
|
95
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
96
|
+
});
|
|
97
|
+
} catch (error) {
|
|
98
|
+
const npmErrors = String(error.stderr ?? '')
|
|
99
|
+
.split('\n')
|
|
100
|
+
.filter((line) => line.startsWith('npm error'))
|
|
101
|
+
.slice(0, 3);
|
|
102
|
+
console.error(`FAIL: npm pack --dry-run failed:\n ${npmErrors.join('\n ')}`);
|
|
103
|
+
console.error('check-package: a native build in the package root is the usual cause — rm -rf android/build android/.cxx ios/build');
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The value exports of a TypeScript module, as the compiler sees them (types are not runtime). */
|
|
109
|
+
function exportedNames(file) {
|
|
110
|
+
const ts = require('typescript');
|
|
111
|
+
const program = ts.createProgram([file], {allowJs: false, jsx: ts.JsxEmit.ReactNative, skipLibCheck: true});
|
|
112
|
+
const checker = program.getTypeChecker();
|
|
113
|
+
const moduleSymbol = checker.getSymbolAtLocation(program.getSourceFile(file));
|
|
114
|
+
return checker
|
|
115
|
+
.getExportsOfModule(moduleSymbol)
|
|
116
|
+
.filter((symbol) => {
|
|
117
|
+
const target = symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
|
118
|
+
return (target.flags & ts.SymbolFlags.Value) !== 0;
|
|
119
|
+
})
|
|
120
|
+
.map((symbol) => symbol.getName())
|
|
121
|
+
.sort();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The export names of a CommonJS file when required with react / react-native stubbed out. */
|
|
125
|
+
function requiredNames(file) {
|
|
126
|
+
const Module = require('module');
|
|
127
|
+
const load = Module._load;
|
|
128
|
+
const stubs = {
|
|
129
|
+
react: {useEffect() {}, useRef: () => ({}), useState: () => [], useCallback: (callback) => callback},
|
|
130
|
+
'react-native': {
|
|
131
|
+
NativeModules: {},
|
|
132
|
+
TurboModuleRegistry: {},
|
|
133
|
+
Platform: {OS: 'ios'},
|
|
134
|
+
NativeEventEmitter: class {},
|
|
135
|
+
Linking: {},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
Module._load = function loadWithStubs(request, ...rest) {
|
|
139
|
+
return request in stubs ? stubs[request] : load.call(this, request, ...rest);
|
|
140
|
+
};
|
|
141
|
+
globalThis.__DEV__ = false;
|
|
142
|
+
try {
|
|
143
|
+
return Object.keys(require(path.resolve(file))).sort();
|
|
144
|
+
} catch (error) {
|
|
145
|
+
problems.push(`"main" (${file}) cannot be required: ${error.message.split('\n')[0]}`);
|
|
146
|
+
return [];
|
|
147
|
+
} finally {
|
|
148
|
+
Module._load = load;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (problems.length > 0) {
|
|
153
|
+
for (const problem of problems) {
|
|
154
|
+
console.error(`FAIL: ${problem}`);
|
|
155
|
+
}
|
|
156
|
+
console.error('check-package: rebuild from a clean tree (rm -rf dist plugin/build) or fix the entry.');
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
console.log(`check-package: OK — ${packed.length} files, every entry ships, every compiled file has a source.`);
|