@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.
Files changed (76) hide show
  1. package/README.md +134 -19
  2. package/dist/api/mock.d.ts +4 -0
  3. package/dist/api/mock.d.ts.map +1 -1
  4. package/dist/api/pay-api.d.ts +9 -4
  5. package/dist/api/pay-api.d.ts.map +1 -1
  6. package/dist/core/config.d.ts.map +1 -1
  7. package/dist/core/extenshi-pay.d.ts +60 -5
  8. package/dist/core/extenshi-pay.d.ts.map +1 -1
  9. package/dist/core/index.d.ts +3 -1
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/storage.d.ts +6 -0
  12. package/dist/core/storage.d.ts.map +1 -1
  13. package/dist/core.d.mts +280 -27
  14. package/dist/core.d.ts +280 -27
  15. package/dist/core.js +566 -44
  16. package/dist/core.js.map +1 -1
  17. package/dist/core.mjs +562 -45
  18. package/dist/core.mjs.map +1 -1
  19. package/dist/extenshi-pay-lite.js +555 -44
  20. package/dist/extenshi-pay-lite.js.map +1 -1
  21. package/dist/extenshi-pay-lite.min.js +3 -3
  22. package/dist/extenshi-pay-lite.min.js.map +1 -1
  23. package/dist/extenshi-pay-lite.mjs +555 -44
  24. package/dist/extenshi-pay-lite.mjs.map +1 -1
  25. package/dist/extenshi-pay.cjs.js +823 -69
  26. package/dist/extenshi-pay.cjs.js.map +1 -1
  27. package/dist/extenshi-pay.d.ts +11 -1
  28. package/dist/extenshi-pay.d.ts.map +1 -1
  29. package/dist/extenshi-pay.js +823 -69
  30. package/dist/extenshi-pay.js.map +1 -1
  31. package/dist/extenshi-pay.min.js +3 -3
  32. package/dist/extenshi-pay.min.js.map +1 -1
  33. package/dist/extenshi-pay.min.mjs +3 -3
  34. package/dist/extenshi-pay.min.mjs.map +1 -1
  35. package/dist/extenshi-pay.mjs +819 -70
  36. package/dist/extenshi-pay.mjs.map +1 -1
  37. package/dist/index.d.mts +305 -27
  38. package/dist/index.d.ts +305 -27
  39. package/dist/lite.d.mts +224 -14
  40. package/dist/lite.d.ts +224 -14
  41. package/dist/lite.d.ts.map +1 -1
  42. package/dist/payment/cloud-backup.d.ts +35 -0
  43. package/dist/payment/cloud-backup.d.ts.map +1 -0
  44. package/dist/payment/entitlement.d.ts +21 -5
  45. package/dist/payment/entitlement.d.ts.map +1 -1
  46. package/dist/payment/recovery.d.ts +4 -2
  47. package/dist/payment/recovery.d.ts.map +1 -1
  48. package/dist/payment/signature.d.ts +29 -3
  49. package/dist/payment/signature.d.ts.map +1 -1
  50. package/dist/payment/trial.d.ts +55 -0
  51. package/dist/payment/trial.d.ts.map +1 -0
  52. package/dist/paywall/i18n.d.ts +3 -0
  53. package/dist/paywall/i18n.d.ts.map +1 -1
  54. package/dist/paywall/icon.d.ts +18 -0
  55. package/dist/paywall/icon.d.ts.map +1 -0
  56. package/dist/paywall/renderer.d.ts +15 -0
  57. package/dist/paywall/renderer.d.ts.map +1 -1
  58. package/dist/paywall.d.mts +27 -1
  59. package/dist/paywall.d.ts +27 -1
  60. package/dist/paywall.js +131 -25
  61. package/dist/paywall.js.map +1 -1
  62. package/dist/paywall.mjs +131 -25
  63. package/dist/paywall.mjs.map +1 -1
  64. package/dist/types/config.d.ts +27 -1
  65. package/dist/types/config.d.ts.map +1 -1
  66. package/dist/types/contract.d.ts +35 -0
  67. package/dist/types/contract.d.ts.map +1 -1
  68. package/dist/types/entitlement.d.ts +37 -1
  69. package/dist/types/entitlement.d.ts.map +1 -1
  70. package/dist/types/events.d.ts +5 -1
  71. package/dist/types/events.d.ts.map +1 -1
  72. package/dist/types/paywall.d.ts +22 -1
  73. package/dist/types/paywall.d.ts.map +1 -1
  74. package/dist/version.d.ts +1 -1
  75. package/dist/version.d.ts.map +1 -1
  76. package/package.json +3 -2
