@namiml/sdk-core 3.4.0-dev.202605180118 → 3.4.0-dev.202605182046
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/dist/index.cjs +34 -6
- package/dist/index.d.ts +14 -4
- package/dist/index.mjs +34 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -98,7 +98,7 @@ const {
|
|
|
98
98
|
// version — stamped by scripts/version.sh
|
|
99
99
|
NAMI_SDK_VERSION: exports.NAMI_SDK_VERSION = "3.4.0",
|
|
100
100
|
// full package version including dev suffix — stamped by scripts/version.sh
|
|
101
|
-
NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.4.0-dev.
|
|
101
|
+
NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.4.0-dev.202605182046",
|
|
102
102
|
// environments
|
|
103
103
|
PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
|
|
104
104
|
// error messages
|
|
@@ -7404,19 +7404,34 @@ const mapAnonymousCampaigns = (campaigns, splitPosition, formFactor) => {
|
|
|
7404
7404
|
});
|
|
7405
7405
|
};
|
|
7406
7406
|
/**
|
|
7407
|
+
* Returns the combined list of API + initial-config campaigns for the current device's
|
|
7408
|
+
* form factor, deduplicated by (type, value) with API entries winning on collision.
|
|
7407
7409
|
*
|
|
7408
|
-
*
|
|
7409
|
-
*
|
|
7410
|
+
* Mirrors NamiCampaignManager.allCampaigns() on Apple (Set keyed on hash(value, type))
|
|
7411
|
+
* and Android (.distinct() with server-first ordering). Keying on (type, value) — rather
|
|
7412
|
+
* than rule UUID — ensures the same logical placement does not surface twice when the
|
|
7413
|
+
* server has republished a campaign under a new rule id.
|
|
7410
7414
|
*
|
|
7411
|
-
* Note:
|
|
7412
|
-
*
|
|
7415
|
+
* Note: this list reflects which placements are available, not whether they are launchable.
|
|
7416
|
+
* An API entry surfaced here may reference a paywall that has not yet been published in the
|
|
7417
|
+
* API response. NamiCampaignManager.launch() handles that case independently via
|
|
7418
|
+
* getPaywallDataFromLabel(), which falls back to the initial-config (campaign, paywall) pair
|
|
7419
|
+
* when the API pair is incomplete — matching the merged-paywall-lookup behavior on
|
|
7420
|
+
* Apple and Android.
|
|
7413
7421
|
*/
|
|
7414
7422
|
const allCampaigns = () => {
|
|
7415
7423
|
const apiCampaigns = storageService.getCampaignRules(exports.API_CAMPAIGN_RULES) ?? [];
|
|
7416
7424
|
const initialCampaigns = storageService.getCampaignRules(exports.INITIAL_CAMPAIGN_RULES) ?? [];
|
|
7417
7425
|
const formFactor = getDeviceFormFactor();
|
|
7418
7426
|
const campaigns = compact([...apiCampaigns, ...initialCampaigns]).filter((cRule) => cRule.form_factors?.some((f) => f.form_factor === formFactor));
|
|
7419
|
-
|
|
7427
|
+
const seen = new Set();
|
|
7428
|
+
return campaigns.filter((c) => {
|
|
7429
|
+
const key = `${c.type ?? ''}::${c.value ?? ''}`;
|
|
7430
|
+
if (seen.has(key))
|
|
7431
|
+
return false;
|
|
7432
|
+
seen.add(key);
|
|
7433
|
+
return true;
|
|
7434
|
+
});
|
|
7420
7435
|
};
|
|
7421
7436
|
/**
|
|
7422
7437
|
* Get campaigns by rule key, filtered by form factor.
|
|
@@ -13670,6 +13685,19 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
13670
13685
|
this.forward(nextStep.id);
|
|
13671
13686
|
}
|
|
13672
13687
|
}
|
|
13688
|
+
handleRemoteBack() {
|
|
13689
|
+
const step = this.currentFlowStep;
|
|
13690
|
+
if (step?.actions[NamiReservedActions.REMOTE_BACK]) {
|
|
13691
|
+
this.triggerActions(NamiReservedActions.REMOTE_BACK);
|
|
13692
|
+
return 'handler';
|
|
13693
|
+
}
|
|
13694
|
+
if (this.previousStepAvailable) {
|
|
13695
|
+
this.back();
|
|
13696
|
+
return 'back';
|
|
13697
|
+
}
|
|
13698
|
+
this.finished();
|
|
13699
|
+
return 'dismissed';
|
|
13700
|
+
}
|
|
13673
13701
|
backToPreviousScreenStep() {
|
|
13674
13702
|
if (this.previousFlowStep?.allow_back_to === false) {
|
|
13675
13703
|
logger.warn(`Not allowed to go back to ${this.previousFlowStep.id}`);
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,7 @@ declare const NamiFlowStepType: {
|
|
|
113
113
|
readonly UNKNOWN: "unknown";
|
|
114
114
|
};
|
|
115
115
|
type NamiFlowStepType = (typeof NamiFlowStepType)[keyof typeof NamiFlowStepType];
|
|
116
|
+
type RemoteBackOutcome = 'handler' | 'back' | 'dismissed';
|
|
116
117
|
declare enum NamiFlowActionFunction {
|
|
117
118
|
NAVIGATE = "flowNav",
|
|
118
119
|
BACK = "flowPrev",
|
|
@@ -1429,6 +1430,7 @@ declare class NamiFlow extends BasicNamiFlow {
|
|
|
1429
1430
|
finished(): void;
|
|
1430
1431
|
back(): void;
|
|
1431
1432
|
next(): void;
|
|
1433
|
+
handleRemoteBack(): RemoteBackOutcome;
|
|
1432
1434
|
private backToPreviousScreenStep;
|
|
1433
1435
|
forward(stepId: string): void;
|
|
1434
1436
|
pause(): void;
|
|
@@ -2751,12 +2753,20 @@ declare const bestUrlCampaignMatch: (incomingUrl: string, campaigns: NamiCampaig
|
|
|
2751
2753
|
declare const selectSegment: (segments: NamiCampaignSegment[], splitPosition: number) => NamiCampaignSegment;
|
|
2752
2754
|
declare const mapAnonymousCampaigns: (campaigns: NamiAnonymousCampaign[], splitPosition: number, formFactor?: TDevice) => NamiCampaign[];
|
|
2753
2755
|
/**
|
|
2756
|
+
* Returns the combined list of API + initial-config campaigns for the current device's
|
|
2757
|
+
* form factor, deduplicated by (type, value) with API entries winning on collision.
|
|
2754
2758
|
*
|
|
2755
|
-
*
|
|
2756
|
-
*
|
|
2759
|
+
* Mirrors NamiCampaignManager.allCampaigns() on Apple (Set keyed on hash(value, type))
|
|
2760
|
+
* and Android (.distinct() with server-first ordering). Keying on (type, value) — rather
|
|
2761
|
+
* than rule UUID — ensures the same logical placement does not surface twice when the
|
|
2762
|
+
* server has republished a campaign under a new rule id.
|
|
2757
2763
|
*
|
|
2758
|
-
* Note:
|
|
2759
|
-
*
|
|
2764
|
+
* Note: this list reflects which placements are available, not whether they are launchable.
|
|
2765
|
+
* An API entry surfaced here may reference a paywall that has not yet been published in the
|
|
2766
|
+
* API response. NamiCampaignManager.launch() handles that case independently via
|
|
2767
|
+
* getPaywallDataFromLabel(), which falls back to the initial-config (campaign, paywall) pair
|
|
2768
|
+
* when the API pair is incomplete — matching the merged-paywall-lookup behavior on
|
|
2769
|
+
* Apple and Android.
|
|
2760
2770
|
*/
|
|
2761
2771
|
declare const allCampaigns: () => NamiCampaign[];
|
|
2762
2772
|
declare const getInitialCampaigns: () => NamiCampaign[];
|
package/dist/index.mjs
CHANGED
|
@@ -96,7 +96,7 @@ const {
|
|
|
96
96
|
// version — stamped by scripts/version.sh
|
|
97
97
|
NAMI_SDK_VERSION = "3.4.0",
|
|
98
98
|
// full package version including dev suffix — stamped by scripts/version.sh
|
|
99
|
-
NAMI_SDK_PACKAGE_VERSION = "3.4.0-dev.
|
|
99
|
+
NAMI_SDK_PACKAGE_VERSION = "3.4.0-dev.202605182046",
|
|
100
100
|
// environments
|
|
101
101
|
PRODUCTION = "production", DEVELOPMENT = "development",
|
|
102
102
|
// error messages
|
|
@@ -7402,19 +7402,34 @@ const mapAnonymousCampaigns = (campaigns, splitPosition, formFactor) => {
|
|
|
7402
7402
|
});
|
|
7403
7403
|
};
|
|
7404
7404
|
/**
|
|
7405
|
+
* Returns the combined list of API + initial-config campaigns for the current device's
|
|
7406
|
+
* form factor, deduplicated by (type, value) with API entries winning on collision.
|
|
7405
7407
|
*
|
|
7406
|
-
*
|
|
7407
|
-
*
|
|
7408
|
+
* Mirrors NamiCampaignManager.allCampaigns() on Apple (Set keyed on hash(value, type))
|
|
7409
|
+
* and Android (.distinct() with server-first ordering). Keying on (type, value) — rather
|
|
7410
|
+
* than rule UUID — ensures the same logical placement does not surface twice when the
|
|
7411
|
+
* server has republished a campaign under a new rule id.
|
|
7408
7412
|
*
|
|
7409
|
-
* Note:
|
|
7410
|
-
*
|
|
7413
|
+
* Note: this list reflects which placements are available, not whether they are launchable.
|
|
7414
|
+
* An API entry surfaced here may reference a paywall that has not yet been published in the
|
|
7415
|
+
* API response. NamiCampaignManager.launch() handles that case independently via
|
|
7416
|
+
* getPaywallDataFromLabel(), which falls back to the initial-config (campaign, paywall) pair
|
|
7417
|
+
* when the API pair is incomplete — matching the merged-paywall-lookup behavior on
|
|
7418
|
+
* Apple and Android.
|
|
7411
7419
|
*/
|
|
7412
7420
|
const allCampaigns = () => {
|
|
7413
7421
|
const apiCampaigns = storageService.getCampaignRules(API_CAMPAIGN_RULES) ?? [];
|
|
7414
7422
|
const initialCampaigns = storageService.getCampaignRules(INITIAL_CAMPAIGN_RULES) ?? [];
|
|
7415
7423
|
const formFactor = getDeviceFormFactor();
|
|
7416
7424
|
const campaigns = compact([...apiCampaigns, ...initialCampaigns]).filter((cRule) => cRule.form_factors?.some((f) => f.form_factor === formFactor));
|
|
7417
|
-
|
|
7425
|
+
const seen = new Set();
|
|
7426
|
+
return campaigns.filter((c) => {
|
|
7427
|
+
const key = `${c.type ?? ''}::${c.value ?? ''}`;
|
|
7428
|
+
if (seen.has(key))
|
|
7429
|
+
return false;
|
|
7430
|
+
seen.add(key);
|
|
7431
|
+
return true;
|
|
7432
|
+
});
|
|
7418
7433
|
};
|
|
7419
7434
|
/**
|
|
7420
7435
|
* Get campaigns by rule key, filtered by form factor.
|
|
@@ -13668,6 +13683,19 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
13668
13683
|
this.forward(nextStep.id);
|
|
13669
13684
|
}
|
|
13670
13685
|
}
|
|
13686
|
+
handleRemoteBack() {
|
|
13687
|
+
const step = this.currentFlowStep;
|
|
13688
|
+
if (step?.actions[NamiReservedActions.REMOTE_BACK]) {
|
|
13689
|
+
this.triggerActions(NamiReservedActions.REMOTE_BACK);
|
|
13690
|
+
return 'handler';
|
|
13691
|
+
}
|
|
13692
|
+
if (this.previousStepAvailable) {
|
|
13693
|
+
this.back();
|
|
13694
|
+
return 'back';
|
|
13695
|
+
}
|
|
13696
|
+
this.finished();
|
|
13697
|
+
return 'dismissed';
|
|
13698
|
+
}
|
|
13671
13699
|
backToPreviousScreenStep() {
|
|
13672
13700
|
if (this.previousFlowStep?.allow_back_to === false) {
|
|
13673
13701
|
logger.warn(`Not allowed to go back to ${this.previousFlowStep.id}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namiml/sdk-core",
|
|
3
|
-
"version": "3.4.0-dev.
|
|
3
|
+
"version": "3.4.0-dev.202605182046",
|
|
4
4
|
"description": "Platform-agnostic core for the Nami SDK — business logic, API, types, and state management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|