@namiml/sdk-core 3.4.0-dev.202604101712 → 3.4.0-dev.202604151444
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 +82 -39
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +83 -40
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ const _fallback = {
|
|
|
16
16
|
getDeviceData: () => ({ os_version: '', os_name: '', browser_name: '', browser_version: '', sdk_client: '', sdk_version: '', language: 'en' }),
|
|
17
17
|
getDeviceFormFactor: () => 'desktop',
|
|
18
18
|
getDeviceScaleFactor: () => 1,
|
|
19
|
-
generateUUID: () =>
|
|
19
|
+
generateUUID: () => { throw new Error('No platform adapter registered — call registerPlatformAdapters() before Nami.configure()'); },
|
|
20
20
|
getScreenInfo: () => ({ width: 0, height: 0, scale: 1 }),
|
|
21
21
|
getLanguage: () => 'en',
|
|
22
22
|
},
|
|
@@ -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.202604151444",
|
|
102
102
|
// environments
|
|
103
103
|
PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
|
|
104
104
|
// error messages
|
|
@@ -108,7 +108,7 @@ AUTH_DEVICE: exports.AUTH_DEVICE = "nami_auth_device", NAMI_CONFIGURATION: expor
|
|
|
108
108
|
// API settings
|
|
109
109
|
API_VERSION: exports.API_VERSION = "v3", BASE_URL_PATH: exports.BASE_URL_PATH = `sdk/${exports.API_VERSION}/platform`, BASE_URL: exports.BASE_URL = "https://app.namiml.com", BASE_STAGING_URL: exports.BASE_STAGING_URL = "https://app-staging.namiml.com", CUSTOM_HOST_PREFIX: exports.CUSTOM_HOST_PREFIX = "namiAPIHost=", USE_STAGING_API: exports.USE_STAGING_API = "useStagingAPI",
|
|
110
110
|
// // extended client info
|
|
111
|
-
EXTENDED_CLIENT_INFO_PREFIX: exports.EXTENDED_CLIENT_INFO_PREFIX = "extendedClientInfo", EXTENDED_CLIENT_INFO_DELIMITER: exports.EXTENDED_CLIENT_INFO_DELIMITER = ":", VALIDATE_PRODUCT_GROUPS: exports.VALIDATE_PRODUCT_GROUPS = "validateProductGroups", EXTENDED_PLATFORM: exports.EXTENDED_PLATFORM = "extended-platform", EXTENDED_PLATFORM_VERSION: exports.EXTENDED_PLATFORM_VERSION = "extended-platform-version", API_MAX_CALLS_LIMIT: exports.API_MAX_CALLS_LIMIT = 2, API_RETRY_DELAY_SEC: exports.API_RETRY_DELAY_SEC = 2, API_TIMEOUT_LIMIT: exports.API_TIMEOUT_LIMIT = 20000, DEVICE_API_TIMEOUT_LIMIT: exports.DEVICE_API_TIMEOUT_LIMIT = 2000,
|
|
111
|
+
EXTENDED_CLIENT_INFO_PREFIX: exports.EXTENDED_CLIENT_INFO_PREFIX = "extendedClientInfo", EXTENDED_CLIENT_INFO_DELIMITER: exports.EXTENDED_CLIENT_INFO_DELIMITER = ":", VALIDATE_PRODUCT_GROUPS: exports.VALIDATE_PRODUCT_GROUPS = "validateProductGroups", LOG_HTTP_REQUESTS: exports.LOG_HTTP_REQUESTS = "logHTTPRequests", LOG_HTTP_TRAFFIC: exports.LOG_HTTP_TRAFFIC = "logHTTPTraffic", EXTENDED_PLATFORM: exports.EXTENDED_PLATFORM = "extended-platform", EXTENDED_PLATFORM_VERSION: exports.EXTENDED_PLATFORM_VERSION = "extended-platform-version", API_MAX_CALLS_LIMIT: exports.API_MAX_CALLS_LIMIT = 2, API_RETRY_DELAY_SEC: exports.API_RETRY_DELAY_SEC = 2, API_TIMEOUT_LIMIT: exports.API_TIMEOUT_LIMIT = 20000, DEVICE_API_TIMEOUT_LIMIT: exports.DEVICE_API_TIMEOUT_LIMIT = 2000,
|
|
112
112
|
// status codes
|
|
113
113
|
STATUS_SUCCESS: exports.STATUS_SUCCESS = 200, STATUS_BAD_REQUEST: exports.STATUS_BAD_REQUEST = 400, STATUS_NOT_FOUND: exports.STATUS_NOT_FOUND = 404, STATUS_CONFLICT: exports.STATUS_CONFLICT = 409, STATUS_INTERNAL_SERVER_ERROR: exports.STATUS_INTERNAL_SERVER_ERROR = 500,
|
|
114
114
|
// configuration states
|
|
@@ -3473,40 +3473,6 @@ const handleErrors = (status, path) => {
|
|
|
3473
3473
|
}
|
|
3474
3474
|
};
|
|
3475
3475
|
|
|
3476
|
-
async function withRetry(url, options, timeout = exports.API_TIMEOUT_LIMIT, retries = exports.API_MAX_CALLS_LIMIT) {
|
|
3477
|
-
let retryCount = 0;
|
|
3478
|
-
const fetchWithRetry = async () => {
|
|
3479
|
-
const response = await timeoutRequest(url, options, timeout);
|
|
3480
|
-
if (!response.ok) {
|
|
3481
|
-
if (response.status == exports.STATUS_CONFLICT) {
|
|
3482
|
-
throw new ConflictError();
|
|
3483
|
-
}
|
|
3484
|
-
retryCount++;
|
|
3485
|
-
// Retry for retries times
|
|
3486
|
-
if (retryCount <= retries) {
|
|
3487
|
-
// Delay by 2 seconds per retryCount
|
|
3488
|
-
const delay = (retryCount + exports.API_RETRY_DELAY_SEC) * 1000;
|
|
3489
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
3490
|
-
return fetchWithRetry();
|
|
3491
|
-
}
|
|
3492
|
-
else {
|
|
3493
|
-
throw new RetryLimitExceededError(response.status, `Request failed after ${retries} retries`);
|
|
3494
|
-
}
|
|
3495
|
-
}
|
|
3496
|
-
return response;
|
|
3497
|
-
};
|
|
3498
|
-
const response = await fetchWithRetry();
|
|
3499
|
-
return response.json();
|
|
3500
|
-
}
|
|
3501
|
-
async function timeoutRequest(url, options = {}, timeout) {
|
|
3502
|
-
const controller = new AbortController();
|
|
3503
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
3504
|
-
options["signal"] = controller.signal;
|
|
3505
|
-
const response = await fetch(url, options);
|
|
3506
|
-
clearTimeout(timeoutId);
|
|
3507
|
-
return response;
|
|
3508
|
-
}
|
|
3509
|
-
|
|
3510
3476
|
/*============================================================================*/
|
|
3511
3477
|
|
|
3512
3478
|
|
|
@@ -6803,6 +6769,14 @@ const shouldValidateProductGroups = () => {
|
|
|
6803
6769
|
const namiCommands = storageService.getNamiConfig()?.namiCommands;
|
|
6804
6770
|
return namiCommands?.includes(exports.VALIDATE_PRODUCT_GROUPS) ?? false;
|
|
6805
6771
|
};
|
|
6772
|
+
const shouldLogHTTPRequests = () => {
|
|
6773
|
+
const namiCommands = storageService.getNamiConfig()?.namiCommands;
|
|
6774
|
+
return namiCommands?.includes(exports.LOG_HTTP_REQUESTS) ?? false;
|
|
6775
|
+
};
|
|
6776
|
+
const shouldLogHTTPTraffic = () => {
|
|
6777
|
+
const namiCommands = storageService.getNamiConfig()?.namiCommands;
|
|
6778
|
+
return namiCommands?.includes(exports.LOG_HTTP_TRAFFIC) ?? false;
|
|
6779
|
+
};
|
|
6806
6780
|
function tryParseJson(str) {
|
|
6807
6781
|
const trimmed = str.trim();
|
|
6808
6782
|
if (!trimmed.startsWith("{") && !trimmed.startsWith("["))
|
|
@@ -6837,6 +6811,57 @@ function base64ToUint8(b64) {
|
|
|
6837
6811
|
return bytes;
|
|
6838
6812
|
}
|
|
6839
6813
|
|
|
6814
|
+
async function withRetry(url, options, timeout = exports.API_TIMEOUT_LIMIT, retries = exports.API_MAX_CALLS_LIMIT) {
|
|
6815
|
+
let retryCount = 0;
|
|
6816
|
+
const logRequests = shouldLogHTTPRequests();
|
|
6817
|
+
const logTraffic = shouldLogHTTPTraffic();
|
|
6818
|
+
const method = options?.method ?? "GET";
|
|
6819
|
+
const fetchWithRetry = async () => {
|
|
6820
|
+
if (logRequests || logTraffic) {
|
|
6821
|
+
logger.debug(`[HTTP] ${method} ${url}`);
|
|
6822
|
+
}
|
|
6823
|
+
if (logTraffic && options?.body) {
|
|
6824
|
+
logger.debug(`[HTTP] Request body: ${options.body}`);
|
|
6825
|
+
}
|
|
6826
|
+
const response = await timeoutRequest(url, options, timeout);
|
|
6827
|
+
if (!response.ok) {
|
|
6828
|
+
if (logTraffic) {
|
|
6829
|
+
const errorBody = await response.clone().text();
|
|
6830
|
+
logger.debug(`[HTTP] Response ${response.status}: ${errorBody}`);
|
|
6831
|
+
}
|
|
6832
|
+
if (response.status == exports.STATUS_CONFLICT) {
|
|
6833
|
+
throw new ConflictError();
|
|
6834
|
+
}
|
|
6835
|
+
retryCount++;
|
|
6836
|
+
// Retry for retries times
|
|
6837
|
+
if (retryCount <= retries) {
|
|
6838
|
+
// Delay by 2 seconds per retryCount
|
|
6839
|
+
const delay = (retryCount + exports.API_RETRY_DELAY_SEC) * 1000;
|
|
6840
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
6841
|
+
return fetchWithRetry();
|
|
6842
|
+
}
|
|
6843
|
+
else {
|
|
6844
|
+
throw new RetryLimitExceededError(response.status, `Request failed after ${retries} retries`);
|
|
6845
|
+
}
|
|
6846
|
+
}
|
|
6847
|
+
if (logTraffic) {
|
|
6848
|
+
const responseBody = await response.clone().text();
|
|
6849
|
+
logger.debug(`[HTTP] Response ${response.status}: ${responseBody}`);
|
|
6850
|
+
}
|
|
6851
|
+
return response;
|
|
6852
|
+
};
|
|
6853
|
+
const response = await fetchWithRetry();
|
|
6854
|
+
return response.json();
|
|
6855
|
+
}
|
|
6856
|
+
async function timeoutRequest(url, options = {}, timeout) {
|
|
6857
|
+
const controller = new AbortController();
|
|
6858
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
6859
|
+
options["signal"] = controller.signal;
|
|
6860
|
+
const response = await fetch(url, options);
|
|
6861
|
+
clearTimeout(timeoutId);
|
|
6862
|
+
return response;
|
|
6863
|
+
}
|
|
6864
|
+
|
|
6840
6865
|
function requirePlatformID(target, propertyKey, descriptor) {
|
|
6841
6866
|
const originalMethod = descriptor.value;
|
|
6842
6867
|
descriptor.value = function (...args) {
|
|
@@ -8252,7 +8277,11 @@ class PaywallRepository {
|
|
|
8252
8277
|
paywalls = await this.getPaywalls(authDevice.id);
|
|
8253
8278
|
}
|
|
8254
8279
|
if (paywalls) {
|
|
8255
|
-
|
|
8280
|
+
const valid = this.validatePaywalls(paywalls);
|
|
8281
|
+
if (valid.length > 0) {
|
|
8282
|
+
storageService.setPaywalls(exports.API_PAYWALLS, valid);
|
|
8283
|
+
}
|
|
8284
|
+
return valid;
|
|
8256
8285
|
}
|
|
8257
8286
|
return paywalls;
|
|
8258
8287
|
}
|
|
@@ -8302,10 +8331,24 @@ class PaywallRepository {
|
|
|
8302
8331
|
}
|
|
8303
8332
|
}
|
|
8304
8333
|
if (paywalls.length > 0) {
|
|
8305
|
-
|
|
8334
|
+
const valid = this.validatePaywalls(paywalls);
|
|
8335
|
+
if (valid.length > 0) {
|
|
8336
|
+
storageService.setPaywalls(exports.API_PAYWALLS, valid);
|
|
8337
|
+
}
|
|
8338
|
+
return valid;
|
|
8306
8339
|
}
|
|
8307
8340
|
return paywalls;
|
|
8308
8341
|
}
|
|
8342
|
+
validatePaywalls(paywalls) {
|
|
8343
|
+
return paywalls.filter((paywall) => {
|
|
8344
|
+
const pages = paywall.template?.pages;
|
|
8345
|
+
if (!Array.isArray(pages) || pages.length === 0) {
|
|
8346
|
+
logger.warn(`Dropping paywall "${paywall.id}" from cache: template.pages is missing or empty`);
|
|
8347
|
+
return false;
|
|
8348
|
+
}
|
|
8349
|
+
return true;
|
|
8350
|
+
});
|
|
8351
|
+
}
|
|
8309
8352
|
fallbackData() {
|
|
8310
8353
|
const storedData = storageService.getPaywalls(exports.API_PAYWALLS)
|
|
8311
8354
|
|| storageService.getPaywalls(exports.INITIAL_PAYWALLS);
|
package/dist/index.d.ts
CHANGED
|
@@ -2520,6 +2520,8 @@ declare const USE_STAGING_API: string;
|
|
|
2520
2520
|
declare const EXTENDED_CLIENT_INFO_PREFIX: string;
|
|
2521
2521
|
declare const EXTENDED_CLIENT_INFO_DELIMITER: string;
|
|
2522
2522
|
declare const VALIDATE_PRODUCT_GROUPS: string;
|
|
2523
|
+
declare const LOG_HTTP_REQUESTS: string;
|
|
2524
|
+
declare const LOG_HTTP_TRAFFIC: string;
|
|
2523
2525
|
declare const EXTENDED_PLATFORM: string;
|
|
2524
2526
|
declare const EXTENDED_PLATFORM_VERSION: string;
|
|
2525
2527
|
declare const API_MAX_CALLS_LIMIT: number;
|
|
@@ -2876,6 +2878,7 @@ declare class PaywallRepository {
|
|
|
2876
2878
|
private getPaywalls;
|
|
2877
2879
|
fetchPaywallByUrl(url: string): Promise<IPaywall>;
|
|
2878
2880
|
fetchPaywallsByUrls(urls: string[]): Promise<IPaywall[]>;
|
|
2881
|
+
private validatePaywalls;
|
|
2879
2882
|
private fallbackData;
|
|
2880
2883
|
}
|
|
2881
2884
|
|
|
@@ -2963,5 +2966,5 @@ declare const getBillingPeriodNumber: (billingPeriod: string) => number;
|
|
|
2963
2966
|
declare const formattedPrice: (price: number) => number;
|
|
2964
2967
|
declare function toDouble(num: number): number;
|
|
2965
2968
|
|
|
2966
|
-
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, 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 };
|
|
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 };
|
|
2967
2970
|
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
|
@@ -14,7 +14,7 @@ const _fallback = {
|
|
|
14
14
|
getDeviceData: () => ({ os_version: '', os_name: '', browser_name: '', browser_version: '', sdk_client: '', sdk_version: '', language: 'en' }),
|
|
15
15
|
getDeviceFormFactor: () => 'desktop',
|
|
16
16
|
getDeviceScaleFactor: () => 1,
|
|
17
|
-
generateUUID: () =>
|
|
17
|
+
generateUUID: () => { throw new Error('No platform adapter registered — call registerPlatformAdapters() before Nami.configure()'); },
|
|
18
18
|
getScreenInfo: () => ({ width: 0, height: 0, scale: 1 }),
|
|
19
19
|
getLanguage: () => 'en',
|
|
20
20
|
},
|
|
@@ -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.202604151444",
|
|
100
100
|
// environments
|
|
101
101
|
PRODUCTION = "production", DEVELOPMENT = "development",
|
|
102
102
|
// error messages
|
|
@@ -106,7 +106,7 @@ AUTH_DEVICE = "nami_auth_device", NAMI_CONFIGURATION = "nami_configuration", NAM
|
|
|
106
106
|
// API settings
|
|
107
107
|
API_VERSION = "v3", BASE_URL_PATH = `sdk/${API_VERSION}/platform`, BASE_URL = "https://app.namiml.com", BASE_STAGING_URL = "https://app-staging.namiml.com", CUSTOM_HOST_PREFIX = "namiAPIHost=", USE_STAGING_API = "useStagingAPI",
|
|
108
108
|
// // extended client info
|
|
109
|
-
EXTENDED_CLIENT_INFO_PREFIX = "extendedClientInfo", EXTENDED_CLIENT_INFO_DELIMITER = ":", VALIDATE_PRODUCT_GROUPS = "validateProductGroups", EXTENDED_PLATFORM = "extended-platform", EXTENDED_PLATFORM_VERSION = "extended-platform-version", API_MAX_CALLS_LIMIT = 2, API_RETRY_DELAY_SEC = 2, API_TIMEOUT_LIMIT = 20000, DEVICE_API_TIMEOUT_LIMIT = 2000,
|
|
109
|
+
EXTENDED_CLIENT_INFO_PREFIX = "extendedClientInfo", EXTENDED_CLIENT_INFO_DELIMITER = ":", VALIDATE_PRODUCT_GROUPS = "validateProductGroups", LOG_HTTP_REQUESTS = "logHTTPRequests", LOG_HTTP_TRAFFIC = "logHTTPTraffic", EXTENDED_PLATFORM = "extended-platform", EXTENDED_PLATFORM_VERSION = "extended-platform-version", API_MAX_CALLS_LIMIT = 2, API_RETRY_DELAY_SEC = 2, API_TIMEOUT_LIMIT = 20000, DEVICE_API_TIMEOUT_LIMIT = 2000,
|
|
110
110
|
// status codes
|
|
111
111
|
STATUS_SUCCESS = 200, STATUS_BAD_REQUEST = 400, STATUS_NOT_FOUND = 404, STATUS_CONFLICT = 409, STATUS_INTERNAL_SERVER_ERROR = 500,
|
|
112
112
|
// configuration states
|
|
@@ -3471,40 +3471,6 @@ const handleErrors = (status, path) => {
|
|
|
3471
3471
|
}
|
|
3472
3472
|
};
|
|
3473
3473
|
|
|
3474
|
-
async function withRetry(url, options, timeout = API_TIMEOUT_LIMIT, retries = API_MAX_CALLS_LIMIT) {
|
|
3475
|
-
let retryCount = 0;
|
|
3476
|
-
const fetchWithRetry = async () => {
|
|
3477
|
-
const response = await timeoutRequest(url, options, timeout);
|
|
3478
|
-
if (!response.ok) {
|
|
3479
|
-
if (response.status == STATUS_CONFLICT) {
|
|
3480
|
-
throw new ConflictError();
|
|
3481
|
-
}
|
|
3482
|
-
retryCount++;
|
|
3483
|
-
// Retry for retries times
|
|
3484
|
-
if (retryCount <= retries) {
|
|
3485
|
-
// Delay by 2 seconds per retryCount
|
|
3486
|
-
const delay = (retryCount + API_RETRY_DELAY_SEC) * 1000;
|
|
3487
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
3488
|
-
return fetchWithRetry();
|
|
3489
|
-
}
|
|
3490
|
-
else {
|
|
3491
|
-
throw new RetryLimitExceededError(response.status, `Request failed after ${retries} retries`);
|
|
3492
|
-
}
|
|
3493
|
-
}
|
|
3494
|
-
return response;
|
|
3495
|
-
};
|
|
3496
|
-
const response = await fetchWithRetry();
|
|
3497
|
-
return response.json();
|
|
3498
|
-
}
|
|
3499
|
-
async function timeoutRequest(url, options = {}, timeout) {
|
|
3500
|
-
const controller = new AbortController();
|
|
3501
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
3502
|
-
options["signal"] = controller.signal;
|
|
3503
|
-
const response = await fetch(url, options);
|
|
3504
|
-
clearTimeout(timeoutId);
|
|
3505
|
-
return response;
|
|
3506
|
-
}
|
|
3507
|
-
|
|
3508
3474
|
/*============================================================================*/
|
|
3509
3475
|
|
|
3510
3476
|
|
|
@@ -6801,6 +6767,14 @@ const shouldValidateProductGroups = () => {
|
|
|
6801
6767
|
const namiCommands = storageService.getNamiConfig()?.namiCommands;
|
|
6802
6768
|
return namiCommands?.includes(VALIDATE_PRODUCT_GROUPS) ?? false;
|
|
6803
6769
|
};
|
|
6770
|
+
const shouldLogHTTPRequests = () => {
|
|
6771
|
+
const namiCommands = storageService.getNamiConfig()?.namiCommands;
|
|
6772
|
+
return namiCommands?.includes(LOG_HTTP_REQUESTS) ?? false;
|
|
6773
|
+
};
|
|
6774
|
+
const shouldLogHTTPTraffic = () => {
|
|
6775
|
+
const namiCommands = storageService.getNamiConfig()?.namiCommands;
|
|
6776
|
+
return namiCommands?.includes(LOG_HTTP_TRAFFIC) ?? false;
|
|
6777
|
+
};
|
|
6804
6778
|
function tryParseJson(str) {
|
|
6805
6779
|
const trimmed = str.trim();
|
|
6806
6780
|
if (!trimmed.startsWith("{") && !trimmed.startsWith("["))
|
|
@@ -6835,6 +6809,57 @@ function base64ToUint8(b64) {
|
|
|
6835
6809
|
return bytes;
|
|
6836
6810
|
}
|
|
6837
6811
|
|
|
6812
|
+
async function withRetry(url, options, timeout = API_TIMEOUT_LIMIT, retries = API_MAX_CALLS_LIMIT) {
|
|
6813
|
+
let retryCount = 0;
|
|
6814
|
+
const logRequests = shouldLogHTTPRequests();
|
|
6815
|
+
const logTraffic = shouldLogHTTPTraffic();
|
|
6816
|
+
const method = options?.method ?? "GET";
|
|
6817
|
+
const fetchWithRetry = async () => {
|
|
6818
|
+
if (logRequests || logTraffic) {
|
|
6819
|
+
logger.debug(`[HTTP] ${method} ${url}`);
|
|
6820
|
+
}
|
|
6821
|
+
if (logTraffic && options?.body) {
|
|
6822
|
+
logger.debug(`[HTTP] Request body: ${options.body}`);
|
|
6823
|
+
}
|
|
6824
|
+
const response = await timeoutRequest(url, options, timeout);
|
|
6825
|
+
if (!response.ok) {
|
|
6826
|
+
if (logTraffic) {
|
|
6827
|
+
const errorBody = await response.clone().text();
|
|
6828
|
+
logger.debug(`[HTTP] Response ${response.status}: ${errorBody}`);
|
|
6829
|
+
}
|
|
6830
|
+
if (response.status == STATUS_CONFLICT) {
|
|
6831
|
+
throw new ConflictError();
|
|
6832
|
+
}
|
|
6833
|
+
retryCount++;
|
|
6834
|
+
// Retry for retries times
|
|
6835
|
+
if (retryCount <= retries) {
|
|
6836
|
+
// Delay by 2 seconds per retryCount
|
|
6837
|
+
const delay = (retryCount + API_RETRY_DELAY_SEC) * 1000;
|
|
6838
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
6839
|
+
return fetchWithRetry();
|
|
6840
|
+
}
|
|
6841
|
+
else {
|
|
6842
|
+
throw new RetryLimitExceededError(response.status, `Request failed after ${retries} retries`);
|
|
6843
|
+
}
|
|
6844
|
+
}
|
|
6845
|
+
if (logTraffic) {
|
|
6846
|
+
const responseBody = await response.clone().text();
|
|
6847
|
+
logger.debug(`[HTTP] Response ${response.status}: ${responseBody}`);
|
|
6848
|
+
}
|
|
6849
|
+
return response;
|
|
6850
|
+
};
|
|
6851
|
+
const response = await fetchWithRetry();
|
|
6852
|
+
return response.json();
|
|
6853
|
+
}
|
|
6854
|
+
async function timeoutRequest(url, options = {}, timeout) {
|
|
6855
|
+
const controller = new AbortController();
|
|
6856
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
6857
|
+
options["signal"] = controller.signal;
|
|
6858
|
+
const response = await fetch(url, options);
|
|
6859
|
+
clearTimeout(timeoutId);
|
|
6860
|
+
return response;
|
|
6861
|
+
}
|
|
6862
|
+
|
|
6838
6863
|
function requirePlatformID(target, propertyKey, descriptor) {
|
|
6839
6864
|
const originalMethod = descriptor.value;
|
|
6840
6865
|
descriptor.value = function (...args) {
|
|
@@ -8250,7 +8275,11 @@ class PaywallRepository {
|
|
|
8250
8275
|
paywalls = await this.getPaywalls(authDevice.id);
|
|
8251
8276
|
}
|
|
8252
8277
|
if (paywalls) {
|
|
8253
|
-
|
|
8278
|
+
const valid = this.validatePaywalls(paywalls);
|
|
8279
|
+
if (valid.length > 0) {
|
|
8280
|
+
storageService.setPaywalls(API_PAYWALLS, valid);
|
|
8281
|
+
}
|
|
8282
|
+
return valid;
|
|
8254
8283
|
}
|
|
8255
8284
|
return paywalls;
|
|
8256
8285
|
}
|
|
@@ -8300,10 +8329,24 @@ class PaywallRepository {
|
|
|
8300
8329
|
}
|
|
8301
8330
|
}
|
|
8302
8331
|
if (paywalls.length > 0) {
|
|
8303
|
-
|
|
8332
|
+
const valid = this.validatePaywalls(paywalls);
|
|
8333
|
+
if (valid.length > 0) {
|
|
8334
|
+
storageService.setPaywalls(API_PAYWALLS, valid);
|
|
8335
|
+
}
|
|
8336
|
+
return valid;
|
|
8304
8337
|
}
|
|
8305
8338
|
return paywalls;
|
|
8306
8339
|
}
|
|
8340
|
+
validatePaywalls(paywalls) {
|
|
8341
|
+
return paywalls.filter((paywall) => {
|
|
8342
|
+
const pages = paywall.template?.pages;
|
|
8343
|
+
if (!Array.isArray(pages) || pages.length === 0) {
|
|
8344
|
+
logger.warn(`Dropping paywall "${paywall.id}" from cache: template.pages is missing or empty`);
|
|
8345
|
+
return false;
|
|
8346
|
+
}
|
|
8347
|
+
return true;
|
|
8348
|
+
});
|
|
8349
|
+
}
|
|
8307
8350
|
fallbackData() {
|
|
8308
8351
|
const storedData = storageService.getPaywalls(API_PAYWALLS)
|
|
8309
8352
|
|| storageService.getPaywalls(INITIAL_PAYWALLS);
|
|
@@ -63762,4 +63805,4 @@ function namiBuySKU(skuRefId) {
|
|
|
63762
63805
|
return result;
|
|
63763
63806
|
}
|
|
63764
63807
|
|
|
63765
|
-
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, 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 };
|
|
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 };
|
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.202604151444",
|
|
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",
|