@@ -1,12 +1,38 @@
1
1
  /**
2
2
  * Ed25519 verification of the entitlement projection.
3
3
  *
4
- * Tamper resistance, not DRM. Trust comes from the developer's bundled key or
5
- * a key fetched over HTTPS, never from editable extension storage. Callers must
6
- * deny access for both invalid and unverified envelopes outside explicit mocks.
4
+ * Tamper resistance, not DRM. Callers must deny access for both invalid and
5
+ * unverified envelopes outside explicit mocks.
6
+ *
7
+ * Which keys are trusted, in order (`PublicKeySource`, built in core/extenshi-pay.ts):
8
+ * 1. the key the server returned over HTTPS in this session;
9
+ * 2. the bundled `entitlementPublicKey`, when the developer configured one. It pins
10
+ * verification without a round-trip: a key read from extension storage is then never used;
11
+ * 3. without a bundled key, the server key saved in `storage.local` next to the
12
+ * license cache, so a restart with no network can still verify the cache.
13
+ * When none of them verifies an envelope the server is asked for its current key once
14
+ * (a rotated key), and that answer decides.
7
15
  */
8
16
  import { type SignedEntitlement } from '../types/contract.js';
9
17
  export type SignatureVerdict = 'valid' | 'invalid' | 'unverified';
10
18
  export declare function base64ToBytes(base64: string): Uint8Array<ArrayBuffer>;
11
19
  export declare function verifyEntitlementSignature(envelope: SignedEntitlement, publicKeyBase64: string | null): Promise<SignatureVerdict>;
20
+ export declare const PUBLIC_KEY_RE: RegExp;
21
+ export interface PublicKeySource {
22
+ /** Keys trusted without a round-trip, in the order above. */
23
+ known(): Promise<string[]>;
24
+ /** The server's current key, fetched now; null when the server signs nothing. Rejects when unreachable. */
25
+ fetchCurrent(): Promise<string | null>;
26
+ }
27
+ export interface KeyedVerdict {
28
+ verdict: SignatureVerdict;
29
+ /** The key that verified the envelope; null unless `verdict` is `valid`. */
30
+ key: string | null;
31
+ }
32
+ /**
33
+ * `invalid` only when the server's current key was checked too (or the envelope carries no
34
+ * signature at all). A mismatch against known keys while the server is unreachable is
35
+ * `unverified`: it may be a rotated key, and no paid access is granted either way.
36
+ */
37
+ export declare function verifyWithKeys(envelope: SignedEntitlement, source: PublicKeySource): Promise<KeyedVerdict>;
12
38
  //# sourceMappingURL=signature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/payment/signature.ts"],"names":[],"mappings":"AAAA;;;;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AAC,YAAY,CAAC,CAyBvB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The free trial an application configures on the server (`trialDays`).
