@extenshi/pay 0.9.0 → 0.11.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 +128 -17
- package/dist/api/mock.d.ts +4 -0
- package/dist/api/mock.d.ts.map +1 -1
- package/dist/api/pay-api.d.ts +9 -4
- package/dist/api/pay-api.d.ts.map +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/extenshi-pay.d.ts +60 -5
- package/dist/core/extenshi-pay.d.ts.map +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/storage.d.ts +6 -0
- package/dist/core/storage.d.ts.map +1 -1
- package/dist/core.d.mts +268 -26
- package/dist/core.d.ts +268 -26
- package/dist/core.js +566 -44
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +562 -45
- package/dist/core.mjs.map +1 -1
- package/dist/extenshi-pay-lite.js +555 -44
- package/dist/extenshi-pay-lite.js.map +1 -1
- package/dist/extenshi-pay-lite.min.js +3 -3
- package/dist/extenshi-pay-lite.min.js.map +1 -1
- package/dist/extenshi-pay-lite.mjs +555 -44
- package/dist/extenshi-pay-lite.mjs.map +1 -1
- package/dist/extenshi-pay.cjs.js +670 -57
- package/dist/extenshi-pay.cjs.js.map +1 -1
- package/dist/extenshi-pay.d.ts +11 -1
- package/dist/extenshi-pay.d.ts.map +1 -1
- package/dist/extenshi-pay.js +670 -57
- package/dist/extenshi-pay.js.map +1 -1
- package/dist/extenshi-pay.min.js +3 -3
- package/dist/extenshi-pay.min.js.map +1 -1
- package/dist/extenshi-pay.min.mjs +3 -3
- package/dist/extenshi-pay.min.mjs.map +1 -1
- package/dist/extenshi-pay.mjs +666 -58
- package/dist/extenshi-pay.mjs.map +1 -1
- package/dist/index.d.mts +285 -26
- package/dist/index.d.ts +285 -26
- package/dist/lite.d.mts +212 -13
- package/dist/lite.d.ts +212 -13
- package/dist/lite.d.ts.map +1 -1
- package/dist/payment/cloud-backup.d.ts +35 -0
- package/dist/payment/cloud-backup.d.ts.map +1 -0
- package/dist/payment/entitlement.d.ts +21 -5
- package/dist/payment/entitlement.d.ts.map +1 -1
- package/dist/payment/recovery.d.ts +4 -2
- package/dist/payment/recovery.d.ts.map +1 -1
- package/dist/payment/signature.d.ts +29 -3
- package/dist/payment/signature.d.ts.map +1 -1
- package/dist/payment/trial.d.ts +55 -0
- package/dist/payment/trial.d.ts.map +1 -0
- package/dist/paywall/i18n.d.ts +3 -0
- package/dist/paywall/i18n.d.ts.map +1 -1
- package/dist/paywall/renderer.d.ts +7 -0
- package/dist/paywall/renderer.d.ts.map +1 -1
- package/dist/paywall.d.mts +7 -0
- package/dist/paywall.d.ts +7 -0
- package/dist/paywall.js +54 -14
- package/dist/paywall.js.map +1 -1
- package/dist/paywall.mjs +54 -14
- package/dist/paywall.mjs.map +1 -1
- package/dist/types/config.d.ts +27 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/contract.d.ts +35 -0
- package/dist/types/contract.d.ts.map +1 -1
- package/dist/types/entitlement.d.ts +37 -1
- package/dist/types/entitlement.d.ts.map +1 -1
- package/dist/types/events.d.ts +5 -1
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/paywall.d.ts +10 -0
- package/dist/types/paywall.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The free trial an application configures on the server (`trialDays`).
|
|
3
|
+
*
|
|
4
|
+
* The server starts one clock per installation at its first license read and
|
|
5
|
+
* signs `{ startedAt, endsAt }` into the entitlement, so the trial comes from
|
|
6
|
+
* the verified license like paid access does: no start date in extension
|
|
7
|
+
* storage, nothing a device clock or a storage edit can move. Offline, the
|
|
8
|
+
* cached license answers for up to 48 hours.
|
|
9
|
+
*
|
|
10
|
+
* `trial:ending` / `trial:ended` fire once per installation and trial (the
|
|
11
|
+
* marker is kept in the SDK's storage), and not while the user has paid
|
|
12
|
+
* access. Render state from `getTrial()`; the events are one-time notices.
|
|
13
|
+
*/
|
|
14
|
+
import type { StorageAdapter } from '../core/storage.js';
|
|
15
|
+
import type { PayTrial } from '../types/contract.js';
|
|
16
|
+
import type { TrialState } from '../types/entitlement.js';
|
|
17
|
+
export declare const DAY_MS: number;
|
|
18
|
+
export interface TrialClock {
|
|
19
|
+
/** Device time. */
|
|
20
|
+
now: number;
|
|
21
|
+
/** The signed issue time of the license; a floor for `now`. */
|
|
22
|
+
issuedAt: number;
|
|
23
|
+
/** Whether the license was checked recently enough to grant access (48 h, as for paid access). */
|
|
24
|
+
checked: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** The trial as of `clock`, or null when the license carries none (or a malformed one). */
|
|
27
|
+
export declare function trialState(trial: PayTrial | undefined, clock: TrialClock): TrialState | null;
|
|
28
|
+
/** The feedback form address with `src=trial_end`; null unless it is a plain HTTPS URL. No installation id is added. */
|
|
29
|
+
export declare function trialFeedbackUrl(raw: string | undefined): string | null;
|
|
30
|
+
export type TrialEvent = 'trial:ending' | 'trial:ended';
|
|
31
|
+
export interface TrialNotifierOptions {
|
|
32
|
+
storage: StorageAdapter;
|
|
33
|
+
storageKey: string;
|
|
34
|
+
/** `trial:ending` fires this many days before the end; 0 never. */
|
|
35
|
+
endingDays: number;
|
|
36
|
+
getTrial: () => TrialState | null;
|
|
37
|
+
hasPaidAccess: () => boolean;
|
|
38
|
+
emit: (event: TrialEvent, trial: TrialState) => void;
|
|
39
|
+
now: () => number;
|
|
40
|
+
}
|
|
41
|
+
export declare class TrialNotifier {
|
|
42
|
+
private readonly options;
|
|
43
|
+
private timer;
|
|
44
|
+
private running;
|
|
45
|
+
private pending;
|
|
46
|
+
constructor(options: TrialNotifierOptions);
|
|
47
|
+
start(): void;
|
|
48
|
+
stop(): void;
|
|
49
|
+
/** Checks the held license; serialized, so two refreshes never send one event twice. */
|
|
50
|
+
evaluate(): Promise<void>;
|
|
51
|
+
private check;
|
|
52
|
+
private send;
|
|
53
|
+
private clearTimer;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=trial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trial.d.ts","sourceRoot":"","sources":["../../src/payment/trial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAGzD,eAAO,MAAM,MAAM,QAAsB,CAAA;AAIzC,MAAM,WAAW,UAAU;IAC1B,mBAAmB;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAA;IAChB,kGAAkG;IAClG,OAAO,EAAE,OAAO,CAAA;CAChB;AAED,2FAA2F;AAC3F,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAe5F;AAED,wHAAwH;AACxH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAWvE;AAED,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,aAAa,CAAA;AAEvD,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,UAAU,GAAG,IAAI,CAAA;IACjC,aAAa,EAAE,MAAM,OAAO,CAAA;IAC5B,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACpD,GAAG,EAAE,MAAM,MAAM,CAAA;CACjB;AAQD,qBAAa,aAAa;IAKb,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAAmC;gBAErB,OAAO,EAAE,oBAAoB;IAE1D,KAAK,IAAI,IAAI;IAKb,IAAI,IAAI,IAAI;IAKZ,wFAAwF;IACxF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAKX,KAAK;YA0BL,IAAI;IAUlB,OAAO,CAAC,UAAU;CAIlB"}
|
package/dist/paywall/i18n.d.ts
CHANGED
|
@@ -79,6 +79,9 @@ export declare const SDK_STRINGS_EN: {
|
|
|
79
79
|
pickerDescription: string;
|
|
80
80
|
pickerFirstRecorded: string;
|
|
81
81
|
pickerCancel: string;
|
|
82
|
+
trialEndedTitle: string;
|
|
83
|
+
trialEndedDescription: string;
|
|
84
|
+
trialEndedFeedback: string;
|
|
82
85
|
};
|
|
83
86
|
export type SdkStringKey = keyof typeof SDK_STRINGS_EN;
|
|
84
87
|
export type SdkStrings = Record<SdkStringKey, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/paywall/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAI7D,eAAO,MAAM,WAAW,mFAAoF,CAAA;AAC5G,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/paywall/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAI7D,eAAO,MAAM,WAAW,mFAAoF,CAAA;AAC5G,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE1B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,cAAc,CAAA;AACtD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AA4uBrD,kHAAkH;AAClH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAUtE;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,CAGvE;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,CAGxE;AAED,mFAAmF;AACnF,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAE5E;AAED,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,UAAU,GAAG,SAAS,CAExF"}
|
|
@@ -31,6 +31,10 @@ export interface PaywallView {
|
|
|
31
31
|
* The waiver text is not overridable through `strings`: it is versioned.
|
|
32
32
|
*/
|
|
33
33
|
withdrawalWaiver?: PayWithdrawalWaiver | null;
|
|
34
|
+
/** A link-styled button under the plans (trial-ended screen); clicking it calls `onFeedback`. */
|
|
35
|
+
feedback?: {
|
|
36
|
+
label: string;
|
|
37
|
+
} | null;
|
|
34
38
|
locale: string | null;
|
|
35
39
|
theme: ThemeConfig;
|
|
36
40
|
strings: Partial<PaywallStrings>;
|
|
@@ -41,6 +45,7 @@ export interface PaywallRendererCallbacks {
|
|
|
41
45
|
onUpgrade: (sku: string, consent?: UpgradeConsent) => void;
|
|
42
46
|
onClose: () => void;
|
|
43
47
|
onRestore?: () => void;
|
|
48
|
+
onFeedback?: () => void;
|
|
44
49
|
}
|
|
45
50
|
export declare const PAYWALL_HOST_CLASS = "extenshi-paywall-host";
|
|
46
51
|
export declare const WITHDRAWAL_WAIVER_CLASS = "extenshi-withdrawal-waiver";
|
|
@@ -58,6 +63,8 @@ export declare class PaywallRenderer {
|
|
|
58
63
|
/** Returns the host element; its shadow root holds the rendered template. */
|
|
59
64
|
show(view: PaywallView): HTMLElement;
|
|
60
65
|
hide(): void;
|
|
66
|
+
/** A text button at the end of the footer (no `href`: the SDK opens URLs itself). */
|
|
67
|
+
private footerLink;
|
|
61
68
|
private prune;
|
|
62
69
|
/**
|
|
63
70
|
* Swaps the templates' product glyphs for the extension's icon. A tile's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/paywall/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAOtE,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,qGAAqG;IACrG,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,SAAS,EAAE,MAAM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B,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAkBnD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,GAAG,MAAM,CAQrE;AAED,qBAAa,eAAe;IAIf,OAAO,CAAC,QAAQ,CAAC,SAAS;IAHtC,OAAO,CAAC,IAAI,CAA2B;IACvC,OAAO,CAAC,UAAU,CAAgD;gBAErC,SAAS,EAAE,wBAAwB;IAEhE,SAAS,IAAI,OAAO;IAIpB,6EAA6E;IAC7E,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW;IAgFpC,IAAI,IAAI,IAAI;IAUZ,qFAAqF;IACrF,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,KAAK;IAmBb;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAqBjB;;;OAGG;IACH,OAAO,CAAC,WAAW;IA8BnB,OAAO,CAAC,IAAI;IA+CZ,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,KAAK;CAIb"}
|
package/dist/paywall.d.mts
CHANGED
|
@@ -194,6 +194,10 @@ interface PaywallView {
|
|
|
194
194
|
* The waiver text is not overridable through `strings`: it is versioned.
|
|
195
195
|
*/
|
|
196
196
|
withdrawalWaiver?: PayWithdrawalWaiver | null;
|
|
197
|
+
/** A link-styled button under the plans (trial-ended screen); clicking it calls `onFeedback`. */
|
|
198
|
+
feedback?: {
|
|
199
|
+
label: string;
|
|
200
|
+
} | null;
|
|
197
201
|
locale: string | null;
|
|
198
202
|
theme: ThemeConfig;
|
|
199
203
|
strings: Partial<PaywallStrings>;
|
|
@@ -204,6 +208,7 @@ interface PaywallRendererCallbacks {
|
|
|
204
208
|
onUpgrade: (sku: string, consent?: UpgradeConsent) => void;
|
|
205
209
|
onClose: () => void;
|
|
206
210
|
onRestore?: () => void;
|
|
211
|
+
onFeedback?: () => void;
|
|
207
212
|
}
|
|
208
213
|
declare const PAYWALL_HOST_CLASS = "extenshi-paywall-host";
|
|
209
214
|
declare const WITHDRAWAL_WAIVER_CLASS = "extenshi-withdrawal-waiver";
|
|
@@ -221,6 +226,8 @@ declare class PaywallRenderer {
|
|
|
221
226
|
/** Returns the host element; its shadow root holds the rendered template. */
|
|
222
227
|
show(view: PaywallView): HTMLElement;
|
|
223
228
|
hide(): void;
|
|
229
|
+
/** A text button at the end of the footer (no `href`: the SDK opens URLs itself). */
|
|
230
|
+
private footerLink;
|
|
224
231
|
private prune;
|
|
225
232
|
/**
|
|
226
233
|
* Swaps the templates' product glyphs for the extension's icon. A tile's
|
package/dist/paywall.d.ts
CHANGED
|
@@ -194,6 +194,10 @@ interface PaywallView {
|
|
|
194
194
|
* The waiver text is not overridable through `strings`: it is versioned.
|
|
195
195
|
*/
|
|
196
196
|
withdrawalWaiver?: PayWithdrawalWaiver | null;
|
|
197
|
+
/** A link-styled button under the plans (trial-ended screen); clicking it calls `onFeedback`. */
|
|
198
|
+
feedback?: {
|
|
199
|
+
label: string;
|
|
200
|
+
} | null;
|
|
197
201
|
locale: string | null;
|
|
198
202
|
theme: ThemeConfig;
|
|
199
203
|
strings: Partial<PaywallStrings>;
|
|
@@ -204,6 +208,7 @@ interface PaywallRendererCallbacks {
|
|
|
204
208
|
onUpgrade: (sku: string, consent?: UpgradeConsent) => void;
|
|
205
209
|
onClose: () => void;
|
|
206
210
|
onRestore?: () => void;
|
|
211
|
+
onFeedback?: () => void;
|
|
207
212
|
}
|
|
208
213
|
declare const PAYWALL_HOST_CLASS = "extenshi-paywall-host";
|
|
209
214
|
declare const WITHDRAWAL_WAIVER_CLASS = "extenshi-withdrawal-waiver";
|
|
@@ -221,6 +226,8 @@ declare class PaywallRenderer {
|
|
|
221
226
|
/** Returns the host element; its shadow root holds the rendered template. */
|
|
222
227
|
show(view: PaywallView): HTMLElement;
|
|
223
228
|
hide(): void;
|
|
229
|
+
/** A text button at the end of the footer (no `href`: the SDK opens URLs itself). */
|
|
230
|
+
private footerLink;
|
|
224
231
|
private prune;
|
|
225
232
|
/**
|
|
226
233
|
* Swaps the templates' product glyphs for the extension's icon. A tile's
|
package/dist/paywall.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ExtenshiPay SDK v0.
|
|
2
|
+
* ExtenshiPay SDK v0.11.0
|
|
3
3
|
* (c) 2026 Extenshi.io
|
|
4
4
|
* Released under the MIT License.
|
|
5
|
-
* commit
|
|
5
|
+
* commit ed0f776ae9ab7ce6b2c614dbdfe696e9007b0d05 · built by `rollup -c`
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
8
8
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -118,6 +118,9 @@
|
|
|
118
118
|
pickerDescription: 'Separate purchases can have separate billing profiles. Choose one to manage its subscriptions and payment details.',
|
|
119
119
|
pickerFirstRecorded: 'First recorded {date}',
|
|
120
120
|
pickerCancel: 'Cancel',
|
|
121
|
+
trialEndedTitle: 'Your free trial has ended',
|
|
122
|
+
trialEndedDescription: 'The extension’s tools are paused. Your settings are kept and will be there when you upgrade.',
|
|
123
|
+
trialEndedFeedback: 'Share feedback',
|
|
121
124
|
};
|
|
122
125
|
// BEGIN GENERATED TRANSLATIONS
|
|
123
126
|
const TRANSLATIONS = {
|
|
@@ -186,6 +189,9 @@
|
|
|
186
189
|
pickerDescription: 'Las compras independientes pueden tener perfiles de facturación distintos. Elige uno para gestionar sus suscripciones y datos de pago.',
|
|
187
190
|
pickerFirstRecorded: 'Registrado por primera vez el {date}',
|
|
188
191
|
pickerCancel: 'Cancelar',
|
|
192
|
+
trialEndedTitle: 'Tu prueba gratuita ha terminado',
|
|
193
|
+
trialEndedDescription: 'Las herramientas de la extensión están en pausa. Tu configuración se conserva y la encontrarás igual cuando mejores tu plan.',
|
|
194
|
+
trialEndedFeedback: 'Enviar comentarios',
|
|
189
195
|
},
|
|
190
196
|
'pt-BR': {
|
|
191
197
|
title: 'Desbloqueie os recursos premium',
|
|
@@ -252,6 +258,9 @@
|
|
|
252
258
|
pickerDescription: 'Compras diferentes podem ter perfis de cobrança diferentes. Escolha um perfil para gerenciar as assinaturas e os dados de pagamento vinculados a ele.',
|
|
253
259
|
pickerFirstRecorded: 'Registrado pela primeira vez em {date}',
|
|
254
260
|
pickerCancel: 'Cancelar',
|
|
261
|
+
trialEndedTitle: 'Seu teste gratuito terminou',
|
|
262
|
+
trialEndedDescription: 'As ferramentas da extensão estão pausadas. Suas configurações foram mantidas e estarão lá quando você fizer o upgrade.',
|
|
263
|
+
trialEndedFeedback: 'Enviar feedback',
|
|
255
264
|
},
|
|
256
265
|
fr: {
|
|
257
266
|
title: 'Débloquez les fonctionnalités premium',
|
|
@@ -318,6 +327,9 @@
|
|
|
318
327
|
pickerDescription: 'Des achats distincts peuvent avoir des profils de facturation distincts. Choisissez-en un pour gérer ses abonnements et ses informations de paiement.',
|
|
319
328
|
pickerFirstRecorded: 'Enregistré pour la première fois le {date}',
|
|
320
329
|
pickerCancel: 'Annuler',
|
|
330
|
+
trialEndedTitle: 'Votre essai gratuit est terminé',
|
|
331
|
+
trialEndedDescription: 'Les outils de l’extension sont en pause. Vos paramètres sont conservés et vous les retrouverez après la mise à niveau.',
|
|
332
|
+
trialEndedFeedback: 'Donner votre avis',
|
|
321
333
|
},
|
|
322
334
|
de: {
|
|
323
335
|
title: 'Premium-Funktionen freischalten',
|
|
@@ -384,6 +396,9 @@
|
|
|
384
396
|
pickerDescription: 'Verschiedene Käufe können eigene Abrechnungsprofile haben. Wähle eines aus, um seine Abonnements und Zahlungsdaten zu verwalten.',
|
|
385
397
|
pickerFirstRecorded: 'Erstmals erfasst am {date}',
|
|
386
398
|
pickerCancel: 'Abbrechen',
|
|
399
|
+
trialEndedTitle: 'Dein kostenloser Testzeitraum ist abgelaufen',
|
|
400
|
+
trialEndedDescription: 'Die Funktionen der Erweiterung sind pausiert. Deine Einstellungen bleiben erhalten und sind nach dem Upgrade wieder da.',
|
|
401
|
+
trialEndedFeedback: 'Feedback geben',
|
|
387
402
|
},
|
|
388
403
|
it: {
|
|
389
404
|
title: 'Sblocca le funzionalità premium',
|
|
@@ -450,6 +465,9 @@
|
|
|
450
465
|
pickerDescription: 'Acquisti diversi possono avere profili di fatturazione diversi. Scegline uno per gestirne gli abbonamenti e i dati di pagamento.',
|
|
451
466
|
pickerFirstRecorded: 'Registrato per la prima volta il {date}',
|
|
452
467
|
pickerCancel: 'Annulla',
|
|
468
|
+
trialEndedTitle: 'La tua prova gratuita è terminata',
|
|
469
|
+
trialEndedDescription: 'Gli strumenti dell’estensione sono in pausa. Le tue impostazioni sono conservate e le ritroverai dopo l’upgrade.',
|
|
470
|
+
trialEndedFeedback: 'Invia un feedback',
|
|
453
471
|
},
|
|
454
472
|
ru: {
|
|
455
473
|
title: 'Откройте доступ к премиум-функциям',
|
|
@@ -516,6 +534,9 @@
|
|
|
516
534
|
pickerDescription: 'У разных покупок могут быть разные платёжные профили. Выберите профиль, чтобы управлять его подписками и платёжными данными.',
|
|
517
535
|
pickerFirstRecorded: 'Впервые зафиксирован: {date}',
|
|
518
536
|
pickerCancel: 'Отмена',
|
|
537
|
+
trialEndedTitle: 'Бесплатный пробный период закончился',
|
|
538
|
+
trialEndedDescription: 'Инструменты расширения приостановлены. Ваши настройки сохранены и будут на месте после перехода на премиум.',
|
|
539
|
+
trialEndedFeedback: 'Оставить отзыв',
|
|
519
540
|
},
|
|
520
541
|
ja: {
|
|
521
542
|
title: 'プレミアム機能をアンロック',
|
|
@@ -582,6 +603,9 @@
|
|
|
582
603
|
pickerDescription: '購入ごとに別々の請求プロファイルがある場合があります。サブスクリプションと支払い情報を管理するプロファイルを1つ選択してください。',
|
|
583
604
|
pickerFirstRecorded: '初回記録日:{date}',
|
|
584
605
|
pickerCancel: 'キャンセル',
|
|
606
|
+
trialEndedTitle: '無料トライアルが終了しました',
|
|
607
|
+
trialEndedDescription: '拡張機能のツールは一時停止しています。設定は保存されており、アップグレード後もそのままご利用いただけます。',
|
|
608
|
+
trialEndedFeedback: 'フィードバックを送信',
|
|
585
609
|
},
|
|
586
610
|
ko: {
|
|
587
611
|
title: '프리미엄 기능 잠금 해제',
|
|
@@ -648,6 +672,9 @@
|
|
|
648
672
|
pickerDescription: '구매마다 결제 프로필이 다를 수 있습니다. 구독과 결제 정보를 관리할 프로필을 하나 선택해 주세요.',
|
|
649
673
|
pickerFirstRecorded: '최초 기록일: {date}',
|
|
650
674
|
pickerCancel: '취소',
|
|
675
|
+
trialEndedTitle: '무료 체험 기간이 종료되었습니다',
|
|
676
|
+
trialEndedDescription: '확장 프로그램의 도구가 일시 중지되었습니다. 설정은 그대로 저장되어 있으며 업그레이드하면 다시 사용할 수 있습니다.',
|
|
677
|
+
trialEndedFeedback: '의견 보내기',
|
|
651
678
|
},
|
|
652
679
|
'zh-CN': {
|
|
653
680
|
title: '解锁高级功能',
|
|
@@ -714,6 +741,9 @@
|
|
|
714
741
|
pickerDescription: '不同的购买可以有各自的账单资料。请选择一个,以管理其订阅和付款信息。',
|
|
715
742
|
pickerFirstRecorded: '首次记录于 {date}',
|
|
716
743
|
pickerCancel: '取消',
|
|
744
|
+
trialEndedTitle: '免费试用已结束',
|
|
745
|
+
trialEndedDescription: '扩展程序的工具已暂停。您的设置已保留,升级后即可继续使用。',
|
|
746
|
+
trialEndedFeedback: '提交反馈',
|
|
717
747
|
},
|
|
718
748
|
ar: {
|
|
719
749
|
title: 'احصل على الميزات المميزة',
|
|
@@ -780,6 +810,9 @@
|
|
|
780
810
|
pickerDescription: 'يمكن أن تكون لعمليات الشراء المنفصلة ملفات فوترة منفصلة. اختر ملفًا منها لإدارة اشتراكاته وتفاصيل الدفع الخاصة به.',
|
|
781
811
|
pickerFirstRecorded: 'سُجِّل لأول مرة في {date}',
|
|
782
812
|
pickerCancel: 'إلغاء',
|
|
813
|
+
trialEndedTitle: 'انتهت فترتك التجريبية المجانية',
|
|
814
|
+
trialEndedDescription: 'أدوات الإضافة متوقفة مؤقتًا. إعداداتك محفوظة وستجدها كما هي بعد الترقية.',
|
|
815
|
+
trialEndedFeedback: 'إرسال ملاحظات',
|
|
783
816
|
},
|
|
784
817
|
};
|
|
785
818
|
// END GENERATED TRANSLATIONS
|
|
@@ -1281,18 +1314,12 @@
|
|
|
1281
1314
|
}
|
|
1282
1315
|
if (waiver && waiverBox)
|
|
1283
1316
|
this.mountWaiver(root, doc, waiver.text, waiverBox);
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
button.style.cssText =
|
|
1291
|
-
'display:block;margin:12px auto 0;background:none;border:0;color:inherit;font:inherit;text-decoration:underline;cursor:pointer';
|
|
1292
|
-
button.addEventListener('click', () => this.callbacks.onRestore?.());
|
|
1293
|
-
footer.appendChild(button);
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1317
|
+
const onRestore = this.callbacks.onRestore;
|
|
1318
|
+
if (view.recoveryEnabled && onRestore)
|
|
1319
|
+
this.footerLink(root, doc, strings.restorePurchase, onRestore);
|
|
1320
|
+
const onFeedback = this.callbacks.onFeedback;
|
|
1321
|
+
if (view.feedback && onFeedback)
|
|
1322
|
+
this.footerLink(root, doc, view.feedback.label, onFeedback);
|
|
1296
1323
|
const mount = view.mode === 'inline' ? (view.container ?? doc.body) : doc.body;
|
|
1297
1324
|
mount.appendChild(host);
|
|
1298
1325
|
this.host = host;
|
|
@@ -1309,6 +1336,19 @@
|
|
|
1309
1336
|
this.host.remove();
|
|
1310
1337
|
this.host = null;
|
|
1311
1338
|
}
|
|
1339
|
+
/** A text button at the end of the footer (no `href`: the SDK opens URLs itself). */
|
|
1340
|
+
footerLink(root, doc, label, onClick) {
|
|
1341
|
+
const footer = root.querySelector('[class*="-footer"], .ep-minimal-actions, .ep-inline-content, .ep-fullscreen-content');
|
|
1342
|
+
if (!footer)
|
|
1343
|
+
return;
|
|
1344
|
+
const button = doc.createElement('button');
|
|
1345
|
+
button.type = 'button';
|
|
1346
|
+
button.textContent = label;
|
|
1347
|
+
button.style.cssText =
|
|
1348
|
+
'display:block;margin:12px auto 0;background:none;border:0;color:inherit;font:inherit;text-decoration:underline;cursor:pointer';
|
|
1349
|
+
button.addEventListener('click', () => onClick());
|
|
1350
|
+
footer.appendChild(button);
|
|
1351
|
+
}
|
|
1312
1352
|
prune(root) {
|
|
1313
1353
|
for (const element of root.querySelectorAll(PRUNE_SELECTOR))
|
|
1314
1354
|
element.remove();
|