@extenshi/pay 0.11.0 → 0.12.0

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.
Files changed (41) hide show
  1. package/README.md +11 -1
  2. package/dist/core/extenshi-pay.d.ts +1 -1
  3. package/dist/core/extenshi-pay.d.ts.map +1 -1
  4. package/dist/core.d.mts +6 -3
  5. package/dist/core.d.ts +6 -3
  6. package/dist/core.js +26 -8
  7. package/dist/core.js.map +1 -1
  8. package/dist/core.mjs +26 -9
  9. package/dist/core.mjs.map +1 -1
  10. package/dist/extenshi-pay-lite.js +25 -8
  11. package/dist/extenshi-pay-lite.js.map +1 -1
  12. package/dist/extenshi-pay-lite.min.js +3 -3
  13. package/dist/extenshi-pay-lite.min.js.map +1 -1
  14. package/dist/extenshi-pay-lite.mjs +25 -8
  15. package/dist/extenshi-pay-lite.mjs.map +1 -1
  16. package/dist/extenshi-pay.cjs.js +28 -8
  17. package/dist/extenshi-pay.cjs.js.map +1 -1
  18. package/dist/extenshi-pay.d.ts.map +1 -1
  19. package/dist/extenshi-pay.js +28 -8
  20. package/dist/extenshi-pay.js.map +1 -1
  21. package/dist/extenshi-pay.min.js +3 -3
  22. package/dist/extenshi-pay.min.js.map +1 -1
  23. package/dist/extenshi-pay.min.mjs +3 -3
  24. package/dist/extenshi-pay.min.mjs.map +1 -1
  25. package/dist/extenshi-pay.mjs +28 -9
  26. package/dist/extenshi-pay.mjs.map +1 -1
  27. package/dist/index.d.mts +6 -3
  28. package/dist/index.d.ts +6 -3
  29. package/dist/lite.d.mts +4 -2
  30. package/dist/lite.d.ts +4 -2
  31. package/dist/payment/entitlement.d.ts.map +1 -1
  32. package/dist/paywall.js +2 -2
  33. package/dist/paywall.js.map +1 -1
  34. package/dist/paywall.mjs +2 -2
  35. package/dist/paywall.mjs.map +1 -1
  36. package/dist/types/contract.d.ts +1 -0
  37. package/dist/types/contract.d.ts.map +1 -1
  38. package/dist/types/entitlement.d.ts +2 -0
  39. package/dist/types/entitlement.d.ts.map +1 -1
  40. package/dist/version.d.ts +1 -1
  41. package/package.json +1 -1
package/README.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  Payments for browser extensions, bundled into the extension itself.
6
6
 
7
+ **Extenshi Pay is in beta.** You can prepare your integration and test the paywall in mock mode.
8
+ Seller agreement acceptance and live payments are currently unavailable to third-party developers.
9
+
7
10
  - **You are the seller.** Money settles on your own Stripe account (Stripe Connect). extenshi keeps the payment ledger and takes 2% per charge on top of Stripe's fee.
8
11
  - **Bundled, no iframe, no remote code.** The paywall is rendered from templates compiled into the SDK and shown in a Shadow DOM. Nothing is fetched at runtime except the JSON API, supporting an extension’s restrictive `content_security_policy`. Store approval depends on the whole extension and is not guaranteed.
9
12
  - **Anonymous until the payment.** The SDK mints a random `endUserRef` on first run and stores it in `chrome.storage.local`. No account, no e-mail, no fingerprint. The buyer authenticates inside the hosted checkout, never in your extension.
@@ -58,6 +61,13 @@ await pay.getEntitlement() // { items, features, verified, source, … }
58
61
  pay.onEntitlementChange((e) => render(e))
