@extenshi/pay 0.8.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 +134 -19
- 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 +280 -27
- package/dist/core.d.ts +280 -27
- 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 +823 -69
- 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 +823 -69
- 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 +819 -70
- package/dist/extenshi-pay.mjs.map +1 -1
- package/dist/index.d.mts +305 -27
- package/dist/index.d.ts +305 -27
- package/dist/lite.d.mts +224 -14
- package/dist/lite.d.ts +224 -14
- 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/icon.d.ts +18 -0
- package/dist/paywall/icon.d.ts.map +1 -0
- package/dist/paywall/renderer.d.ts +15 -0
- package/dist/paywall/renderer.d.ts.map +1 -1
- package/dist/paywall.d.mts +27 -1
- package/dist/paywall.d.ts +27 -1
- package/dist/paywall.js +131 -25
- package/dist/paywall.js.map +1 -1
- package/dist/paywall.mjs +131 -25
- 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 +22 -1
- 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
package/dist/extenshi-pay.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) :
|
|
@@ -92,6 +92,14 @@
|
|
|
92
92
|
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
93
93
|
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(',')}}`;
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* `storage`: the buyer turns on the cloud copy of the extension's settings. The
|
|
97
|
+
* hosted page shows the storage disclosure; the claim records consent. Additive:
|
|
98
|
+
* a session without a purpose is a plain restore.
|
|
99
|
+
*/
|
|
100
|
+
const PAY_RESTORE_PURPOSES = ['restore', 'storage'];
|
|
101
|
+
/** From `shared-types/storage.ts`: `est_` + 32 random bytes, base64url. */
|
|
102
|
+
const STORAGE_TOKEN_RE = /^est_[A-Za-z0-9_-]{43}$/;
|
|
95
103
|
|
|
96
104
|
const ERROR_CODES = {
|
|
97
105
|
INVALID_CONFIG: 'INVALID_CONFIG',
|
|
@@ -163,7 +171,7 @@
|
|
|
163
171
|
* developed with no backend: offers and entitlements come from `mockData`, a
|
|
164
172
|
* mock checkout completes after `claimAfterPolls` polls and grants the SKU.
|
|
165
173
|
*/
|
|
166
|
-
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
174
|
+
const DAY_MS$1 = 24 * 60 * 60 * 1000;
|
|
167
175
|
/** Accepts the same optional `withdrawalWaiver` input as the BFF; anything else is no consent. */
|
|
168
176
|
function mockConsent(value) {
|
|
169
177
|
const consent = value;
|
|
@@ -181,6 +189,10 @@
|
|
|
181
189
|
this.claimAfterPolls = data.claimAfterPolls ?? 1;
|
|
182
190
|
this.withdrawalWaiver =
|
|
183
191
|
data.withdrawalWaiver === undefined ? { version: PAY_WITHDRAWAL_WAIVER_VERSION } : data.withdrawalWaiver;
|
|
192
|
+
this.seller = data.seller;
|
|
193
|
+
this.trial = null;
|
|
194
|
+
if (data.trial)
|
|
195
|
+
this.setTrial(data.trial.days, data.trial.startedAt);
|
|
184
196
|
}
|
|
185
197
|
async call(procedure, _kind, input) {
|
|
186
198
|
switch (procedure) {
|
|
@@ -202,6 +214,14 @@
|
|
|
202
214
|
setEntitlements(items) {
|
|
203
215
|
this.entitlements = [...items];
|
|
204
216
|
}
|
|
217
|
+
/** Previews a server trial of `days` from `startedAt` (default now); `null` removes it. */
|
|
218
|
+
setTrial(days, startedAt = new Date().toISOString()) {
|
|
219
|
+
const start = Date.parse(startedAt);
|
|
220
|
+
this.trial =
|
|
221
|
+
days === null || !Number.isFinite(start)
|
|
222
|
+
? null
|
|
223
|
+
: { startedAt: new Date(start).toISOString(), endsAt: new Date(start + days * DAY_MS$1).toISOString() };
|
|
224
|
+
}
|
|
205
225
|
cancelSession(sessionId) {
|
|
206
226
|
const session = this.sessions.get(sessionId);
|
|
207
227
|
if (session)
|
|
@@ -221,6 +241,7 @@
|
|
|
221
241
|
offers: [...this.offers],
|
|
222
242
|
entitlementPublicKey: null,
|
|
223
243
|
withdrawalWaiver: this.withdrawalWaiver ? { ...this.withdrawalWaiver } : null,
|
|
244
|
+
...(this.seller !== undefined && { seller: this.seller ? { ...this.seller } : null }),
|
|
224
245
|
};
|
|
225
246
|
}
|
|
226
247
|
createCheckout(sku, withdrawalWaiver) {
|
|
@@ -258,7 +279,7 @@
|
|
|
258
279
|
grant(sku) {
|
|
259
280
|
const offer = this.offers.find((o) => o.sku === sku);
|
|
260
281
|
const expiresAt = offer?.kind === 'subscription'
|
|
261
|
-
? new Date(Date.now() + (offer.interval === 'year' ? 365 : 30) * DAY_MS).toISOString()
|
|
282
|
+
? new Date(Date.now() + (offer.interval === 'year' ? 365 : 30) * DAY_MS$1).toISOString()
|
|
262
283
|
: null;
|
|
263
284
|
this.entitlements = [
|
|
264
285
|
...this.entitlements.filter((item) => item.sku !== sku),
|
|
@@ -280,6 +301,7 @@
|
|
|
280
301
|
endUserRef,
|
|
281
302
|
entitlements: [...this.entitlements],
|
|
282
303
|
issuedAt: new Date().toISOString(),
|
|
304
|
+
...(this.trial ? { trial: { ...this.trial } } : {}),
|
|
283
305
|
},
|
|
284
306
|
signature: null,
|
|
285
307
|
alg: null,
|
|
@@ -293,12 +315,17 @@
|
|
|
293
315
|
this.transport = transport;
|
|
294
316
|
this.publishableKey = publishableKey;
|
|
295
317
|
}
|
|
296
|
-
/**
|
|
297
|
-
|
|
318
|
+
/**
|
|
319
|
+
* `locale` opens the hosted recovery page (and its email) in the user's language.
|
|
320
|
+
* `purpose` is sent only for `storage`: a plain restore keeps the request older
|
|
321
|
+
* BFFs know, and their non-strict zod input strips the key anyway.
|
|
322
|
+
*/
|
|
323
|
+
createRestoreSession(claimChallenge, locale, purpose) {
|
|
298
324
|
return this.transport.call('pay.createRestoreSession', 'mutation', {
|
|
299
325
|
publishableKey: this.publishableKey,
|
|
300
326
|
claimChallenge,
|
|
301
327
|
...(locale ? { locale } : {}),
|
|
328
|
+
...(purpose === 'storage' ? { purpose } : {}),
|
|
302
329
|
});
|
|
303
330
|
}
|
|
304
331
|
claimRestoreSession(sessionId, claimSecret) {
|
|
@@ -337,10 +364,12 @@
|
|
|
337
364
|
endUserRef,
|
|
338
365
|
});
|
|
339
366
|
}
|
|
340
|
-
|
|
367
|
+
/** `trialStartedHint`: the trial start kept in storage.sync; the server only lets it move a start earlier. */
|
|
368
|
+
getEntitlement(endUserRef, trialStartedHint) {
|
|
341
369
|
return this.transport.call('pay.getEntitlement', 'query', {
|
|
342
370
|
publishableKey: this.publishableKey,
|
|
343
371
|
endUserRef,
|
|
372
|
+
...(trialStartedHint ? { trialStartedHint } : {}),
|
|
344
373
|
});
|
|
345
374
|
}
|
|
346
375
|
getPortalUrl(endUserRef, customerId, locale) {
|
|
@@ -738,6 +767,118 @@
|
|
|
738
767
|
openInNewTab: openInNewTab
|
|
739
768
|
});
|
|
740
769
|
|
|
770
|
+
/**
|
|
771
|
+
* Cloud copy of the extension's settings (`@extenshi/storage`). Pay owns the
|
|
772
|
+
* token: only a verified restore claim issues it; this module keeps it in the
|
|
773
|
+
* SDK's storage (`storage.local`) and revokes it. `@extenshi/storage` reads it
|
|
774
|
+
* through `cloudBackupToken()`. The token is never logged and never answered to
|
|
775
|
+
* a content script: route those calls to the background.
|
|
776
|
+
*/
|
|
777
|
+
const REQUEST_TIMEOUT_MS = 10000;
|
|
778
|
+
/** True in a content script, where the token must not be handed out. */
|
|
779
|
+
function inContentScript() {
|
|
780
|
+
const g = globalThis;
|
|
781
|
+
return !!(g.chrome?.runtime?.id || g.browser?.runtime?.id) && !(g.chrome?.tabs || g.browser?.tabs);
|
|
782
|
+
}
|
|
783
|
+
class CloudBackup {
|
|
784
|
+
constructor(options) {
|
|
785
|
+
this.options = options;
|
|
786
|
+
this.fetchImpl = options.fetch ?? ((input, init) => fetch(input, init));
|
|
787
|
+
}
|
|
788
|
+
get storageKey() {
|
|
789
|
+
return `extenshi-pay:${this.options.publishableKey}:storageToken`;
|
|
790
|
+
}
|
|
791
|
+
/** Stores or clears the token from a verified claim. Never throws: the licence is already restored. */
|
|
792
|
+
async accept(grant) {
|
|
793
|
+
if (!grant || typeof grant !== 'object')
|
|
794
|
+
return undefined;
|
|
795
|
+
try {
|
|
796
|
+
if (grant.state === 'granted') {
|
|
797
|
+
if (typeof grant.token !== 'string' || !STORAGE_TOKEN_RE.test(grant.token))
|
|
798
|
+
return undefined;
|
|
799
|
+
await this.options.storage.set(this.storageKey, grant.token);
|
|
800
|
+
return 'on';
|
|
801
|
+
}
|
|
802
|
+
if (grant.state === 'unavailable') {
|
|
803
|
+
await this.options.storage.remove(this.storageKey);
|
|
804
|
+
return grant.reason === 'LICENSE_REQUIRED' ? 'license_required' : 'no_consent';
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
catch {
|
|
808
|
+
logger.warn('cloud backup state could not be saved');
|
|
809
|
+
}
|
|
810
|
+
return undefined;
|
|
811
|
+
}
|
|
812
|
+
async token() {
|
|
813
|
+
this.assertTrustedContext();
|
|
814
|
+
const value = await this.options.storage.get(this.storageKey);
|
|
815
|
+
return typeof value === 'string' && STORAGE_TOKEN_RE.test(value) ? value : null;
|
|
816
|
+
}
|
|
817
|
+
/** Revokes this installation's token. A token the server no longer knows (401) is forgotten too. */
|
|
818
|
+
async disable() {
|
|
819
|
+
const token = await this.token();
|
|
820
|
+
if (!token)
|
|
821
|
+
return;
|
|
822
|
+
if (!this.options.mock) {
|
|
823
|
+
const status = await this.request('/v1/storage/grant', token);
|
|
824
|
+
if (status !== 401)
|
|
825
|
+
this.throwUnlessOk(status);
|
|
826
|
+
}
|
|
827
|
+
await this.options.storage.remove(this.storageKey);
|
|
828
|
+
}
|
|
829
|
+
/** Deletes the buyer's cloud copy and turns the backup off on every device. */
|
|
830
|
+
async delete() {
|
|
831
|
+
const token = await this.token();
|
|
832
|
+
if (!token)
|
|
833
|
+
throw new ExtenshiPayError(ERROR_CODES.INVALID_REQUEST, 'Cloud backup is off on this installation; turn it on to delete the cloud copy');
|
|
834
|
+
if (!this.options.mock) {
|
|
835
|
+
const status = await this.request('/v1/storage/data', token);
|
|
836
|
+
if (status === 401) {
|
|
837
|
+
// The server no longer accepts this token, so it is useless here; the copy was not deleted.
|
|
838
|
+
await this.options.storage.remove(this.storageKey);
|
|
839
|
+
throw new ExtenshiPayError(ERROR_CODES.INVALID_REQUEST, 'Cloud backup is off on the server; turn it on again to delete the cloud copy', { httpStatus: 401 });
|
|
840
|
+
}
|
|
841
|
+
this.throwUnlessOk(status);
|
|
842
|
+
}
|
|
843
|
+
await this.options.storage.remove(this.storageKey);
|
|
844
|
+
}
|
|
845
|
+
assertTrustedContext() {
|
|
846
|
+
if (inContentScript())
|
|
847
|
+
throw new ExtenshiPayError(ERROR_CODES.INVALID_REQUEST, 'Use cloud backup from an extension page or background context');
|
|
848
|
+
}
|
|
849
|
+
throwUnlessOk(status) {
|
|
850
|
+
if (status >= 200 && status < 300)
|
|
851
|
+
return;
|
|
852
|
+
if (status === 429)
|
|
853
|
+
throw new ExtenshiPayError(ERROR_CODES.RATE_LIMITED, 'Too many requests', { httpStatus: status });
|
|
854
|
+
if (status >= 500)
|
|
855
|
+
throw new ExtenshiPayError(ERROR_CODES.GATEWAY_UNAVAILABLE, `HTTP ${status}`, { httpStatus: status });
|
|
856
|
+
throw new ExtenshiPayError(ERROR_CODES.INVALID_RESPONSE, `HTTP ${status}`, { httpStatus: status });
|
|
857
|
+
}
|
|
858
|
+
async request(path, token) {
|
|
859
|
+
const controller = typeof AbortController === 'function' ? new AbortController() : null;
|
|
860
|
+
const timer = controller ? setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS) : null;
|
|
861
|
+
try {
|
|
862
|
+
const response = await this.fetchImpl(`${this.options.apiUrl}${path}`, {
|
|
863
|
+
method: 'DELETE',
|
|
864
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
865
|
+
credentials: 'omit',
|
|
866
|
+
signal: controller?.signal,
|
|
867
|
+
});
|
|
868
|
+
return response.status;
|
|
869
|
+
}
|
|
870
|
+
catch (error) {
|
|
871
|
+
if (controller?.signal.aborted)
|
|
872
|
+
throw new ExtenshiPayError(ERROR_CODES.TIMEOUT, `Request timed out after ${REQUEST_TIMEOUT_MS}ms`);
|
|
873
|
+
throw new ExtenshiPayError(ERROR_CODES.NETWORK_ERROR, 'Network request failed', { cause: error });
|
|
874
|
+
}
|
|
875
|
+
finally {
|
|
876
|
+
if (timer !== null)
|
|
877
|
+
clearTimeout(timer);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
741
882
|
/** Pure helpers over the entitlement projection. Features come from the items' `features[]`. */
|
|
742
883
|
const LIVE_STATUSES = new Set(['active', 'grace']);
|
|
743
884
|
function isLive(item) {
|
|
@@ -792,9 +933,17 @@
|
|
|
792
933
|
/**
|
|
793
934
|
* Ed25519 verification of the entitlement projection.
|
|
794
935
|
*
|
|
795
|
-
* Tamper resistance, not DRM.
|
|
796
|
-
*
|
|
797
|
-
*
|
|
936
|
+
* Tamper resistance, not DRM. Callers must deny access for both invalid and
|
|
937
|
+
* unverified envelopes outside explicit mocks.
|
|
938
|
+
*
|
|
939
|
+
* Which keys are trusted, in order (`PublicKeySource`, built in core/extenshi-pay.ts):
|
|
940
|
+
* 1. the key the server returned over HTTPS in this session;
|
|
941
|
+
* 2. the bundled `entitlementPublicKey`, when the developer configured one. It pins
|
|
942
|
+
* verification without a round-trip: a key read from extension storage is then never used;
|
|
943
|
+
* 3. without a bundled key, the server key saved in `storage.local` next to the
|
|
944
|
+
* license cache, so a restart with no network can still verify the cache.
|
|
945
|
+
* When none of them verifies an envelope the server is asked for its current key once
|
|
946
|
+
* (a rotated key), and that answer decides.
|
|
798
947
|
*/
|
|
799
948
|
function base64ToBytes(base64) {
|
|
800
949
|
const binary = atob(base64);
|
|
@@ -829,6 +978,156 @@
|
|
|
829
978
|
return 'invalid';
|
|
830
979
|
}
|
|
831
980
|
}
|
|
981
|
+
const PUBLIC_KEY_RE = /^[A-Za-z0-9+/]{43}=$/;
|
|
982
|
+
/**
|
|
983
|
+
* `invalid` only when the server's current key was checked too (or the envelope carries no
|
|
984
|
+
* signature at all). A mismatch against known keys while the server is unreachable is
|
|
985
|
+
* `unverified`: it may be a rotated key, and no paid access is granted either way.
|
|
986
|
+
*/
|
|
987
|
+
async function verifyWithKeys(envelope, source) {
|
|
988
|
+
if (!envelope.signature || envelope.alg !== 'ed25519')
|
|
989
|
+
return { verdict: 'invalid', key: null };
|
|
990
|
+
let known = [];
|
|
991
|
+
try {
|
|
992
|
+
known = await source.known();
|
|
993
|
+
}
|
|
994
|
+
catch {
|
|
995
|
+
known = [];
|
|
996
|
+
}
|
|
997
|
+
let mismatch = false;
|
|
998
|
+
for (const key of known) {
|
|
999
|
+
const verdict = await verifyEntitlementSignature(envelope, key);
|
|
1000
|
+
if (verdict === 'valid')
|
|
1001
|
+
return { verdict, key };
|
|
1002
|
+
if (verdict === 'invalid')
|
|
1003
|
+
mismatch = true;
|
|
1004
|
+
}
|
|
1005
|
+
let current;
|
|
1006
|
+
try {
|
|
1007
|
+
current = await source.fetchCurrent();
|
|
1008
|
+
}
|
|
1009
|
+
catch {
|
|
1010
|
+
return { verdict: 'unverified', key: null };
|
|
1011
|
+
}
|
|
1012
|
+
if (current && !known.includes(current)) {
|
|
1013
|
+
const verdict = await verifyEntitlementSignature(envelope, current);
|
|
1014
|
+
return { verdict, key: verdict === 'valid' ? current : null };
|
|
1015
|
+
}
|
|
1016
|
+
return { verdict: mismatch ? 'invalid' : 'unverified', key: null };
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* The free trial an application configures on the server (`trialDays`).
|
|
1021
|
+
*
|
|
1022
|
+
* The server starts one clock per installation at its first license read and
|
|
1023
|
+
* signs `{ startedAt, endsAt }` into the entitlement, so the trial comes from
|
|
1024
|
+
* the verified license like paid access does: no start date in extension
|
|
1025
|
+
* storage, nothing a device clock or a storage edit can move. Offline, the
|
|
1026
|
+
* cached license answers for up to 48 hours.
|
|
1027
|
+
*
|
|
1028
|
+
* `trial:ending` / `trial:ended` fire once per installation and trial (the
|
|
1029
|
+
* marker is kept in the SDK's storage), and not while the user has paid
|
|
1030
|
+
* access. Render state from `getTrial()`; the events are one-time notices.
|
|
1031
|
+
*/
|
|
1032
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
1033
|
+
/** Re-check at least daily: long timers are clamped by browsers and lost when a service worker sleeps. */
|
|
1034
|
+
const MAX_TIMER_MS$1 = DAY_MS;
|
|
1035
|
+
/** The trial as of `clock`, or null when the license carries none (or a malformed one). */
|
|
1036
|
+
function trialState(trial, clock) {
|
|
1037
|
+
if (!trial)
|
|
1038
|
+
return null;
|
|
1039
|
+
const startedAt = Date.parse(trial.startedAt);
|
|
1040
|
+
const endsAt = Date.parse(trial.endsAt);
|
|
1041
|
+
if (!Number.isFinite(startedAt) || !Number.isFinite(endsAt))
|
|
1042
|
+
return null;
|
|
1043
|
+
// The server's signed time is a floor: a clock turned back cannot reopen an ended trial.
|
|
1044
|
+
const now = Number.isFinite(clock.issuedAt) ? Math.max(clock.now, clock.issuedAt) : clock.now;
|
|
1045
|
+
const left = endsAt - now;
|
|
1046
|
+
return {
|
|
1047
|
+
active: left > 0 && clock.checked,
|
|
1048
|
+
startedAt: trial.startedAt,
|
|
1049
|
+
endsAt: trial.endsAt,
|
|
1050
|
+
daysLeft: left > 0 ? Math.ceil(left / DAY_MS) : 0,
|
|
1051
|
+
requiresOnlineCheck: left > 0 && !clock.checked,
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
/** The feedback form address with `src=trial_end`; null unless it is a plain HTTPS URL. No installation id is added. */
|
|
1055
|
+
function trialFeedbackUrl(raw) {
|
|
1056
|
+
if (!raw)
|
|
1057
|
+
return null;
|
|
1058
|
+
let url;
|
|
1059
|
+
try {
|
|
1060
|
+
url = new URL(raw);
|
|
1061
|
+
}
|
|
1062
|
+
catch {
|
|
1063
|
+
return null;
|
|
1064
|
+
}
|
|
1065
|
+
if (url.protocol !== 'https:' || url.username || url.password)
|
|
1066
|
+
return null;
|
|
1067
|
+
url.searchParams.set('src', 'trial_end');
|
|
1068
|
+
return url.toString();
|
|
1069
|
+
}
|
|
1070
|
+
class TrialNotifier {
|
|
1071
|
+
constructor(options) {
|
|
1072
|
+
this.options = options;
|
|
1073
|
+
this.timer = null;
|
|
1074
|
+
this.running = false;
|
|
1075
|
+
this.pending = Promise.resolve();
|
|
1076
|
+
}
|
|
1077
|
+
start() {
|
|
1078
|
+
this.running = true;
|
|
1079
|
+
void this.evaluate();
|
|
1080
|
+
}
|
|
1081
|
+
stop() {
|
|
1082
|
+
this.running = false;
|
|
1083
|
+
this.clearTimer();
|
|
1084
|
+
}
|
|
1085
|
+
/** Checks the held license; serialized, so two refreshes never send one event twice. */
|
|
1086
|
+
evaluate() {
|
|
1087
|
+
this.pending = this.pending.then(() => this.check()).catch((error) => logger.debug('trial check', error));
|
|
1088
|
+
return this.pending;
|
|
1089
|
+
}
|
|
1090
|
+
async check() {
|
|
1091
|
+
if (!this.running)
|
|
1092
|
+
return;
|
|
1093
|
+
this.clearTimer();
|
|
1094
|
+
const trial = this.options.getTrial();
|
|
1095
|
+
if (!trial)
|
|
1096
|
+
return;
|
|
1097
|
+
const now = this.options.now();
|
|
1098
|
+
const endsAt = Date.parse(trial.endsAt);
|
|
1099
|
+
const endingAt = endsAt - this.options.endingDays * DAY_MS;
|
|
1100
|
+
const event = trial.daysLeft === 0
|
|
1101
|
+
? 'trial:ended'
|
|
1102
|
+
: trial.active && this.options.endingDays > 0 && now >= endingAt
|
|
1103
|
+
? 'trial:ending'
|
|
1104
|
+
: null;
|
|
1105
|
+
if (event && !this.options.hasPaidAccess())
|
|
1106
|
+
await this.send(event, trial);
|
|
1107
|
+
if (!this.running || trial.daysLeft === 0)
|
|
1108
|
+
return;
|
|
1109
|
+
const next = [endingAt, endsAt].find((at) => at > now) ?? endsAt;
|
|
1110
|
+
this.timer = setTimeout(() => {
|
|
1111
|
+
this.timer = null;
|
|
1112
|
+
void this.evaluate();
|
|
1113
|
+
}, Math.max(1000, Math.min(next - now, MAX_TIMER_MS$1)));
|
|
1114
|
+
}
|
|
1115
|
+
async send(event, trial) {
|
|
1116
|
+
const id = `${trial.startedAt}|${trial.endsAt}`;
|
|
1117
|
+
const field = event === 'trial:ended' ? 'ended' : 'ending';
|
|
1118
|
+
const stored = (await this.options.storage.get(this.options.storageKey));
|
|
1119
|
+
const sent = stored && typeof stored === 'object' ? stored : {};
|
|
1120
|
+
if (sent[field] === id || !this.running)
|
|
1121
|
+
return;
|
|
1122
|
+
await this.options.storage.set(this.options.storageKey, { ...sent, [field]: id });
|
|
1123
|
+
this.options.emit(event, trial);
|
|
1124
|
+
}
|
|
1125
|
+
clearTimer() {
|
|
1126
|
+
if (this.timer !== null)
|
|
1127
|
+
clearTimeout(this.timer);
|
|
1128
|
+
this.timer = null;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
832
1131
|
|
|
833
1132
|
/**
|
|
834
1133
|
* Entitlement cache + refresh.
|
|
@@ -836,13 +1135,18 @@
|
|
|
836
1135
|
* The cached envelope is a cache OF the server projection, never a second
|
|
837
1136
|
* source of truth: it is verified when stored and re-verified on load (once
|
|
838
1137
|
* the project's public key is known), served without a round-trip while the
|
|
839
|
-
* TTL holds, served for
|
|
1138
|
+
* TTL holds, served after signed issuance for the signed `offlineSeconds` (48 hours when absent) when the network is down, and expired
|
|
840
1139
|
* locally by `expiresAt`. Background refresh polls at most every 15 minutes
|
|
841
1140
|
* and backs off exponentially on errors.
|
|
842
1141
|
*/
|
|
843
1142
|
const MIN_REFRESH_INTERVAL_MS = 15 * 60 * 1000;
|
|
844
1143
|
const MAX_REFRESH_BACKOFF_MS = 6 * 60 * 60 * 1000;
|
|
1144
|
+
/** Offline allowance when the signed license names none (older servers and caches). */
|
|
845
1145
|
const MAX_OFFLINE_AGE_MS = 48 * 60 * 60 * 1000;
|
|
1146
|
+
/** Ceiling for a signed `offlineSeconds`. */
|
|
1147
|
+
const MAX_SIGNED_OFFLINE_AGE_MS = 366 * 24 * 60 * 60 * 1000;
|
|
1148
|
+
/** `setTimeout` fires at once past this delay. */
|
|
1149
|
+
const MAX_TIMER_MS = 2 ** 31 - 1;
|
|
846
1150
|
// Allow small server/client clock skew without granting more than the signed age limit.
|
|
847
1151
|
const MAX_CLOCK_SKEW_MS = 5 * 60 * 1000;
|
|
848
1152
|
const CACHE_VERSION = 1;
|
|
@@ -861,6 +1165,8 @@
|
|
|
861
1165
|
this.options = options;
|
|
862
1166
|
this.held = null;
|
|
863
1167
|
this.inflight = null;
|
|
1168
|
+
/** Device clock against the server's at the last license check; null within 5 minutes. */
|
|
1169
|
+
this.clockSkew = null;
|
|
864
1170
|
this.timer = null;
|
|
865
1171
|
this.refreshGeneration = 0;
|
|
866
1172
|
this.deadlineTimer = null;
|
|
@@ -902,8 +1208,10 @@
|
|
|
902
1208
|
envelope: JSON.parse(JSON.stringify(record.envelope)),
|
|
903
1209
|
fetchedAt: record.fetchedAt,
|
|
904
1210
|
verified: false,
|
|
1211
|
+
key: null,
|
|
905
1212
|
source: this.source === 'mock' ? 'mock' : 'cache',
|
|
906
1213
|
};
|
|
1214
|
+
this.measureClockSkew(record.fetchedAt, Date.parse(record.envelope.payload.issuedAt));
|
|
907
1215
|
this.lastFingerprint = this.fingerprint();
|
|
908
1216
|
return this.snapshot();
|
|
909
1217
|
}
|
|
@@ -914,8 +1222,7 @@
|
|
|
914
1222
|
if (this.source === 'mock')
|
|
915
1223
|
return;
|
|
916
1224
|
const held = this.held;
|
|
917
|
-
const key = await this.
|
|
918
|
-
const verdict = await verifyEntitlementSignature(held.envelope, key);
|
|
1225
|
+
const { verdict, key } = await verifyWithKeys(held.envelope, this.options.keys);
|
|
919
1226
|
if (held !== this.held)
|
|
920
1227
|
return;
|
|
921
1228
|
if (verdict === 'invalid') {
|
|
@@ -924,19 +1231,39 @@
|
|
|
924
1231
|
throw new ExtenshiPayError(ERROR_CODES.INVALID_RESPONSE, 'Cached entitlement signature is invalid');
|
|
925
1232
|
}
|
|
926
1233
|
held.verified = verdict === 'valid';
|
|
1234
|
+
held.key = key;
|
|
927
1235
|
if (!held.verified) {
|
|
928
1236
|
throw new ExtenshiPayError(ERROR_CODES.VERIFICATION_UNAVAILABLE, 'Entitlement verification requires a trusted key and Ed25519 WebCrypto support');
|
|
929
1237
|
}
|
|
930
1238
|
this.scheduleDeadline();
|
|
931
1239
|
}
|
|
1240
|
+
/** The key the held license was verified with; null when there is none or it is unverified. */
|
|
1241
|
+
get verifiedKey() {
|
|
1242
|
+
return this.held?.verified ? this.held.key : null;
|
|
1243
|
+
}
|
|
932
1244
|
getCached() {
|
|
933
1245
|
return this.held ? this.snapshot() : null;
|
|
934
1246
|
}
|
|
1247
|
+
/** The server trial in the held license; null without one, or while the license is unverified. */
|
|
1248
|
+
getTrial() {
|
|
1249
|
+
const held = this.held;
|
|
1250
|
+
if (!held || (this.source !== 'mock' && !held.verified))
|
|
1251
|
+
return null;
|
|
1252
|
+
const now = this.now();
|
|
1253
|
+
const issuedAt = Date.parse(held.envelope.payload.issuedAt);
|
|
1254
|
+
return trialState(held.envelope.payload.trial, {
|
|
1255
|
+
now,
|
|
1256
|
+
issuedAt,
|
|
1257
|
+
// The same offline rule as paid access (snapshot): the allowance from the signed issue, no clock turned back.
|
|
1258
|
+
checked: this.source === 'mock' ||
|
|
1259
|
+
(now >= held.fetchedAt && now < this.offlineDeadline() && now + MAX_CLOCK_SKEW_MS >= issuedAt),
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
935
1262
|
isFresh() {
|
|
936
1263
|
return (this.held !== null &&
|
|
937
1264
|
(this.source === 'mock' || (this.held.verified && !this.snapshot().requiresOnlineCheck)) &&
|
|
938
1265
|
this.now() >= this.held.fetchedAt &&
|
|
939
|
-
this.now() - this.held.fetchedAt < Math.min(this.options.cacheTtlMs,
|
|
1266
|
+
this.now() - this.held.fetchedAt < Math.min(this.options.cacheTtlMs, this.offlineAgeMs()));
|
|
940
1267
|
}
|
|
941
1268
|
async get(options = {}) {
|
|
942
1269
|
if (!options.force && this.isFresh())
|
|
@@ -951,7 +1278,7 @@
|
|
|
951
1278
|
logger.debug('serving cached entitlement after refresh failure', err.code);
|
|
952
1279
|
return this.snapshot();
|
|
953
1280
|
}
|
|
954
|
-
return
|
|
1281
|
+
return this.snapshot();
|
|
955
1282
|
}
|
|
956
1283
|
}
|
|
957
1284
|
/** Fetches the projection from the backend, verifies and stores it. */
|
|
@@ -959,7 +1286,8 @@
|
|
|
959
1286
|
if (!this.inflight) {
|
|
960
1287
|
this.inflight = (async () => {
|
|
961
1288
|
const endUserRef = await this.options.getEndUserRef();
|
|
962
|
-
const
|
|
1289
|
+
const hint = this.options.getTrialStartHint ? await this.options.getTrialStartHint() : null;
|
|
1290
|
+
const envelope = await this.options.api.getEntitlement(endUserRef, hint);
|
|
963
1291
|
return this.accept(envelope, this.source);
|
|
964
1292
|
})().finally(() => {
|
|
965
1293
|
this.inflight = null;
|
|
@@ -981,9 +1309,9 @@
|
|
|
981
1309
|
if (envelope.payload.endUserRef !== endUserRef) {
|
|
982
1310
|
throw new ExtenshiPayError(ERROR_CODES.INVALID_RESPONSE, 'Entitlement issued for a different endUserRef');
|
|
983
1311
|
}
|
|
984
|
-
const verdict = this.source === 'mock'
|
|
985
|
-
? 'unverified'
|
|
986
|
-
: await
|
|
1312
|
+
const { verdict, key } = this.source === 'mock'
|
|
1313
|
+
? { verdict: 'unverified', key: null }
|
|
1314
|
+
: await verifyWithKeys(envelope, this.options.keys);
|
|
987
1315
|
if (verdict === 'invalid') {
|
|
988
1316
|
await this.discard();
|
|
989
1317
|
throw new ExtenshiPayError(ERROR_CODES.INVALID_RESPONSE, 'Entitlement signature is invalid');
|
|
@@ -993,15 +1321,19 @@
|
|
|
993
1321
|
}
|
|
994
1322
|
const fetchedAt = this.now();
|
|
995
1323
|
const issuedAt = Date.parse(envelope.payload.issuedAt);
|
|
1324
|
+
// A verified envelope was signed moments ago: its `issuedAt` is the server's clock.
|
|
1325
|
+
if (this.source !== 'mock')
|
|
1326
|
+
this.measureClockSkew(fetchedAt, issuedAt);
|
|
996
1327
|
if (this.source !== 'mock' && (!Number.isFinite(issuedAt) || issuedAt > fetchedAt + MAX_CLOCK_SKEW_MS)) {
|
|
997
1328
|
throw new ExtenshiPayError(ERROR_CODES.INVALID_RESPONSE, 'Entitlement issuedAt is invalid or in the future');
|
|
998
1329
|
}
|
|
999
|
-
this.held = { envelope, fetchedAt, verified: verdict === 'valid', source };
|
|
1330
|
+
this.held = { envelope, fetchedAt, verified: verdict === 'valid', key, source };
|
|
1000
1331
|
const record = { v: CACHE_VERSION, envelope, fetchedAt };
|
|
1001
1332
|
await this.options.storage.set(this.storageKey, JSON.parse(JSON.stringify(record)));
|
|
1002
1333
|
this.backoffMs = 0;
|
|
1003
1334
|
this.scheduleDeadline();
|
|
1004
1335
|
this.notifyIfChanged();
|
|
1336
|
+
this.options.onAccepted?.();
|
|
1005
1337
|
return this.snapshot();
|
|
1006
1338
|
}
|
|
1007
1339
|
/** Drain an older installation refresh before changing identity. */
|
|
@@ -1055,7 +1387,7 @@
|
|
|
1055
1387
|
this.deadlineTimer = null;
|
|
1056
1388
|
this.notifyIfChanged();
|
|
1057
1389
|
this.scheduleDeadline();
|
|
1058
|
-
}, remaining);
|
|
1390
|
+
}, Math.min(remaining, MAX_TIMER_MS));
|
|
1059
1391
|
}
|
|
1060
1392
|
schedule(delayMs) {
|
|
1061
1393
|
const generation = this.refreshGeneration;
|
|
@@ -1076,14 +1408,12 @@
|
|
|
1076
1408
|
}
|
|
1077
1409
|
}, delayMs);
|
|
1078
1410
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
return null;
|
|
1086
|
-
}
|
|
1411
|
+
measureClockSkew(local, server) {
|
|
1412
|
+
const ms = local - server;
|
|
1413
|
+
this.clockSkew =
|
|
1414
|
+
Number.isFinite(ms) && Math.abs(ms) > MAX_CLOCK_SKEW_MS
|
|
1415
|
+
? { direction: ms > 0 ? 'ahead' : 'behind', ms: Math.abs(ms) }
|
|
1416
|
+
: null;
|
|
1087
1417
|
}
|
|
1088
1418
|
async discard() {
|
|
1089
1419
|
this.held = null;
|
|
@@ -1106,13 +1436,25 @@
|
|
|
1106
1436
|
if (!this.held)
|
|
1107
1437
|
return NaN;
|
|
1108
1438
|
// fetchedAt is untrusted bookkeeping; it may shorten, never extend, a grant.
|
|
1109
|
-
return Math.min(this.held.fetchedAt, Date.parse(this.held.envelope.payload.issuedAt)) +
|
|
1439
|
+
return (Math.min(this.held.fetchedAt, Date.parse(this.held.envelope.payload.issuedAt)) + this.offlineAgeMs());
|
|
1440
|
+
}
|
|
1441
|
+
/** The signed allowance of the held license, or 48 hours when it names none. */
|
|
1442
|
+
offlineAgeMs() {
|
|
1443
|
+
const seconds = this.held?.envelope.payload.offlineSeconds;
|
|
1444
|
+
if (typeof seconds !== 'number' || !Number.isFinite(seconds) || seconds <= 0)
|
|
1445
|
+
return MAX_OFFLINE_AGE_MS;
|
|
1446
|
+
return Math.min(seconds * 1000, MAX_SIGNED_OFFLINE_AGE_MS);
|
|
1110
1447
|
}
|
|
1111
1448
|
snapshot() {
|
|
1112
1449
|
if (!this.held)
|
|
1113
|
-
return EMPTY_ENTITLEMENT;
|
|
1450
|
+
return this.clockSkew ? { ...EMPTY_ENTITLEMENT, clockSkew: this.clockSkew } : EMPTY_ENTITLEMENT;
|
|
1114
1451
|
if (this.source !== 'mock' && !this.held.verified) {
|
|
1115
|
-
return {
|
|
1452
|
+
return {
|
|
1453
|
+
...EMPTY_ENTITLEMENT,
|
|
1454
|
+
requiresOnlineCheck: true,
|
|
1455
|
+
clockSkew: this.clockSkew,
|
|
1456
|
+
source: this.held.source,
|
|
1457
|
+
};
|
|
1116
1458
|
}
|
|
1117
1459
|
const items = applyLocalExpiry(JSON.parse(JSON.stringify(this.held.envelope.payload.entitlements)), this.now());
|
|
1118
1460
|
const hasPaidAccess = collectFeatures(items).length > 0 ||
|
|
@@ -1128,6 +1470,7 @@
|
|
|
1128
1470
|
features: requiresOnlineCheck ? [] : collectFeatures(items),
|
|
1129
1471
|
requiresOnlineCheck,
|
|
1130
1472
|
offlineUntil,
|
|
1473
|
+
clockSkew: this.clockSkew,
|
|
1131
1474
|
verified: this.held.verified,
|
|
1132
1475
|
issuedAt: this.held.envelope.payload.issuedAt,
|
|
1133
1476
|
fetchedAt: this.held.fetchedAt,
|
|
@@ -1216,6 +1559,16 @@
|
|
|
1216
1559
|
this.map.delete(key);
|
|
1217
1560
|
}
|
|
1218
1561
|
}
|
|
1562
|
+
/**
|
|
1563
|
+
* The browser's synced storage (`storage.sync`), or null outside an extension. The SDK keeps
|
|
1564
|
+
* only the trial start there (never `endUserRef`), so devices on one synced account share the
|
|
1565
|
+
* trial. Uninstalling clears it from the account, so it does not survive a reinstall.
|
|
1566
|
+
*/
|
|
1567
|
+
function createSyncStorage() {
|
|
1568
|
+
const g = extensionGlobals();
|
|
1569
|
+
const area = g.chrome?.storage?.sync ?? g.browser?.storage?.sync;
|
|
1570
|
+
return area ? new ExtensionStorage(area) : null;
|
|
1571
|
+
}
|
|
1219
1572
|
function createStorage() {
|
|
1220
1573
|
const g = extensionGlobals();
|
|
1221
1574
|
const area = g.chrome?.storage?.local ?? g.browser?.storage?.local;
|
|
@@ -1272,7 +1625,7 @@
|
|
|
1272
1625
|
const secret = Array.from(cryptoApi.getRandomValues(new Uint8Array(32)), (b) => b.toString(16).padStart(2, '0')).join('');
|
|
1273
1626
|
const hash = await cryptoApi.subtle.digest('SHA-256', new TextEncoder().encode(secret));
|
|
1274
1627
|
const challenge = Array.from(new Uint8Array(hash), (b) => b.toString(16).padStart(2, '0')).join('');
|
|
1275
|
-
const created = await this.options.api.createRestoreSession(challenge, this.options.locale);
|
|
1628
|
+
const created = await this.options.api.createRestoreSession(challenge, this.options.locale, options.purpose);
|
|
1276
1629
|
if (!Number.isFinite(Date.parse(created.expiresAt)))
|
|
1277
1630
|
throw new ExtenshiPayError(ERROR_CODES.INVALID_RESPONSE, 'Invalid recovery expiry');
|
|
1278
1631
|
const pending = { sessionId: created.sessionId, expiresAt: created.expiresAt, claimSecret: secret };
|
|
@@ -1332,8 +1685,9 @@
|
|
|
1332
1685
|
break;
|
|
1333
1686
|
if (claim.state === 'complete') {
|
|
1334
1687
|
const entitlement = await this.options.onComplete(claim.endUserRef, claim.entitlement);
|
|
1688
|
+
const cloudBackup = await this.options.onStorageGrant?.(claim.storage);
|
|
1335
1689
|
await this.options.storage.remove(this.pendingKey);
|
|
1336
|
-
return { state: 'complete', entitlement };
|
|
1690
|
+
return { state: 'complete', entitlement, ...(cloudBackup ? { cloudBackup } : {}) };
|
|
1337
1691
|
}
|
|
1338
1692
|
if (claim.state !== 'pending')
|
|
1339
1693
|
throw new ExtenshiPayError(ERROR_CODES.INVALID_RESPONSE, 'Invalid recovery response');
|
|
@@ -1362,9 +1716,10 @@
|
|
|
1362
1716
|
const DEFAULT_API_URL = 'https://bff.extenshi.io';
|
|
1363
1717
|
const DEFAULT_CACHE_TTL_MS = 60 * 60 * 1000;
|
|
1364
1718
|
const MAX_CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
1719
|
+
const DEFAULT_TRIAL_ENDING_DAYS = 2;
|
|
1365
1720
|
|
|
1366
1721
|
/** Kept in sync with package.json by tests/unit/version.test.ts. */
|
|
1367
|
-
const VERSION = '0.
|
|
1722
|
+
const VERSION = '0.11.0';
|
|
1368
1723
|
|
|
1369
1724
|
/**
|
|
1370
1725
|
* The user's language as the SDK sends it. Kept apart from the paywall
|
|
@@ -1434,7 +1789,7 @@
|
|
|
1434
1789
|
if (!isHttpUrl(apiUrl))
|
|
1435
1790
|
errors.push('apiUrl must be an http(s) URL');
|
|
1436
1791
|
const entitlementPublicKey = input.entitlementPublicKey ?? null;
|
|
1437
|
-
if (entitlementPublicKey !== null &&
|
|
1792
|
+
if (entitlementPublicKey !== null && !PUBLIC_KEY_RE.test(entitlementPublicKey)) {
|
|
1438
1793
|
errors.push('entitlementPublicKey must be a base64-encoded 32-byte Ed25519 public key');
|
|
1439
1794
|
}
|
|
1440
1795
|
const environment = input.environment ?? 'production';
|
|
@@ -1456,6 +1811,9 @@
|
|
|
1456
1811
|
const theme = input.theme ?? {};
|
|
1457
1812
|
if (theme.mode !== undefined && !THEME_MODES.has(theme.mode))
|
|
1458
1813
|
errors.push('theme.mode must be light, dark or auto');
|
|
1814
|
+
const trialEndingDays = input.trialEndingDays ?? DEFAULT_TRIAL_ENDING_DAYS;
|
|
1815
|
+
if (!Number.isInteger(trialEndingDays) || trialEndingDays < 0 || trialEndingDays > 365)
|
|
1816
|
+
errors.push('trialEndingDays must be a whole number of days between 0 and 365');
|
|
1459
1817
|
if (input.mock &&
|
|
1460
1818
|
input.mockData !== undefined &&
|
|
1461
1819
|
(typeof input.mockData !== 'object' || input.mockData === null)) {
|
|
@@ -1476,6 +1834,8 @@
|
|
|
1476
1834
|
mock: input.mock === true,
|
|
1477
1835
|
mockData: input.mock ? (input.mockData ?? {}) : null,
|
|
1478
1836
|
theme,
|
|
1837
|
+
trialEndingDays,
|
|
1838
|
+
syncTrialStart: input.syncTrialStart !== false,
|
|
1479
1839
|
};
|
|
1480
1840
|
}
|
|
1481
1841
|
|
|
@@ -1600,6 +1960,9 @@
|
|
|
1600
1960
|
pickerDescription: 'Separate purchases can have separate billing profiles. Choose one to manage its subscriptions and payment details.',
|
|
1601
1961
|
pickerFirstRecorded: 'First recorded {date}',
|
|
1602
1962
|
pickerCancel: 'Cancel',
|
|
1963
|
+
trialEndedTitle: 'Your free trial has ended',
|
|
1964
|
+
trialEndedDescription: 'The extension’s tools are paused. Your settings are kept and will be there when you upgrade.',
|
|
1965
|
+
trialEndedFeedback: 'Share feedback',
|
|
1603
1966
|
};
|
|
1604
1967
|
// BEGIN GENERATED TRANSLATIONS
|
|
1605
1968
|
const TRANSLATIONS = {
|
|
@@ -1668,6 +2031,9 @@
|
|
|
1668
2031
|
pickerDescription: 'Las compras independientes pueden tener perfiles de facturación distintos. Elige uno para gestionar sus suscripciones y datos de pago.',
|
|
1669
2032
|
pickerFirstRecorded: 'Registrado por primera vez el {date}',
|
|
1670
2033
|
pickerCancel: 'Cancelar',
|
|
2034
|
+
trialEndedTitle: 'Tu prueba gratuita ha terminado',
|
|
2035
|
+
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.',
|
|
2036
|
+
trialEndedFeedback: 'Enviar comentarios',
|
|
1671
2037
|
},
|
|
1672
2038
|
'pt-BR': {
|
|
1673
2039
|
title: 'Desbloqueie os recursos premium',
|
|
@@ -1734,6 +2100,9 @@
|
|
|
1734
2100
|
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.',
|
|
1735
2101
|
pickerFirstRecorded: 'Registrado pela primeira vez em {date}',
|
|
1736
2102
|
pickerCancel: 'Cancelar',
|
|
2103
|
+
trialEndedTitle: 'Seu teste gratuito terminou',
|
|
2104
|
+
trialEndedDescription: 'As ferramentas da extensão estão pausadas. Suas configurações foram mantidas e estarão lá quando você fizer o upgrade.',
|
|
2105
|
+
trialEndedFeedback: 'Enviar feedback',
|
|
1737
2106
|
},
|
|
1738
2107
|
fr: {
|
|
1739
2108
|
title: 'Débloquez les fonctionnalités premium',
|
|
@@ -1800,6 +2169,9 @@
|
|
|
1800
2169
|
pickerDescription: 'Des achats distincts peuvent avoir des profils de facturation distincts. Choisissez-en un pour gérer ses abonnements et ses informations de paiement.',
|
|
1801
2170
|
pickerFirstRecorded: 'Enregistré pour la première fois le {date}',
|
|
1802
2171
|
pickerCancel: 'Annuler',
|
|
2172
|
+
trialEndedTitle: 'Votre essai gratuit est terminé',
|
|
2173
|
+
trialEndedDescription: 'Les outils de l’extension sont en pause. Vos paramètres sont conservés et vous les retrouverez après la mise à niveau.',
|
|
2174
|
+
trialEndedFeedback: 'Donner votre avis',
|
|
1803
2175
|
},
|
|
1804
2176
|
de: {
|
|
1805
2177
|
title: 'Premium-Funktionen freischalten',
|
|
@@ -1866,6 +2238,9 @@
|
|
|
1866
2238
|
pickerDescription: 'Verschiedene Käufe können eigene Abrechnungsprofile haben. Wähle eines aus, um seine Abonnements und Zahlungsdaten zu verwalten.',
|
|
1867
2239
|
pickerFirstRecorded: 'Erstmals erfasst am {date}',
|
|
1868
2240
|
pickerCancel: 'Abbrechen',
|
|
2241
|
+
trialEndedTitle: 'Dein kostenloser Testzeitraum ist abgelaufen',
|
|
2242
|
+
trialEndedDescription: 'Die Funktionen der Erweiterung sind pausiert. Deine Einstellungen bleiben erhalten und sind nach dem Upgrade wieder da.',
|
|
2243
|
+
trialEndedFeedback: 'Feedback geben',
|
|
1869
2244
|
},
|
|
1870
2245
|
it: {
|
|
1871
2246
|
title: 'Sblocca le funzionalità premium',
|
|
@@ -1932,6 +2307,9 @@
|
|
|
1932
2307
|
pickerDescription: 'Acquisti diversi possono avere profili di fatturazione diversi. Scegline uno per gestirne gli abbonamenti e i dati di pagamento.',
|
|
1933
2308
|
pickerFirstRecorded: 'Registrato per la prima volta il {date}',
|
|
1934
2309
|
pickerCancel: 'Annulla',
|
|
2310
|
+
trialEndedTitle: 'La tua prova gratuita è terminata',
|
|
2311
|
+
trialEndedDescription: 'Gli strumenti dell’estensione sono in pausa. Le tue impostazioni sono conservate e le ritroverai dopo l’upgrade.',
|
|
2312
|
+
trialEndedFeedback: 'Invia un feedback',
|
|
1935
2313
|
},
|
|
1936
2314
|
ru: {
|
|
1937
2315
|
title: 'Откройте доступ к премиум-функциям',
|
|
@@ -1998,6 +2376,9 @@
|
|
|
1998
2376
|
pickerDescription: 'У разных покупок могут быть разные платёжные профили. Выберите профиль, чтобы управлять его подписками и платёжными данными.',
|
|
1999
2377
|
pickerFirstRecorded: 'Впервые зафиксирован: {date}',
|
|
2000
2378
|
pickerCancel: 'Отмена',
|
|
2379
|
+
trialEndedTitle: 'Бесплатный пробный период закончился',
|
|
2380
|
+
trialEndedDescription: 'Инструменты расширения приостановлены. Ваши настройки сохранены и будут на месте после перехода на премиум.',
|
|
2381
|
+
trialEndedFeedback: 'Оставить отзыв',
|
|
2001
2382
|
},
|
|
2002
2383
|
ja: {
|
|
2003
2384
|
title: 'プレミアム機能をアンロック',
|
|
@@ -2064,6 +2445,9 @@
|
|
|
2064
2445
|
pickerDescription: '購入ごとに別々の請求プロファイルがある場合があります。サブスクリプションと支払い情報を管理するプロファイルを1つ選択してください。',
|
|
2065
2446
|
pickerFirstRecorded: '初回記録日:{date}',
|
|
2066
2447
|
pickerCancel: 'キャンセル',
|
|
2448
|
+
trialEndedTitle: '無料トライアルが終了しました',
|
|
2449
|
+
trialEndedDescription: '拡張機能のツールは一時停止しています。設定は保存されており、アップグレード後もそのままご利用いただけます。',
|
|
2450
|
+
trialEndedFeedback: 'フィードバックを送信',
|
|
2067
2451
|
},
|
|
2068
2452
|
ko: {
|
|
2069
2453
|
title: '프리미엄 기능 잠금 해제',
|
|
@@ -2130,6 +2514,9 @@
|
|
|
2130
2514
|
pickerDescription: '구매마다 결제 프로필이 다를 수 있습니다. 구독과 결제 정보를 관리할 프로필을 하나 선택해 주세요.',
|
|
2131
2515
|
pickerFirstRecorded: '최초 기록일: {date}',
|
|
2132
2516
|
pickerCancel: '취소',
|
|
2517
|
+
trialEndedTitle: '무료 체험 기간이 종료되었습니다',
|
|
2518
|
+
trialEndedDescription: '확장 프로그램의 도구가 일시 중지되었습니다. 설정은 그대로 저장되어 있으며 업그레이드하면 다시 사용할 수 있습니다.',
|
|
2519
|
+
trialEndedFeedback: '의견 보내기',
|
|
2133
2520
|
},
|
|
2134
2521
|
'zh-CN': {
|
|
2135
2522
|
title: '解锁高级功能',
|
|
@@ -2196,6 +2583,9 @@
|
|
|
2196
2583
|
pickerDescription: '不同的购买可以有各自的账单资料。请选择一个,以管理其订阅和付款信息。',
|
|
2197
2584
|
pickerFirstRecorded: '首次记录于 {date}',
|
|
2198
2585
|
pickerCancel: '取消',
|
|
2586
|
+
trialEndedTitle: '免费试用已结束',
|
|
2587
|
+
trialEndedDescription: '扩展程序的工具已暂停。您的设置已保留,升级后即可继续使用。',
|
|
2588
|
+
trialEndedFeedback: '提交反馈',
|
|
2199
2589
|
},
|
|
2200
2590
|
ar: {
|
|
2201
2591
|
title: 'احصل على الميزات المميزة',
|
|
@@ -2262,6 +2652,9 @@
|
|
|
2262
2652
|
pickerDescription: 'يمكن أن تكون لعمليات الشراء المنفصلة ملفات فوترة منفصلة. اختر ملفًا منها لإدارة اشتراكاته وتفاصيل الدفع الخاصة به.',
|
|
2263
2653
|
pickerFirstRecorded: 'سُجِّل لأول مرة في {date}',
|
|
2264
2654
|
pickerCancel: 'إلغاء',
|
|
2655
|
+
trialEndedTitle: 'انتهت فترتك التجريبية المجانية',
|
|
2656
|
+
trialEndedDescription: 'أدوات الإضافة متوقفة مؤقتًا. إعداداتك محفوظة وستجدها كما هي بعد الترقية.',
|
|
2657
|
+
trialEndedFeedback: 'إرسال ملاحظات',
|
|
2265
2658
|
},
|
|
2266
2659
|
};
|
|
2267
2660
|
// END GENERATED TRANSLATIONS
|
|
@@ -2342,8 +2735,10 @@
|
|
|
2342
2735
|
* extends it with `getOffer()` / `showPaywall()`.
|
|
2343
2736
|
*
|
|
2344
2737
|
* Data that leaves the extension: `publishableKey`, `endUserRef`, `sku`,
|
|
2345
|
-
* `locale
|
|
2346
|
-
*
|
|
2738
|
+
* `locale`, checkout session IDs and, with a server trial, the trial start date
|
|
2739
|
+
* the server issued (`trialStartedHint`, kept in storage.sync). Explicit recovery also sends its session ID,
|
|
2740
|
+
* challenge and claim secret (POST body). Email stays on the hosted page. With cloud backup, the
|
|
2741
|
+
* storage token goes only to `/v1/storage` (as a bearer), never in a message to a content script.
|
|
2347
2742
|
*/
|
|
2348
2743
|
/** Server-side offer cache is 5 min; mirror it in memory. */
|
|
2349
2744
|
const OFFER_TTL_MS = 5 * 60 * 1000;
|
|
@@ -2354,12 +2749,30 @@
|
|
|
2354
2749
|
this.endUserRefPromise = null;
|
|
2355
2750
|
this.offer = null;
|
|
2356
2751
|
this.offerInflight = null;
|
|
2752
|
+
/** The signing key the server returned in this session; never one read from storage. */
|
|
2753
|
+
this.serverKey = null;
|
|
2754
|
+
/** Trust order for license signatures; see payment/signature.ts. */
|
|
2755
|
+
this.keys = {
|
|
2756
|
+
known: async () => {
|
|
2757
|
+
const pinned = this.config.entitlementPublicKey;
|
|
2758
|
+
const offline = pinned ?? (await this.readSavedServerKey());
|
|
2759
|
+
return [...new Set([this.serverKey, offline].filter((key) => !!key))];
|
|
2760
|
+
},
|
|
2761
|
+
fetchCurrent: async () => (await this.fetchOffer(true)).entitlementPublicKey,
|
|
2762
|
+
};
|
|
2357
2763
|
this.readyPromise = null;
|
|
2358
2764
|
this.destroyed = false;
|
|
2359
2765
|
this.config = resolveConfig(config);
|
|
2360
2766
|
logger.configure({ logLevel: this.config.logLevel, debug: this.config.debug });
|
|
2361
2767
|
this.now = deps.now ?? (() => Date.now());
|
|
2362
2768
|
this.storage = deps.storage ?? createStorage();
|
|
2769
|
+
this.openUrl = deps.openUrl;
|
|
2770
|
+
this.syncStorage =
|
|
2771
|
+
!this.config.syncTrialStart || this.config.mock
|
|
2772
|
+
? null
|
|
2773
|
+
: deps.syncStorage === undefined
|
|
2774
|
+
? createSyncStorage()
|
|
2775
|
+
: deps.syncStorage;
|
|
2363
2776
|
const transport = deps.transport ??
|
|
2364
2777
|
(this.config.mock
|
|
2365
2778
|
? new MockTransport(this.config.mockData ?? {})
|
|
@@ -2372,11 +2785,26 @@
|
|
|
2372
2785
|
cacheTtlMs: this.config.cacheTtlMs,
|
|
2373
2786
|
source: this.config.mock ? 'mock' : 'network',
|
|
2374
2787
|
getEndUserRef: () => this.getEndUserRef(),
|
|
2375
|
-
|
|
2788
|
+
keys: this.keys,
|
|
2376
2789
|
onChange: (entitlement) => this.emitter.emit('entitlement:changed', entitlement),
|
|
2790
|
+
onAccepted: () => {
|
|
2791
|
+
void this.trial.evaluate();
|
|
2792
|
+
void this.rememberTrialStart();
|
|
2793
|
+
},
|
|
2794
|
+
getTrialStartHint: () => this.readTrialStartHint(),
|
|
2377
2795
|
onError: (error) => this.reportError(error),
|
|
2378
2796
|
now: this.now,
|
|
2379
2797
|
});
|
|
2798
|
+
this.trial = new TrialNotifier({
|
|
2799
|
+
storage: this.storage,
|
|
2800
|
+
storageKey: `extenshi-pay:${this.config.publishableKey}:trial-events${this.config.mock ? ':mock' : ''}`,
|
|
2801
|
+
endingDays: this.config.trialEndingDays,
|
|
2802
|
+
getTrial: () => this.entitlements.getTrial(),
|
|
2803
|
+
// A paid license still counts while it waits for an online check: no "trial ended" to a buyer.
|
|
2804
|
+
hasPaidAccess: () => (this.entitlements.getCached()?.items ?? []).some(isLive),
|
|
2805
|
+
emit: (event, trial) => this.emitter.emit(event, trial),
|
|
2806
|
+
now: this.now,
|
|
2807
|
+
});
|
|
2380
2808
|
this.checkout = new CheckoutManager({
|
|
2381
2809
|
api: this.api,
|
|
2382
2810
|
storage: this.storage,
|
|
@@ -2390,6 +2818,13 @@
|
|
|
2390
2818
|
(this.config.mock ? (url) => logger.info('mock checkout (no tab opened)', url) : undefined),
|
|
2391
2819
|
now: this.now,
|
|
2392
2820
|
});
|
|
2821
|
+
this.backup = new CloudBackup({
|
|
2822
|
+
storage: this.storage,
|
|
2823
|
+
publishableKey: this.config.publishableKey,
|
|
2824
|
+
apiUrl: this.config.apiUrl,
|
|
2825
|
+
fetch: deps.fetch,
|
|
2826
|
+
mock: this.config.mock,
|
|
2827
|
+
});
|
|
2393
2828
|
this.recovery = new RecoveryManager({
|
|
2394
2829
|
api: this.api,
|
|
2395
2830
|
locale: this.config.locale,
|
|
@@ -2403,7 +2838,7 @@
|
|
|
2403
2838
|
envelope.payload.publishableKey !== this.config.publishableKey ||
|
|
2404
2839
|
!Number.isFinite(Date.parse(envelope.payload.issuedAt)) ||
|
|
2405
2840
|
Date.parse(envelope.payload.issuedAt) > this.now() + MAX_CLOCK_SKEW_MS ||
|
|
2406
|
-
(await
|
|
2841
|
+
(await verifyWithKeys(envelope, this.keys)).verdict !== 'valid')
|
|
2407
2842
|
throw new ExtenshiPayError(ERROR_CODES.INVALID_RESPONSE, 'Recovery requires a verified entitlement for this installation');
|
|
2408
2843
|
this.entitlements.stopAutoRefresh();
|
|
2409
2844
|
try {
|
|
@@ -2421,6 +2856,7 @@
|
|
|
2421
2856
|
this.entitlements.startAutoRefresh();
|
|
2422
2857
|
}
|
|
2423
2858
|
},
|
|
2859
|
+
onStorageGrant: (grant) => this.backup.accept(grant),
|
|
2424
2860
|
});
|
|
2425
2861
|
if (config.onError)
|
|
2426
2862
|
this.emitter.on('error', config.onError);
|
|
@@ -2466,8 +2902,11 @@
|
|
|
2466
2902
|
catch (error) {
|
|
2467
2903
|
this.reportError(error);
|
|
2468
2904
|
}
|
|
2469
|
-
|
|
2905
|
+
void this.confirmSavedServerKey();
|
|
2906
|
+
if (!this.destroyed) {
|
|
2470
2907
|
this.entitlements.startAutoRefresh();
|
|
2908
|
+
this.trial.start();
|
|
2909
|
+
}
|
|
2471
2910
|
}
|
|
2472
2911
|
/** The anonymous, random id this install is known by. */
|
|
2473
2912
|
getEndUserRef() {
|
|
@@ -2488,6 +2927,16 @@
|
|
|
2488
2927
|
await this.initialize();
|
|
2489
2928
|
return this.entitlements.get(options);
|
|
2490
2929
|
}
|
|
2930
|
+
/**
|
|
2931
|
+
* The free trial the application set on the server, from the verified license, or null when
|
|
2932
|
+
* there is none (or the license could not be verified yet). Answers offline from the cached
|
|
2933
|
+
* license; like paid access, `active` needs a license check within 48 hours. `isPaid()` and
|
|
2934
|
+
* `hasFeature()` do not include the trial: grant trial access with `(await getTrial())?.active`.
|
|
2935
|
+
*/
|
|
2936
|
+
async getTrial(options = {}) {
|
|
2937
|
+
await this.getEntitlement(options);
|
|
2938
|
+
return this.entitlements.getTrial();
|
|
2939
|
+
}
|
|
2491
2940
|
/** True when any active/grace entitlement exists, or the given `sku` is active/grace. */
|
|
2492
2941
|
async isPaid(sku) {
|
|
2493
2942
|
return isEntitled(await this.getEntitlement(), sku);
|
|
@@ -2571,6 +3020,41 @@
|
|
|
2571
3020
|
throw this.reportError(error);
|
|
2572
3021
|
}
|
|
2573
3022
|
}
|
|
3023
|
+
/**
|
|
3024
|
+
* Turns on the cloud copy of the extension's settings (`@extenshi/storage`): the
|
|
3025
|
+
* hosted restore page shows the storage disclosure and the buyer confirms with
|
|
3026
|
+
* the code from the purchase email. `cloudBackup` in the result says whether it is
|
|
3027
|
+
* on. Buyers only; consent is recorded by the server.
|
|
3028
|
+
*/
|
|
3029
|
+
enableCloudBackup(options = {}) {
|
|
3030
|
+
return this.restorePurchase({ ...options, purpose: 'storage' });
|
|
3031
|
+
}
|
|
3032
|
+
/**
|
|
3033
|
+
* The storage token for `ExtenshiStorage.create({ cloud: { getToken } })`, or null
|
|
3034
|
+
* while cloud backup is off on this installation. Extension pages and background
|
|
3035
|
+
* only: it rejects in a content script, and must never be sent to one.
|
|
3036
|
+
*/
|
|
3037
|
+
async cloudBackupToken() {
|
|
3038
|
+
return this.backup.token();
|
|
3039
|
+
}
|
|
3040
|
+
/** Turns cloud backup off on this installation: revokes its token. The cloud copy stays. */
|
|
3041
|
+
async disableCloudBackup() {
|
|
3042
|
+
try {
|
|
3043
|
+
await this.backup.disable();
|
|
3044
|
+
}
|
|
3045
|
+
catch (error) {
|
|
3046
|
+
throw this.reportError(error);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
/** Deletes the buyer's cloud copy and turns cloud backup off on every installation. */
|
|
3050
|
+
async deleteCloudBackup() {
|
|
3051
|
+
try {
|
|
3052
|
+
await this.backup.delete();
|
|
3053
|
+
}
|
|
3054
|
+
catch (error) {
|
|
3055
|
+
throw this.reportError(error);
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
2574
3058
|
/** Read-only license view. Entitlements retain cache/signature/offline semantics. */
|
|
2575
3059
|
async getLicenseSummary(options = {}) {
|
|
2576
3060
|
await this.initialize();
|
|
@@ -2640,6 +3124,7 @@
|
|
|
2640
3124
|
destroy() {
|
|
2641
3125
|
this.destroyed = true;
|
|
2642
3126
|
this.recovery.stop();
|
|
3127
|
+
this.trial.stop();
|
|
2643
3128
|
this.entitlements.stopAutoRefresh();
|
|
2644
3129
|
this.emitter.removeAll();
|
|
2645
3130
|
}
|
|
@@ -2651,8 +3136,9 @@
|
|
|
2651
3136
|
if (!this.offerInflight) {
|
|
2652
3137
|
this.offerInflight = this.api
|
|
2653
3138
|
.getOffer(this.config.locale)
|
|
2654
|
-
.then((value) => {
|
|
3139
|
+
.then(async (value) => {
|
|
2655
3140
|
this.offer = { value, fetchedAt: this.now() };
|
|
3141
|
+
await this.rememberServerKey(value.entitlementPublicKey);
|
|
2656
3142
|
return value;
|
|
2657
3143
|
})
|
|
2658
3144
|
.finally(() => {
|
|
@@ -2661,8 +3147,88 @@
|
|
|
2661
3147
|
}
|
|
2662
3148
|
return this.offerInflight;
|
|
2663
3149
|
}
|
|
2664
|
-
|
|
2665
|
-
return this.config.entitlementPublicKey
|
|
3150
|
+
get serverKeyStorageKey() {
|
|
3151
|
+
return `extenshi-pay:${this.config.publishableKey}:entitlementPublicKey`;
|
|
3152
|
+
}
|
|
3153
|
+
async readSavedServerKey() {
|
|
3154
|
+
try {
|
|
3155
|
+
const value = await this.storage.get(this.serverKeyStorageKey);
|
|
3156
|
+
return typeof value === 'string' && PUBLIC_KEY_RE.test(value) ? value : null;
|
|
3157
|
+
}
|
|
3158
|
+
catch {
|
|
3159
|
+
return null;
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
/**
|
|
3163
|
+
* Keeps the server's key next to the license cache so a restart with no network can verify it.
|
|
3164
|
+
* Not with a bundled key: that one already covers the restart, and storage stays untrusted.
|
|
3165
|
+
*/
|
|
3166
|
+
async rememberServerKey(key) {
|
|
3167
|
+
if (typeof key !== 'string' || !PUBLIC_KEY_RE.test(key))
|
|
3168
|
+
return;
|
|
3169
|
+
this.serverKey = key;
|
|
3170
|
+
if (this.config.entitlementPublicKey || this.config.mock)
|
|
3171
|
+
return;
|
|
3172
|
+
try {
|
|
3173
|
+
if ((await this.readSavedServerKey()) !== key)
|
|
3174
|
+
await this.storage.set(this.serverKeyStorageKey, key);
|
|
3175
|
+
}
|
|
3176
|
+
catch (error) {
|
|
3177
|
+
logger.debug('signing key not saved', error);
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
/**
|
|
3181
|
+
* A license verified with the saved key alone is checked against the server once per start:
|
|
3182
|
+
* when the server's key differs (rotation, or an edited storage) the license is fetched again,
|
|
3183
|
+
* and dropped if it does not verify. Offline, the saved key stands until `offlineUntil`.
|
|
3184
|
+
*/
|
|
3185
|
+
async confirmSavedServerKey() {
|
|
3186
|
+
const used = this.entitlements.verifiedKey;
|
|
3187
|
+
if (this.destroyed || !used || used === this.serverKey || used === this.config.entitlementPublicKey)
|
|
3188
|
+
return;
|
|
3189
|
+
try {
|
|
3190
|
+
if ((await this.fetchOffer()).entitlementPublicKey === used || this.destroyed)
|
|
3191
|
+
return;
|
|
3192
|
+
}
|
|
3193
|
+
catch {
|
|
3194
|
+
return;
|
|
3195
|
+
}
|
|
3196
|
+
try {
|
|
3197
|
+
await this.entitlements.refresh();
|
|
3198
|
+
}
|
|
3199
|
+
catch {
|
|
3200
|
+
await this.entitlements.reverify().catch((error) => this.reportError(error));
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
get trialStartKey() {
|
|
3204
|
+
return `extenshi-pay:${this.config.publishableKey}:trialStartedAt`;
|
|
3205
|
+
}
|
|
3206
|
+
/** The synced trial start, or null (none, malformed, or storage.sync unavailable). */
|
|
3207
|
+
async readTrialStartHint() {
|
|
3208
|
+
if (!this.syncStorage)
|
|
3209
|
+
return null;
|
|
3210
|
+
try {
|
|
3211
|
+
const value = await this.syncStorage.get(this.trialStartKey);
|
|
3212
|
+
return typeof value === 'string' && Number.isFinite(Date.parse(value)) ? value : null;
|
|
3213
|
+
}
|
|
3214
|
+
catch {
|
|
3215
|
+
return null;
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
/** Syncs the verified trial start, keeping the earliest one seen. Never the installation id. */
|
|
3219
|
+
async rememberTrialStart() {
|
|
3220
|
+
const trial = this.entitlements.getTrial();
|
|
3221
|
+
if (!this.syncStorage || !trial)
|
|
3222
|
+
return;
|
|
3223
|
+
try {
|
|
3224
|
+
const synced = await this.readTrialStartHint();
|
|
3225
|
+
if (synced && Date.parse(synced) <= Date.parse(trial.startedAt))
|
|
3226
|
+
return;
|
|
3227
|
+
await this.syncStorage.set(this.trialStartKey, trial.startedAt);
|
|
3228
|
+
}
|
|
3229
|
+
catch (error) {
|
|
3230
|
+
logger.debug('trial start not synced', error);
|
|
3231
|
+
}
|
|
2666
3232
|
}
|
|
2667
3233
|
reportError(error) {
|
|
2668
3234
|
const err = ExtenshiPayError.from(error);
|
|
@@ -2702,7 +3268,7 @@
|
|
|
2702
3268
|
a.href = href;
|
|
2703
3269
|
a.target = '_blank';
|
|
2704
3270
|
a.rel = 'noopener noreferrer';
|
|
2705
|
-
a.style.
|
|
3271
|
+
a.style.marginInlineEnd = '12px';
|
|
2706
3272
|
section.append(a);
|
|
2707
3273
|
};
|
|
2708
3274
|
if (seller) {
|
|
@@ -2993,6 +3559,78 @@
|
|
|
2993
3559
|
}
|
|
2994
3560
|
}
|
|
2995
3561
|
|
|
3562
|
+
/**
|
|
3563
|
+
* The paywall's header image: the extension's own icon in place of the
|
|
3564
|
+
* templates' generic glyph (lock, layers).
|
|
3565
|
+
*
|
|
3566
|
+
* Only images from the extension package or `data:image/` URLs: a remote
|
|
3567
|
+
* image would be a request to a third party on every paywall view. The
|
|
3568
|
+
* manifest icon is the default on the extension's own pages (popup, options)
|
|
3569
|
+
* only. A content script runs on the site's origin, where the package's files
|
|
3570
|
+
* load only when `web_accessible_resources` lists them, and the SDK never asks
|
|
3571
|
+
* for that.
|
|
3572
|
+
*/
|
|
3573
|
+
const DATA_IMAGE_RE = /^data:image\/[\w.+-]+[;,]/i;
|
|
3574
|
+
/** `chrome-extension://<id>/`, `moz-extension://<uuid>/`, `safari-web-extension://<id>/`. */
|
|
3575
|
+
const PACKAGE_BASE_RE = /^[a-z-]+-extension:\/\/[^/]+\/$/;
|
|
3576
|
+
function extensionRuntime() {
|
|
3577
|
+
const g = globalThis;
|
|
3578
|
+
return g.chrome?.runtime ?? g.browser?.runtime;
|
|
3579
|
+
}
|
|
3580
|
+
function packageBase(runtime) {
|
|
3581
|
+
try {
|
|
3582
|
+
const base = runtime?.getURL?.('');
|
|
3583
|
+
return typeof base === 'string' && PACKAGE_BASE_RE.test(base) ? base : null;
|
|
3584
|
+
}
|
|
3585
|
+
catch {
|
|
3586
|
+
return null;
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
function onExtensionPage(base) {
|
|
3590
|
+
const href = globalThis.location?.href;
|
|
3591
|
+
return typeof href === 'string' && href.startsWith(base);
|
|
3592
|
+
}
|
|
3593
|
+
function largestIcon(runtime) {
|
|
3594
|
+
let best = null;
|
|
3595
|
+
try {
|
|
3596
|
+
for (const [size, path] of Object.entries(runtime?.getManifest?.().icons ?? {})) {
|
|
3597
|
+
const n = Number(size);
|
|
3598
|
+
if (typeof path === 'string' && path && Number.isFinite(n) && (!best || n > best[0]))
|
|
3599
|
+
best = [n, path];
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
catch {
|
|
3603
|
+
/* No manifest to read. */
|
|
3604
|
+
}
|
|
3605
|
+
return best?.[1] ?? '';
|
|
3606
|
+
}
|
|
3607
|
+
/**
|
|
3608
|
+
* The header image for `PaywallOptions.icon`, or null to keep the template's
|
|
3609
|
+
* glyph: `false` opts out, a `data:image/` URL is used anywhere, a package path
|
|
3610
|
+
* (or the manifest's largest icon by default) only on the extension's pages.
|
|
3611
|
+
*/
|
|
3612
|
+
function paywallIconUrl(option) {
|
|
3613
|
+
if (option === false)
|
|
3614
|
+
return null;
|
|
3615
|
+
const explicit = typeof option === 'string' ? option.trim() : '';
|
|
3616
|
+
if (DATA_IMAGE_RE.test(explicit))
|
|
3617
|
+
return explicit;
|
|
3618
|
+
const runtime = extensionRuntime();
|
|
3619
|
+
const base = packageBase(runtime);
|
|
3620
|
+
if (!base || !onExtensionPage(base))
|
|
3621
|
+
return null;
|
|
3622
|
+
const path = explicit || largestIcon(runtime);
|
|
3623
|
+
if (!path)
|
|
3624
|
+
return null;
|
|
3625
|
+
try {
|
|
3626
|
+
const url = new URL(path, base).href;
|
|
3627
|
+
return url.startsWith(base) ? url : null;
|
|
3628
|
+
}
|
|
3629
|
+
catch {
|
|
3630
|
+
return null;
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
|
|
2996
3634
|
function formatPrice(amountMinor, currency, locale) {
|
|
2997
3635
|
const value = amountMinor / 100;
|
|
2998
3636
|
const code = currency.toUpperCase();
|
|
@@ -3058,7 +3696,7 @@
|
|
|
3058
3696
|
return paywallStrings(sdkStrings(locale));
|
|
3059
3697
|
}
|
|
3060
3698
|
|
|
3061
|
-
var sharedCss = ":host{--ep-primary-50:#f0f9ff;--ep-primary-100:#e0f2fe;--ep-primary-200:#bae6fd;--ep-primary-300:#7dd3fc;--ep-primary-400:#38bdf8;--ep-primary-500:#0ea5e9;--ep-primary-600:#0284c7;--ep-primary-700:#0369a1;--ep-primary-800:#075985;--ep-primary-900:#0c4a6e;--ep-gray-50:#f9fafb;--ep-gray-100:#f3f4f6;--ep-gray-200:#e5e7eb;--ep-gray-300:#d1d5db;--ep-gray-400:#9ca3af;--ep-gray-500:#6b7280;--ep-gray-600:#4b5563;--ep-gray-700:#374151;--ep-gray-800:#1f2937;--ep-gray-900:#111827;--ep-success-500:#10b981;--ep-success-600:#059669;--ep-error-500:#ef4444;--ep-error-600:#dc2626;--ep-warning-500:#f59e0b;--ep-warning-600:#d97706;--ep-bg-primary:var(--ep-gray-50);--ep-bg-secondary:#ffffff;--ep-bg-tertiary:var(--ep-gray-100);--ep-text-primary:var(--ep-gray-900);--ep-text-secondary:var(--ep-gray-600);--ep-text-tertiary:var(--ep-gray-400);--ep-border-primary:var(--ep-gray-200);--ep-border-secondary:var(--ep-gray-300);--ep-shadow-sm:0 1px 2px 0 rgba(0,0,0,0.05);--ep-shadow-md:0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -1px rgba(0,0,0,0.06);--ep-shadow-lg:0 10px 15px -3px rgba(0,0,0,0.1),0 4px 6px -2px rgba(0,0,0,0.05);--ep-shadow-xl:0 20px 25px -5px rgba(0,0,0,0.1),0 10px 10px -5px rgba(0,0,0,0.04);--ep-font-family-sans:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,sans-serif;--ep-font-family-mono:\"SF Mono\",Monaco,\"Cascadia Code\",\"Roboto Mono\",Consolas,\"Courier New\",monospace;--ep-font-size-xs:0.75rem;--ep-font-size-sm:0.875rem;--ep-font-size-base:1rem;--ep-font-size-lg:1.125rem;--ep-font-size-xl:1.25rem;--ep-font-size-2xl:1.5rem;--ep-font-size-3xl:1.875rem;--ep-font-size-4xl:2.25rem;--ep-font-size-5xl:3rem;--ep-font-weight-normal:400;--ep-font-weight-medium:500;--ep-font-weight-semibold:600;--ep-font-weight-bold:700;--ep-line-height-tight:1.25;--ep-line-height-snug:1.375;--ep-line-height-normal:1.5;--ep-line-height-relaxed:1.625;--ep-space-1:0.25rem;--ep-space-2:0.5rem;--ep-space-3:0.75rem;--ep-space-4:1rem;--ep-space-5:1.25rem;--ep-space-6:1.5rem;--ep-space-8:2rem;--ep-space-10:2.5rem;--ep-space-12:3rem;--ep-space-16:4rem;--ep-space-20:5rem;--ep-space-24:6rem;--ep-radius-sm:0.125rem;--ep-radius-md:0.375rem;--ep-radius-lg:0.5rem;--ep-radius-xl:0.75rem;--ep-radius-2xl:1rem;--ep-radius-full:9999px;--ep-transition-fast:150ms ease-in-out;--ep-transition-normal:300ms ease-in-out;--ep-transition-slow:500ms ease-in-out;--ep-z-backdrop:1000;--ep-z-modal:1010;--ep-z-popover:1020;--ep-z-tooltip:1030}:host([data-theme=\"dark\"]){--ep-bg-primary:var(--ep-gray-900);--ep-bg-secondary:var(--ep-gray-800);--ep-bg-tertiary:var(--ep-gray-700);--ep-text-primary:var(--ep-gray-50);--ep-text-secondary:var(--ep-gray-300);--ep-text-tertiary:var(--ep-gray-400);--ep-border-primary:var(--ep-gray-700);--ep-border-secondary:var(--ep-gray-600);--ep-shadow-sm:0 1px 2px 0 rgba(0,0,0,0.3);--ep-shadow-md:0 4px 6px -1px rgba(0,0,0,0.4),0 2px 4px -1px rgba(0,0,0,0.3);--ep-shadow-lg:0 10px 15px -3px rgba(0,0,0,0.4),0 4px 6px -2px rgba(0,0,0,0.3);--ep-shadow-xl:0 20px 25px -5px rgba(0,0,0,0.4),0 10px 10px -5px rgba(0,0,0,0.3)}@media (prefers-contrast:high){:host{--ep-border-primary:var(--ep-gray-400);--ep-border-secondary:var(--ep-gray-500)}:host([data-theme=\"dark\"]){--ep-border-primary:var(--ep-gray-500);--ep-border-secondary:var(--ep-gray-400)}}@media (prefers-reduced-motion:reduce){:host{--ep-transition-fast:0ms;--ep-transition-normal:0ms;--ep-transition-slow:0ms}}@media print{:host{--ep-bg-primary:white;--ep-bg-secondary:white;--ep-bg-tertiary:white;--ep-text-primary:black;--ep-text-secondary:black;--ep-text-tertiary:black;--ep-shadow-sm:none;--ep-shadow-md:none;--ep-shadow-lg:none;--ep-shadow-xl:none}}*{box-sizing:border-box;margin:0;padding:0}:host{font-family:var(--ep-font-family-sans);font-size:var(--ep-font-size-base);line-height:var(--ep-line-height-normal);color:var(--ep-text-primary);background-color:var(--ep-bg-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*:focus{outline:2px solid var(--ep-primary-500);outline-offset:2px}*:focus:not(:focus-visible){outline:none}.ep-container{max-width:1200px;margin:0 auto;padding:0 var(--ep-space-4)}.ep-card{background-color:var(--ep-bg-secondary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-lg);box-shadow:var(--ep-shadow-sm);padding:var(--ep-space-6)}.ep-card-header{margin-bottom:var(--ep-space-6)}.ep-card-body{margin-bottom:var(--ep-space-6)}.ep-card-footer{margin-top:var(--ep-space-6);padding-top:var(--ep-space-6);border-top:1px solid var(--ep-border-primary)}.ep-heading-1{font-size:var(--ep-font-size-3xl);font-weight:var(--ep-font-weight-bold);line-height:var(--ep-line-height-tight);color:var(--ep-text-primary);margin-bottom:var(--ep-space-4)}.ep-heading-2{font-size:var(--ep-font-size-2xl);font-weight:var(--ep-font-weight-semibold);line-height:var(--ep-line-height-tight);color:var(--ep-text-primary);margin-bottom:var(--ep-space-3)}.ep-heading-3{font-size:var(--ep-font-size-xl);font-weight:var(--ep-font-weight-semibold);line-height:var(--ep-line-height-snug);color:var(--ep-text-primary);margin-bottom:var(--ep-space-2)}.ep-text-body{font-size:var(--ep-font-size-base);line-height:var(--ep-line-height-relaxed);color:var(--ep-text-secondary);margin-bottom:var(--ep-space-4)}.ep-text-sm{font-size:var(--ep-font-size-sm);line-height:var(--ep-line-height-normal);color:var(--ep-text-tertiary)}.ep-text-center{text-align:center}.ep-text-left{text-align:left}.ep-text-right{text-align:right}.ep-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--ep-space-2);padding:var(--ep-space-3) var(--ep-space-6);border:1px solid transparent;border-radius:var(--ep-radius-md);font-family:var(--ep-font-family-sans);font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-medium);line-height:var(--ep-line-height-tight);text-decoration:none;cursor:pointer;transition:all var(--ep-transition-fast);user-select:none;white-space:nowrap}.ep-btn:disabled{opacity:0.5;cursor:not-allowed}.ep-btn-primary{background-color:var(--ep-primary-600);color:white;border-color:var(--ep-primary-600)}.ep-btn-primary:hover:not(:disabled){background-color:var(--ep-primary-700);border-color:var(--ep-primary-700)}.ep-btn-primary:active:not(:disabled){background-color:var(--ep-primary-800);border-color:var(--ep-primary-800)}.ep-btn-secondary{background-color:var(--ep-bg-secondary);color:var(--ep-text-primary);border-color:var(--ep-border-secondary)}.ep-btn-secondary:hover:not(:disabled){background-color:var(--ep-bg-tertiary);border-color:var(--ep-border-secondary)}.ep-btn-ghost{background-color:transparent;color:var(--ep-text-secondary);border-color:transparent}.ep-btn-ghost:hover:not(:disabled){background-color:var(--ep-bg-tertiary);color:var(--ep-text-primary)}.ep-btn-sm{padding:var(--ep-space-2) var(--ep-space-4);font-size:var(--ep-font-size-sm)}.ep-btn-lg{padding:var(--ep-space-4) var(--ep-space-8);font-size:var(--ep-font-size-lg)}.ep-btn-full{width:100%}.ep-input{width:100%;padding:var(--ep-space-3);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-md);font-family:var(--ep-font-family-sans);font-size:var(--ep-font-size-base);line-height:var(--ep-line-height-normal);color:var(--ep-text-primary);background-color:var(--ep-bg-secondary);transition:border-color var(--ep-transition-fast)}.ep-input:focus{border-color:var(--ep-primary-500);outline:none;box-shadow:0 0 0 3px rgba(14,165,233,0.1)}.ep-input::placeholder{color:var(--ep-text-tertiary)}.ep-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.ep-hidden{display:none}.ep-flex{display:flex}.ep-flex-col{flex-direction:column}.ep-items-center{align-items:center}.ep-justify-center{justify-content:center}.ep-justify-between{justify-content:space-between}.ep-gap-2{gap:var(--ep-space-2)}.ep-gap-4{gap:var(--ep-space-4)}.ep-gap-6{gap:var(--ep-space-6)}.ep-w-full{width:100%}.ep-h-full{height:100%}.ep-mb-4{margin-bottom:var(--ep-space-4)}.ep-mb-6{margin-bottom:var(--ep-space-6)}.ep-p-4{padding:var(--ep-space-4)}.ep-p-6{padding:var(--ep-space-6)}@media (max-width:768px){.ep-container{padding:0 var(--ep-space-3)}.ep-heading-1{font-size:var(--ep-font-size-2xl)}.ep-heading-2{font-size:var(--ep-font-size-xl)}.ep-card{padding:var(--ep-space-4)}.ep-btn{padding:var(--ep-space-4) var(--ep-space-6)}}@media (max-width:480px){.ep-container{padding:0 var(--ep-space-2)}.ep-heading-1{font-size:var(--ep-font-size-xl)}.ep-card{padding:var(--ep-space-3)}}";
|
|
3699
|
+
var sharedCss = ":host{--ep-primary-50:#f0f9ff;--ep-primary-100:#e0f2fe;--ep-primary-200:#bae6fd;--ep-primary-300:#7dd3fc;--ep-primary-400:#38bdf8;--ep-primary-500:#0ea5e9;--ep-primary-600:#0284c7;--ep-primary-700:#0369a1;--ep-primary-800:#075985;--ep-primary-900:#0c4a6e;--ep-gray-50:#f9fafb;--ep-gray-100:#f3f4f6;--ep-gray-200:#e5e7eb;--ep-gray-300:#d1d5db;--ep-gray-400:#9ca3af;--ep-gray-500:#6b7280;--ep-gray-600:#4b5563;--ep-gray-700:#374151;--ep-gray-800:#1f2937;--ep-gray-900:#111827;--ep-success-500:#10b981;--ep-success-600:#059669;--ep-error-500:#ef4444;--ep-error-600:#dc2626;--ep-warning-500:#f59e0b;--ep-warning-600:#d97706;--ep-bg-primary:var(--ep-gray-50);--ep-bg-secondary:#ffffff;--ep-bg-tertiary:var(--ep-gray-100);--ep-text-primary:var(--ep-gray-900);--ep-text-secondary:var(--ep-gray-600);--ep-text-tertiary:var(--ep-gray-400);--ep-border-primary:var(--ep-gray-200);--ep-border-secondary:var(--ep-gray-300);--ep-link:var(--ep-primary-700);--ep-link-hover:var(--ep-primary-800);--ep-shadow-sm:0 1px 2px 0 rgba(0,0,0,0.05);--ep-shadow-md:0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -1px rgba(0,0,0,0.06);--ep-shadow-lg:0 10px 15px -3px rgba(0,0,0,0.1),0 4px 6px -2px rgba(0,0,0,0.05);--ep-shadow-xl:0 20px 25px -5px rgba(0,0,0,0.1),0 10px 10px -5px rgba(0,0,0,0.04);--ep-font-family-sans:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,sans-serif;--ep-font-family-mono:\"SF Mono\",Monaco,\"Cascadia Code\",\"Roboto Mono\",Consolas,\"Courier New\",monospace;--ep-font-size-xs:0.75rem;--ep-font-size-sm:0.875rem;--ep-font-size-base:1rem;--ep-font-size-lg:1.125rem;--ep-font-size-xl:1.25rem;--ep-font-size-2xl:1.5rem;--ep-font-size-3xl:1.875rem;--ep-font-size-4xl:2.25rem;--ep-font-size-5xl:3rem;--ep-font-weight-normal:400;--ep-font-weight-medium:500;--ep-font-weight-semibold:600;--ep-font-weight-bold:700;--ep-line-height-tight:1.25;--ep-line-height-snug:1.375;--ep-line-height-normal:1.5;--ep-line-height-relaxed:1.625;--ep-space-1:0.25rem;--ep-space-2:0.5rem;--ep-space-3:0.75rem;--ep-space-4:1rem;--ep-space-5:1.25rem;--ep-space-6:1.5rem;--ep-space-8:2rem;--ep-space-10:2.5rem;--ep-space-12:3rem;--ep-space-16:4rem;--ep-space-20:5rem;--ep-space-24:6rem;--ep-radius-sm:0.125rem;--ep-radius-md:0.375rem;--ep-radius-lg:0.5rem;--ep-radius-xl:0.75rem;--ep-radius-2xl:1rem;--ep-radius-full:9999px;--ep-transition-fast:150ms ease-in-out;--ep-transition-normal:300ms ease-in-out;--ep-transition-slow:500ms ease-in-out;--ep-z-backdrop:1000;--ep-z-modal:1010;--ep-z-popover:1020;--ep-z-tooltip:1030}:host([data-theme=\"dark\"]){--ep-bg-primary:var(--ep-gray-900);--ep-bg-secondary:var(--ep-gray-800);--ep-bg-tertiary:var(--ep-gray-700);--ep-text-primary:var(--ep-gray-50);--ep-text-secondary:var(--ep-gray-300);--ep-text-tertiary:var(--ep-gray-400);--ep-border-primary:var(--ep-gray-700);--ep-border-secondary:var(--ep-gray-600);--ep-link:var(--ep-primary-300);--ep-link-hover:var(--ep-primary-200);--ep-shadow-sm:0 1px 2px 0 rgba(0,0,0,0.3);--ep-shadow-md:0 4px 6px -1px rgba(0,0,0,0.4),0 2px 4px -1px rgba(0,0,0,0.3);--ep-shadow-lg:0 10px 15px -3px rgba(0,0,0,0.4),0 4px 6px -2px rgba(0,0,0,0.3);--ep-shadow-xl:0 20px 25px -5px rgba(0,0,0,0.4),0 10px 10px -5px rgba(0,0,0,0.3)}@media (prefers-contrast:high){:host{--ep-border-primary:var(--ep-gray-400);--ep-border-secondary:var(--ep-gray-500)}:host([data-theme=\"dark\"]){--ep-border-primary:var(--ep-gray-500);--ep-border-secondary:var(--ep-gray-400)}}@media (prefers-reduced-motion:reduce){:host{--ep-transition-fast:0ms;--ep-transition-normal:0ms;--ep-transition-slow:0ms}}@media print{:host{--ep-bg-primary:white;--ep-bg-secondary:white;--ep-bg-tertiary:white;--ep-text-primary:black;--ep-text-secondary:black;--ep-text-tertiary:black;--ep-shadow-sm:none;--ep-shadow-md:none;--ep-shadow-lg:none;--ep-shadow-xl:none}}*{box-sizing:border-box;margin:0;padding:0}:host{font-family:var(--ep-font-family-sans);font-size:var(--ep-font-size-base);line-height:var(--ep-line-height-normal);color:var(--ep-text-primary);background-color:var(--ep-bg-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*:focus{outline:2px solid var(--ep-primary-500);outline-offset:2px}*:focus:not(:focus-visible){outline:none}a,a:visited{color:var(--ep-link);text-decoration:underline;text-underline-offset:2px}a:hover{color:var(--ep-link-hover)}.ep-container{max-width:1200px;margin:0 auto;padding:0 var(--ep-space-4)}.ep-card{background-color:var(--ep-bg-secondary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-lg);box-shadow:var(--ep-shadow-sm);padding:var(--ep-space-6)}.ep-card-header{margin-bottom:var(--ep-space-6)}.ep-card-body{margin-bottom:var(--ep-space-6)}.ep-card-footer{margin-top:var(--ep-space-6);padding-top:var(--ep-space-6);border-top:1px solid var(--ep-border-primary)}.ep-heading-1{font-size:var(--ep-font-size-3xl);font-weight:var(--ep-font-weight-bold);line-height:var(--ep-line-height-tight);color:var(--ep-text-primary);margin-bottom:var(--ep-space-4)}.ep-heading-2{font-size:var(--ep-font-size-2xl);font-weight:var(--ep-font-weight-semibold);line-height:var(--ep-line-height-tight);color:var(--ep-text-primary);margin-bottom:var(--ep-space-3)}.ep-heading-3{font-size:var(--ep-font-size-xl);font-weight:var(--ep-font-weight-semibold);line-height:var(--ep-line-height-snug);color:var(--ep-text-primary);margin-bottom:var(--ep-space-2)}.ep-text-body{font-size:var(--ep-font-size-base);line-height:var(--ep-line-height-relaxed);color:var(--ep-text-secondary);margin-bottom:var(--ep-space-4)}.ep-text-sm{font-size:var(--ep-font-size-sm);line-height:var(--ep-line-height-normal);color:var(--ep-text-tertiary)}.ep-text-center{text-align:center}.ep-text-left{text-align:left}.ep-text-right{text-align:right}.ep-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--ep-space-2);padding:var(--ep-space-3) var(--ep-space-6);border:1px solid transparent;border-radius:var(--ep-radius-md);font-family:var(--ep-font-family-sans);font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-medium);line-height:var(--ep-line-height-tight);text-decoration:none;cursor:pointer;transition:all var(--ep-transition-fast);user-select:none;white-space:nowrap}.ep-btn:disabled{opacity:0.5;cursor:not-allowed}.ep-btn-primary{background-color:var(--ep-primary-600);color:white;border-color:var(--ep-primary-600)}.ep-btn-primary:hover:not(:disabled){background-color:var(--ep-primary-700);border-color:var(--ep-primary-700)}.ep-btn-primary:active:not(:disabled){background-color:var(--ep-primary-800);border-color:var(--ep-primary-800)}.ep-btn-secondary{background-color:var(--ep-bg-secondary);color:var(--ep-text-primary);border-color:var(--ep-border-secondary)}.ep-btn-secondary:hover:not(:disabled){background-color:var(--ep-bg-tertiary);border-color:var(--ep-border-secondary)}.ep-btn-ghost{background-color:transparent;color:var(--ep-text-secondary);border-color:transparent}.ep-btn-ghost:hover:not(:disabled){background-color:var(--ep-bg-tertiary);color:var(--ep-text-primary)}.ep-btn-sm{padding:var(--ep-space-2) var(--ep-space-4);font-size:var(--ep-font-size-sm)}.ep-btn-lg{padding:var(--ep-space-4) var(--ep-space-8);font-size:var(--ep-font-size-lg)}.ep-btn-full{width:100%}.ep-input{width:100%;padding:var(--ep-space-3);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-md);font-family:var(--ep-font-family-sans);font-size:var(--ep-font-size-base);line-height:var(--ep-line-height-normal);color:var(--ep-text-primary);background-color:var(--ep-bg-secondary);transition:border-color var(--ep-transition-fast)}.ep-input:focus{border-color:var(--ep-primary-500);outline:none;box-shadow:0 0 0 3px rgba(14,165,233,0.1)}.ep-input::placeholder{color:var(--ep-text-tertiary)}.ep-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.ep-hidden{display:none}.ep-flex{display:flex}.ep-flex-col{flex-direction:column}.ep-items-center{align-items:center}.ep-justify-center{justify-content:center}.ep-justify-between{justify-content:space-between}.ep-gap-2{gap:var(--ep-space-2)}.ep-gap-4{gap:var(--ep-space-4)}.ep-gap-6{gap:var(--ep-space-6)}.ep-w-full{width:100%}.ep-h-full{height:100%}.ep-mb-4{margin-bottom:var(--ep-space-4)}.ep-mb-6{margin-bottom:var(--ep-space-6)}.ep-p-4{padding:var(--ep-space-4)}.ep-p-6{padding:var(--ep-space-6)}@media (max-width:768px){.ep-container{padding:0 var(--ep-space-3)}.ep-heading-1{font-size:var(--ep-font-size-2xl)}.ep-heading-2{font-size:var(--ep-font-size-xl)}.ep-card{padding:var(--ep-space-4)}.ep-btn{padding:var(--ep-space-4) var(--ep-space-6)}}@media (max-width:480px){.ep-container{padding:0 var(--ep-space-2)}.ep-heading-1{font-size:var(--ep-font-size-xl)}.ep-card{padding:var(--ep-space-3)}}";
|
|
3062
3700
|
|
|
3063
3701
|
const html$4 = "<div class=\"ep-fullscreen-paywall\" id=\"fullscreenPaywall\" role=\"dialog\" aria-labelledby=\"fullscreen-title\"><div class=\"ep-fullscreen-background\"><div class=\"ep-background-pattern\"></div></div><div class=\"ep-fullscreen-header\"><div class=\"ep-fullscreen-logo\"><svg width=\"40\" height=\"40\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2L2 7l10 5 10-5-10-5z\"></path><path d=\"M2 17l10 5 10-5\"></path><path d=\"M2 12l10 5 10-5\"></path></svg><span class=\"ep-fullscreen-logo-text\">{{brandName}}</span></div><button class=\"ep-fullscreen-close\" aria-label=\"Close paywall\" data-ep-action=\"closeFullscreen\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg></button></div><div class=\"ep-fullscreen-content\"><div class=\"ep-fullscreen-container\"><div class=\"ep-fullscreen-hero\"><div class=\"ep-hero-icon\"><svg width=\"80\" height=\"80\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2L2 7l10 5 10-5-10-5z\"></path><path d=\"M2 17l10 5 10-5\"></path><path d=\"M2 12l10 5 10-5\"></path></svg></div><h1 class=\"ep-heading-1\" id=\"fullscreen-title\">{{title}}</h1><p class=\"ep-hero-description\">{{description}}</p></div><div class=\"ep-fullscreen-features\"><div class=\"ep-features-grid\"><div class=\"ep-feature-card\"><div class=\"ep-feature-card-icon\"><svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 12h-4l-3 9L9 3l-3 9H2\"></path></svg></div><h3 class=\"ep-feature-card-title\">{{feature1Title}}</h3><p class=\"ep-feature-card-description\">{{feature1Description}}</p></div><div class=\"ep-feature-card\"><div class=\"ep-feature-card-icon\"><svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z\"></path></svg></div><h3 class=\"ep-feature-card-title\">{{feature2Title}}</h3><p class=\"ep-feature-card-description\">{{feature2Description}}</p></div><div class=\"ep-feature-card\"><div class=\"ep-feature-card-icon\"><svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13 2L3 14h9l-1 8 10-12h-9l1-8z\"></path></svg></div><h3 class=\"ep-feature-card-title\">{{feature3Title}}</h3><p class=\"ep-feature-card-description\">{{feature3Description}}</p></div><div class=\"ep-feature-card\"><div class=\"ep-feature-card-icon\"><svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z\"></path><polyline points=\"7.5,4.21 12,6.81 16.5,4.21\"></polyline><polyline points=\"7.5,19.79 7.5,14.6 3,12\"></polyline><polyline points=\"21,12 16.5,14.6 16.5,19.79\"></polyline></svg></div><h3 class=\"ep-feature-card-title\">{{feature4Title}}</h3><p class=\"ep-feature-card-description\">{{feature4Description}}</p></div></div></div><div class=\"ep-fullscreen-pricing\"><div class=\"ep-pricing-header\"><h2 class=\"ep-heading-2\">{{plansHeading}}</h2><p class=\"ep-pricing-subtitle\">{{pricingSubtitle}}</p></div><div class=\"ep-pricing-plans\"><div class=\"ep-pricing-plan\"><div class=\"ep-pricing-plan-header\"><h3 class=\"ep-pricing-plan-title\">{{freePlanName}}</h3><div class=\"ep-pricing-plan-price\"><span class=\"ep-pricing-currency\">{{currency}}</span><span class=\"ep-pricing-amount\">0</span></div><p class=\"ep-pricing-plan-description\">{{freeDescription}}</p></div><ul class=\"ep-pricing-plan-features\"><li class=\"ep-pricing-feature\"><svg class=\"ep-pricing-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg> {{freeFeature1}} </li><li class=\"ep-pricing-feature\"><svg class=\"ep-pricing-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg> {{freeFeature2}} </li><li class=\"ep-pricing-feature ep-pricing-feature-disabled\"><svg class=\"ep-pricing-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg> {{freeFeature3}} </li></ul><button class=\"ep-btn ep-btn-secondary ep-btn-full\" data-ep-action=\"continueFree\"> {{continueButtonText}} </button></div><div class=\"ep-pricing-plan ep-pricing-plan-premium\"><div class=\"ep-pricing-plan-badge\">{{premiumBadge}}</div><div class=\"ep-pricing-plan-header\"><h3 class=\"ep-pricing-plan-title\">{{premiumPlanName}}</h3><div class=\"ep-pricing-plan-price\"><span class=\"ep-pricing-currency\">{{currency}}</span><span class=\"ep-pricing-amount\">{{price}}</span><span class=\"ep-pricing-period\">{{period}}</span></div><p class=\"ep-pricing-plan-description\">{{premiumDescription}}</p></div><ul class=\"ep-pricing-plan-features\"><li class=\"ep-pricing-feature\"><svg class=\"ep-pricing-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg> {{premiumFeature1}} </li><li class=\"ep-pricing-feature\"><svg class=\"ep-pricing-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg> {{premiumFeature2}} </li><li class=\"ep-pricing-feature\"><svg class=\"ep-pricing-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg> {{premiumFeature3}} </li><li class=\"ep-pricing-feature\"><svg class=\"ep-pricing-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg> {{premiumFeature4}} </li></ul><button class=\"ep-btn ep-btn-primary ep-btn-lg ep-btn-full\" data-ep-action=\"upgradeNow\"> {{upgradeButtonText}} </button></div></div></div><div class=\"ep-fullscreen-trial\"><div class=\"ep-trial-card\"><div class=\"ep-trial-icon\"><svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"></path><polyline points=\"22,4 12,14.01 9,11.01\"></polyline></svg></div><h3 class=\"ep-trial-title\">{{trialTitle}}</h3><p class=\"ep-trial-description\">{{trialDescription}}</p><button class=\"ep-btn ep-btn-secondary ep-btn-lg\" data-ep-action=\"startTrial\"> {{trialButtonText}} </button></div></div></div></div></div>";
|
|
3064
3702
|
const css$4 = ".ep-fullscreen-paywall{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--ep-bg-primary);z-index:var(--ep-z-modal);display:flex;flex-direction:column;animation:ep-fullscreen-in var(--ep-transition-slow);overflow-y:auto}.ep-fullscreen-paywall.ep-fullscreen-closing{animation:ep-fullscreen-out var(--ep-transition-slow)}.ep-fullscreen-background{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;z-index:-1}.ep-background-pattern{position:absolute;top:-50%;left:-50%;width:200%;height:200%;background:linear-gradient(45deg,transparent 30%,rgba(14,165,233,0.03) 50%,transparent 70%);background-size:60px 60px;animation:ep-background-pattern var(--ep-transition-slow) infinite linear}:host([data-theme=\"dark\"]) .ep-background-pattern{background:linear-gradient(45deg,transparent 30%,rgba(14,165,233,0.05) 50%,transparent 70%)}.ep-fullscreen-header{display:flex;justify-content:space-between;align-items:center;padding:var(--ep-space-6) var(--ep-space-8);border-bottom:1px solid var(--ep-border-primary);background-color:var(--ep-bg-secondary);backdrop-filter:blur(10px);z-index:1}.ep-fullscreen-logo{display:flex;align-items:center;gap:var(--ep-space-3);color:var(--ep-primary-600)}.ep-fullscreen-logo-text{font-size:var(--ep-font-size-xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-text-primary)}.ep-fullscreen-close{background:none;border:none;color:var(--ep-text-tertiary);cursor:pointer;padding:var(--ep-space-2);border-radius:var(--ep-radius-md);transition:all var(--ep-transition-fast)}.ep-fullscreen-close:hover{color:var(--ep-text-primary);background-color:var(--ep-bg-tertiary)}.ep-fullscreen-content{flex:1;padding:var(--ep-space-8);display:flex;align-items:center;justify-content:center}.ep-fullscreen-container{max-width:1200px;width:100%;margin:0 auto}.ep-fullscreen-hero{text-align:center;margin-bottom:var(--ep-space-16)}.ep-hero-icon{width:120px;height:120px;margin:0 auto var(--ep-space-6);background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-2xl);display:flex;align-items:center;justify-content:center;color:white;box-shadow:var(--ep-shadow-lg);animation:ep-hero-icon-in var(--ep-transition-slow) 0.2s both}.ep-fullscreen-hero .ep-heading-1{font-size:var(--ep-font-size-5xl);margin-bottom:var(--ep-space-6);background:linear-gradient(135deg,var(--ep-primary-600),var(--ep-primary-700));-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;animation:ep-hero-title-in var(--ep-transition-slow) 0.3s both}.ep-hero-description{font-size:var(--ep-font-size-xl);color:var(--ep-text-secondary);max-width:600px;margin:0 auto;line-height:var(--ep-line-height-relaxed);animation:ep-hero-description-in var(--ep-transition-slow) 0.4s both}.ep-fullscreen-features{margin-bottom:var(--ep-space-16)}.ep-features-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:var(--ep-space-6)}.ep-feature-card{background-color:var(--ep-bg-secondary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-xl);padding:var(--ep-space-8);text-align:center;box-shadow:var(--ep-shadow-sm);transition:all var(--ep-transition-normal);opacity:0;transform:translateY(20px);animation:ep-feature-card-in var(--ep-transition-slow) both}.ep-feature-card:hover{transform:translateY(-4px);box-shadow:var(--ep-shadow-lg)}.ep-feature-card-icon{width:80px;height:80px;margin:0 auto var(--ep-space-4);background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-xl);display:flex;align-items:center;justify-content:center;color:white}.ep-feature-card-title{font-size:var(--ep-font-size-xl);font-weight:var(--ep-font-weight-semibold);color:var(--ep-text-primary);margin-bottom:var(--ep-space-3)}.ep-feature-card-description{color:var(--ep-text-secondary);line-height:var(--ep-line-height-relaxed);margin:0}.ep-fullscreen-pricing{margin-bottom:var(--ep-space-16)}.ep-pricing-header{text-align:center;margin-bottom:var(--ep-space-10)}.ep-pricing-header .ep-heading-2{font-size:var(--ep-font-size-4xl);margin-bottom:var(--ep-space-4)}.ep-pricing-subtitle{font-size:var(--ep-font-size-lg);color:var(--ep-text-secondary);margin:0}.ep-pricing-plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:var(--ep-space-8);max-width:800px;margin:0 auto}.ep-pricing-plan{position:relative;background-color:var(--ep-bg-secondary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-xl);padding:var(--ep-space-8);box-shadow:var(--ep-shadow-md);transition:all var(--ep-transition-normal);opacity:0;transform:translateY(20px);animation:ep-pricing-plan-in var(--ep-transition-slow) both}.ep-pricing-plan:hover{transform:translateY(-4px);box-shadow:var(--ep-shadow-lg)}.ep-pricing-plan-premium{border-color:var(--ep-primary-300);box-shadow:var(--ep-shadow-xl);transform:scale(1.05)}.ep-pricing-plan-premium:hover{transform:scale(1.05) translateY(-4px)}.ep-pricing-plan-badge{position:absolute;top:-16px;left:50%;transform:translateX(-50%);background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));color:white;padding:var(--ep-space-2) var(--ep-space-6);border-radius:var(--ep-radius-full);font-size:var(--ep-font-size-sm);font-weight:var(--ep-font-weight-semibold);white-space:nowrap}.ep-pricing-plan-header{text-align:center;margin-bottom:var(--ep-space-8)}.ep-pricing-plan-title{font-size:var(--ep-font-size-2xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-text-primary);margin-bottom:var(--ep-space-4)}.ep-pricing-plan-price{display:flex;align-items:baseline;justify-content:center;gap:var(--ep-space-2);margin-bottom:var(--ep-space-3)}.ep-pricing-currency{font-size:var(--ep-font-size-xl);font-weight:var(--ep-font-weight-medium);color:var(--ep-text-secondary)}.ep-pricing-amount{font-size:var(--ep-font-size-5xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-text-primary)}.ep-pricing-period{font-size:var(--ep-font-size-xl);color:var(--ep-text-secondary)}.ep-pricing-plan-description{color:var(--ep-text-secondary);margin:0}.ep-pricing-plan-features{list-style:none;padding:0;margin:0 0 var(--ep-space-8) 0}.ep-pricing-feature{display:flex;align-items:center;gap:var(--ep-space-3);padding:var(--ep-space-3) 0;color:var(--ep-text-primary);font-size:var(--ep-font-size-base)}.ep-pricing-feature-disabled{color:var(--ep-text-tertiary)}.ep-pricing-feature-icon{color:var(--ep-success-500);flex-shrink:0}.ep-pricing-feature-disabled .ep-pricing-feature-icon{color:var(--ep-text-tertiary)}.ep-fullscreen-trial{text-align:center}.ep-trial-card{background:linear-gradient(135deg,var(--ep-success-50),var(--ep-success-100));border:1px solid var(--ep-success-200);border-radius:var(--ep-radius-xl);padding:var(--ep-space-8);max-width:600px;margin:0 auto;box-shadow:var(--ep-shadow-md)}:host([data-theme=\"dark\"]) .ep-trial-card{background:linear-gradient(135deg,rgba(16,185,129,0.1),rgba(16,185,129,0.15));border-color:rgba(16,185,129,0.3)}.ep-trial-icon{width:80px;height:80px;margin:0 auto var(--ep-space-4);background:linear-gradient(135deg,var(--ep-success-500),var(--ep-success-600));border-radius:var(--ep-radius-xl);display:flex;align-items:center;justify-content:center;color:white}.ep-trial-title{font-size:var(--ep-font-size-2xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-success-700);margin-bottom:var(--ep-space-3)}:host([data-theme=\"dark\"]) .ep-trial-title{color:var(--ep-success-400)}.ep-trial-description{color:var(--ep-success-600);font-size:var(--ep-font-size-lg);line-height:var(--ep-line-height-relaxed);margin-bottom:var(--ep-space-6)}:host([data-theme=\"dark\"]) .ep-trial-description{color:var(--ep-success-300)}.ep-theme-toggle{position:fixed;top:var(--ep-space-4);right:var(--ep-space-4);z-index:var(--ep-z-tooltip)}@keyframes ep-fullscreen-in{from{opacity:0;transform:scale(0.98)}to{opacity:1;transform:scale(1)}}@keyframes ep-fullscreen-out{from{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(0.98)}}@keyframes ep-background-pattern{from{transform:translateX(0) translateY(0)}to{transform:translateX(-60px) translateY(-60px)}}@keyframes ep-hero-icon-in{from{opacity:0;transform:scale(0.8)}to{opacity:1;transform:scale(1)}}@keyframes ep-hero-title-in{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes ep-hero-description-in{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes ep-feature-card-in{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes ep-pricing-plan-in{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media (max-width:1024px){.ep-fullscreen-content{padding:var(--ep-space-6)}.ep-fullscreen-hero{margin-bottom:var(--ep-space-12)}.ep-fullscreen-features{margin-bottom:var(--ep-space-12)}.ep-fullscreen-pricing{margin-bottom:var(--ep-space-12)}.ep-features-grid{grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:var(--ep-space-4)}.ep-pricing-plans{gap:var(--ep-space-6)}}@media (max-width:768px){.ep-fullscreen-header{padding:var(--ep-space-4) var(--ep-space-6)}.ep-fullscreen-content{padding:var(--ep-space-4)}.ep-fullscreen-hero .ep-heading-1{font-size:var(--ep-font-size-3xl)}.ep-hero-description{font-size:var(--ep-font-size-lg)}.ep-hero-icon{width:80px;height:80px}.ep-features-grid{grid-template-columns:1fr}.ep-pricing-plans{grid-template-columns:1fr}.ep-pricing-plan-premium{transform:none}.ep-pricing-plan-premium:hover{transform:translateY(-4px)}.ep-feature-card{padding:var(--ep-space-6)}.ep-feature-card-icon{width:60px;height:60px}.ep-pricing-plan{padding:var(--ep-space-6)}.ep-pricing-amount{font-size:var(--ep-font-size-4xl)}}@media (max-width:480px){.ep-fullscreen-header{padding:var(--ep-space-3) var(--ep-space-4)}.ep-fullscreen-logo-text{font-size:var(--ep-font-size-lg)}.ep-fullscreen-content{padding:var(--ep-space-3)}.ep-fullscreen-hero .ep-heading-1{font-size:var(--ep-font-size-2xl)}.ep-hero-description{font-size:var(--ep-font-size-base)}.ep-hero-icon{width:60px;height:60px}.ep-pricing-header .ep-heading-2{font-size:var(--ep-font-size-2xl)}.ep-pricing-amount{font-size:var(--ep-font-size-3xl)}.ep-feature-card-icon{width:48px;height:48px}.ep-trial-icon{width:60px;height:60px}}@media (prefers-contrast:high){.ep-fullscreen-paywall{background-color:var(--ep-bg-primary)}.ep-feature-card{border:2px solid var(--ep-border-secondary)}.ep-pricing-plan{border:2px solid var(--ep-border-secondary)}.ep-pricing-plan-premium{border:2px solid var(--ep-primary-500)}.ep-trial-card{border:2px solid var(--ep-success-500)}}@media (prefers-reduced-motion:reduce){.ep-fullscreen-paywall{animation:none}.ep-background-pattern{animation:none}.ep-hero-icon{animation:none}.ep-fullscreen-hero .ep-heading-1{animation:none}.ep-hero-description{animation:none}.ep-feature-card{animation:none;opacity:1;transform:none}.ep-pricing-plan{animation:none;opacity:1;transform:none}.ep-pricing-plan-premium{transform:none}.ep-feature-card:hover{transform:none}.ep-pricing-plan:hover{transform:none}}";
|
|
@@ -3069,11 +3707,11 @@
|
|
|
3069
3707
|
const html$2 = "<div class=\"ep-minimal-paywall\" id=\"minimalPaywall\" role=\"dialog\" aria-labelledby=\"minimal-title\"><button class=\"ep-minimal-close\" aria-label=\"Close paywall\" data-ep-action=\"closeMinimal\"><svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg></button><div class=\"ep-minimal-content\"><div class=\"ep-minimal-header\"><div class=\"ep-minimal-icon\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 12l2 2 4-4\"></path><path d=\"M21 12c-1 0-3-1-3-3s2-3 3-3 3 1 3 3-2 3-3 3\"></path><path d=\"M3 12c1 0 3-1 3-3s-2-3-3-3-3 1-3 3 2 3 3 3\"></path></svg></div><h3 class=\"ep-minimal-title\" id=\"minimal-title\">{{title}}</h3><p class=\"ep-minimal-description\">{{description}}</p></div><div class=\"ep-minimal-pricing\"><div class=\"ep-minimal-price\"><span class=\"ep-minimal-currency\">{{currency}}</span><span class=\"ep-minimal-amount\">{{price}}</span><span class=\"ep-minimal-period\">{{period}}</span></div><p class=\"ep-minimal-price-description\">{{priceDescription}}</p></div><div class=\"ep-minimal-features\"><ul class=\"ep-minimal-feature-list\"><li class=\"ep-minimal-feature\"><svg class=\"ep-minimal-feature-icon\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature1}}</span></li><li class=\"ep-minimal-feature\"><svg class=\"ep-minimal-feature-icon\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature2}}</span></li><li class=\"ep-minimal-feature\"><svg class=\"ep-minimal-feature-icon\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature3}}</span></li></ul></div><div class=\"ep-minimal-actions\"><button class=\"ep-btn ep-btn-primary ep-btn-full\" data-ep-action=\"upgradeNow\"> {{upgradeButtonText}} </button><button class=\"ep-btn ep-btn-ghost ep-btn-sm\" data-ep-action=\"closeMinimal\"> {{dismissButtonText}} </button></div><div class=\"ep-minimal-trial\"><p class=\"ep-minimal-trial-text\">{{trialText}}</p></div></div></div><div class=\"ep-minimal-backdrop\" id=\"minimalBackdrop\"></div>";
|
|
3070
3708
|
const css$2 = ".ep-minimal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.4);z-index:var(--ep-z-backdrop);opacity:0;visibility:hidden;transition:all var(--ep-transition-fast)}.ep-minimal-backdrop.ep-minimal-backdrop-visible{opacity:1;visibility:visible}.ep-minimal-paywall{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%) scale(0.95);background-color:var(--ep-bg-secondary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-lg);box-shadow:var(--ep-shadow-xl);z-index:var(--ep-z-modal);max-width:400px;width:90vw;max-height:90vh;overflow-y:auto;opacity:0;visibility:hidden;transition:all var(--ep-transition-fast)}.ep-minimal-paywall.ep-minimal-visible{opacity:1;visibility:visible;transform:translate(-50%,-50%) scale(1)}.ep-minimal-close{position:absolute;top:var(--ep-space-3);right:var(--ep-space-3);background:none;border:none;color:var(--ep-text-tertiary);cursor:pointer;padding:var(--ep-space-2);border-radius:var(--ep-radius-sm);transition:all var(--ep-transition-fast);z-index:1}.ep-minimal-close:hover{color:var(--ep-text-primary);background-color:var(--ep-bg-tertiary)}.ep-minimal-content{padding:var(--ep-space-6);padding-top:var(--ep-space-8)}.ep-minimal-header{text-align:center;margin-bottom:var(--ep-space-6)}.ep-minimal-icon{width:48px;height:48px;margin:0 auto var(--ep-space-3);background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-lg);display:flex;align-items:center;justify-content:center;color:white}.ep-minimal-title{font-size:var(--ep-font-size-xl);font-weight:var(--ep-font-weight-semibold);color:var(--ep-text-primary);margin-bottom:var(--ep-space-2)}.ep-minimal-description{color:var(--ep-text-secondary);font-size:var(--ep-font-size-sm);line-height:var(--ep-line-height-relaxed);margin:0}.ep-minimal-pricing{text-align:center;margin-bottom:var(--ep-space-6);padding:var(--ep-space-4);background:linear-gradient(135deg,var(--ep-primary-50),var(--ep-primary-100));border:1px solid var(--ep-primary-200);border-radius:var(--ep-radius-md)}:host([data-theme=\"dark\"]) .ep-minimal-pricing{background:linear-gradient(135deg,var(--ep-primary-900),var(--ep-primary-800));border-color:var(--ep-primary-700)}.ep-minimal-price{display:flex;align-items:baseline;justify-content:center;gap:var(--ep-space-1);margin-bottom:var(--ep-space-2)}.ep-minimal-currency{font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-medium);color:var(--ep-text-secondary)}.ep-minimal-amount{font-size:var(--ep-font-size-2xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-text-primary)}.ep-minimal-period{font-size:var(--ep-font-size-base);color:var(--ep-text-secondary)}.ep-minimal-price-description{color:var(--ep-text-secondary);font-size:var(--ep-font-size-xs);margin:0}.ep-minimal-features{margin-bottom:var(--ep-space-6)}.ep-minimal-feature-list{list-style:none;padding:0;margin:0}.ep-minimal-feature{display:flex;align-items:center;gap:var(--ep-space-2);padding:var(--ep-space-2) 0;color:var(--ep-text-primary);font-size:var(--ep-font-size-sm);border-bottom:1px solid var(--ep-border-primary)}.ep-minimal-feature:last-child{border-bottom:none}.ep-minimal-feature-icon{color:var(--ep-success-500);flex-shrink:0}.ep-minimal-feature span{font-weight:var(--ep-font-weight-medium)}.ep-minimal-actions{display:flex;flex-direction:column;gap:var(--ep-space-2);margin-bottom:var(--ep-space-4)}.ep-minimal-trial{text-align:center;padding-top:var(--ep-space-4);border-top:1px solid var(--ep-border-primary)}.ep-minimal-trial-text{color:var(--ep-text-tertiary);font-size:var(--ep-font-size-xs);margin:0}.ep-theme-toggle{position:fixed;top:var(--ep-space-4);left:var(--ep-space-4);z-index:var(--ep-z-tooltip);display:flex;flex-direction:column;gap:var(--ep-space-2)}@media (max-width:480px){.ep-minimal-paywall{width:95vw;max-width:none}.ep-minimal-content{padding:var(--ep-space-4);padding-top:var(--ep-space-6)}.ep-minimal-close{top:var(--ep-space-2);right:var(--ep-space-2)}.ep-minimal-icon{width:40px;height:40px}.ep-minimal-title{font-size:var(--ep-font-size-lg)}.ep-minimal-amount{font-size:var(--ep-font-size-xl)}.ep-minimal-pricing{padding:var(--ep-space-3)}}@media (prefers-contrast:high){.ep-minimal-paywall{border:2px solid var(--ep-border-secondary)}.ep-minimal-pricing{border:2px solid var(--ep-primary-500)}.ep-minimal-backdrop{background-color:rgba(0,0,0,0.8)}}@media (prefers-reduced-motion:reduce){.ep-minimal-backdrop{transition:none}.ep-minimal-paywall{transition:none;transform:translate(-50%,-50%)}.ep-minimal-paywall.ep-minimal-visible{transform:translate(-50%,-50%)}}@media print{.ep-minimal-backdrop{display:none}.ep-minimal-paywall{position:static;transform:none;box-shadow:none;border:1px solid black;opacity:1;visibility:visible}.ep-minimal-close{display:none}}.ep-minimal-paywall *:focus{outline:2px solid var(--ep-primary-500);outline-offset:2px}.ep-minimal-paywall *:focus:not(:focus-visible){outline:none}.ep-minimal-paywall{animation:ep-minimal-entrance var(--ep-transition-normal) ease-out}@keyframes ep-minimal-entrance{from{opacity:0;transform:translate(-50%,-50%) scale(0.9)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}.ep-minimal-feature:hover{background-color:var(--ep-bg-tertiary);border-radius:var(--ep-radius-sm);margin:0 calc(-1 * var(--ep-space-2));padding:var(--ep-space-2)}.ep-minimal-pricing:hover{background:linear-gradient(135deg,var(--ep-primary-100),var(--ep-primary-200));border-color:var(--ep-primary-300)}:host([data-theme=\"dark\"]) .ep-minimal-pricing:hover{background:linear-gradient(135deg,var(--ep-primary-800),var(--ep-primary-700));border-color:var(--ep-primary-600)}";
|
|
3071
3709
|
|
|
3072
|
-
const html$1 = "<div class=\"ep-modal-backdrop\" id=\"paywallModal\" role=\"dialog\" aria-labelledby=\"paywall-title\" aria-describedby=\"paywall-description\"><div class=\"ep-modal-container\"><button class=\"ep-modal-close\" aria-label=\"Close paywall\" data-ep-action=\"closePaywall\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg></button><div class=\"ep-modal-content\"><div class=\"ep-modal-header\"><div class=\"ep-modal-icon\"><svg width=\"48\" height=\"48\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\" ry=\"2\"></rect><path d=\"m7 11V7a5 5 0 0 1 10 0v4\"></path></svg></div><h2 class=\"ep-heading-2\" id=\"paywall-title\">{{title}}</h2><p class=\"ep-text-body\" id=\"paywall-description\">{{description}}</p></div><div class=\"ep-modal-features\"><h3 class=\"ep-heading-3\">{{featuresHeading}}</h3><ul class=\"ep-feature-list\"><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature1}}</span></li><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature2}}</span></li><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature3}}</span></li></ul></div><div class=\"ep-modal-pricing\"><div class=\"ep-pricing-card\"><div class=\"ep-pricing-header\"><div class=\"ep-pricing-price\"><span class=\"ep-pricing-currency\">{{currency}}</span><span class=\"ep-pricing-amount\">{{price}}</span><span class=\"ep-pricing-period\">{{period}}</span></div><p class=\"ep-pricing-description\">{{pricingDescription}}</p></div><div class=\"ep-trial-info\"><p class=\"ep-text-sm\">{{trialInfo}}</p></div></div></div><div class=\"ep-modal-actions\"><button class=\"ep-btn ep-btn-primary ep-btn-lg ep-btn-full\" data-ep-action=\"upgradeNow\"> {{upgradeButtonText}} </button><button class=\"ep-btn ep-btn-ghost ep-btn-sm\" data-ep-action=\"closePaywall\"> {{cancelButtonText}} </button></div><div class=\"ep-modal-footer\"><p class=\"ep-text-sm\">{{footerText}}</p></div></div></div></div>";
|
|
3073
|
-
const css$1 = ".ep-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.75);backdrop-filter:blur(4px);z-index:var(--ep-z-modal);display:flex;align-items:center;justify-content:center;padding:var(--ep-space-4);animation:ep-modal-backdrop-in var(--ep-transition-normal)}.ep-modal-backdrop.ep-modal-closing{animation:ep-modal-backdrop-out var(--ep-transition-normal)}.ep-modal-container{position:relative;background-color:var(--ep-bg-secondary);border-radius:var(--ep-radius-xl);box-shadow:var(--ep-shadow-xl);max-width:480px;width:100%;max-height:90vh;overflow-y:auto;animation:ep-modal-container-in var(--ep-transition-normal)}.ep-modal-backdrop.ep-modal-closing .ep-modal-container{animation:ep-modal-container-out var(--ep-transition-normal)}.ep-modal-close{position:absolute;top:var(--ep-space-4);right:var(--ep-space-4);background:none;border:none;color:var(--ep-text-tertiary);cursor:pointer;padding:var(--ep-space-2);border-radius:var(--ep-radius-md);transition:all var(--ep-transition-fast);z-index:1}.ep-modal-close:hover{color:var(--ep-text-primary);background-color:var(--ep-bg-tertiary)}.ep-modal-close:focus{outline:2px solid var(--ep-primary-500);outline-offset:2px}.ep-modal-content{padding:var(--ep-space-8);padding-top:var(--ep-space-12)}.ep-modal-header{text-align:center;margin-bottom:var(--ep-space-8)}.ep-modal-icon{width:80px;height:80px;margin:0 auto var(--ep-space-4);background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-2xl);display:flex;align-items:center;justify-content:center;color:white}.ep-modal-header .ep-heading-2{margin-bottom:var(--ep-space-3)}.ep-modal-header .ep-text-body{margin-bottom:0;font-size:var(--ep-font-size-lg)}.ep-modal-features{margin-bottom:var(--ep-space-8)}.ep-modal-features .ep-heading-3{margin-bottom:var(--ep-space-4);text-align:center}.ep-feature-list{list-style:none;padding:0;margin:0}.ep-feature-item{display:flex;align-items:center;gap:var(--ep-space-3);padding:var(--ep-space-3) 0;border-bottom:1px solid var(--ep-border-primary)}.ep-feature-item:last-child{border-bottom:none}.ep-feature-icon{color:var(--ep-success-500);flex-shrink:0}.ep-feature-item span{color:var(--ep-text-primary);font-weight:var(--ep-font-weight-medium)}.ep-modal-pricing{margin-bottom:var(--ep-space-8)}.ep-pricing-card{background:linear-gradient(135deg,var(--ep-primary-50),var(--ep-primary-100));border:1px solid var(--ep-primary-200);border-radius:var(--ep-radius-lg);padding:var(--ep-space-6);text-align:center}:host([data-theme=\"dark\"]) .ep-pricing-card{background:linear-gradient(135deg,var(--ep-primary-900),var(--ep-primary-800));border-color:var(--ep-primary-700)}.ep-pricing-header{margin-bottom:var(--ep-space-4)}.ep-pricing-price{display:flex;align-items:baseline;justify-content:center;gap:var(--ep-space-1);margin-bottom:var(--ep-space-2)}.ep-pricing-currency{font-size:var(--ep-font-size-lg);font-weight:var(--ep-font-weight-medium);color:var(--ep-text-secondary)}.ep-pricing-amount{font-size:var(--ep-font-size-4xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-text-primary)}.ep-pricing-period{font-size:var(--ep-font-size-lg);color:var(--ep-text-secondary)}.ep-pricing-description{color:var(--ep-text-secondary);margin:0}.ep-trial-info{background-color:var(--ep-success-50);border:1px solid var(--ep-success-200);border-radius:var(--ep-radius-md);padding:var(--ep-space-3);margin-top:var(--ep-space-4)}:host([data-theme=\"dark\"]) .ep-trial-info{background-color:rgba(16,185,129,0.1);border-color:rgba(16,185,129,0.3)}.ep-trial-info .ep-text-sm{color:var(--ep-success-700);margin:0;font-weight:var(--ep-font-weight-medium)}:host([data-theme=\"dark\"]) .ep-trial-info .ep-text-sm{color:var(--ep-success-400)}.ep-modal-actions{display:flex;flex-direction:column;gap:var(--ep-space-3);margin-bottom:var(--ep-space-6)}.ep-modal-footer{text-align:center;padding-top:var(--ep-space-6);border-top:1px solid var(--ep-border-primary)}.ep-modal-footer .ep-text-sm{margin:0}.ep-theme-toggle{position:fixed;top:var(--ep-space-4);left:var(--ep-space-4);z-index:var(--ep-z-tooltip)}@keyframes ep-modal-backdrop-in{from{opacity:0}to{opacity:1}}@keyframes ep-modal-backdrop-out{from{opacity:1}to{opacity:0}}@keyframes ep-modal-container-in{from{opacity:0;transform:scale(0.95) translateY(-10px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes ep-modal-container-out{from{opacity:1;transform:scale(1) translateY(0)}to{opacity:0;transform:scale(0.95) translateY(-10px)}}@media (max-width:640px){.ep-modal-backdrop{padding:var(--ep-space-2)}.ep-modal-container{max-width:100%;border-radius:var(--ep-radius-lg)}.ep-modal-content{padding:var(--ep-space-6);padding-top:var(--ep-space-10)}.ep-modal-icon{width:60px;height:60px}.ep-modal-header .ep-heading-2{font-size:var(--ep-font-size-xl)}.ep-pricing-amount{font-size:var(--ep-font-size-3xl)}}@media (max-width:480px){.ep-modal-content{padding:var(--ep-space-4);padding-top:var(--ep-space-8)}.ep-modal-close{top:var(--ep-space-3);right:var(--ep-space-3)}}@media (prefers-contrast:high){.ep-modal-backdrop{background-color:rgba(0,0,0,0.9);backdrop-filter:none}.ep-modal-container{border:2px solid var(--ep-border-secondary)}.ep-pricing-card{background:var(--ep-bg-secondary);border:2px solid var(--ep-primary-500)}}@media (prefers-reduced-motion:reduce){.ep-modal-backdrop{animation:none}.ep-modal-container{animation:none}.ep-modal-backdrop.ep-modal-closing{animation:none}.ep-modal-backdrop.ep-modal-closing .ep-modal-container{animation:none}}";
|
|
3710
|
+
const html$1 = "<div class=\"ep-modal-backdrop\" id=\"paywallModal\" role=\"dialog\" aria-labelledby=\"paywall-title\" aria-describedby=\"paywall-description\"><div class=\"ep-modal-container\"><button class=\"ep-modal-close\" aria-label=\"Close paywall\" data-ep-action=\"closePaywall\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg></button><div class=\"ep-modal-content\"><div class=\"ep-modal-header\"><div class=\"ep-modal-icon\"><svg width=\"48\" height=\"48\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\" ry=\"2\"></rect><path d=\"m7 11V7a5 5 0 0 1 10 0v4\"></path></svg></div><h2 class=\"ep-heading-2\" id=\"paywall-title\">{{title}}</h2><p class=\"ep-text-body\" id=\"paywall-description\">{{description}}</p></div><div class=\"ep-modal-features\"><h3 class=\"ep-heading-3\">{{featuresHeading}}</h3><ul class=\"ep-feature-list\"><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature1}}</span></li><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature2}}</span></li><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature3}}</span></li><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature4}}</span></li><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature5}}</span></li><li class=\"ep-feature-item\"><svg class=\"ep-feature-icon\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20,6 9,17 4,12\"></polyline></svg><span>{{feature6}}</span></li></ul></div><div class=\"ep-modal-pricing\"><div class=\"ep-pricing-card\"><div class=\"ep-pricing-header\"><div class=\"ep-pricing-price\"><span class=\"ep-pricing-currency\">{{currency}}</span><span class=\"ep-pricing-amount\">{{price}}</span><span class=\"ep-pricing-period\">{{period}}</span></div><p class=\"ep-pricing-description\">{{pricingDescription}}</p></div><div class=\"ep-trial-info\"><p class=\"ep-text-sm\">{{trialInfo}}</p></div></div></div><div class=\"ep-modal-actions\"><button class=\"ep-btn ep-btn-primary ep-btn-lg ep-btn-full\" data-ep-action=\"upgradeNow\"> {{upgradeButtonText}} </button><button class=\"ep-btn ep-btn-ghost ep-btn-sm\" data-ep-action=\"closePaywall\"> {{cancelButtonText}} </button></div><div class=\"ep-modal-footer\"><p class=\"ep-text-sm\">{{footerText}}</p></div></div></div></div>";
|
|
3711
|
+
const css$1 = ".ep-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.75);backdrop-filter:blur(4px);z-index:var(--ep-z-modal);display:flex;align-items:center;justify-content:center;padding:var(--ep-space-4);animation:ep-modal-backdrop-in var(--ep-transition-normal)}.ep-modal-backdrop.ep-modal-closing{animation:ep-modal-backdrop-out var(--ep-transition-normal)}.ep-modal-container{position:relative;background-color:var(--ep-bg-secondary);border-radius:var(--ep-radius-xl);box-shadow:var(--ep-shadow-xl);max-width:480px;width:100%;max-height:90vh;overflow-y:auto;animation:ep-modal-container-in var(--ep-transition-normal)}.ep-modal-backdrop.ep-modal-closing .ep-modal-container{animation:ep-modal-container-out var(--ep-transition-normal)}.ep-modal-close{position:absolute;top:var(--ep-space-4);right:var(--ep-space-4);background:none;border:none;color:var(--ep-text-tertiary);cursor:pointer;padding:var(--ep-space-2);border-radius:var(--ep-radius-md);transition:all var(--ep-transition-fast);z-index:1}.ep-modal-close:hover{color:var(--ep-text-primary);background-color:var(--ep-bg-tertiary)}.ep-modal-close:focus{outline:2px solid var(--ep-primary-500);outline-offset:2px}.ep-modal-content{padding:var(--ep-space-8);padding-top:var(--ep-space-12)}.ep-modal-header{text-align:center;margin-bottom:var(--ep-space-8)}.ep-modal-icon{width:80px;height:80px;margin:0 auto var(--ep-space-4);background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-2xl);display:flex;align-items:center;justify-content:center;color:white}.ep-modal-header .ep-heading-2{margin-bottom:var(--ep-space-3)}.ep-modal-header .ep-text-body{margin-bottom:0;font-size:var(--ep-font-size-lg)}.ep-modal-features{margin-bottom:var(--ep-space-8)}.ep-modal-features .ep-heading-3{margin-bottom:var(--ep-space-4);text-align:center}.ep-feature-list{list-style:none;padding:0;margin:0}.ep-feature-item{display:flex;align-items:center;gap:var(--ep-space-3);padding:var(--ep-space-3) 0;border-bottom:1px solid var(--ep-border-primary)}.ep-feature-item:last-child{border-bottom:none}.ep-feature-icon{color:var(--ep-success-500);flex-shrink:0}.ep-feature-item span{color:var(--ep-text-primary);font-weight:var(--ep-font-weight-medium)}.ep-modal-pricing{margin-bottom:var(--ep-space-8)}.ep-pricing-card{background:linear-gradient(135deg,var(--ep-primary-50),var(--ep-primary-100));border:1px solid var(--ep-primary-200);border-radius:var(--ep-radius-lg);padding:var(--ep-space-6);text-align:center}:host([data-theme=\"dark\"]) .ep-pricing-card{background:linear-gradient(135deg,var(--ep-primary-900),var(--ep-primary-800));border-color:var(--ep-primary-700)}.ep-pricing-header{margin-bottom:var(--ep-space-4)}.ep-pricing-price{display:flex;align-items:baseline;justify-content:center;gap:var(--ep-space-1);margin-bottom:var(--ep-space-2)}.ep-pricing-currency{font-size:var(--ep-font-size-lg);font-weight:var(--ep-font-weight-medium);color:var(--ep-text-secondary)}.ep-pricing-amount{font-size:var(--ep-font-size-4xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-text-primary)}.ep-pricing-period{font-size:var(--ep-font-size-lg);color:var(--ep-text-secondary)}.ep-pricing-description{color:var(--ep-text-secondary);margin:0}.ep-pricing-header:last-child,.ep-pricing-price:last-child{margin-bottom:0}.ep-trial-info{background-color:var(--ep-success-50);border:1px solid var(--ep-success-200);border-radius:var(--ep-radius-md);padding:var(--ep-space-3);margin-top:var(--ep-space-4)}:host([data-theme=\"dark\"]) .ep-trial-info{background-color:rgba(16,185,129,0.1);border-color:rgba(16,185,129,0.3)}.ep-trial-info .ep-text-sm{color:var(--ep-success-700);margin:0;font-weight:var(--ep-font-weight-medium)}:host([data-theme=\"dark\"]) .ep-trial-info .ep-text-sm{color:var(--ep-success-400)}.ep-modal-actions{display:flex;flex-direction:column;gap:var(--ep-space-3);margin-bottom:var(--ep-space-6)}.ep-modal-footer{text-align:center;padding-top:var(--ep-space-6);border-top:1px solid var(--ep-border-primary)}.ep-modal-footer .ep-text-sm{margin:0}.ep-theme-toggle{position:fixed;top:var(--ep-space-4);left:var(--ep-space-4);z-index:var(--ep-z-tooltip)}@keyframes ep-modal-backdrop-in{from{opacity:0}to{opacity:1}}@keyframes ep-modal-backdrop-out{from{opacity:1}to{opacity:0}}@keyframes ep-modal-container-in{from{opacity:0;transform:scale(0.95) translateY(-10px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes ep-modal-container-out{from{opacity:1;transform:scale(1) translateY(0)}to{opacity:0;transform:scale(0.95) translateY(-10px)}}@media (max-width:640px){.ep-modal-backdrop{padding:var(--ep-space-2)}.ep-modal-container{max-width:100%;border-radius:var(--ep-radius-lg)}.ep-modal-content{padding:var(--ep-space-6);padding-top:var(--ep-space-10)}.ep-modal-icon{width:60px;height:60px}.ep-modal-header .ep-heading-2{font-size:var(--ep-font-size-xl)}.ep-pricing-amount{font-size:var(--ep-font-size-3xl)}}@media (max-width:480px){.ep-modal-content{padding:var(--ep-space-4);padding-top:var(--ep-space-8)}.ep-modal-close{top:var(--ep-space-3);right:var(--ep-space-3)}}@media (prefers-contrast:high){.ep-modal-backdrop{background-color:rgba(0,0,0,0.9);backdrop-filter:none}.ep-modal-container{border:2px solid var(--ep-border-secondary)}.ep-pricing-card{background:var(--ep-bg-secondary);border:2px solid var(--ep-primary-500)}}@media (prefers-reduced-motion:reduce){.ep-modal-backdrop{animation:none}.ep-modal-container{animation:none}.ep-modal-backdrop.ep-modal-closing{animation:none}.ep-modal-backdrop.ep-modal-closing .ep-modal-container{animation:none}}";
|
|
3074
3712
|
|
|
3075
3713
|
const html = "<div class=\"ep-sidebar-backdrop\" id=\"sidebarBackdrop\"></div><div class=\"ep-sidebar-paywall\" id=\"sidebarPaywall\" role=\"dialog\" aria-labelledby=\"sidebar-title\" aria-describedby=\"sidebar-description\"><div class=\"ep-sidebar-header\"><button class=\"ep-sidebar-close\" aria-label=\"Close paywall\" data-ep-action=\"closeSidebar\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg></button><div class=\"ep-sidebar-logo\"><svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2L2 7l10 5 10-5-10-5z\"></path><path d=\"M2 17l10 5 10-5\"></path><path d=\"M2 12l10 5 10-5\"></path></svg><span class=\"ep-sidebar-logo-text\">{{brandName}}</span></div></div><div class=\"ep-sidebar-content\"><div class=\"ep-sidebar-title-section\"><h2 class=\"ep-heading-2\" id=\"sidebar-title\">{{title}}</h2><p class=\"ep-text-body\" id=\"sidebar-description\">{{description}}</p></div><div class=\"ep-sidebar-progress\"><div class=\"ep-progress-header\"><span class=\"ep-progress-label\">{{progressLabel}}</span><span class=\"ep-progress-value\">{{usageCount}}/{{usageLimit}}</span></div><div class=\"ep-progress-bar\"><div class=\"ep-progress-fill\" style=\"width: {{progressPercentage}}%\"></div></div><p class=\"ep-progress-text\">{{progressText}}</p></div><div class=\"ep-sidebar-features\"><h3 class=\"ep-heading-3\">{{unlockHeading}}</h3><div class=\"ep-feature-list\"><div class=\"ep-feature-item\"><div class=\"ep-feature-icon\"><svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2L2 7l10 5 10-5-10-5z\"></path><path d=\"M2 17l10 5 10-5\"></path><path d=\"M2 12l10 5 10-5\"></path></svg></div><div class=\"ep-feature-content\"><h4 class=\"ep-feature-title\">{{feature1Title}}</h4><p class=\"ep-feature-description\">{{feature1Description}}</p></div></div><div class=\"ep-feature-item\"><div class=\"ep-feature-icon\"><svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 12h-4l-3 9L9 3l-3 9H2\"></path></svg></div><div class=\"ep-feature-content\"><h4 class=\"ep-feature-title\">{{feature2Title}}</h4><p class=\"ep-feature-description\">{{feature2Description}}</p></div></div><div class=\"ep-feature-item\"><div class=\"ep-feature-icon\"><svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z\"></path></svg></div><div class=\"ep-feature-content\"><h4 class=\"ep-feature-title\">{{feature3Title}}</h4><p class=\"ep-feature-description\">{{feature3Description}}</p></div></div></div></div><div class=\"ep-sidebar-pricing\"><div class=\"ep-pricing-card\"><div class=\"ep-pricing-header\"><div class=\"ep-pricing-badge\">{{pricingBadge}}</div><div class=\"ep-pricing-price\"><span class=\"ep-pricing-currency\">{{currency}}</span><span class=\"ep-pricing-amount\">{{price}}</span><span class=\"ep-pricing-period\">{{period}}</span></div><p class=\"ep-pricing-description\">{{pricingDescription}}</p></div></div></div><div class=\"ep-sidebar-trial\"><div class=\"ep-trial-info\"><div class=\"ep-trial-icon\"><svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"></path><polyline points=\"22,4 12,14.01 9,11.01\"></polyline></svg></div><div class=\"ep-trial-content\"><h4 class=\"ep-trial-title\">{{trialTitle}}</h4><p class=\"ep-trial-description\">{{trialDescription}}</p></div></div></div></div><div class=\"ep-sidebar-footer\"><button class=\"ep-btn ep-btn-primary ep-btn-lg ep-btn-full\" data-ep-action=\"startUpgrade\"> {{upgradeButtonText}} </button><button class=\"ep-btn ep-btn-secondary ep-btn-full\" data-ep-action=\"startTrial\"> {{trialButtonText}} </button><button class=\"ep-btn ep-btn-ghost ep-btn-sm\" data-ep-action=\"remindLater\"> {{remindLaterText}} </button></div></div>";
|
|
3076
|
-
const css = ".ep-sidebar-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.5);backdrop-filter:blur(2px);z-index:var(--ep-z-backdrop);opacity:0;visibility:hidden;transition:all var(--ep-transition-normal)}.ep-sidebar-backdrop.ep-sidebar-backdrop-visible{opacity:1;visibility:visible}.ep-sidebar-paywall{position:fixed;top:0;right:0;bottom:0;width:400px;max-width:90vw;background-color:var(--ep-bg-secondary);border-left:1px solid var(--ep-border-primary);box-shadow:var(--ep-shadow-xl);z-index:var(--ep-z-modal);display:flex;flex-direction:column;transform:translateX(100%);transition:transform var(--ep-transition-normal)}.ep-sidebar-paywall.ep-sidebar-visible{transform:translateX(0)}.ep-sidebar-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ep-space-4) var(--ep-space-6);border-bottom:1px solid var(--ep-border-primary);background:linear-gradient(135deg,var(--ep-primary-50),var(--ep-primary-100))}:host([data-theme=\"dark\"]) .ep-sidebar-header{background:linear-gradient(135deg,var(--ep-primary-900),var(--ep-primary-800))}.ep-sidebar-close{background:none;border:none;color:var(--ep-text-tertiary);cursor:pointer;padding:var(--ep-space-2);border-radius:var(--ep-radius-md);transition:all var(--ep-transition-fast)}.ep-sidebar-close:hover{color:var(--ep-text-primary);background-color:var(--ep-bg-tertiary)}.ep-sidebar-logo{display:flex;align-items:center;gap:var(--ep-space-2);color:var(--ep-primary-600)}.ep-sidebar-logo-text{font-size:var(--ep-font-size-lg);font-weight:var(--ep-font-weight-semibold);color:var(--ep-text-primary)}.ep-sidebar-content{flex:1;padding:var(--ep-space-6);overflow-y:auto;display:flex;flex-direction:column;gap:var(--ep-space-6)}.ep-sidebar-title-section{text-align:center}.ep-sidebar-title-section .ep-heading-2{margin-bottom:var(--ep-space-3);color:var(--ep-text-primary)}.ep-sidebar-title-section .ep-text-body{margin-bottom:0;color:var(--ep-text-secondary)}.ep-sidebar-progress{background-color:var(--ep-bg-tertiary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-md);padding:var(--ep-space-4)}.ep-progress-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--ep-space-3)}.ep-progress-label{font-size:var(--ep-font-size-sm);font-weight:var(--ep-font-weight-medium);color:var(--ep-text-primary)}.ep-progress-value{font-size:var(--ep-font-size-sm);font-weight:var(--ep-font-weight-semibold);color:var(--ep-primary-600)}.ep-progress-bar{height:8px;background-color:var(--ep-bg-primary);border-radius:var(--ep-radius-full);overflow:hidden;margin-bottom:var(--ep-space-2)}.ep-progress-fill{height:100%;background:linear-gradient(90deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-full);transition:width var(--ep-transition-normal)}.ep-progress-text{font-size:var(--ep-font-size-xs);color:var(--ep-text-tertiary);margin:0}.ep-sidebar-features .ep-heading-3{margin-bottom:var(--ep-space-4);text-align:center}.ep-feature-list{display:flex;flex-direction:column;gap:var(--ep-space-4)}.ep-feature-item{display:flex;align-items:flex-start;gap:var(--ep-space-3);padding:var(--ep-space-3);background-color:var(--ep-bg-tertiary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-md);opacity:0;transform:translateX(20px);transition:all var(--ep-transition-normal)}.ep-feature-item.ep-feature-item-visible{opacity:1;transform:translateX(0)}.ep-feature-icon{width:40px;height:40px;background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-lg);display:flex;align-items:center;justify-content:center;color:white;flex-shrink:0}.ep-feature-content{flex:1;min-width:0}.ep-feature-title{font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-semibold);color:var(--ep-text-primary);margin-bottom:var(--ep-space-1)}.ep-feature-description{font-size:var(--ep-font-size-sm);color:var(--ep-text-secondary);line-height:var(--ep-line-height-relaxed);margin:0}.ep-sidebar-pricing{background:linear-gradient(135deg,var(--ep-primary-50),var(--ep-primary-100));border:1px solid var(--ep-primary-200);border-radius:var(--ep-radius-lg);padding:var(--ep-space-4)}:host([data-theme=\"dark\"]) .ep-sidebar-pricing{background:linear-gradient(135deg,var(--ep-primary-900),var(--ep-primary-800));border-color:var(--ep-primary-700)}.ep-pricing-card{text-align:center}.ep-pricing-header{margin-bottom:var(--ep-space-4)}.ep-pricing-badge{background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));color:white;padding:var(--ep-space-1) var(--ep-space-3);border-radius:var(--ep-radius-full);font-size:var(--ep-font-size-xs);font-weight:var(--ep-font-weight-medium);display:inline-block;margin-bottom:var(--ep-space-3)}.ep-pricing-price{display:flex;align-items:baseline;justify-content:center;gap:var(--ep-space-1);margin-bottom:var(--ep-space-2)}.ep-pricing-currency{font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-medium);color:var(--ep-text-secondary)}.ep-pricing-amount{font-size:var(--ep-font-size-2xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-text-primary)}.ep-pricing-period{font-size:var(--ep-font-size-base);color:var(--ep-text-secondary)}.ep-pricing-description{font-size:var(--ep-font-size-sm);color:var(--ep-text-secondary);margin:0}.ep-sidebar-trial{background-color:var(--ep-success-50);border:1px solid var(--ep-success-200);border-radius:var(--ep-radius-md);padding:var(--ep-space-4)}:host([data-theme=\"dark\"]) .ep-sidebar-trial{background-color:rgba(16,185,129,0.1);border-color:rgba(16,185,129,0.3)}.ep-trial-info{display:flex;align-items:flex-start;gap:var(--ep-space-3)}.ep-trial-icon{width:32px;height:32px;background:linear-gradient(135deg,var(--ep-success-500),var(--ep-success-600));border-radius:var(--ep-radius-lg);display:flex;align-items:center;justify-content:center;color:white;flex-shrink:0}.ep-trial-content{flex:1;min-width:0}.ep-trial-title{font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-semibold);color:var(--ep-success-700);margin-bottom:var(--ep-space-1)}:host([data-theme=\"dark\"]) .ep-trial-title{color:var(--ep-success-400)}.ep-trial-description{font-size:var(--ep-font-size-sm);color:var(--ep-success-600);line-height:var(--ep-line-height-relaxed);margin:0}:host([data-theme=\"dark\"]) .ep-trial-description{color:var(--ep-success-300)}.ep-sidebar-footer{padding:var(--ep-space-6);border-top:1px solid var(--ep-border-primary);background-color:var(--ep-bg-tertiary);display:flex;flex-direction:column;gap:var(--ep-space-3)}.ep-theme-toggle{position:fixed;top:var(--ep-space-4);left:var(--ep-space-4);z-index:var(--ep-z-tooltip);display:flex;flex-direction:column;gap:var(--ep-space-2)}@media (max-width:768px){.ep-sidebar-paywall{width:100%;max-width:100%;border-left:none}.ep-sidebar-content{padding:var(--ep-space-4)}.ep-sidebar-footer{padding:var(--ep-space-4)}}@media (max-width:480px){.ep-sidebar-header{padding:var(--ep-space-3) var(--ep-space-4)}.ep-sidebar-content{padding:var(--ep-space-3);gap:var(--ep-space-4)}.ep-sidebar-footer{padding:var(--ep-space-3)}.ep-feature-item{padding:var(--ep-space-2)}.ep-feature-icon{width:32px;height:32px}.ep-pricing-amount{font-size:var(--ep-font-size-xl)}}@media (prefers-contrast:high){.ep-sidebar-paywall{border-left:2px solid var(--ep-border-secondary)}.ep-feature-item{border:2px solid var(--ep-border-secondary)}.ep-sidebar-pricing{border:2px solid var(--ep-primary-500)}.ep-sidebar-trial{border:2px solid var(--ep-success-500)}}@media (prefers-reduced-motion:reduce){.ep-sidebar-backdrop{transition:none}.ep-sidebar-paywall{transition:none}.ep-feature-item{transition:none;opacity:1;transform:none}.ep-progress-fill{transition:none}}";
|
|
3714
|
+
const css = ".ep-sidebar-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.5);backdrop-filter:blur(2px);z-index:var(--ep-z-backdrop);opacity:0;visibility:hidden;transition:all var(--ep-transition-normal)}.ep-sidebar-backdrop.ep-sidebar-backdrop-visible{opacity:1;visibility:visible}.ep-sidebar-paywall{position:fixed;top:0;right:0;bottom:0;width:400px;max-width:90vw;background-color:var(--ep-bg-secondary);border-left:1px solid var(--ep-border-primary);box-shadow:var(--ep-shadow-xl);z-index:var(--ep-z-modal);display:flex;flex-direction:column;transform:translateX(100%);transition:transform var(--ep-transition-normal)}.ep-sidebar-paywall.ep-sidebar-visible{transform:translateX(0)}.ep-sidebar-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ep-space-4) var(--ep-space-6);border-bottom:1px solid var(--ep-border-primary);background:linear-gradient(135deg,var(--ep-primary-50),var(--ep-primary-100))}:host([data-theme=\"dark\"]) .ep-sidebar-header{background:linear-gradient(135deg,var(--ep-primary-900),var(--ep-primary-800))}.ep-sidebar-close{background:none;border:none;color:var(--ep-text-tertiary);cursor:pointer;padding:var(--ep-space-2);border-radius:var(--ep-radius-md);transition:all var(--ep-transition-fast)}.ep-sidebar-close:hover{color:var(--ep-text-primary);background-color:var(--ep-bg-tertiary)}.ep-sidebar-logo{display:flex;align-items:center;gap:var(--ep-space-2);color:var(--ep-primary-600)}.ep-sidebar-logo-text{font-size:var(--ep-font-size-lg);font-weight:var(--ep-font-weight-semibold);color:var(--ep-text-primary)}.ep-sidebar-content{flex:1;padding:var(--ep-space-6);overflow-y:auto;display:flex;flex-direction:column;gap:var(--ep-space-6)}.ep-sidebar-title-section{text-align:center}.ep-sidebar-title-section .ep-heading-2{margin-bottom:var(--ep-space-3);color:var(--ep-text-primary)}.ep-sidebar-title-section .ep-text-body{margin-bottom:0;color:var(--ep-text-secondary)}.ep-sidebar-progress{background-color:var(--ep-bg-tertiary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-md);padding:var(--ep-space-4)}.ep-progress-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--ep-space-3)}.ep-progress-label{font-size:var(--ep-font-size-sm);font-weight:var(--ep-font-weight-medium);color:var(--ep-text-primary)}.ep-progress-value{font-size:var(--ep-font-size-sm);font-weight:var(--ep-font-weight-semibold);color:var(--ep-primary-600)}.ep-progress-bar{height:8px;background-color:var(--ep-bg-primary);border-radius:var(--ep-radius-full);overflow:hidden;margin-bottom:var(--ep-space-2)}.ep-progress-fill{height:100%;background:linear-gradient(90deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-full);transition:width var(--ep-transition-normal)}.ep-progress-text{font-size:var(--ep-font-size-xs);color:var(--ep-text-tertiary);margin:0}.ep-sidebar-features .ep-heading-3{margin-bottom:var(--ep-space-4);text-align:center}.ep-feature-list{display:flex;flex-direction:column;gap:var(--ep-space-4)}.ep-feature-item{display:flex;align-items:flex-start;gap:var(--ep-space-3);padding:var(--ep-space-3);background-color:var(--ep-bg-tertiary);border:1px solid var(--ep-border-primary);border-radius:var(--ep-radius-md);opacity:0;transform:translateX(20px);transition:all var(--ep-transition-normal)}.ep-feature-item.ep-feature-item-visible{opacity:1;transform:translateX(0)}.ep-feature-icon{width:40px;height:40px;background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));border-radius:var(--ep-radius-lg);display:flex;align-items:center;justify-content:center;color:white;flex-shrink:0}.ep-feature-content{flex:1;min-width:0}.ep-feature-title{font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-semibold);color:var(--ep-text-primary);margin-bottom:var(--ep-space-1)}.ep-feature-description{font-size:var(--ep-font-size-sm);color:var(--ep-text-secondary);line-height:var(--ep-line-height-relaxed);margin:0}.ep-sidebar-pricing{background:linear-gradient(135deg,var(--ep-primary-50),var(--ep-primary-100));border:1px solid var(--ep-primary-200);border-radius:var(--ep-radius-lg);padding:var(--ep-space-4)}:host([data-theme=\"dark\"]) .ep-sidebar-pricing{background:linear-gradient(135deg,var(--ep-primary-900),var(--ep-primary-800));border-color:var(--ep-primary-700)}.ep-pricing-card{text-align:center}.ep-pricing-header{margin-bottom:var(--ep-space-4)}.ep-pricing-badge{background:linear-gradient(135deg,var(--ep-primary-500),var(--ep-primary-600));color:white;padding:var(--ep-space-1) var(--ep-space-3);border-radius:var(--ep-radius-full);font-size:var(--ep-font-size-xs);font-weight:var(--ep-font-weight-medium);display:inline-block;margin-bottom:var(--ep-space-3)}.ep-pricing-price{display:flex;align-items:baseline;justify-content:center;gap:var(--ep-space-1);margin-bottom:var(--ep-space-2)}.ep-pricing-currency{font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-medium);color:var(--ep-text-secondary)}.ep-pricing-amount{font-size:var(--ep-font-size-2xl);font-weight:var(--ep-font-weight-bold);color:var(--ep-text-primary)}.ep-pricing-period{font-size:var(--ep-font-size-base);color:var(--ep-text-secondary)}.ep-pricing-description{font-size:var(--ep-font-size-sm);color:var(--ep-text-secondary);margin:0}.ep-pricing-header:last-child,.ep-pricing-price:last-child{margin-bottom:0}.ep-sidebar-trial{background-color:var(--ep-success-50);border:1px solid var(--ep-success-200);border-radius:var(--ep-radius-md);padding:var(--ep-space-4)}:host([data-theme=\"dark\"]) .ep-sidebar-trial{background-color:rgba(16,185,129,0.1);border-color:rgba(16,185,129,0.3)}.ep-trial-info{display:flex;align-items:flex-start;gap:var(--ep-space-3)}.ep-trial-icon{width:32px;height:32px;background:linear-gradient(135deg,var(--ep-success-500),var(--ep-success-600));border-radius:var(--ep-radius-lg);display:flex;align-items:center;justify-content:center;color:white;flex-shrink:0}.ep-trial-content{flex:1;min-width:0}.ep-trial-title{font-size:var(--ep-font-size-base);font-weight:var(--ep-font-weight-semibold);color:var(--ep-success-700);margin-bottom:var(--ep-space-1)}:host([data-theme=\"dark\"]) .ep-trial-title{color:var(--ep-success-400)}.ep-trial-description{font-size:var(--ep-font-size-sm);color:var(--ep-success-600);line-height:var(--ep-line-height-relaxed);margin:0}:host([data-theme=\"dark\"]) .ep-trial-description{color:var(--ep-success-300)}.ep-sidebar-footer{padding:var(--ep-space-6);border-top:1px solid var(--ep-border-primary);background-color:var(--ep-bg-tertiary);display:flex;flex-direction:column;gap:var(--ep-space-3)}.ep-theme-toggle{position:fixed;top:var(--ep-space-4);left:var(--ep-space-4);z-index:var(--ep-z-tooltip);display:flex;flex-direction:column;gap:var(--ep-space-2)}@media (max-width:768px){.ep-sidebar-paywall{width:100%;max-width:100%;border-left:none}.ep-sidebar-content{padding:var(--ep-space-4)}.ep-sidebar-footer{padding:var(--ep-space-4)}}@media (max-width:480px){.ep-sidebar-header{padding:var(--ep-space-3) var(--ep-space-4)}.ep-sidebar-content{padding:var(--ep-space-3);gap:var(--ep-space-4)}.ep-sidebar-footer{padding:var(--ep-space-3)}.ep-feature-item{padding:var(--ep-space-2)}.ep-feature-icon{width:32px;height:32px}.ep-pricing-amount{font-size:var(--ep-font-size-xl)}}@media (prefers-contrast:high){.ep-sidebar-paywall{border-left:2px solid var(--ep-border-secondary)}.ep-feature-item{border:2px solid var(--ep-border-secondary)}.ep-sidebar-pricing{border:2px solid var(--ep-primary-500)}.ep-sidebar-trial{border:2px solid var(--ep-success-500)}}@media (prefers-reduced-motion:reduce){.ep-sidebar-backdrop{transition:none}.ep-sidebar-paywall{transition:none}.ep-feature-item{transition:none;opacity:1;transform:none}.ep-progress-fill{transition:none}}";
|
|
3077
3715
|
|
|
3078
3716
|
/**
|
|
3079
3717
|
* The five templates from `@extenshi/paywall-templates`, inlined at build
|
|
@@ -3137,6 +3775,9 @@
|
|
|
3137
3775
|
};
|
|
3138
3776
|
/** Template blocks the contract has no data for (trials, usage meters). */
|
|
3139
3777
|
const PRUNE_SELECTOR = '[class*="-trial"], .ep-sidebar-progress';
|
|
3778
|
+
/** Glyphs that stand for the product: on a gradient tile, or next to the brand name. */
|
|
3779
|
+
const ICON_TILE_SELECTOR = '.ep-modal-icon, .ep-inline-icon, .ep-minimal-icon, .ep-hero-icon';
|
|
3780
|
+
const ICON_LOGO_SELECTOR = '.ep-fullscreen-logo, .ep-sidebar-logo';
|
|
3140
3781
|
/**
|
|
3141
3782
|
* Templates stagger their feature rows in with this class from their demo
|
|
3142
3783
|
* script (sidebar, fullscreen); without it the rows sit at opacity 0.
|
|
@@ -3144,8 +3785,11 @@
|
|
|
3144
3785
|
const FEATURE_ITEM_VISIBLE = ['.ep-feature-item', 'ep-feature-item-visible'];
|
|
3145
3786
|
/** Containers of a single feature slot; dropped when the slot's placeholder is empty. */
|
|
3146
3787
|
const FEATURE_SLOT_SELECTOR = 'li, .ep-feature-card, .ep-feature-item, .ep-pricing-feature, .ep-feature';
|
|
3788
|
+
/** Feature sections and lists (with their headings); dropped once no slot is left in them. */
|
|
3789
|
+
const FEATURE_BLOCK_SELECTOR = '[class*="-features"]';
|
|
3147
3790
|
const EMPTY_SLOT_MARK = 'data-ep-empty';
|
|
3148
|
-
|
|
3791
|
+
/** Placeholders whose element is dropped when empty: feature slots and the price card's copy. */
|
|
3792
|
+
const OPTIONAL_KEY_RE = /^(feature\d+(Title)?|premiumFeature\d+|freeFeature\d+|pricingDescription|priceDescription|premiumDescription)$/;
|
|
3149
3793
|
function escapeHtml(value) {
|
|
3150
3794
|
return value
|
|
3151
3795
|
.replace(/&/g, '&')
|
|
@@ -3157,7 +3801,7 @@
|
|
|
3157
3801
|
function substitute(html, content) {
|
|
3158
3802
|
return html.replace(/\{\{(\w+)\}\}/g, (_match, key) => {
|
|
3159
3803
|
const value = content[key] ?? '';
|
|
3160
|
-
if (value === '' &&
|
|
3804
|
+
if (value === '' && OPTIONAL_KEY_RE.test(key))
|
|
3161
3805
|
return `<i ${EMPTY_SLOT_MARK}></i>`;
|
|
3162
3806
|
return escapeHtml(value);
|
|
3163
3807
|
});
|
|
@@ -3165,6 +3809,10 @@
|
|
|
3165
3809
|
function buildContent(view, strings) {
|
|
3166
3810
|
const offer = view.offer;
|
|
3167
3811
|
const price = offer ? formatPrice(offer.amountMinor, offer.currency, view.locale) : null;
|
|
3812
|
+
// Without a `description` option the header already shows the offer's
|
|
3813
|
+
// description (ExtenshiPay.showPaywall); the price card must not repeat it.
|
|
3814
|
+
const offerDescription = offer?.description?.trim() ?? '';
|
|
3815
|
+
const priceCopy = offerDescription === view.description.trim() ? '' : offerDescription;
|
|
3168
3816
|
const content = {
|
|
3169
3817
|
title: view.title,
|
|
3170
3818
|
description: view.description,
|
|
@@ -3172,9 +3820,9 @@
|
|
|
3172
3820
|
currency: price?.currency ?? '',
|
|
3173
3821
|
price: price?.amount ?? '',
|
|
3174
3822
|
period: offer ? periodLabel(offer, strings) : '',
|
|
3175
|
-
pricingDescription:
|
|
3176
|
-
priceDescription:
|
|
3177
|
-
premiumDescription:
|
|
3823
|
+
pricingDescription: priceCopy,
|
|
3824
|
+
priceDescription: priceCopy,
|
|
3825
|
+
premiumDescription: priceCopy,
|
|
3178
3826
|
upgradeButtonText: view.checkoutEnabled && offer ? strings.upgrade : strings.checkoutUnavailable,
|
|
3179
3827
|
cancelButtonText: strings.cancel,
|
|
3180
3828
|
dismissButtonText: strings.dismiss,
|
|
@@ -3204,12 +3852,32 @@
|
|
|
3204
3852
|
return view.seller?.displayName?.trim() || view.brandName.trim() || view.title;
|
|
3205
3853
|
}
|
|
3206
3854
|
const CSS_VALUE_UNSAFE = /[;{}<>]/g;
|
|
3855
|
+
/**
|
|
3856
|
+
* The rest of the primary scale, as the share of `primaryColor` mixed with
|
|
3857
|
+
* white (tints) or black (shades). Price cards and links use these steps; left
|
|
3858
|
+
* at the defaults they stay sky blue next to a button in the author's colour.
|
|
3859
|
+
*/
|
|
3860
|
+
const PRIMARY_TINTS = [
|
|
3861
|
+
[50, 8],
|
|
3862
|
+
[100, 16],
|
|
3863
|
+
[200, 32],
|
|
3864
|
+
[300, 52],
|
|
3865
|
+
[400, 76],
|
|
3866
|
+
];
|
|
3867
|
+
const PRIMARY_SHADES = [
|
|
3868
|
+
[800, 72],
|
|
3869
|
+
[900, 52],
|
|
3870
|
+
];
|
|
3207
3871
|
function themeCss(theme) {
|
|
3208
3872
|
const declarations = [];
|
|
3209
3873
|
const safe = (value) => value.replace(CSS_VALUE_UNSAFE, '');
|
|
3210
3874
|
if (theme.primaryColor) {
|
|
3211
3875
|
const color = safe(theme.primaryColor);
|
|
3212
3876
|
declarations.push(`--ep-primary-500:${color}`, `--ep-primary-600:${color}`, `--ep-primary-700:${color}`);
|
|
3877
|
+
for (const [step, percent] of PRIMARY_TINTS)
|
|
3878
|
+
declarations.push(`--ep-primary-${step}:color-mix(in srgb,${color} ${percent}%,white)`);
|
|
3879
|
+
for (const [step, percent] of PRIMARY_SHADES)
|
|
3880
|
+
declarations.push(`--ep-primary-${step}:color-mix(in srgb,${color} ${percent}%,black)`);
|
|
3213
3881
|
}
|
|
3214
3882
|
if (theme.fontFamily)
|
|
3215
3883
|
declarations.push(`--ep-font-family-sans:${safe(theme.fontFamily)}`);
|
|
@@ -3267,6 +3935,8 @@
|
|
|
3267
3935
|
`<style>${PAYWALL_SHARED_CSS}${template.css}${themeCss(view.theme)}</style>` +
|
|
3268
3936
|
substitute(template.html, buildContent(view, strings));
|
|
3269
3937
|
this.prune(root);
|
|
3938
|
+
if (view.icon)
|
|
3939
|
+
this.placeIcon(root, doc, view.icon);
|
|
3270
3940
|
const waiver = view.offer && view.checkoutEnabled && view.withdrawalWaiver
|
|
3271
3941
|
? withdrawalWaiverText(view.withdrawalWaiver.version, view.locale, waiverSellerName(view))
|
|
3272
3942
|
: null;
|
|
@@ -3282,7 +3952,7 @@
|
|
|
3282
3952
|
if (sellerMount) {
|
|
3283
3953
|
const details = sellerDetails(view.seller ?? null, t);
|
|
3284
3954
|
details.style.cssText =
|
|
3285
|
-
'font-size:12px;line-height:1.5;margin-top:12px;text-align:
|
|
3955
|
+
'font-size:12px;line-height:1.5;margin-top:12px;text-align:start;white-space:normal;color:var(--ep-text-secondary)';
|
|
3286
3956
|
// In the modal, disclose the provider before the purchase action,
|
|
3287
3957
|
// instead of below it in the scrollable footer.
|
|
3288
3958
|
const modalActions = root.querySelector('.ep-modal-actions');
|
|
@@ -3303,18 +3973,12 @@
|
|
|
3303
3973
|
}
|
|
3304
3974
|
if (waiver && waiverBox)
|
|
3305
3975
|
this.mountWaiver(root, doc, waiver.text, waiverBox);
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
button.style.cssText =
|
|
3313
|
-
'display:block;margin:12px auto 0;background:none;border:0;color:inherit;font:inherit;text-decoration:underline;cursor:pointer';
|
|
3314
|
-
button.addEventListener('click', () => this.callbacks.onRestore?.());
|
|
3315
|
-
footer.appendChild(button);
|
|
3316
|
-
}
|
|
3317
|
-
}
|
|
3976
|
+
const onRestore = this.callbacks.onRestore;
|
|
3977
|
+
if (view.recoveryEnabled && onRestore)
|
|
3978
|
+
this.footerLink(root, doc, strings.restorePurchase, onRestore);
|
|
3979
|
+
const onFeedback = this.callbacks.onFeedback;
|
|
3980
|
+
if (view.feedback && onFeedback)
|
|
3981
|
+
this.footerLink(root, doc, view.feedback.label, onFeedback);
|
|
3318
3982
|
const mount = view.mode === 'inline' ? (view.container ?? doc.body) : doc.body;
|
|
3319
3983
|
mount.appendChild(host);
|
|
3320
3984
|
this.host = host;
|
|
@@ -3331,6 +3995,19 @@
|
|
|
3331
3995
|
this.host.remove();
|
|
3332
3996
|
this.host = null;
|
|
3333
3997
|
}
|
|
3998
|
+
/** A text button at the end of the footer (no `href`: the SDK opens URLs itself). */
|
|
3999
|
+
footerLink(root, doc, label, onClick) {
|
|
4000
|
+
const footer = root.querySelector('[class*="-footer"], .ep-minimal-actions, .ep-inline-content, .ep-fullscreen-content');
|
|
4001
|
+
if (!footer)
|
|
4002
|
+
return;
|
|
4003
|
+
const button = doc.createElement('button');
|
|
4004
|
+
button.type = 'button';
|
|
4005
|
+
button.textContent = label;
|
|
4006
|
+
button.style.cssText =
|
|
4007
|
+
'display:block;margin:12px auto 0;background:none;border:0;color:inherit;font:inherit;text-decoration:underline;cursor:pointer';
|
|
4008
|
+
button.addEventListener('click', () => onClick());
|
|
4009
|
+
footer.appendChild(button);
|
|
4010
|
+
}
|
|
3334
4011
|
prune(root) {
|
|
3335
4012
|
for (const element of root.querySelectorAll(PRUNE_SELECTOR))
|
|
3336
4013
|
element.remove();
|
|
@@ -3338,6 +4015,12 @@
|
|
|
3338
4015
|
const slot = mark.parentElement?.closest(FEATURE_SLOT_SELECTOR) ?? mark.parentElement;
|
|
3339
4016
|
(slot ?? mark).remove();
|
|
3340
4017
|
}
|
|
4018
|
+
// Every slot empty (no `features` passed): drop the section with its
|
|
4019
|
+
// heading, so no "Premium Features" title sits over nothing.
|
|
4020
|
+
for (const block of root.querySelectorAll(FEATURE_BLOCK_SELECTOR)) {
|
|
4021
|
+
if (!block.querySelector(FEATURE_SLOT_SELECTOR))
|
|
4022
|
+
block.remove();
|
|
4023
|
+
}
|
|
3341
4024
|
// A button whose label placeholder the contract does not fill (trial
|
|
3342
4025
|
// CTAs on sidebar/fullscreen) would render as an empty pill; icon-only
|
|
3343
4026
|
// buttons (close) keep their SVG and stay.
|
|
@@ -3346,6 +4029,34 @@
|
|
|
3346
4029
|
button.remove();
|
|
3347
4030
|
}
|
|
3348
4031
|
}
|
|
4032
|
+
/**
|
|
4033
|
+
* Swaps the templates' product glyphs for the extension's icon. A tile's
|
|
4034
|
+
* gradient only backs the white glyph, so it goes too; an image that fails
|
|
4035
|
+
* to load puts the glyph (and the gradient) back.
|
|
4036
|
+
*/
|
|
4037
|
+
placeIcon(root, doc, url) {
|
|
4038
|
+
for (const slot of root.querySelectorAll(`${ICON_TILE_SELECTOR}, ${ICON_LOGO_SELECTOR}`)) {
|
|
4039
|
+
const glyph = Array.from(slot.children).find((child) => child.localName === 'svg');
|
|
4040
|
+
if (!glyph)
|
|
4041
|
+
continue;
|
|
4042
|
+
const tile = slot.matches(ICON_TILE_SELECTOR);
|
|
4043
|
+
const size = Number(glyph.getAttribute('width')) || 32;
|
|
4044
|
+
const img = doc.createElement('img');
|
|
4045
|
+
img.alt = '';
|
|
4046
|
+
img.style.cssText = tile
|
|
4047
|
+
? 'width:100%;height:100%;object-fit:contain'
|
|
4048
|
+
: `width:${size}px;height:${size}px;object-fit:contain`;
|
|
4049
|
+
img.addEventListener('error', () => {
|
|
4050
|
+
img.replaceWith(glyph);
|
|
4051
|
+
if (tile)
|
|
4052
|
+
slot.style.removeProperty('background');
|
|
4053
|
+
});
|
|
4054
|
+
img.src = url;
|
|
4055
|
+
if (tile)
|
|
4056
|
+
slot.style.background = 'none';
|
|
4057
|
+
glyph.replaceWith(img);
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
3349
4060
|
/**
|
|
3350
4061
|
* Inserts the unticked waiver checkbox right before the first upgrade
|
|
3351
4062
|
* button and keeps every upgrade button disabled until it is ticked.
|
|
@@ -3503,6 +4214,28 @@
|
|
|
3503
4214
|
* `getOffer()`; if that fails the paywall still renders with checkout disabled.
|
|
3504
4215
|
*/
|
|
3505
4216
|
async showPaywall(options = {}) {
|
|
4217
|
+
return this.present(options, null);
|
|
4218
|
+
}
|
|
4219
|
+
/**
|
|
4220
|
+
* The paywall for a user whose free trial ended, e.g. on `trial:ended`. In the user's
|
|
4221
|
+
* language it says the trial has ended, the tools are paused and the settings are kept,
|
|
4222
|
+
* then shows the plans, "Restore purchase" when recovery is on, and with `feedbackFormUrl`
|
|
4223
|
+
* a feedback button. Resolves like `showPaywall()`. The default text promises the settings
|
|
4224
|
+
* are kept: pass `description` if your extension does not keep them.
|
|
4225
|
+
*/
|
|
4226
|
+
async showTrialEnded(options = {}) {
|
|
4227
|
+
const t = sdkStrings(this.config.locale);
|
|
4228
|
+
const feedbackUrl = trialFeedbackUrl(options.feedbackFormUrl);
|
|
4229
|
+
if (options.feedbackFormUrl !== undefined && !feedbackUrl)
|
|
4230
|
+
this.reportError(new ExtenshiPayError(ERROR_CODES.INVALID_REQUEST, 'feedbackFormUrl must be an https URL without credentials; the feedback button is left out'));
|
|
4231
|
+
const { feedbackFormUrl: _url, feedbackLabel, ...paywall } = options;
|
|
4232
|
+
return this.present({
|
|
4233
|
+
...paywall,
|
|
4234
|
+
title: options.title ?? t.trialEndedTitle,
|
|
4235
|
+
description: options.description ?? t.trialEndedDescription,
|
|
4236
|
+
}, feedbackUrl ? { label: feedbackLabel ?? t.trialEndedFeedback, url: feedbackUrl } : null);
|
|
4237
|
+
}
|
|
4238
|
+
async present(options, feedback) {
|
|
3506
4239
|
await this.initialize();
|
|
3507
4240
|
let offer = null;
|
|
3508
4241
|
try {
|
|
@@ -3517,8 +4250,11 @@
|
|
|
3517
4250
|
mode: options.mode ?? 'modal',
|
|
3518
4251
|
title: options.title ?? selected?.title ?? defaults.title,
|
|
3519
4252
|
description: options.description ?? selected?.description ?? defaults.description,
|
|
3520
|
-
|
|
4253
|
+
// The offer's `features` are entitlement keys ('full'), not display
|
|
4254
|
+
// text: bullets come from the caller only, or the block is dropped.
|
|
4255
|
+
features: options.features ?? [],
|
|
3521
4256
|
freeFeatures: options.freeFeatures ?? [],
|
|
4257
|
+
icon: paywallIconUrl(options.icon),
|
|
3522
4258
|
brandName: offer?.projectName ?? '',
|
|
3523
4259
|
offer: selected,
|
|
3524
4260
|
checkoutEnabled: offer?.checkoutEnabled === true && selected !== null && offer.seller !== null,
|
|
@@ -3526,6 +4262,7 @@
|
|
|
3526
4262
|
recoveryEnabled: offer?.recoveryEnabled === true,
|
|
3527
4263
|
seller: offer?.seller ?? null,
|
|
3528
4264
|
withdrawalWaiver: offer?.withdrawalWaiver ?? null,
|
|
4265
|
+
feedback: feedback ? { label: feedback.label } : null,
|
|
3529
4266
|
locale: this.config.locale,
|
|
3530
4267
|
theme: { ...this.config.theme, ...options.theme },
|
|
3531
4268
|
strings: options.strings ?? {},
|
|
@@ -3533,7 +4270,7 @@
|
|
|
3533
4270
|
};
|
|
3534
4271
|
this.hidePaywall();
|
|
3535
4272
|
return new Promise((resolve) => {
|
|
3536
|
-
this.paywallSession = { options, resolve };
|
|
4273
|
+
this.paywallSession = { options, resolve, feedbackUrl: feedback?.url ?? null };
|
|
3537
4274
|
try {
|
|
3538
4275
|
this.renderer().show(view);
|
|
3539
4276
|
}
|
|
@@ -3566,6 +4303,7 @@
|
|
|
3566
4303
|
onUpgrade: (sku, consent) => void this.handleUpgrade(sku, consent),
|
|
3567
4304
|
onClose: () => this.settlePaywall(false),
|
|
3568
4305
|
onRestore: () => void this.handleRestore(),
|
|
4306
|
+
onFeedback: () => void this.handleFeedback(),
|
|
3569
4307
|
});
|
|
3570
4308
|
}
|
|
3571
4309
|
return this.paywall;
|
|
@@ -3582,6 +4320,17 @@
|
|
|
3582
4320
|
/* Reported through the error event; leave the paywall open for retry. */
|
|
3583
4321
|
}
|
|
3584
4322
|
}
|
|
4323
|
+
async handleFeedback() {
|
|
4324
|
+
const url = this.paywallSession?.feedbackUrl;
|
|
4325
|
+
if (!url)
|
|
4326
|
+
return;
|
|
4327
|
+
try {
|
|
4328
|
+
await (this.openUrl ?? openInNewTab)(url);
|
|
4329
|
+
}
|
|
4330
|
+
catch (error) {
|
|
4331
|
+
this.reportError(error);
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
3585
4334
|
async handleUpgrade(sku, consent) {
|
|
3586
4335
|
if (consent)
|
|
3587
4336
|
this.paywallSession?.options.onUpgrade?.(sku, consent);
|
|
@@ -3614,9 +4363,11 @@
|
|
|
3614
4363
|
exports.CHECKOUT_POLL_INTERVAL_MS = CHECKOUT_POLL_INTERVAL_MS;
|
|
3615
4364
|
exports.CHECKOUT_TIMEOUT_MS = CHECKOUT_TIMEOUT_MS;
|
|
3616
4365
|
exports.CheckoutManager = CheckoutManager;
|
|
4366
|
+
exports.CloudBackup = CloudBackup;
|
|
3617
4367
|
exports.DEFAULT_API_URL = DEFAULT_API_URL;
|
|
3618
4368
|
exports.DEFAULT_CACHE_TTL_MS = DEFAULT_CACHE_TTL_MS;
|
|
3619
4369
|
exports.DEFAULT_STRINGS = DEFAULT_STRINGS;
|
|
4370
|
+
exports.DEFAULT_TRIAL_ENDING_DAYS = DEFAULT_TRIAL_ENDING_DAYS;
|
|
3620
4371
|
exports.EMPTY_ENTITLEMENT = EMPTY_ENTITLEMENT;
|
|
3621
4372
|
exports.END_USER_REF_STORAGE_KEY = END_USER_REF_STORAGE_KEY;
|
|
3622
4373
|
exports.ERROR_CODES = ERROR_CODES;
|
|
@@ -3649,11 +4400,13 @@
|
|
|
3649
4400
|
exports.PAY_OFFER_KINDS = PAY_OFFER_KINDS;
|
|
3650
4401
|
exports.PAY_PUBLISHABLE_KEY_HEX_LENGTH = PAY_PUBLISHABLE_KEY_HEX_LENGTH;
|
|
3651
4402
|
exports.PAY_PUBLISHABLE_KEY_PREFIX = PAY_PUBLISHABLE_KEY_PREFIX;
|
|
4403
|
+
exports.PAY_RESTORE_PURPOSES = PAY_RESTORE_PURPOSES;
|
|
3652
4404
|
exports.PAY_SKU_RE = PAY_SKU_RE;
|
|
3653
4405
|
exports.PAY_WITHDRAWAL_WAIVER_VERSION = PAY_WITHDRAWAL_WAIVER_VERSION;
|
|
3654
4406
|
exports.PayApi = PayApi;
|
|
3655
4407
|
exports.PaywallRenderer = PaywallRenderer;
|
|
3656
4408
|
exports.RecoveryManager = RecoveryManager;
|
|
4409
|
+
exports.STORAGE_TOKEN_RE = STORAGE_TOKEN_RE;
|
|
3657
4410
|
exports.TRPC_PATH = TRPC_PATH;
|
|
3658
4411
|
exports.VERSION = VERSION;
|
|
3659
4412
|
exports.WITHDRAWAL_WAIVER_CLASS = WITHDRAWAL_WAIVER_CLASS;
|
|
@@ -3666,6 +4419,7 @@
|
|
|
3666
4419
|
exports.collectFeatures = collectFeatures;
|
|
3667
4420
|
exports.createRecoveryStorage = createRecoveryStorage;
|
|
3668
4421
|
exports.createStorage = createStorage;
|
|
4422
|
+
exports.createSyncStorage = createSyncStorage;
|
|
3669
4423
|
exports.default = ExtenshiPay;
|
|
3670
4424
|
exports.escapeHtml = escapeHtml;
|
|
3671
4425
|
exports.formatPrice = formatPrice;
|