@extenshi/pay 0.7.1 → 0.9.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.
- package/README.md +16 -10
- package/dist/api/mock.d.ts +4 -0
- package/dist/api/mock.d.ts.map +1 -1
- package/dist/api/pay-api.d.ts +10 -3
- package/dist/api/pay-api.d.ts.map +1 -1
- package/dist/api/transport.d.ts.map +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/extenshi-pay.d.ts +21 -2
- package/dist/core/extenshi-pay.d.ts.map +1 -1
- package/dist/core/locale.d.ts +13 -0
- package/dist/core/locale.d.ts.map +1 -0
- package/dist/core.d.mts +219 -113
- package/dist/core.d.ts +219 -113
- package/dist/core.js +204 -14
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +204 -15
- package/dist/core.mjs.map +1 -1
- package/dist/extenshi-pay-lite.js +204 -14
- package/dist/extenshi-pay-lite.js.map +1 -1
- package/dist/extenshi-pay-lite.min.js +3 -2
- package/dist/extenshi-pay-lite.min.js.map +1 -1
- package/dist/extenshi-pay-lite.mjs +204 -15
- package/dist/extenshi-pay-lite.mjs.map +1 -1
- package/dist/extenshi-pay.cjs.js +1386 -191
- package/dist/extenshi-pay.cjs.js.map +1 -1
- package/dist/extenshi-pay.d.ts.map +1 -1
- package/dist/extenshi-pay.js +1386 -191
- package/dist/extenshi-pay.js.map +1 -1
- package/dist/extenshi-pay.min.js +3 -2
- package/dist/extenshi-pay.min.js.map +1 -1
- package/dist/extenshi-pay.min.mjs +3 -2
- package/dist/extenshi-pay.min.mjs.map +1 -1
- package/dist/extenshi-pay.mjs +1383 -192
- package/dist/extenshi-pay.mjs.map +1 -1
- package/dist/index.d.mts +287 -117
- package/dist/index.d.ts +287 -117
- package/dist/lite.d.mts +188 -83
- package/dist/lite.d.ts +188 -83
- package/dist/lite.d.ts.map +1 -1
- package/dist/payment/checkout.d.ts.map +1 -1
- package/dist/payment/recovery.d.ts +2 -0
- package/dist/payment/recovery.d.ts.map +1 -1
- package/dist/payment/withdrawal-waiver.d.ts +26 -0
- package/dist/payment/withdrawal-waiver.d.ts.map +1 -0
- package/dist/paywall/billing-profile-picker.d.ts +1 -1
- package/dist/paywall/billing-profile-picker.d.ts.map +1 -1
- package/dist/paywall/i18n.d.ts +94 -0
- package/dist/paywall/i18n.d.ts.map +1 -0
- package/dist/paywall/icon.d.ts +18 -0
- package/dist/paywall/icon.d.ts.map +1 -0
- package/dist/paywall/index.d.ts +2 -1
- package/dist/paywall/index.d.ts.map +1 -1
- package/dist/paywall/license-panel.d.ts +4 -1
- package/dist/paywall/license-panel.d.ts.map +1 -1
- package/dist/paywall/renderer.d.ts +24 -2
- package/dist/paywall/renderer.d.ts.map +1 -1
- package/dist/paywall/seller-details.d.ts +2 -1
- package/dist/paywall/seller-details.d.ts.map +1 -1
- package/dist/paywall/strings.d.ts +6 -4
- package/dist/paywall/strings.d.ts.map +1 -1
- package/dist/paywall.d.mts +113 -8
- package/dist/paywall.d.ts +113 -8
- package/dist/paywall.js +1068 -51
- package/dist/paywall.js.map +1 -1
- package/dist/paywall.mjs +1066 -52
- package/dist/paywall.mjs.map +1 -1
- package/dist/types/config.d.ts +6 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/contract.d.ts +25 -0
- package/dist/types/contract.d.ts.map +1 -1
- package/dist/types/entitlement.d.ts +22 -0
- package/dist/types/entitlement.d.ts.map +1 -1
- package/dist/types/errors.d.ts +1 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/paywall.d.ts +27 -3
- package/dist/types/paywall.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/dist/core.esm.js +0 -1681
- package/dist/core.esm.js.map +0 -1
- package/dist/extenshi-pay-lite.esm.js +0 -1664
- package/dist/extenshi-pay-lite.esm.js.map +0 -1
- package/dist/extenshi-pay.esm.js +0 -2496
- package/dist/extenshi-pay.esm.js.map +0 -1
- package/dist/extenshi-pay.esm.min.js +0 -7
- package/dist/extenshi-pay.esm.min.js.map +0 -1
- package/dist/paywall.esm.js +0 -442
- package/dist/paywall.esm.js.map +0 -1
package/dist/lite.d.mts
CHANGED
|
@@ -52,6 +52,28 @@ interface PayOfferResponse {
|
|
|
52
52
|
offers: PayOfferDto[];
|
|
53
53
|
/** Base64 Ed25519 public key for `SignedEntitlement.signature`; null when unsigned. */
|
|
54
54
|
entitlementPublicKey: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* The language the offers' text is in when the seller translated them
|
|
57
|
+
* (it. 13 T10 L2); absent from older servers and for single-language offers.
|
|
58
|
+
*/
|
|
59
|
+
locale?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Set when the paywall must show an unticked withdrawal-waiver checkbox and
|
|
62
|
+
* send the accepted `version` with `createCheckout`. Null when the seller
|
|
63
|
+
* attested the extension is not distributed in the EEA/UK; absent from
|
|
64
|
+
* older servers (the SDK then shows no checkbox).
|
|
65
|
+
*/
|
|
66
|
+
withdrawalWaiver?: PayWithdrawalWaiver | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Version of the buyer-facing withdrawal waiver text the paywall shows (EU/EEA
|
|
70
|
+
* digital content, Directive 2011/83/EU art. 16(m); UK CCR 2013 reg. 37). The
|
|
71
|
+
* text itself lives in the SDK dictionary under the same version; bump both
|
|
72
|
+
* together so a recorded consent always names the words the buyer saw.
|
|
73
|
+
*/
|
|
74
|
+
declare const PAY_WITHDRAWAL_WAIVER_VERSION = "2026-10-v1";
|
|
75
|
+
interface PayWithdrawalWaiver {
|
|
76
|
+
version: string;
|
|
55
77
|
}
|
|
56
78
|
interface PayEntitlementItem {
|
|
57
79
|
/** Optional for old signed caches and older servers. */
|
|
@@ -134,6 +156,8 @@ interface PaySellerPublic {
|
|
|
134
156
|
/** HTTPS support page or plain email address. */
|
|
135
157
|
supportUrl: string;
|
|
136
158
|
termsUrl: string | null;
|
|
159
|
+
/** Optional for older servers: refunds section of the license terms. */
|
|
160
|
+
refundPolicyUrl?: string | null;
|
|
137
161
|
}
|
|
138
162
|
|
|
139
163
|
declare const ERROR_CODES: {
|
|
@@ -150,6 +174,7 @@ declare const ERROR_CODES: {
|
|
|
150
174
|
readonly GATEWAY_UNAVAILABLE: "GATEWAY_UNAVAILABLE";
|
|
151
175
|
readonly CHECKOUT_UNAVAILABLE: "CHECKOUT_UNAVAILABLE";
|
|
152
176
|
readonly PAYWALL_UNAVAILABLE: "PAYWALL_UNAVAILABLE";
|
|
177
|
+
readonly WITHDRAWAL_WAIVER_REQUIRED: "WITHDRAWAL_WAIVER_REQUIRED";
|
|
153
178
|
readonly UNKNOWN: "UNKNOWN";
|
|
154
179
|
};
|
|
155
180
|
type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
@@ -188,6 +213,11 @@ interface MockData {
|
|
|
188
213
|
checkoutEnabled?: boolean;
|
|
189
214
|
/** How many `claimSession` polls answer `pending` before a mock checkout completes (default 1). */
|
|
190
215
|
claimAfterPolls?: number;
|
|
216
|
+
/**
|
|
217
|
+
* Offer's withdrawal waiver (default: required, current version, so the
|
|
218
|
+
* paywall previews the checkbox). `null` previews a seller outside the EEA/UK.
|
|
219
|
+
*/
|
|
220
|
+
withdrawalWaiver?: PayWithdrawalWaiver | null;
|
|
191
221
|
}
|
|
192
222
|
interface ExtenshiPayConfig {
|
|
193
223
|
/** `pk_ext_` + 32 hex characters, from the project's Monetization tab. */
|
|
@@ -224,84 +254,12 @@ interface ResolvedConfig {
|
|
|
224
254
|
theme: ThemeConfig;
|
|
225
255
|
}
|
|
226
256
|
|
|
257
|
+
type PaywallMode = 'modal' | 'inline' | 'sidebar' | 'fullscreen' | 'minimal';
|
|
227
258
|
/**
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* so no preflight); mutations POST a JSON body. The only things that leave the
|
|
232
|
-
* extension are payment inputs and optional recovery session/proof inputs
|
|
233
|
-
* and the browser's standard headers — `credentials: 'omit'` keeps cookies out.
|
|
234
|
-
* Queries are retried on network / 5xx errors; mutations never are.
|
|
235
|
-
*/
|
|
236
|
-
|
|
237
|
-
type ProcedureKind = 'query' | 'mutation';
|
|
238
|
-
interface Transport {
|
|
239
|
-
call<T>(procedure: string, kind: ProcedureKind, input: Record<string, unknown>): Promise<T>;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* In-memory stand-in for the BFF, used when `mock: true`. Lets an extension be
|
|
244
|
-
* developed with no backend: offers and entitlements come from `mockData`, a
|
|
245
|
-
* mock checkout completes after `claimAfterPolls` polls and grants the SKU.
|
|
246
|
-
*/
|
|
247
|
-
|
|
248
|
-
type SessionState = 'open' | 'complete' | 'canceled' | 'expired';
|
|
249
|
-
interface MockSession {
|
|
250
|
-
sku: string;
|
|
251
|
-
polls: number;
|
|
252
|
-
state: SessionState;
|
|
253
|
-
}
|
|
254
|
-
declare class MockTransport implements Transport {
|
|
255
|
-
private entitlements;
|
|
256
|
-
private readonly offers;
|
|
257
|
-
private readonly projectName;
|
|
258
|
-
private readonly checkoutEnabled;
|
|
259
|
-
private readonly claimAfterPolls;
|
|
260
|
-
readonly sessions: Map<string, MockSession>;
|
|
261
|
-
constructor(data?: MockData);
|
|
262
|
-
call<T>(procedure: string, _kind: ProcedureKind, input: Record<string, unknown>): Promise<T>;
|
|
263
|
-
/** Test/dev helpers. */
|
|
264
|
-
setEntitlements(items: PayEntitlementItem[]): void;
|
|
265
|
-
cancelSession(sessionId: string): void;
|
|
266
|
-
expireSession(sessionId: string): void;
|
|
267
|
-
private offerResponse;
|
|
268
|
-
private createCheckout;
|
|
269
|
-
private claim;
|
|
270
|
-
private grant;
|
|
271
|
-
private envelope;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/** Typed wrapper over the SDK-facing `pay.*` procedures. Nothing else is ever called. */
|
|
275
|
-
|
|
276
|
-
declare class PayApi {
|
|
277
|
-
private readonly transport;
|
|
278
|
-
private readonly publishableKey;
|
|
279
|
-
constructor(transport: Transport, publishableKey: string);
|
|
280
|
-
createRestoreSession(claimChallenge: string): Promise<PayRestoreSessionResponse>;
|
|
281
|
-
claimRestoreSession(sessionId: string, claimSecret: string): Promise<PayRestoreClaimResponse>;
|
|
282
|
-
getOffer(locale?: string | null): Promise<PayOfferResponse>;
|
|
283
|
-
createCheckout(sku: string, endUserRef: string, locale?: string | null): Promise<PayCheckoutSession>;
|
|
284
|
-
claimSession(sessionId: string, endUserRef: string): Promise<PayCheckoutClaim>;
|
|
285
|
-
getEntitlement(endUserRef: string): Promise<SignedEntitlement>;
|
|
286
|
-
getPortalUrl(endUserRef: string, customerId?: string): Promise<PayPortalResponse>;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Persistent key/value storage for the SDK's own namespace.
|
|
291
|
-
*
|
|
292
|
-
* Preference order: `chrome.storage.local` (Chrome/Edge), `browser.storage.local`
|
|
293
|
-
* (Firefox), `localStorage` (non-extension contexts such as a dev page), then
|
|
294
|
-
* memory. Both promise-returning (MV3, Firefox) and callback-only (MV2) storage
|
|
295
|
-
* APIs are supported.
|
|
259
|
+
* Every user-visible string the paywall adds on top of the templates. The SDK
|
|
260
|
+
* fills them in the configured `locale` (src/paywall/i18n.ts); pass `strings`
|
|
261
|
+
* to override any of them.
|
|
296
262
|
*/
|
|
297
|
-
interface StorageAdapter {
|
|
298
|
-
get(key: string): Promise<unknown>;
|
|
299
|
-
set(key: string, value: unknown): Promise<void>;
|
|
300
|
-
remove(key: string): Promise<void>;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
type PaywallMode = 'modal' | 'inline' | 'sidebar' | 'fullscreen' | 'minimal';
|
|
304
|
-
/** Every user-visible string the SDK adds on top of the templates (English only; iteration 12 T9 swaps locales). */
|
|
305
263
|
interface PaywallStrings {
|
|
306
264
|
title: string;
|
|
307
265
|
description: string;
|
|
@@ -316,6 +274,13 @@ interface PaywallStrings {
|
|
|
316
274
|
periodOnce: string;
|
|
317
275
|
footer: string;
|
|
318
276
|
restorePurchase: string;
|
|
277
|
+
/** Template headings and plan labels (were fixed English text in the templates). */
|
|
278
|
+
featuresHeading: string;
|
|
279
|
+
plansHeading: string;
|
|
280
|
+
freePlanName: string;
|
|
281
|
+
premiumPlanName: string;
|
|
282
|
+
popularBadge: string;
|
|
283
|
+
unlockHeading: string;
|
|
319
284
|
}
|
|
320
285
|
interface PaywallOptions {
|
|
321
286
|
/** Template to render (default `modal`). */
|
|
@@ -324,15 +289,27 @@ interface PaywallOptions {
|
|
|
324
289
|
sku?: string;
|
|
325
290
|
title?: string;
|
|
326
291
|
description?: string;
|
|
327
|
-
/**
|
|
292
|
+
/**
|
|
293
|
+
* Bullet points, in the user's language (`chrome.i18n.getMessage`). The
|
|
294
|
+
* offer's `features[]` are entitlement keys and are never shown: without
|
|
295
|
+
* this option the paywall has no feature list.
|
|
296
|
+
*/
|
|
328
297
|
features?: string[];
|
|
329
298
|
/** Free-tier bullets for the comparison templates (`inline`, `fullscreen`). */
|
|
330
299
|
freeFeatures?: string[];
|
|
300
|
+
/**
|
|
301
|
+
* Header image in place of the template's glyph: a path inside the
|
|
302
|
+
* extension (`icons/icon128.png`) or a `data:image/` URL. Defaults to the
|
|
303
|
+
* largest `manifest.icons` entry on the extension's own pages (popup,
|
|
304
|
+
* options); `false` keeps the glyph. Remote URLs are ignored.
|
|
305
|
+
*/
|
|
306
|
+
icon?: string | false;
|
|
331
307
|
theme?: ThemeConfig;
|
|
332
308
|
/** Mount point for `inline` mode (default `document.body`). */
|
|
333
309
|
container?: HTMLElement;
|
|
334
310
|
strings?: Partial<PaywallStrings>;
|
|
335
|
-
|
|
311
|
+
/** `consent` carries the withdrawal waiver when the paywall showed one. */
|
|
312
|
+
onUpgrade?: (sku: string, consent?: UpgradeConsent) => void;
|
|
336
313
|
onClose?: () => void;
|
|
337
314
|
}
|
|
338
315
|
|
|
@@ -364,8 +341,30 @@ interface CheckoutResult {
|
|
|
364
341
|
sessionId: string;
|
|
365
342
|
entitlement?: Entitlement;
|
|
366
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* The buyer ticked the withdrawal-waiver checkbox (EU/EEA/UK digital content).
|
|
346
|
+
* `version` names the waiver words that were shown (`PAY_WITHDRAWAL_WAIVER_VERSION`).
|
|
347
|
+
*/
|
|
348
|
+
interface WithdrawalWaiverConsent {
|
|
349
|
+
version: string;
|
|
350
|
+
accepted: true;
|
|
351
|
+
}
|
|
352
|
+
/** What a paywall upgrade click carries besides the SKU. */
|
|
353
|
+
interface UpgradeConsent {
|
|
354
|
+
withdrawalWaiver?: WithdrawalWaiverConsent;
|
|
355
|
+
}
|
|
367
356
|
interface CheckoutOptions {
|
|
368
357
|
locale?: string;
|
|
358
|
+
/**
|
|
359
|
+
* Withdrawal-waiver consent, sent with `pay.createCheckout`. The paywall
|
|
360
|
+
* collects it itself. When you call `openCheckout()` from your own UI, ask
|
|
361
|
+
* `getWithdrawalWaiver()` first: if it returns a waiver, YOUR UI must show an
|
|
362
|
+
* unticked checkbox with exactly its `text` and pass
|
|
363
|
+
* `{ version, accepted: true }` here only once the buyer ticked it. Without
|
|
364
|
+
* it `openCheckout()` rejects with `WITHDRAWAL_WAIVER_REQUIRED`, and so does
|
|
365
|
+
* the server.
|
|
366
|
+
*/
|
|
367
|
+
withdrawalWaiver?: WithdrawalWaiverConsent;
|
|
369
368
|
/** Stop polling `claimSession` after this long (default 10 minutes). */
|
|
370
369
|
timeoutMs?: number;
|
|
371
370
|
/** Poll interval (default 2 seconds). */
|
|
@@ -405,6 +404,91 @@ interface LicenseSummary {
|
|
|
405
404
|
recoveryEnabled: boolean;
|
|
406
405
|
}
|
|
407
406
|
|
|
407
|
+
/**
|
|
408
|
+
* HTTP transport for the BFF's tRPC endpoint (`/api/trpc/<procedure>`).
|
|
409
|
+
*
|
|
410
|
+
* Queries are header-less GETs with `?input=<json>` (a CORS "simple request",
|
|
411
|
+
* so no preflight); mutations POST a JSON body. The only things that leave the
|
|
412
|
+
* extension are payment inputs and optional recovery session/proof inputs
|
|
413
|
+
* and the browser's standard headers — `credentials: 'omit'` keeps cookies out.
|
|
414
|
+
* Queries are retried on network / 5xx errors; mutations never are.
|
|
415
|
+
*/
|
|
416
|
+
|
|
417
|
+
type ProcedureKind = 'query' | 'mutation';
|
|
418
|
+
interface Transport {
|
|
419
|
+
call<T>(procedure: string, kind: ProcedureKind, input: Record<string, unknown>): Promise<T>;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* In-memory stand-in for the BFF, used when `mock: true`. Lets an extension be
|
|
424
|
+
* developed with no backend: offers and entitlements come from `mockData`, a
|
|
425
|
+
* mock checkout completes after `claimAfterPolls` polls and grants the SKU.
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
type SessionState = 'open' | 'complete' | 'canceled' | 'expired';
|
|
429
|
+
interface MockSession {
|
|
430
|
+
sku: string;
|
|
431
|
+
polls: number;
|
|
432
|
+
state: SessionState;
|
|
433
|
+
/** What `createCheckout` received, for inspecting the consent in dev/tests. */
|
|
434
|
+
withdrawalWaiver: WithdrawalWaiverConsent | null;
|
|
435
|
+
}
|
|
436
|
+
declare class MockTransport implements Transport {
|
|
437
|
+
private entitlements;
|
|
438
|
+
private readonly offers;
|
|
439
|
+
private readonly projectName;
|
|
440
|
+
private readonly checkoutEnabled;
|
|
441
|
+
private readonly claimAfterPolls;
|
|
442
|
+
private readonly withdrawalWaiver;
|
|
443
|
+
readonly sessions: Map<string, MockSession>;
|
|
444
|
+
constructor(data?: MockData);
|
|
445
|
+
call<T>(procedure: string, _kind: ProcedureKind, input: Record<string, unknown>): Promise<T>;
|
|
446
|
+
/** Test/dev helpers. */
|
|
447
|
+
setEntitlements(items: PayEntitlementItem[]): void;
|
|
448
|
+
cancelSession(sessionId: string): void;
|
|
449
|
+
expireSession(sessionId: string): void;
|
|
450
|
+
private offerResponse;
|
|
451
|
+
private createCheckout;
|
|
452
|
+
private claim;
|
|
453
|
+
private grant;
|
|
454
|
+
private envelope;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** Typed wrapper over the SDK-facing `pay.*` procedures. Nothing else is ever called. */
|
|
458
|
+
|
|
459
|
+
declare class PayApi {
|
|
460
|
+
private readonly transport;
|
|
461
|
+
private readonly publishableKey;
|
|
462
|
+
constructor(transport: Transport, publishableKey: string);
|
|
463
|
+
/** `locale` opens the hosted recovery page (and its email) in the user's language. */
|
|
464
|
+
createRestoreSession(claimChallenge: string, locale?: string | null): Promise<PayRestoreSessionResponse>;
|
|
465
|
+
claimRestoreSession(sessionId: string, claimSecret: string): Promise<PayRestoreClaimResponse>;
|
|
466
|
+
getOffer(locale?: string | null): Promise<PayOfferResponse>;
|
|
467
|
+
/**
|
|
468
|
+
* `withdrawalWaiver` is sent only when given. Older BFFs parse the input with
|
|
469
|
+
* a non-strict zod object, which strips the unknown key, so it is safe there.
|
|
470
|
+
* Plain-JS callers passing anything but `accepted: true` send no consent.
|
|
471
|
+
*/
|
|
472
|
+
createCheckout(sku: string, endUserRef: string, locale?: string | null, withdrawalWaiver?: WithdrawalWaiverConsent): Promise<PayCheckoutSession>;
|
|
473
|
+
claimSession(sessionId: string, endUserRef: string): Promise<PayCheckoutClaim>;
|
|
474
|
+
getEntitlement(endUserRef: string): Promise<SignedEntitlement>;
|
|
475
|
+
getPortalUrl(endUserRef: string, customerId?: string, locale?: string | null): Promise<PayPortalResponse>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Persistent key/value storage for the SDK's own namespace.
|
|
480
|
+
*
|
|
481
|
+
* Preference order: `chrome.storage.local` (Chrome/Edge), `browser.storage.local`
|
|
482
|
+
* (Firefox), `localStorage` (non-extension contexts such as a dev page), then
|
|
483
|
+
* memory. Both promise-returning (MV3, Firefox) and callback-only (MV2) storage
|
|
484
|
+
* APIs are supported.
|
|
485
|
+
*/
|
|
486
|
+
interface StorageAdapter {
|
|
487
|
+
get(key: string): Promise<unknown>;
|
|
488
|
+
set(key: string, value: unknown): Promise<void>;
|
|
489
|
+
remove(key: string): Promise<void>;
|
|
490
|
+
}
|
|
491
|
+
|
|
408
492
|
interface ExtenshiPayEvents {
|
|
409
493
|
ready: {
|
|
410
494
|
endUserRef: string;
|
|
@@ -543,6 +627,8 @@ declare class EntitlementManager {
|
|
|
543
627
|
|
|
544
628
|
interface RecoveryManagerOptions {
|
|
545
629
|
api: PayApi;
|
|
630
|
+
/** The user's language, for the hosted recovery page and its email. */
|
|
631
|
+
locale?: string | null;
|
|
546
632
|
storage: StorageAdapter;
|
|
547
633
|
publishableKey: string;
|
|
548
634
|
onComplete: (endUserRef: string, envelope: SignedEntitlement) => Promise<Entitlement>;
|
|
@@ -594,7 +680,7 @@ interface ExtenshiPayDeps {
|
|
|
594
680
|
now?: () => number;
|
|
595
681
|
}
|
|
596
682
|
declare class ExtenshiPayLite {
|
|
597
|
-
static readonly version = "0.
|
|
683
|
+
static readonly version = "0.9.0";
|
|
598
684
|
protected readonly config: ResolvedConfig;
|
|
599
685
|
protected readonly emitter: EventEmitter<ExtenshiPayEvents>;
|
|
600
686
|
protected readonly storage: StorageAdapter;
|
|
@@ -631,7 +717,26 @@ declare class ExtenshiPayLite {
|
|
|
631
717
|
requireFeature(feature: string, options?: RequireFeatureOptions): Promise<boolean>;
|
|
632
718
|
/** Lite has no UI: a locked feature stays locked. The full SDK shows the paywall here. */
|
|
633
719
|
protected onFeatureLocked(_feature: string, _options: RequireFeatureOptions): Promise<boolean>;
|
|
634
|
-
/**
|
|
720
|
+
/**
|
|
721
|
+
* The withdrawal waiver this offer asks for, with the exact text to show
|
|
722
|
+
* next to an unticked checkbox (buyer's language, seller's name filled in),
|
|
723
|
+
* or null when the seller attested the extension is not distributed in the
|
|
724
|
+
* EEA/UK. For UIs that call `openCheckout()` themselves — Lite, or a custom
|
|
725
|
+
* paywall; the full SDK's paywall does this for you.
|
|
726
|
+
*/
|
|
727
|
+
getWithdrawalWaiver(): Promise<{
|
|
728
|
+
version: string;
|
|
729
|
+
text: string;
|
|
730
|
+
} | null>;
|
|
731
|
+
/**
|
|
732
|
+
* Opens hosted checkout for `sku` in a new tab and resolves when the session settles.
|
|
733
|
+
*
|
|
734
|
+
* Called directly (not from the paywall), this does NOT collect the EU/UK
|
|
735
|
+
* withdrawal waiver. If `getWithdrawalWaiver()` returns one, your UI must
|
|
736
|
+
* collect the buyer's consent and pass it as `options.withdrawalWaiver`;
|
|
737
|
+
* without it this rejects with `WITHDRAWAL_WAIVER_REQUIRED` (the server
|
|
738
|
+
* refuses such a checkout too).
|
|
739
|
+
*/
|
|
635
740
|
openCheckout(sku: string, options?: CheckoutOptions): Promise<CheckoutResult>;
|
|
636
741
|
/** Opens email verification on the hosted page. No email is collected inside the extension. */
|
|
637
742
|
restorePurchase(options?: RestoreOptions): Promise<RestoreResult>;
|
|
@@ -653,7 +758,7 @@ declare class ExtenshiPayLite {
|
|
|
653
758
|
}
|
|
654
759
|
|
|
655
760
|
/** Kept in sync with package.json by tests/unit/version.test.ts. */
|
|
656
|
-
declare const VERSION = "0.
|
|
761
|
+
declare const VERSION = "0.9.0";
|
|
657
762
|
|
|
658
|
-
export { ERROR_CODES, ExtenshiPayLite as ExtenshiPay, ExtenshiPayError, ExtenshiPayLite, MockTransport, VERSION, ExtenshiPayLite as default };
|
|
659
|
-
export type { CheckoutOptions, CheckoutResult, CheckoutState, CustomerPortalOptions, Entitlement, EntitlementSource, ErrorCode, ExtenshiPayConfig, ExtenshiPayDeps, ExtenshiPayEventName, ExtenshiPayEvents, GetEntitlementOptions, LicenseSummary, MockData, PayEntitlementItem, PayEntitlementStatus, PayOfferDto, PayPortalAccount, PayPortalResponse, PaySellerPublic, RequireFeatureOptions, RestoreOptions, RestoreResult, StorageAdapter, ThemeConfig, Transport };
|
|
763
|
+
export { ERROR_CODES, ExtenshiPayLite as ExtenshiPay, ExtenshiPayError, ExtenshiPayLite, MockTransport, PAY_WITHDRAWAL_WAIVER_VERSION, VERSION, ExtenshiPayLite as default };
|
|
764
|
+
export type { CheckoutOptions, CheckoutResult, CheckoutState, CustomerPortalOptions, Entitlement, EntitlementSource, ErrorCode, ExtenshiPayConfig, ExtenshiPayDeps, ExtenshiPayEventName, ExtenshiPayEvents, GetEntitlementOptions, LicenseSummary, MockData, PayEntitlementItem, PayEntitlementStatus, PayOfferDto, PayPortalAccount, PayPortalResponse, PaySellerPublic, PayWithdrawalWaiver, RequireFeatureOptions, RestoreOptions, RestoreResult, StorageAdapter, ThemeConfig, Transport, WithdrawalWaiverConsent };
|