3
+ *
4
+ * The server starts one clock per installation at its first license read and
5
+ * signs `{ startedAt, endsAt }` into the entitlement, so the trial comes from
6
+ * the verified license like paid access does: no start date in extension
7
+ * storage, nothing a device clock or a storage edit can move. Offline, the
8
+ * cached license answers for up to 48 hours.
9
+ *
10
+ * `trial:ending` / `trial:ended` fire once per installation and trial (the
11
+ * marker is kept in the SDK's storage), and not while the user has paid
12
+ * access. Render state from `getTrial()`; the events are one-time notices.
13
+ */
14
+ import type { StorageAdapter } from '../core/storage.js';
15
+ import type { PayTrial } from '../types/contract.js';
16
+ import type { TrialState } from '../types/entitlement.js';
17
+ export declare const DAY_MS: number;
18
+ export interface TrialClock {
19
+ /** Device time. */
20
+ now: number;
21
+ /** The signed issue time of the license; a floor for `now`. */
22
+ issuedAt: number;
23
+ /** Whether the license was checked recently enough to grant access (48 h, as for paid access). */
24
+ checked: boolean;
25
+ }
26
+ /** The trial as of `clock`, or null when the license carries none (or a malformed one). */
27
+ export declare function trialState(trial: PayTrial | undefined, clock: TrialClock): TrialState | null;
28
+ /** The feedback form address with `src=trial_end`; null unless it is a plain HTTPS URL. No installation id is added. */
29
+ export declare function trialFeedbackUrl(raw: string | undefined): string | null;
30
+ export type TrialEvent = 'trial:ending' | 'trial:ended';
31
+ export interface TrialNotifierOptions {
32
+ storage: StorageAdapter;
33
+ storageKey: string;
34
+ /** `trial:ending` fires this many days before the end; 0 never. */
35
+ endingDays: number;
36
+ getTrial: () => TrialState | null;
37
+ hasPaidAccess: () => boolean;
38
+ emit: (event: TrialEvent, trial: TrialState) => void;
39
+ now: () => number;
40
+ }
41
+ export declare class TrialNotifier {
42
+ private readonly options;
43
+ private timer;
44
+ private running;
45
+ private pending;
46
+ constructor(options: TrialNotifierOptions);
47
+ start(): void;
48
+ stop(): void;
49
+ /** Checks the held license; serialized, so two refreshes never send one event twice. */
50
+ evaluate(): Promise<void>;
51
+ private check;
52
+ private send;
53
+ private clearTimer;
54
+ }
55
+ //# sourceMappingURL=trial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trial.d.ts","sourceRoot":"","sources":["../../src/payment/trial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAGzD,eAAO,MAAM,MAAM,QAAsB,CAAA;AAIzC,MAAM,WAAW,UAAU;IAC1B,mBAAmB;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAA;IAChB,kGAAkG;IAClG,OAAO,EAAE,OAAO,CAAA;CAChB;AAED,2FAA2F;AAC3F,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAe5F;AAED,wHAAwH;AACxH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAWvE;AAED,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,aAAa,CAAA;AAEvD,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,UAAU,GAAG,IAAI,CAAA;IACjC,aAAa,EAAE,MAAM,OAAO,CAAA;IAC5B,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACpD,GAAG,EAAE,MAAM,MAAM,CAAA;CACjB;AAQD,qBAAa,aAAa;IAKb,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAAmC;gBAErB,OAAO,EAAE,oBAAoB;IAE1D,KAAK,IAAI,IAAI;IAKb,IAAI,IAAI,IAAI;IAKZ,wFAAwF;IACxF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAKX,KAAK;YA0BL,IAAI;IAUlB,OAAO,CAAC,UAAU;CAIlB"}
@@ -79,6 +79,9 @@ export declare const SDK_STRINGS_EN: {
79
79
  pickerDescription: string;
80
80
  pickerFirstRecorded: string;
81
81
  pickerCancel: string;
82
+ trialEndedTitle: string;
83
+ trialEndedDescription: string;
84
+ trialEndedFeedback: string;
82
85
  };
83
86
  export type SdkStringKey = keyof typeof SDK_STRINGS_EN;
84
87
  export type SdkStrings = Record<SdkStringKey, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/paywall/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAI7D,eAAO,MAAM,WAAW,mFAAoF,CAAA;AAC5G,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE1B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,cAAc,CAAA;AACtD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAssBrD,kHAAkH;AAClH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAUtE;AAED,wBAAgB,MAAM,CAA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AAG,SAAS,GAAG,UAAU,CAGxE;AAED,mFAAmF;AACnF,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAE5E;AAED,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,UAAU,GAAG,SAAS,CAExF"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The paywall's header image: the extension's own icon in place of the
3
+ * templates' generic glyph (lock, layers).
4
+ *
5
+ * Only images from the extension package or `data:image/` URLs: a remote
6
+ * image would be a request to a third party on every paywall view. The
7
+ * manifest icon is the default on the extension's own pages (popup, options)
8
+ * only. A content script runs on the site's origin, where the package's files
9
+ * load only when `web_accessible_resources` lists them, and the SDK never asks
10
+ * for that.
11
+ */
12
+ /**
13
+ * The header image for `PaywallOptions.icon`, or null to keep the template's
14
+ * glyph: `false` opts out, a `data:image/` URL is used anywhere, a package path
15
+ * (or the manifest's largest icon by default) only on the extension's pages.
16
+ */
17
+ export declare function paywallIconUrl(option?: string | false): string | null;
18
+ //# sourceMappingURL=icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/paywall/icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA8CH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAerE"}
@@ -17,6 +17,8 @@ export interface PaywallView {
17
17
  description: string;
18
18
  features: string[];
19
19
  freeFeatures: string[];
20
+ /** Header image URL (./icon.ts) in place of the template's glyph; absent or null keeps the glyph. */
21
+ icon?: string | null;
20
22
  brandName: string;
21
23
  offer: PayOfferDto | null;
22
24
  checkoutEnabled: boolean;
@@ -29,6 +31,10 @@ export interface PaywallView {
29
31
  * The waiver text is not overridable through `strings`: it is versioned.
30
32
  */
31
33
  withdrawalWaiver?: PayWithdrawalWaiver | null;
34
+ /** A link-styled button under the plans (trial-ended screen); clicking it calls `onFeedback`. */
35
+ feedback?: {
36
+ label: string;
37
+ } | null;
32
38
  locale: string | null;
33
39
  theme: ThemeConfig;
34
40
  strings: Partial<PaywallStrings>;
@@ -39,6 +45,7 @@ export interface PaywallRendererCallbacks {
39
45
  onUpgrade: (sku: string, consent?: UpgradeConsent) => void;
40
46
  onClose: () => void;
41
47
  onRestore?: () => void;
48
+ onFeedback?: () => void;
42
49
  }
43
50
  export declare const PAYWALL_HOST_CLASS = "extenshi-paywall-host";
44
51
  export declare const WITHDRAWAL_WAIVER_CLASS = "extenshi-withdrawal-waiver";
@@ -56,7 +63,15 @@ export declare class PaywallRenderer {
56
63
  /** Returns the host element; its shadow root holds the rendered template. */
57
64
  show(view: PaywallView): HTMLElement;
58
65
  hide(): void;
66
+ /** A text button at the end of the footer (no `href`: the SDK opens URLs itself). */
67
+ private footerLink;
59
68
  private prune;
69
+ /**
70
+ * Swaps the templates' product glyphs for the extension's icon. A tile's
71
+ * gradient only backs the white glyph, so it goes too; an image that fails
72
+ * to load puts the glyph (and the gradient) back.
73
+ */
74
+ private placeIcon;
60
75
  /**
61
76
  * Inserts the unticked waiver checkbox right before the first upgrade
62
77
  * button and keeps every upgrade button disabled until it is ticked.
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/paywall/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAOtE,MAAM,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AAG,OAAO,GAAG,MAAM,CAQrE;AAED,qBAAa,eAAe;IAIf,OAAO,CAAC,QAAQ,CAAC,SAAS;IAHtC,OAAO,CAAC,IAAI,CAA2B;IACvC,OAAO,CAAC,UAAU,CAAgD;gBAErC,SAAS,EAAE,wBAAwB;IAEhE,SAAS,IAAI,OAAO;IAIpB,6EAA6E;IAC7E,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW;IAgFpC,IAAI,IAAI,IAAI;IAUZ,qFAAqF;IACrF,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,KAAK;IAmBb;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAqBjB;;;OAGG;IACH,OAAO,CAAC,WAAW;IA8BnB,OAAO,CAAC,IAAI;IA+CZ,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,KAAK;CAIb"}
@@ -116,10 +116,21 @@ interface PaywallOptions {
116
116
  sku?: string;
117
117
  title?: string;
118
118
  description?: string;
119
- /** Overrides the offer's `features[]`. */
119
+ /**
120
+ * Bullet points, in the user's language (`chrome.i18n.getMessage`). The
121
+ * offer's `features[]` are entitlement keys and are never shown: without
122
+ * this option the paywall has no feature list.
123
+ */
120
124
  features?: string[];
121
125
  /** Free-tier bullets for the comparison templates (`inline`, `fullscreen`). */
122
126
  freeFeatures?: string[];
127
+ /**
128
+ * Header image in place of the template's glyph: a path inside the
129
+ * extension (`icons/icon128.png`) or a `data:image/` URL. Defaults to the
130
+ * largest `manifest.icons` entry on the extension's own pages (popup,
131
+ * options); `false` keeps the glyph. Remote URLs are ignored.
132
+ */
133
+ icon?: string | false;
123
134
  theme?: ThemeConfig;
124
135
  /** Mount point for `inline` mode (default `document.body`). */
125
136
  container?: HTMLElement;
@@ -169,6 +180,8 @@ interface PaywallView {
169
180
  description: string;
170
181
  features: string[];
171
182
  freeFeatures: string[];
183
+ /** Header image URL (./icon.ts) in place of the template's glyph; absent or null keeps the glyph. */
184
+ icon?: string | null;
172
185
  brandName: string;
173
186
  offer: PayOfferDto | null;
174
187
  checkoutEnabled: boolean;
@@ -181,6 +194,10 @@ interface PaywallView {
181
194
  * The waiver text is not overridable through `strings`: it is versioned.
182
195
  */
183
196
  withdrawalWaiver?: PayWithdrawalWaiver | null;
197
+ /** A link-styled button under the plans (trial-ended screen); clicking it calls `onFeedback`. */
198
+ feedback?: {
199
+ label: string;
200
+ } | null;
184
201
  locale: string | null;
185
202
  theme: ThemeConfig;
186
203
  strings: Partial<PaywallStrings>;
@@ -191,6 +208,7 @@ interface PaywallRendererCallbacks {
191
208
  onUpgrade: (sku: string, consent?: UpgradeConsent) => void;
192
209
  onClose: () => void;
193
210
  onRestore?: () => void;
211
+ onFeedback?: () => void;
194
212
  }
195
213
  declare const PAYWALL_HOST_CLASS = "extenshi-paywall-host";
196
214
  declare const WITHDRAWAL_WAIVER_CLASS = "extenshi-withdrawal-waiver";
@@ -208,7 +226,15 @@ declare class PaywallRenderer {
208
226
  /** Returns the host element; its shadow root holds the rendered template. */
209
227
  show(view: PaywallView): HTMLElement;
210
228
  hide(): void;
229
+ /** A text button at the end of the footer (no `href`: the SDK opens URLs itself). */
230
+ private footerLink;
211
231
  private prune;
232
+ /**
233
+ * Swaps the templates' product glyphs for the extension's icon. A tile's
234
+ * gradient only backs the white glyph, so it goes too; an image that fails
235
+ * to load puts the glyph (and the gradient) back.
236
+ */
237
+ private placeIcon;
212
238
  /**
213
239
  * Inserts the unticked waiver checkbox right before the first upgrade
214
240
  * button and keeps every upgrade button disabled until it is ticked.
package/dist/paywall.d.ts CHANGED
@@ -116,10 +116,21 @@ interface PaywallOptions {
116
116
  sku?: string;
117
117
  title?: string;
118
118
  description?: string;
119
- /** Overrides the offer's `features[]`. */
119
+ /**
120
+ * Bullet points, in the user's language (`chrome.i18n.getMessage`). The
121
+ * offer's `features[]` are entitlement keys and are never shown: without
122
+ * this option the paywall has no feature list.
123
+ */
120
124
  features?: string[];
121
125
  /** Free-tier bullets for the comparison templates (`inline`, `fullscreen`). */
122
126
  freeFeatures?: string[];
127
+ /**
128
+ * Header image in place of the template's glyph: a path inside the
129
+ * extension (`icons/icon128.png`) or a `data:image/` URL. Defaults to the
130
+ * largest `manifest.icons` entry on the extension's own pages (popup,
131
+ * options); `false` keeps the glyph. Remote URLs are ignored.
132
+ */
133
+ icon?: string | false;
123
134
  theme?: ThemeConfig;
124
135
  /** Mount point for `inline` mode (default `document.body`). */
125
136
  container?: HTMLElement;
@@ -169,6 +180,8 @@ interface PaywallView {
169
180
  description: string;
170
181
  features: string[];
171
182
  freeFeatures: string[];
183
+ /** Header image URL (./icon.ts) in place of the template's glyph; absent or null keeps the glyph. */
184
+ icon?: string | null;
172
185
  brandName: string;
173
186
  offer: PayOfferDto | null;
174
187
  checkoutEnabled: boolean;
@@ -181,6 +194,10 @@ interface PaywallView {
181
194
  * The waiver text is not overridable through `strings`: it is versioned.
182
195
  */
183
196
  withdrawalWaiver?: PayWithdrawalWaiver | null;
197
+ /** A link-styled button under the plans (trial-ended screen); clicking it calls `onFeedback`. */
198
+ feedback?: {
199
+ label: string;
200
+ } | null;
184
201
  locale: string | null;
185
202
  theme: ThemeConfig;
186
203
  strings: Partial<PaywallStrings>;
@@ -191,6 +208,7 @@ interface PaywallRendererCallbacks {
191
208
  onUpgrade: (sku: string, consent?: UpgradeConsent) => void;
192
209
  onClose: () => void;
193
210
  onRestore?: () => void;
211
+ onFeedback?: () => void;
194
212
  }
195
213
  declare const PAYWALL_HOST_CLASS = "extenshi-paywall-host";
196
214
  declare const WITHDRAWAL_WAIVER_CLASS = "extenshi-withdrawal-waiver";
@@ -208,7 +226,15 @@ declare class PaywallRenderer {
208
226
  /** Returns the host element; its shadow root holds the rendered template. */
209
227
  show(view: PaywallView): HTMLElement;
210
228
  hide(): void;
229
+ /** A text button at the end of the footer (no `href`: the SDK opens URLs itself). */
230
+ private footerLink;
211
231
  private prune;
232
+ /**
233
+ * Swaps the templates' product glyphs for the extension's icon. A tile's
234
+ * gradient only backs the white glyph, so it goes too; an image that fails
235
+ * to load puts the glyph (and the gradient) back.
236
+ */
237
+ private placeIcon;
212
238
  /**
213
239
  * Inserts the unticked waiver checkbox right before the first upgrade
214
240
  * button and keeps every upgrade button disabled until it is ticked.