@namiml/sdk-core 3.4.0-dev.202604151444 → 3.4.0-dev.202604182042
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 +41 -2
- package/dist/index.d.ts +17 -1
- package/dist/index.mjs +41 -3
- 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.202604182042",
|
|
102
102
|
// environments
|
|
103
103
|
PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
|
|
104
104
|
// error messages
|
|
@@ -119,6 +119,21 @@ AVAILABLE_CAMPAIGNS_CHANGED: exports.AVAILABLE_CAMPAIGNS_CHANGED = 'AvailableCam
|
|
|
119
119
|
AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED: exports.AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED = 'AvailableActiveEntitlementsChanged', CUSTOMER_JOURNEY_STATE_CHANGED: exports.CUSTOMER_JOURNEY_STATE_CHANGED = 'CustomerJourneyStateChanged',
|
|
120
120
|
//regex
|
|
121
121
|
SKU_TEXT_REGEX: exports.SKU_TEXT_REGEX = /\$\{sku\.(\w+)(:\d+)?\}/g, VAR_REGEX: exports.VAR_REGEX = /\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g, HTML_REGEX: exports.HTML_REGEX = /<\/?[a-z][\s\S]*>/i, SMART_TEXT_PATTERN: exports.SMART_TEXT_PATTERN = '${', LIQUID_VARIABLE_REGEX: exports.LIQUID_VARIABLE_REGEX = /\${[A-Za-z0-9.]+}/g, } = {};
|
|
122
|
+
/**
|
|
123
|
+
* Every Nami-owned localStorage key that clearAll() must remove.
|
|
124
|
+
* If you add a new storage key above, add it here too — a test will fail if you forget.
|
|
125
|
+
*/
|
|
126
|
+
const NAMI_STORAGE_KEYS = [
|
|
127
|
+
exports.AUTH_DEVICE, exports.NAMI_CONFIGURATION, exports.NAMI_PROFILE,
|
|
128
|
+
exports.API_CONFIG, exports.API_CAMPAIGN_RULES, exports.API_PAYWALLS, exports.API_CAMPAIGN_SESSION_TIMESTAMP,
|
|
129
|
+
exports.API_PRODUCTS, exports.API_ACTIVE_ENTITLEMENTS, exports.SERVER_NAMI_ENTITLEMENTS,
|
|
130
|
+
exports.INITIAL_APP_CONFIG, exports.INITIAL_CAMPAIGN_RULES, exports.INITIAL_PAYWALLS, exports.INITIAL_PRODUCTS,
|
|
131
|
+
exports.LOCAL_NAMI_ENTITLEMENTS,
|
|
132
|
+
exports.NAMI_CUSTOMER_JOURNEY_STATE,
|
|
133
|
+
exports.ANONYMOUS_MODE, exports.ANONYMOUS_UUID,
|
|
134
|
+
exports.KEY_SESSION_COUNTER, exports.NAMI_LAST_IMPRESSION_ID, exports.NAMI_PURCHASE_IMPRESSION_ID,
|
|
135
|
+
exports.NAMI_LAUNCH_ID, exports.NAMI_SESSION_ID, exports.NAMI_LANGUAGE_CODE, exports.NAMI_PURCHASE_CHANNEL,
|
|
136
|
+
];
|
|
122
137
|
|
|
123
138
|
exports.LogLevel = void 0;
|
|
124
139
|
(function (LogLevel) {
|
|
@@ -3347,6 +3362,17 @@ class StorageService {
|
|
|
3347
3362
|
}
|
|
3348
3363
|
delete this.memoryStore[key];
|
|
3349
3364
|
}
|
|
3365
|
+
/**
|
|
3366
|
+
* Clear all Nami-owned storage keys without touching host-app data.
|
|
3367
|
+
* Uses targeted key removal instead of localStorage.clear().
|
|
3368
|
+
*/
|
|
3369
|
+
clearAll() {
|
|
3370
|
+
NAMI_STORAGE_KEYS.forEach(k => this.resetItem(k));
|
|
3371
|
+
// Remove prefix-based customer attribute keys
|
|
3372
|
+
this.clearAllCustomerAttributes();
|
|
3373
|
+
// Clear the in-memory store as well
|
|
3374
|
+
this.memoryStore = {};
|
|
3375
|
+
}
|
|
3350
3376
|
/**
|
|
3351
3377
|
* Clear all items from localStorage.
|
|
3352
3378
|
*/
|
|
@@ -7257,7 +7283,9 @@ function uuidFromSplitPosition(namiCommands) {
|
|
|
7257
7283
|
|
|
7258
7284
|
const isValidUrl = (label) => {
|
|
7259
7285
|
try {
|
|
7260
|
-
|
|
7286
|
+
const url = new URL(label);
|
|
7287
|
+
const isHttp = url.protocol === 'http:' || url.protocol === 'https:';
|
|
7288
|
+
return isHttp && !!url.hostname;
|
|
7261
7289
|
}
|
|
7262
7290
|
catch {
|
|
7263
7291
|
return false;
|
|
@@ -11798,6 +11826,16 @@ class Nami {
|
|
|
11798
11826
|
static sdkPackageVersion() {
|
|
11799
11827
|
return exports.NAMI_SDK_PACKAGE_VERSION;
|
|
11800
11828
|
}
|
|
11829
|
+
/**
|
|
11830
|
+
* Clear all locally persisted SDK state (device ID, customer attributes,
|
|
11831
|
+
* campaigns/paywalls/products caches, session, and anonymous-mode flags).
|
|
11832
|
+
* After reset, the next configure() call regenerates the device ID.
|
|
11833
|
+
*/
|
|
11834
|
+
static async reset() {
|
|
11835
|
+
storageService.clearAll();
|
|
11836
|
+
clearInMemoryAnonymousMode();
|
|
11837
|
+
__classPrivateFieldSet(Nami.instance, _Nami_isInitialized, false, "f");
|
|
11838
|
+
}
|
|
11801
11839
|
/**
|
|
11802
11840
|
* Configures and initializes the SDK.
|
|
11803
11841
|
* This method must be called as the first thing before interacting with the SDK.
|
|
@@ -63830,6 +63868,7 @@ exports.ExternalIDRequiredError = ExternalIDRequiredError;
|
|
|
63830
63868
|
exports.FlowScreensNotAvailableError = FlowScreensNotAvailableError;
|
|
63831
63869
|
exports.InternalServerError = InternalServerError;
|
|
63832
63870
|
exports.LaunchContextResolver = LaunchContextResolver;
|
|
63871
|
+
exports.NAMI_STORAGE_KEYS = NAMI_STORAGE_KEYS;
|
|
63833
63872
|
exports.Nami = Nami;
|
|
63834
63873
|
exports.NamiAPI = NamiAPI;
|
|
63835
63874
|
exports.NamiAnimationType = NamiAnimationType;
|
package/dist/index.d.ts
CHANGED
|
@@ -1827,6 +1827,12 @@ declare class Nami {
|
|
|
1827
1827
|
get isInitialized(): boolean;
|
|
1828
1828
|
static sdkVersion(): string;
|
|
1829
1829
|
static sdkPackageVersion(): string;
|
|
1830
|
+
/**
|
|
1831
|
+
* Clear all locally persisted SDK state (device ID, customer attributes,
|
|
1832
|
+
* campaigns/paywalls/products caches, session, and anonymous-mode flags).
|
|
1833
|
+
* After reset, the next configure() call regenerates the device ID.
|
|
1834
|
+
*/
|
|
1835
|
+
static reset(): Promise<void>;
|
|
1830
1836
|
/**
|
|
1831
1837
|
* Configures and initializes the SDK.
|
|
1832
1838
|
* This method must be called as the first thing before interacting with the SDK.
|
|
@@ -2407,6 +2413,11 @@ declare class StorageService {
|
|
|
2407
2413
|
* @param {string} key - The key of the item to remove.
|
|
2408
2414
|
*/
|
|
2409
2415
|
private resetItem;
|
|
2416
|
+
/**
|
|
2417
|
+
* Clear all Nami-owned storage keys without touching host-app data.
|
|
2418
|
+
* Uses targeted key removal instead of localStorage.clear().
|
|
2419
|
+
*/
|
|
2420
|
+
clearAll(): void;
|
|
2410
2421
|
/**
|
|
2411
2422
|
* Clear all items from localStorage.
|
|
2412
2423
|
*/
|
|
@@ -2545,6 +2556,11 @@ declare const VAR_REGEX: RegExp;
|
|
|
2545
2556
|
declare const HTML_REGEX: RegExp;
|
|
2546
2557
|
declare const SMART_TEXT_PATTERN: string;
|
|
2547
2558
|
declare const LIQUID_VARIABLE_REGEX: RegExp;
|
|
2559
|
+
/**
|
|
2560
|
+
* Every Nami-owned localStorage key that clearAll() must remove.
|
|
2561
|
+
* If you add a new storage key above, add it here too — a test will fail if you forget.
|
|
2562
|
+
*/
|
|
2563
|
+
declare const NAMI_STORAGE_KEYS: readonly string[];
|
|
2548
2564
|
|
|
2549
2565
|
declare const SHOULD_SHOW_LOADING_INDICATOR = false;
|
|
2550
2566
|
|
|
@@ -2966,5 +2982,5 @@ declare const getBillingPeriodNumber: (billingPeriod: string) => number;
|
|
|
2966
2982
|
declare const formattedPrice: (price: number) => number;
|
|
2967
2983
|
declare function toDouble(num: number): number;
|
|
2968
2984
|
|
|
2969
|
-
export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_NOT_AVAILABLE, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LOG_HTTP_REQUESTS, LOG_HTTP_TRAFFIC, LaunchCampaignError, LaunchContextResolver, LogLevel, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager, NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager, NamiFlowStepType, NamiPaywallAction, NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiProfileManager, NamiPurchaseManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SessionService, SimpleEventTarget, StorageService, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, activateEntitlementByPurchase, activeEntitlements, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bestUrlCampaignMatch, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, empty, extractStandardPricingPhases, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getPurchaseAdapter, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseToSemver, postConversion, productDetail, registerPlatformAdapters, registerPurchaseAdapter, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateMinSDKVersion };
|
|
2985
|
+
export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_NOT_AVAILABLE, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LOG_HTTP_REQUESTS, LOG_HTTP_TRAFFIC, LaunchCampaignError, LaunchContextResolver, LogLevel, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, NAMI_STORAGE_KEYS, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager, NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager, NamiFlowStepType, NamiPaywallAction, NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiProfileManager, NamiPurchaseManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SessionService, SimpleEventTarget, StorageService, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, activateEntitlementByPurchase, activeEntitlements, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bestUrlCampaignMatch, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, empty, extractStandardPricingPhases, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getPurchaseAdapter, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseToSemver, postConversion, productDetail, registerPlatformAdapters, registerPurchaseAdapter, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateMinSDKVersion };
|
|
2970
2986
|
export type { AlignmentType, AmazonProduct, ApiResponse, AppleProduct, AvailableCampaignsResponseHandler, BorderLocationType, BorderSideType, Callback$1 as Callback, CloseHandler, CustomerJourneyState, DeepLinkUrlHandler, Device, DevicePayload, DeviceProfile, DirectionType, ExtendedPlatformInfo, FlexDirectionObject, FlowNavigationOptions, FontCollection, FontDetails, FormFactor, GoogleProduct, IConfig, IDeviceAdapter, IEntitlements$1 as IEntitlements, IPaywall, IPlatformAdapters, IProductsWithComponents, IPurchaseAdapter, ISkuMenu, IStorageAdapter, IUIAdapter, Impression, InitialConfig, InitialConfigCompressed, InitiateStateGroup, LoginResponse, NamiAnimation, NamiAnimationObjectSpec, NamiAnimationSpec, NamiAnonymousCampaign, NamiAppSuppliedVideoDetails, NamiCampaign, NamiCampaignSegment, NamiConfiguration, NamiConfigurationState, NamiEntitlement$1 as NamiEntitlement, NamiFlowAction, NamiFlowAnimation, NamiFlowCampaign, NamiFlowDTO, NamiFlowEventHandler, NamiFlowHandoffStepHandler, NamiFlowObjectDTO, NamiFlowOn, NamiFlowStep, NamiFlowTransition, NamiFlowTransitionDirection, NamiFlowWithObject, NamiInitialConfig, NamiLanguageCodes, NamiLogLevel, NamiPaywallActionHandler, NamiPaywallComponentChange, NamiPaywallEvent, NamiPaywallEventVideoMetadata, NamiPaywallLaunchContext, NamiPresentationStyle, NamiProductDetails, NamiProductOffer, NamiProfile, NamiPurchase, NamiPurchaseCompleteResult, NamiPurchaseDetails, NamiPurchasesState, NamiSKU, NamiSKUType, NamiSubscriptionInterval, NamiSubscriptionPeriod, None, NoneSpec, PaywallActionEvent, PaywallHandle, PaywallResultHandler, PaywallSKU, PricingPhase, ProductGroup, Pulse, PulseSpec, PurchaseContext, PurchaseResult, PurchaseValidationRequest, SKU, SKUActionHandler, ScreenInfo, Session, TBaseComponent, TButtonContainer, TCarouselContainer, TCarouselSlide, TCarouselSlidesState, TCollapseContainer, TComponent, TConditionalAttributes, TConditionalComponent, TContainer, TContainerPosition, TCountdownTimerTextComponent, TDevice, TDisabledButton, TField, TFieldSettings, TFlexProductContainer, THeaderFooter, TImageComponent, TInitialState, TMediaTypes, TOffer, TPages, TPaywallContext, TPaywallLaunchContext, TPaywallMedia, TPaywallTemplate, TPlayPauseButton, TProductContainer, TProductGroup, TProgressBarComponent, TProgressIndicatorComponent, TQRCodeComponent, TRadioButton, TRepeatingGrid, TResponsiveGrid, TSegmentPicker, TSegmentPickerItem, TSemverObj, TSpacerComponent, TStack, TSvgImageComponent, TSymbolComponent, TTestObject, TTextComponent, TTextLikeComponent, TTextListComponent, TToggleButtonComponent, TToggleSwitch, TVariablePattern, TVideoComponent, TVolumeButton, TimerState, TransactionRequest, UserAction, UserActionParameters, Wave, WaveSpec };
|
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.202604182042",
|
|
100
100
|
// environments
|
|
101
101
|
PRODUCTION = "production", DEVELOPMENT = "development",
|
|
102
102
|
// error messages
|
|
@@ -117,6 +117,21 @@ AVAILABLE_CAMPAIGNS_CHANGED = 'AvailableCampaignsChanged', PAYWALL_ACTION_EVENT
|
|
|
117
117
|
AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED = 'AvailableActiveEntitlementsChanged', CUSTOMER_JOURNEY_STATE_CHANGED = 'CustomerJourneyStateChanged',
|
|
118
118
|
//regex
|
|
119
119
|
SKU_TEXT_REGEX = /\$\{sku\.(\w+)(:\d+)?\}/g, VAR_REGEX = /\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g, HTML_REGEX = /<\/?[a-z][\s\S]*>/i, SMART_TEXT_PATTERN = '${', LIQUID_VARIABLE_REGEX = /\${[A-Za-z0-9.]+}/g, } = {};
|
|
120
|
+
/**
|
|
121
|
+
* Every Nami-owned localStorage key that clearAll() must remove.
|
|
122
|
+
* If you add a new storage key above, add it here too — a test will fail if you forget.
|
|
123
|
+
*/
|
|
124
|
+
const NAMI_STORAGE_KEYS = [
|
|
125
|
+
AUTH_DEVICE, NAMI_CONFIGURATION, NAMI_PROFILE,
|
|
126
|
+
API_CONFIG, API_CAMPAIGN_RULES, API_PAYWALLS, API_CAMPAIGN_SESSION_TIMESTAMP,
|
|
127
|
+
API_PRODUCTS, API_ACTIVE_ENTITLEMENTS, SERVER_NAMI_ENTITLEMENTS,
|
|
128
|
+
INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS,
|
|
129
|
+
LOCAL_NAMI_ENTITLEMENTS,
|
|
130
|
+
NAMI_CUSTOMER_JOURNEY_STATE,
|
|
131
|
+
ANONYMOUS_MODE, ANONYMOUS_UUID,
|
|
132
|
+
KEY_SESSION_COUNTER, NAMI_LAST_IMPRESSION_ID, NAMI_PURCHASE_IMPRESSION_ID,
|
|
133
|
+
NAMI_LAUNCH_ID, NAMI_SESSION_ID, NAMI_LANGUAGE_CODE, NAMI_PURCHASE_CHANNEL,
|
|
134
|
+
];
|
|
120
135
|
|
|
121
136
|
var LogLevel;
|
|
122
137
|
(function (LogLevel) {
|
|
@@ -3345,6 +3360,17 @@ class StorageService {
|
|
|
3345
3360
|
}
|
|
3346
3361
|
delete this.memoryStore[key];
|
|
3347
3362
|
}
|
|
3363
|
+
/**
|
|
3364
|
+
* Clear all Nami-owned storage keys without touching host-app data.
|
|
3365
|
+
* Uses targeted key removal instead of localStorage.clear().
|
|
3366
|
+
*/
|
|
3367
|
+
clearAll() {
|
|
3368
|
+
NAMI_STORAGE_KEYS.forEach(k => this.resetItem(k));
|
|
3369
|
+
// Remove prefix-based customer attribute keys
|
|
3370
|
+
this.clearAllCustomerAttributes();
|
|
3371
|
+
// Clear the in-memory store as well
|
|
3372
|
+
this.memoryStore = {};
|
|
3373
|
+
}
|
|
3348
3374
|
/**
|
|
3349
3375
|
* Clear all items from localStorage.
|
|
3350
3376
|
*/
|
|
@@ -7255,7 +7281,9 @@ function uuidFromSplitPosition(namiCommands) {
|
|
|
7255
7281
|
|
|
7256
7282
|
const isValidUrl = (label) => {
|
|
7257
7283
|
try {
|
|
7258
|
-
|
|
7284
|
+
const url = new URL(label);
|
|
7285
|
+
const isHttp = url.protocol === 'http:' || url.protocol === 'https:';
|
|
7286
|
+
return isHttp && !!url.hostname;
|
|
7259
7287
|
}
|
|
7260
7288
|
catch {
|
|
7261
7289
|
return false;
|
|
@@ -11796,6 +11824,16 @@ class Nami {
|
|
|
11796
11824
|
static sdkPackageVersion() {
|
|
11797
11825
|
return NAMI_SDK_PACKAGE_VERSION;
|
|
11798
11826
|
}
|
|
11827
|
+
/**
|
|
11828
|
+
* Clear all locally persisted SDK state (device ID, customer attributes,
|
|
11829
|
+
* campaigns/paywalls/products caches, session, and anonymous-mode flags).
|
|
11830
|
+
* After reset, the next configure() call regenerates the device ID.
|
|
11831
|
+
*/
|
|
11832
|
+
static async reset() {
|
|
11833
|
+
storageService.clearAll();
|
|
11834
|
+
clearInMemoryAnonymousMode();
|
|
11835
|
+
__classPrivateFieldSet(Nami.instance, _Nami_isInitialized, false, "f");
|
|
11836
|
+
}
|
|
11799
11837
|
/**
|
|
11800
11838
|
* Configures and initializes the SDK.
|
|
11801
11839
|
* This method must be called as the first thing before interacting with the SDK.
|
|
@@ -63805,4 +63843,4 @@ function namiBuySKU(skuRefId) {
|
|
|
63805
63843
|
return result;
|
|
63806
63844
|
}
|
|
63807
63845
|
|
|
63808
|
-
export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_NOT_AVAILABLE, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LOG_HTTP_REQUESTS, LOG_HTTP_TRAFFIC, LaunchCampaignError, LaunchContextResolver, LogLevel, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager, NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager, NamiFlowStepType, NamiPaywallAction, NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiProfileManager, NamiPurchaseManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SessionService, SimpleEventTarget, StorageService, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, activateEntitlementByPurchase, activeEntitlements, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bestUrlCampaignMatch, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, empty, extractStandardPricingPhases, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getPurchaseAdapter, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseToSemver, postConversion, productDetail, registerPlatformAdapters, registerPurchaseAdapter, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateMinSDKVersion };
|
|
63846
|
+
export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_NOT_AVAILABLE, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LOG_HTTP_REQUESTS, LOG_HTTP_TRAFFIC, LaunchCampaignError, LaunchContextResolver, LogLevel, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, NAMI_STORAGE_KEYS, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager, NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager, NamiFlowStepType, NamiPaywallAction, NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiProfileManager, NamiPurchaseManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SessionService, SimpleEventTarget, StorageService, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, activateEntitlementByPurchase, activeEntitlements, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bestUrlCampaignMatch, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, empty, extractStandardPricingPhases, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getPurchaseAdapter, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseToSemver, postConversion, productDetail, registerPlatformAdapters, registerPurchaseAdapter, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateMinSDKVersion };
|
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.202604182042",
|
|
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",
|