59
62
  ```
60
63
 
64
+ ### Free access by country
65
+
66
+ In Dojo, open the Pay application's **Offers → Free access by country**. Selected countries get the features of all active offers. The server uses the country of the current connection at each licence check. A missing country or an empty selection uses ordinary billing. The trial clock keeps running. Existing subscriptions keep their billing terms.
67
+
68
+ Use `hasFeature(feature)` or `requireFeature(feature)` to unlock tools. SDK 0.12 and later exposes the regional grant's expiry in `getEntitlement().regionalFreeUntil` (Unix milliseconds). `isPaid()` and `items` describe purchases. Regional access can continue offline until its signed deadline, up to 48 hours. Older SDKs expose the regional grant as a temporary entitlement item.
69
+
70
+
61
71
  The envelope is cached in `chrome.storage.local` (default refresh TTL 1 h). Paid
62
72
  access requires a valid Ed25519 signature. Unsigned, modified or unverifiable
63
73
  responses never unlock features outside explicit `mock: true` mode. A missing key
@@ -163,7 +173,7 @@ pay.on('trial:ended', () => pay.showTrialEnded({ feedbackFormUrl: 'https://feedb
163
173
  - `getTrial()` reads the verified license only, so it answers offline from the cache. Like paid
164
174
  access, `active` needs a license check within 48 hours (`requiresOnlineCheck` says when one is
165
175
  due), and the signed issue time is a floor, so turning the clock back does not reopen an ended
166
- trial. `isPaid()` and `hasFeature()` stay purchase-only.
176
+ trial. Check trial access separately from feature access.
167
177
  - `trial:ending` and `trial:ended` (the `trialEnding` / `trialEnded` of the spec, named like the
168
178
  other `ns:verb` events) fire once per installation and trial; the marker is kept in the SDK's
169
179
  storage, so a popup opened later does not repeat them. They do not fire while the user has
@@ -34,7 +34,7 @@ export interface ExtenshiPayDeps {
34
34
  now?: () => number;
35
35
  }
36
36
  export declare class ExtenshiPayLite {
37
- static readonly version = "0.11.0";
37
+ static readonly version = "0.12.0";
38
38
  protected readonly config: ResolvedConfig;
39
39
  protected readonly emitter: EventEmitter<ExtenshiPayEvents>;
40
40
  protected readonly storage: StorageAdapter;
@@ -1 +1 @@
1
- {"version":3,"file":"extenshi-pay.d.ts","sourceRoot":"","sources":["../../src/core/extenshi-pay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAqB,MAAM,2BAA2B,CAAA;AAEjF,OAAO,EAAyB,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAI/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,KAAK,EACX,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,UAAU,EACV,MAAM,yBAAyB,CAAA;AAChC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;IAiCrF,EAAE,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAIrG,IAAI,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAIvG,GAAG,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAIhG,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,MAAM,IAAI;IAI1D,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC,oDAAoD;IACpD,OAAO,IAAI,IAAI;IAQf,+EAA+E;IAC/E,SAAS,CAAC,UAAU,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmB9D,OAAO,KAAK,mBAAmB,GAE9B;YAEa,kBAAkB;IAShC;;;OAGG;YACW,iBAAiB;IAW/B;;;;OAIG;YACW,qBAAqB;IAgBnC,OAAO,KAAK,aAAa,GAExB;IAED,sFAAsF;YACxE,kBAAkB;IAUhC,gGAAgG;YAClF,kBAAkB;IAYhC,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB;CAMvD"}
package/dist/core.d.mts CHANGED
@@ -49,6 +49,7 @@ interface PayOfferDto {
49
49
  description: string | null;
50
50
  features: string[];
51
51
  }
52
+ declare const PAY_REGIONAL_ACCESS_SKU = "@regional-free";
52
53
  interface PayOfferResponse {
53
54
  /** Optional during rolling upgrades; never infer this from the project name. */
54
55
  seller?: PaySellerPublic | null;
@@ -428,6 +429,8 @@ interface Entitlement {
428
429
  items: PayEntitlementItem[];
429
430
  /** Union of `features[]` over active/grace items. */
430
431
  features: string[];
432
+ /** Signed expiry of regional free access, independent of any purchase. */
433
+ regionalFreeUntil?: number;
431
434
  /** True only when the Ed25519 signature was checked against the project's key. */
432
435
  verified: boolean;
433
436
  issuedAt: string | null;
@@ -983,7 +986,7 @@ declare class Logger {
983
986
  declare const logger: Logger;
984
987
 
985
988
  /** Kept in sync with package.json by tests/unit/version.test.ts. */
986
- declare const VERSION = "0.11.0";
989
+ declare const VERSION = "0.12.0";
987
990
 
988
991
  /** Same shape the BFF accepts (`en`, `de-DE`, `zh-Hant`). */
989
992
  declare const LOCALE_RE: RegExp;
@@ -1024,7 +1027,7 @@ interface ExtenshiPayDeps {
1024
1027
  now?: () => number;
1025
1028
  }
1026
1029
  declare class ExtenshiPayLite {
1027
- static readonly version = "0.11.0";
1030
+ static readonly version = "0.12.0";
1028
1031
  protected readonly config: ResolvedConfig;
1029
1032
  protected readonly emitter: EventEmitter<ExtenshiPayEvents>;
1030
1033
  protected readonly storage: StorageAdapter;
@@ -1165,5 +1168,5 @@ declare const END_USER_REF_STORAGE_KEY = "extenshi-pay:endUserRef";
1165
1168
  declare function mintEndUserRef(): string;
1166
1169
  declare function getOrCreateEndUserRef(storage: StorageAdapter): Promise<string>;
1167
1170
 
1168
- export { CHECKOUT_POLL_INTERVAL_MS, CHECKOUT_TIMEOUT_MS, CheckoutManager, CloudBackup, DEFAULT_API_URL, DEFAULT_CACHE_TTL_MS, DEFAULT_TRIAL_ENDING_DAYS, EMPTY_ENTITLEMENT, END_USER_REF_STORAGE_KEY, ERROR_CODES, EntitlementManager, EventEmitter, ExtenshiPayError, ExtenshiPayLite, ExtensionStorage, HttpTransport, LOCALE_RE, LocalStorageAdapter, Logger, MAX_CACHE_TTL_MS, MAX_REFRESH_BACKOFF_MS, MIN_REFRESH_INTERVAL_MS, MemoryStorage, MockTransport, PAY_CONTRACT_VERSION, PAY_CURRENCIES, PAY_END_USER_REF_RE, PAY_ENTITLEMENT_STATUSES, PAY_ERRORS, PAY_GATEWAYS, PAY_OFFER_INTERVALS, PAY_OFFER_KINDS, PAY_PUBLISHABLE_KEY_HEX_LENGTH, PAY_PUBLISHABLE_KEY_PREFIX, PAY_RESTORE_PURPOSES, PAY_SKU_RE, PAY_WITHDRAWAL_WAIVER_VERSION, PayApi, RecoveryManager, STORAGE_TOKEN_RE, TRPC_PATH, VERSION, applyLocalExpiry, base64ToBytes, canonicalJson, checkFeatures, collectFeatures, createRecoveryStorage, createStorage, createSyncStorage, getOrCreateEndUserRef, hasFeature, isEntitled, isLive, isPayPublishableKey, logger, mintEndUserRef, openInNewTab, resolveConfig, trpcErrorToPayError, verifyEntitlementSignature };
1171
+ export { CHECKOUT_POLL_INTERVAL_MS, CHECKOUT_TIMEOUT_MS, CheckoutManager, CloudBackup, DEFAULT_API_URL, DEFAULT_CACHE_TTL_MS, DEFAULT_TRIAL_ENDING_DAYS, EMPTY_ENTITLEMENT, END_USER_REF_STORAGE_KEY, ERROR_CODES, EntitlementManager, EventEmitter, ExtenshiPayError, ExtenshiPayLite, ExtensionStorage, HttpTransport, LOCALE_RE, LocalStorageAdapter, Logger, MAX_CACHE_TTL_MS, MAX_REFRESH_BACKOFF_MS, MIN_REFRESH_INTERVAL_MS, MemoryStorage, MockTransport, PAY_CONTRACT_VERSION, PAY_CURRENCIES, PAY_END_USER_REF_RE, PAY_ENTITLEMENT_STATUSES, PAY_ERRORS, PAY_GATEWAYS, PAY_OFFER_INTERVALS, PAY_OFFER_KINDS, PAY_PUBLISHABLE_KEY_HEX_LENGTH, PAY_PUBLISHABLE_KEY_PREFIX, PAY_REGIONAL_ACCESS_SKU, PAY_RESTORE_PURPOSES, PAY_SKU_RE, PAY_WITHDRAWAL_WAIVER_VERSION, PayApi, RecoveryManager, STORAGE_TOKEN_RE, TRPC_PATH, VERSION, applyLocalExpiry, base64ToBytes, canonicalJson, checkFeatures, collectFeatures, createRecoveryStorage, createStorage, createSyncStorage, getOrCreateEndUserRef, hasFeature, isEntitled, isLive, isPayPublishableKey, logger, mintEndUserRef, openInNewTab, resolveConfig, trpcErrorToPayError, verifyEntitlementSignature };
1169
1172
  export type { CheckoutManagerOptions, CheckoutOptions, CheckoutResult, CheckoutState, ClockSkew, CloudBackupOptions, CloudBackupState, CustomerPortalOptions, Entitlement, EntitlementManagerOptions, EntitlementSource, Environment, ErrorCode, ExtenshiPayConfig, ExtenshiPayDeps, ExtenshiPayErrorOptions, ExtenshiPayEventName, ExtenshiPayEvents, GetEntitlementOptions, HttpTransportOptions, LicenseSummary, Listener, LogLevel, MockData, PayCheckoutClaim, PayCheckoutSession, PayCurrency, PayEntitlementItem, PayEntitlementPayload, PayEntitlementStatus, PayErrorCode, PayGatewayId, PayOfferDto, PayOfferInterval, PayOfferKind, PayOfferResponse, PayPortalAccount, PayPortalResponse, PayRestoreClaimResponse, PayRestorePurpose, PayRestoreSessionResponse, PaySellerPublic, PayStorageGrant, PayTrial, PayWithdrawalWaiver, PaywallMode, PaywallOptions, PaywallStrings, ProcedureKind, RecoveryManagerOptions, RequireFeatureOptions, ResolvedConfig, RestoreOptions, RestoreResult, SignatureVerdict, SignedEntitlement, StorageAdapter, ThemeConfig, Transport, TrialEndedOptions, TrialState, UpgradeConsent, WithdrawalWaiverConsent };
package/dist/core.d.ts CHANGED
@@ -49,6 +49,7 @@ interface PayOfferDto {
49
49
  description: string | null;
50
50
  features: string[];
51
51
  }
52
+ declare const PAY_REGIONAL_ACCESS_SKU = "@regional-free";
52
53
  interface PayOfferResponse {
53
54
  /** Optional during rolling upgrades; never infer this from the project name. */
54
55
  seller?: PaySellerPublic | null;
@@ -428,6 +429,8 @@ interface Entitlement {
428
429
  items: PayEntitlementItem[];
429
430
  /** Union of `features[]` over active/grace items. */
430
431
  features: string[];
432
+ /** Signed expiry of regional free access, independent of any purchase. */
433
+ regionalFreeUntil?: number;
431
434
  /** True only when the Ed25519 signature was checked against the project's key. */
432
435
  verified: boolean;
433
436
  issuedAt: string | null;
@@ -983,7 +986,7 @@ declare class Logger {
983
986
  declare const logger: Logger;
984
987
 
985
988
  /** Kept in sync with package.json by tests/unit/version.test.ts. */
986
- declare const VERSION = "0.11.0";
989
+ declare const VERSION = "0.12.0";
987
990
 
988
991
  /** Same shape the BFF accepts (`en`, `de-DE`, `zh-Hant`). */
989
992
  declare const LOCALE_RE: RegExp;
@@ -1024,7 +1027,7 @@ interface ExtenshiPayDeps {
1024
1027
  now?: () => number;
1025
1028
  }
1026
1029
  declare class ExtenshiPayLite {
1027
- static readonly version = "0.11.0";
1030
+ static readonly version = "0.12.0";
1028
1031
  protected readonly config: ResolvedConfig;
1029
1032
  protected readonly emitter: EventEmitter<ExtenshiPayEvents>;
1030
1033
  protected readonly storage: StorageAdapter;
@@ -1165,5 +1168,5 @@ declare const END_USER_REF_STORAGE_KEY = "extenshi-pay:endUserRef";
1165
1168
  declare function mintEndUserRef(): string;
1166
1169
  declare function getOrCreateEndUserRef(storage: StorageAdapter): Promise<string>;
1167
1170
 
1168
- export { CHECKOUT_POLL_INTERVAL_MS, CHECKOUT_TIMEOUT_MS, CheckoutManager, CloudBackup, DEFAULT_API_URL, DEFAULT_CACHE_TTL_MS, DEFAULT_TRIAL_ENDING_DAYS, EMPTY_ENTITLEMENT, END_USER_REF_STORAGE_KEY, ERROR_CODES, EntitlementManager, EventEmitter, ExtenshiPayError, ExtenshiPayLite, ExtensionStorage, HttpTransport, LOCALE_RE, LocalStorageAdapter, Logger, MAX_CACHE_TTL_MS, MAX_REFRESH_BACKOFF_MS, MIN_REFRESH_INTERVAL_MS, MemoryStorage, MockTransport, PAY_CONTRACT_VERSION, PAY_CURRENCIES, PAY_END_USER_REF_RE, PAY_ENTITLEMENT_STATUSES, PAY_ERRORS, PAY_GATEWAYS, PAY_OFFER_INTERVALS, PAY_OFFER_KINDS, PAY_PUBLISHABLE_KEY_HEX_LENGTH, PAY_PUBLISHABLE_KEY_PREFIX, PAY_RESTORE_PURPOSES, PAY_SKU_RE, PAY_WITHDRAWAL_WAIVER_VERSION, PayApi, RecoveryManager, STORAGE_TOKEN_RE, TRPC_PATH, VERSION, applyLocalExpiry, base64ToBytes, canonicalJson, checkFeatures, collectFeatures, createRecoveryStorage, createStorage, createSyncStorage, getOrCreateEndUserRef, hasFeature, isEntitled, isLive, isPayPublishableKey, logger, mintEndUserRef, openInNewTab, resolveConfig, trpcErrorToPayError, verifyEntitlementSignature };
1171
+ export { CHECKOUT_POLL_INTERVAL_MS, CHECKOUT_TIMEOUT_MS, CheckoutManager, CloudBackup, DEFAULT_API_URL, DEFAULT_CACHE_TTL_MS, DEFAULT_TRIAL_ENDING_DAYS, EMPTY_ENTITLEMENT, END_USER_REF_STORAGE_KEY, ERROR_CODES, EntitlementManager, EventEmitter, ExtenshiPayError, ExtenshiPayLite, ExtensionStorage, HttpTransport, LOCALE_RE, LocalStorageAdapter, Logger, MAX_CACHE_TTL_MS, MAX_REFRESH_BACKOFF_MS, MIN_REFRESH_INTERVAL_MS, MemoryStorage, MockTransport, PAY_CONTRACT_VERSION, PAY_CURRENCIES, PAY_END_USER_REF_RE, PAY_ENTITLEMENT_STATUSES, PAY_ERRORS, PAY_GATEWAYS, PAY_OFFER_INTERVALS, PAY_OFFER_KINDS, PAY_PUBLISHABLE_KEY_HEX_LENGTH, PAY_PUBLISHABLE_KEY_PREFIX, PAY_REGIONAL_ACCESS_SKU, PAY_RESTORE_PURPOSES, PAY_SKU_RE, PAY_WITHDRAWAL_WAIVER_VERSION, PayApi, RecoveryManager, STORAGE_TOKEN_RE, TRPC_PATH, VERSION, applyLocalExpiry, base64ToBytes, canonicalJson, checkFeatures, collectFeatures, createRecoveryStorage, createStorage, createSyncStorage, getOrCreateEndUserRef, hasFeature, isEntitled, isLive, isPayPublishableKey, logger, mintEndUserRef, openInNewTab, resolveConfig, trpcErrorToPayError, verifyEntitlementSignature };
1169
1172
  export type { CheckoutManagerOptions, CheckoutOptions, CheckoutResult, CheckoutState, ClockSkew, CloudBackupOptions, CloudBackupState, CustomerPortalOptions, Entitlement, EntitlementManagerOptions, EntitlementSource, Environment, ErrorCode, ExtenshiPayConfig, ExtenshiPayDeps, ExtenshiPayErrorOptions, ExtenshiPayEventName, ExtenshiPayEvents, GetEntitlementOptions, HttpTransportOptions, LicenseSummary, Listener, LogLevel, MockData, PayCheckoutClaim, PayCheckoutSession, PayCurrency, PayEntitlementItem, PayEntitlementPayload, PayEntitlementStatus, PayErrorCode, PayGatewayId, PayOfferDto, PayOfferInterval, PayOfferKind, PayOfferResponse, PayPortalAccount, PayPortalResponse, PayRestoreClaimResponse, PayRestorePurpose, PayRestoreSessionResponse, PaySellerPublic, PayStorageGrant, PayTrial, PayWithdrawalWaiver, PaywallMode, PaywallOptions, PaywallStrings, ProcedureKind, RecoveryManagerOptions, RequireFeatureOptions, ResolvedConfig, RestoreOptions, RestoreResult, SignatureVerdict, SignedEntitlement, StorageAdapter, ThemeConfig, Transport, TrialEndedOptions, TrialState, UpgradeConsent, WithdrawalWaiverConsent };
package/dist/core.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * ExtenshiPay SDK v0.11.0
2
+ * ExtenshiPay SDK v0.12.0
3
3
  * (c) 2026 Extenshi.io
4
4
  * Released under the MIT License.
5
- * commit ed0f776ae9ab7ce6b2c614dbdfe696e9007b0d05 · built by `rollup -c`
5
+ * commit 7f4b4e98165b3c8eb11e100b3855fee1ade7aaab · built by `rollup -c`
6
6
  */
7
7
  (function (global, factory) {
8
8
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -52,6 +52,8 @@
52
52
  * none — never had it
53
53
  */
54
54
  const PAY_ENTITLEMENT_STATUSES = ['active', 'grace', 'expired', 'none'];
55
+ // Outside the seller SKU grammar. Issued only in a signed projection, never in the sales ledger.
56
+ const PAY_REGIONAL_ACCESS_SKU = '@regional-free';
55
57
  /**
56
58
  * Version of the buyer-facing withdrawal waiver text the paywall shows (EU/EEA
57
59
  * digital content, Directive 2011/83/EU art. 16(m); UK CCR 2013 reg. 37). The
@@ -1407,7 +1409,13 @@
1407
1409
  }
1408
1410
  fingerprint() {
1409
1411
  const state = this.snapshot();
1410
- return canonicalJson({ items: state.items, requiresOnlineCheck: state.requiresOnlineCheck });
1412
+ return canonicalJson({
1413
+ items: state.items,
1414
+ requiresOnlineCheck: state.requiresOnlineCheck,
1415
+ ...(state.regionalFreeUntil
1416
+ ? { regionalFreeUntil: state.regionalFreeUntil, features: state.features }
1417
+ : {}),
1418
+ });
1411
1419
  }
1412
1420
  notifyIfChanged() {
1413
1421
  const fingerprint = this.fingerprint();
@@ -1440,8 +1448,11 @@
1440
1448
  source: this.held.source,
1441
1449
  };
1442
1450
  }
1443
- const items = applyLocalExpiry(JSON.parse(JSON.stringify(this.held.envelope.payload.entitlements)), this.now());
1444
- const hasPaidAccess = collectFeatures(items).length > 0 ||
1451
+ const grants = applyLocalExpiry(JSON.parse(JSON.stringify(this.held.envelope.payload.entitlements)), this.now());
1452
+ const regional = grants.find((grant) => grant.sku === PAY_REGIONAL_ACCESS_SKU && grant.status === 'active');
1453
+ const items = grants.filter((grant) => grant.sku !== PAY_REGIONAL_ACCESS_SKU);
1454
+ const hasPaidAccess = grants.some((grant) => grant.sku === PAY_REGIONAL_ACCESS_SKU) ||
1455
+ collectFeatures(items).length > 0 ||
1445
1456
  items.some((item) => item.status === 'active' || item.status === 'grace');
1446
1457
  const offlineUntil = this.source === 'mock' || !hasPaidAccess ? null : this.offlineDeadline();
1447
1458
  const requiresOnlineCheck = offlineUntil !== null &&
@@ -1451,7 +1462,10 @@
1451
1462
  this.now() + MAX_CLOCK_SKEW_MS < Date.parse(this.held.envelope.payload.issuedAt));
1452
1463
  return {
1453
1464
  items,
1454
- features: requiresOnlineCheck ? [] : collectFeatures(items),
1465
+ features: requiresOnlineCheck ? [] : collectFeatures(grants),
1466
+ ...(regional?.expiresAt && !requiresOnlineCheck
1467
+ ? { regionalFreeUntil: Date.parse(regional.expiresAt) }
1468
+ : {}),
1455
1469
  requiresOnlineCheck,
1456
1470
  offlineUntil,
1457
1471
  clockSkew: this.clockSkew,
@@ -1703,7 +1717,7 @@
1703
1717
  const DEFAULT_TRIAL_ENDING_DAYS = 2;
1704
1718
 
1705
1719
  /** Kept in sync with package.json by tests/unit/version.test.ts. */
1706
- const VERSION = '0.11.0';
1720
+ const VERSION = '0.12.0';
1707
1721
 
1708
1722
  /**
1709
1723
  * The user's language as the SDK sends it. Kept apart from the paywall
@@ -2014,7 +2028,10 @@
2014
2028
  endingDays: this.config.trialEndingDays,
2015
2029
  getTrial: () => this.entitlements.getTrial(),
2016
2030
  // A paid license still counts while it waits for an online check: no "trial ended" to a buyer.
2017
- hasPaidAccess: () => (this.entitlements.getCached()?.items ?? []).some(isLive),
2031
+ hasPaidAccess: () => {
2032
+ const license = this.entitlements.getCached();
2033
+ return Boolean(license?.regionalFreeUntil || license?.items.some(isLive));
2034
+ },
2018
2035
  emit: (event, trial) => this.emitter.emit(event, trial),
2019
2036
  now: this.now,
2020
2037
  });
@@ -2486,6 +2503,7 @@
2486
2503
  exports.PAY_OFFER_KINDS = PAY_OFFER_KINDS;
2487
2504
  exports.PAY_PUBLISHABLE_KEY_HEX_LENGTH = PAY_PUBLISHABLE_KEY_HEX_LENGTH;
2488
2505
  exports.PAY_PUBLISHABLE_KEY_PREFIX = PAY_PUBLISHABLE_KEY_PREFIX;
2506
+ exports.PAY_REGIONAL_ACCESS_SKU = PAY_REGIONAL_ACCESS_SKU;
2489
2507
  exports.PAY_RESTORE_PURPOSES = PAY_RESTORE_PURPOSES;
2490
2508
  exports.PAY_SKU_RE = PAY_SKU_RE;
2491
2509
  exports.PAY_WITHDRAWAL_WAIVER_VERSION = PAY_WITHDRAWAL_WAIVER_VERSION;