palbase 0.65.0 → 0.68.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 +3 -2
- package/dist/ai/index.js +2 -2
- package/dist/ai-sdk/index.js +4 -0
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +8 -8
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{YP3QTS4L.js → 22GRHCVI.js} +1 -1
- package/dist/chunks/{CZGZTOK7.js → 2ZHSNWVZ.js} +2 -2
- package/dist/chunks/3OP3YJ63.js +22 -0
- package/dist/chunks/{5HMDOBEH.js → 4YV35XDP.js} +2 -2
- package/dist/chunks/5ZXXBM6L.js +18 -0
- package/dist/chunks/{KZZ3Y3DC.js → 622BI7EV.js} +1 -1
- package/dist/chunks/65QZXK2S.js +2 -0
- package/dist/chunks/{ZF3WKPVM.js → 7SGTDHXJ.js} +2 -2
- package/dist/chunks/D6EUPFUR.js +2 -0
- package/dist/chunks/EGWQ3EJE.js +21 -0
- package/dist/chunks/{ARRJICH3.js → EJAGO6ZV.js} +2 -2
- package/dist/chunks/{6GRY63N6.js → F4B6ELAN.js} +2 -2
- package/dist/chunks/IZWB7FGX.js +6 -0
- package/dist/chunks/{G2JBUBZO.js → J7WJF7F4.js} +2 -2
- package/dist/chunks/{DFX37NU3.js → LUUXXMXH.js} +1 -1
- package/dist/chunks/MVY4K43S.js +13 -0
- package/dist/chunks/{JHM7GTPD.js → OWLXCD3D.js} +1 -1
- package/dist/chunks/PP7MW4OT.js +2 -0
- package/dist/chunks/{DLMWZYLL.js → QFZ4GCJH.js} +2 -2
- package/dist/chunks/QQUIM4VK.js +2 -0
- package/dist/chunks/UJLFALKX.js +2 -0
- package/dist/chunks/{TEF7WS37.js → XJLAH42O.js} +1 -1
- package/dist/chunks/{XSOQNHZ5.js → XU4G5W72.js} +1 -1
- package/dist/chunks/YCDAV3WO.js +2 -0
- package/dist/cli.js +351 -364
- package/dist/cloud/index.js +2 -2
- package/dist/refuse/ai-sdk.js +2 -0
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/cloud.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/message.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/payments-ui.js +264 -0
- package/dist/web/paywall.js +2 -2
- package/dist/web/push-sw.js +1 -1
- package/dist/web/ssr.js +2 -2
- package/dist/web/vite.js +4 -3
- package/package.json +19 -2
- package/types/ai/src/ai.d.ts +55 -29
- package/types/ai/src/chats.d.ts +163 -171
- package/types/ai/src/index.d.ts +5 -5
- package/types/ai/src/pools.d.ts +17 -7
- package/types/ai/src/tools.d.ts +6 -64
- package/types/ai-sdk/src/index.d.ts +166 -0
- package/types/backend/src/decorators.d.ts +3 -9
- package/types/backend/src/idempotency.d.ts +18 -0
- package/types/backend/src/index.d.ts +1 -1
- package/types/backend/src/services.d.ts +2 -2
- package/types/backend/src/stack.d.ts +2 -4
- package/types/backend/src/strings-files.d.ts +5 -6
- package/types/backend/src/upload.d.ts +2 -1
- package/types/cloud/src/generated/project.d.ts +3 -2
- package/types/cloud/src/generated/studio.d.ts +3 -3
- package/types/internal/src/chat.d.ts +56 -2
- package/types/internal/src/event.d.ts +1 -1
- package/types/internal/src/modules/ai.d.ts +939 -1133
- package/types/internal/src/modules/analytics.d.ts +1 -1
- package/types/internal/src/modules/events.d.ts +5 -4
- package/types/internal/src/modules/{purchases.d.ts → iap.d.ts} +2183 -2438
- package/types/internal/src/modules/index.d.ts +2 -1
- package/types/internal/src/modules/journeys.d.ts +1 -1
- package/types/internal/src/modules/notify.d.ts +3 -3
- package/types/internal/src/modules/payments.d.ts +3286 -0
- package/types/internal/src/modules/stores.d.ts +7 -7
- package/types/internal/src/modules/workspaces.d.ts +22 -0
- package/types/server/src/{purchases.d.ts → iap.d.ts} +7 -7
- package/types/server/src/index.d.ts +2 -1
- package/types/server/src/payments.d.ts +65 -0
- package/types/server/src/server.d.ts +4 -1
- package/types/web/src/chat.d.ts +30 -4
- package/types/web/src/client.d.ts +13 -10
- package/types/web/src/{purchases.d.ts → iap.d.ts} +46 -56
- package/types/web/src/inapp.d.ts +5 -5
- package/types/web/src/index.d.ts +4 -2
- package/types/web/src/messaging.d.ts +1 -0
- package/types/web/src/notify.d.ts +2 -2
- package/types/web/src/payments-ui/index.d.ts +7 -0
- package/types/web/src/payments-ui/payment-sheet.d.ts +13 -0
- package/types/web/src/payments-ui/qr.d.ts +9 -0
- package/types/web/src/payments-ui/saved-cards-view.d.ts +7 -0
- package/types/web/src/payments-ui/spend-qr-view.d.ts +8 -0
- package/types/web/src/payments-ui/theme.d.ts +16 -0
- package/types/web/src/payments-ui/types.d.ts +149 -0
- package/types/web/src/payments-ui/wallet-topup-sheet.d.ts +7 -0
- package/types/web/src/payments.d.ts +281 -0
- package/types/web/src/paywall/placement.d.ts +6 -8
- package/types/web/src/screen/assets.d.ts +1 -1
- package/types/web/src/screen/resolve.d.ts +3 -3
- package/types/web/src/vite.d.ts +8 -0
- package/dist/chunks/2HJQSGOO.js +0 -13
- package/dist/chunks/3TXOVBZP.js +0 -22
- package/dist/chunks/4NHRUBEF.js +0 -2
- package/dist/chunks/63TUW6P7.js +0 -18
- package/dist/chunks/BYXX373R.js +0 -21
- package/dist/chunks/CTWUVLVE.js +0 -2
- package/dist/chunks/GFG7WVN2.js +0 -2
- package/dist/chunks/KU6B2OXP.js +0 -2
- package/dist/chunks/X6JMSZBD.js +0 -6
- package/dist/chunks/ZZRRJOEP.js +0 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type IntentView, type Payments } from '../payments.js';
|
|
2
|
+
import type { PaymentSheetOptions, PaymentViewHandle } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Mounts an accessible, PCI-DSS SAQ-A PaymentSheet inside `container`.
|
|
5
|
+
* Supports saved cards, installment selection, Masterpass OTP verification,
|
|
6
|
+
* sandboxed provider 3DS/checkout embeds, and zero-polling live settlement.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mountPaymentSheet(container: HTMLElement, payments: Payments, options: PaymentSheetOptions): PaymentViewHandle;
|
|
9
|
+
/**
|
|
10
|
+
* Opens PaymentSheet in an accessible modal overlay on `document.body` and
|
|
11
|
+
* resolves with the settled IntentView, or `null` if canceled by the customer.
|
|
12
|
+
*/
|
|
13
|
+
export declare function openPaymentSheet(payments: Payments, options: Omit<PaymentSheetOptions, 'onSuccess' | 'onFailure' | 'onCancel'>): Promise<IntentView | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Encodes a string into a boolean QR matrix (true = dark module). */
|
|
2
|
+
export declare function encodeQrMatrix(text: string): boolean[][];
|
|
3
|
+
/** Renders an ISO 18004 scannable SVG QR code string for a spend token or short string. */
|
|
4
|
+
export declare function renderQrSvg(text: string, opts?: {
|
|
5
|
+
size?: number;
|
|
6
|
+
margin?: number;
|
|
7
|
+
fg?: string;
|
|
8
|
+
bg?: string;
|
|
9
|
+
}): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Payments } from '../payments.js';
|
|
2
|
+
import type { PaymentViewHandle, SavedCardsViewOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Mounts a PCI-DSS SAQ-A SavedCardsView listing the signed-in customer's
|
|
5
|
+
* tokenized payment methods with remove and add-card actions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mountSavedCardsView(container: HTMLElement, payments: Payments, options?: SavedCardsViewOptions): PaymentViewHandle;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Payments } from '../payments.js';
|
|
2
|
+
import type { PaymentViewHandle, SpendQRViewOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Mounts a SpendQRView that mints a short-lived, single-use wallet spend token
|
|
5
|
+
* (`pst_...`), renders a scannable ISO 18004 SVG QR code with a live countdown
|
|
6
|
+
* bar, automatically renews before expiry, and reflects live wallet balance changes.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mountSpendQRView(container: HTMLElement, payments: Payments, options: SpendQRViewOptions): PaymentViewHandle;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PaymentsAppearance } from './types.js';
|
|
2
|
+
export declare function resolveThemeMode(theme: PaymentsAppearance['theme']): 'light' | 'dark';
|
|
3
|
+
export declare function resolveLocale(appearance?: PaymentsAppearance): string;
|
|
4
|
+
/** Number of fractional minor-unit digits for an ISO 4217 currency (e.g. 2 for USD/TRY, 0 for JPY). */
|
|
5
|
+
export declare function currencyMinorDigits(currency: string): number;
|
|
6
|
+
/** Formats an amount in minor units into a localized currency string. */
|
|
7
|
+
export declare function formatMinorAmount(amount: number, currency: string, locale?: string): string;
|
|
8
|
+
export declare function formatBrand(brand: string | undefined): string;
|
|
9
|
+
export declare function applyAppearanceVars(el: HTMLElement, appearance?: PaymentsAppearance): void;
|
|
10
|
+
export declare const SHARED_STYLES = "\n:host {\n display: block;\n font-family: var(--pb-font);\n color: var(--pb-text);\n box-sizing: border-box;\n}\n*, *::before, *::after { box-sizing: border-box; }\n.pb-card {\n background: var(--pb-surface);\n color: var(--pb-text);\n border: 1px solid var(--pb-border);\n border-radius: var(--pb-radius);\n padding: 20px;\n font-family: var(--pb-font);\n line-height: 1.4;\n}\n.pb-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 12px;\n margin-bottom: 16px;\n}\n.pb-title {\n font-size: 16px;\n font-weight: 600;\n margin: 0;\n}\n.pb-amount {\n font-size: 20px;\n font-weight: 700;\n font-variant-numeric: tabular-nums;\n}\n.pb-sub {\n font-size: 13px;\n color: var(--pb-muted);\n margin: 0 0 12px;\n}\n.pb-split {\n background: var(--pb-surface-alt);\n border-radius: calc(var(--pb-radius) * 0.7);\n padding: 10px 12px;\n font-size: 13px;\n margin-bottom: 14px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.pb-split-row {\n display: flex;\n justify-content: space-between;\n}\n.pb-section-label {\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--pb-muted);\n margin: 14px 0 8px;\n}\n.pb-list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.pb-option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n width: 100%;\n padding: 12px 14px;\n border: 1.5px solid var(--pb-border);\n border-radius: calc(var(--pb-radius) * 0.75);\n background: transparent;\n color: var(--pb-text);\n font: inherit;\n font-size: 14px;\n cursor: pointer;\n text-align: left;\n transition: border-color 0.15s ease, background-color 0.15s ease;\n}\n.pb-option:hover {\n border-color: var(--pb-primary);\n}\n.pb-option[aria-checked=\"true\"], .pb-option[data-selected=\"true\"] {\n border-color: var(--pb-primary);\n background: var(--pb-surface-alt);\n}\n.pb-option-main {\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n}\n.pb-badge {\n display: inline-block;\n font-size: 11px;\n font-weight: 600;\n padding: 2px 7px;\n border-radius: 999px;\n background: var(--pb-surface-alt);\n border: 1px solid var(--pb-border);\n color: var(--pb-muted);\n}\n.pb-input {\n width: 100%;\n padding: 10px 12px;\n border: 1.5px solid var(--pb-border);\n border-radius: calc(var(--pb-radius) * 0.65);\n background: var(--pb-surface);\n color: var(--pb-text);\n font: inherit;\n font-size: 14px;\n}\n.pb-input:focus {\n outline: none;\n border-color: var(--pb-primary);\n}\n.pb-checkbox {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n color: var(--pb-muted);\n margin-top: 12px;\n cursor: pointer;\n}\n.pb-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n padding: 12px 16px;\n border: 0;\n border-radius: calc(var(--pb-radius) * 0.75);\n background: var(--pb-primary);\n color: var(--pb-on-primary);\n font: inherit;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n margin-top: 16px;\n transition: opacity 0.15s ease;\n}\n.pb-btn:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n.pb-btn-ghost {\n background: transparent;\n color: var(--pb-muted);\n border: 1px solid var(--pb-border);\n margin-top: 8px;\n}\n.pb-btn-danger-sm {\n background: transparent;\n color: var(--pb-danger);\n border: 1px solid var(--pb-border);\n border-radius: 8px;\n padding: 5px 10px;\n font: inherit;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n}\n.pb-alert {\n padding: 11px 13px;\n border-radius: calc(var(--pb-radius) * 0.65);\n font-size: 13px;\n margin-top: 12px;\n}\n.pb-alert-error {\n background: var(--pb-danger-bg);\n color: var(--pb-danger);\n}\n.pb-alert-success {\n background: var(--pb-success-bg);\n color: var(--pb-success);\n}\n.pb-chips {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n margin-bottom: 12px;\n}\n.pb-chip {\n padding: 10px 12px;\n border: 1.5px solid var(--pb-border);\n border-radius: calc(var(--pb-radius) * 0.65);\n background: transparent;\n color: var(--pb-text);\n font: inherit;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n}\n.pb-chip[data-selected=\"true\"] {\n border-color: var(--pb-primary);\n background: var(--pb-surface-alt);\n}\n.pb-frame-wrap {\n margin-top: 12px;\n border: 1px solid var(--pb-border);\n border-radius: calc(var(--pb-radius) * 0.7);\n overflow: hidden;\n background: #ffffff;\n}\n.pb-qr-wrap {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n padding: 12px 0;\n}\n.pb-qr-box {\n background: #ffffff;\n padding: 14px;\n border-radius: 12px;\n border: 1px solid var(--pb-border);\n display: inline-flex;\n}\n.pb-progress {\n width: 100%;\n height: 6px;\n border-radius: 999px;\n background: var(--pb-surface-alt);\n overflow: hidden;\n}\n.pb-progress-bar {\n height: 100%;\n background: var(--pb-primary);\n transition: width 0.25s linear;\n}\n.pb-meta {\n font-size: 12px;\n color: var(--pb-muted);\n font-variant-numeric: tabular-nums;\n}\n.pb-inst-grid {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 6px;\n margin-top: 6px;\n}\n.pb-inst-btn {\n padding: 8px 10px;\n border: 1.5px solid var(--pb-border);\n border-radius: 8px;\n background: transparent;\n color: var(--pb-text);\n font: inherit;\n font-size: 12px;\n cursor: pointer;\n text-align: left;\n}\n.pb-inst-btn[data-selected=\"true\"] {\n border-color: var(--pb-primary);\n background: var(--pb-surface-alt);\n}\n";
|
|
11
|
+
/** Creates a Shadow DOM host inside container with scoped payments-ui styles. */
|
|
12
|
+
export declare function createShadowRoot(container: HTMLElement, attrName: string, appearance?: PaymentsAppearance): {
|
|
13
|
+
host: HTMLElement;
|
|
14
|
+
shadow: ShadowRoot;
|
|
15
|
+
root: HTMLElement;
|
|
16
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { Buyer, IntentView, Payments, SavedMethodView, SpendToken, WalletBalance } from '../payments.js';
|
|
2
|
+
/** Visual customization options for Palbase Payments UI components. */
|
|
3
|
+
export interface PaymentsAppearance {
|
|
4
|
+
/** Color scheme: light, dark, or auto (follows prefers-color-scheme). */
|
|
5
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
6
|
+
/** Primary brand accent color (CSS color value). */
|
|
7
|
+
primaryColor?: string;
|
|
8
|
+
/** Surface background color override. */
|
|
9
|
+
surfaceColor?: string;
|
|
10
|
+
/** Primary text color override. */
|
|
11
|
+
textColor?: string;
|
|
12
|
+
/** Border radius token (e.g. "12px"). */
|
|
13
|
+
borderRadius?: string;
|
|
14
|
+
/** Font family stack override. */
|
|
15
|
+
fontFamily?: string;
|
|
16
|
+
/** BCP 47 locale for currency and number formatting (defaults to browser locale). */
|
|
17
|
+
locale?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Customizable text labels for PaymentSheet (defaults are concise English). */
|
|
20
|
+
export interface PaymentSheetLabels {
|
|
21
|
+
title: string;
|
|
22
|
+
payButton: string;
|
|
23
|
+
processing: string;
|
|
24
|
+
savedCardsHeading: string;
|
|
25
|
+
newCardOption: string;
|
|
26
|
+
masterpassOption: string;
|
|
27
|
+
saveCardCheckbox: string;
|
|
28
|
+
installmentsHeading: string;
|
|
29
|
+
singlePayment: string;
|
|
30
|
+
otpHeading: string;
|
|
31
|
+
otpPlaceholder: string;
|
|
32
|
+
otpSubmit: string;
|
|
33
|
+
retryButton: string;
|
|
34
|
+
cancelButton: string;
|
|
35
|
+
succeededTitle: string;
|
|
36
|
+
walletApplied: string;
|
|
37
|
+
cardRemaining: string;
|
|
38
|
+
}
|
|
39
|
+
/** Handle returned by mounted Payments UI components. */
|
|
40
|
+
export interface PaymentViewHandle {
|
|
41
|
+
/** Removes the component from the DOM and cleans up all listeners and timers. */
|
|
42
|
+
destroy(): void;
|
|
43
|
+
/** Updates appearance tokens live without losing component state. */
|
|
44
|
+
setAppearance(appearance: PaymentsAppearance): void;
|
|
45
|
+
}
|
|
46
|
+
/** Options for mounting or opening PaymentSheet. */
|
|
47
|
+
export interface PaymentSheetOptions {
|
|
48
|
+
/** Server-created PaymentIntent (full IntentView or `{ id, client_secret }`). */
|
|
49
|
+
intent: IntentView | {
|
|
50
|
+
id: string;
|
|
51
|
+
client_secret?: string;
|
|
52
|
+
};
|
|
53
|
+
/** Visual customization options. */
|
|
54
|
+
appearance?: PaymentsAppearance;
|
|
55
|
+
/** Show the signed-in customer's saved cards for one-click payment (default true). */
|
|
56
|
+
showSavedCards?: boolean;
|
|
57
|
+
/** Show an opt-in checkbox to save a new card for future payments (default true when supported). */
|
|
58
|
+
allowSaveCard?: boolean;
|
|
59
|
+
/** Show installment options when the active channel supports installments (default true). */
|
|
60
|
+
allowInstallments?: boolean;
|
|
61
|
+
/** Offer Masterpass OTP checkout when enabled on the active channel (default true). */
|
|
62
|
+
allowMasterpass?: boolean;
|
|
63
|
+
/** Prefilled phone number for Masterpass lookup. */
|
|
64
|
+
masterpassPhone?: string;
|
|
65
|
+
/** Optional customer billing/shipping info forwarded on confirm. */
|
|
66
|
+
buyer?: Buyer;
|
|
67
|
+
/** Wait timeout in milliseconds (default 300,000). */
|
|
68
|
+
timeoutMs?: number;
|
|
69
|
+
/** Called when the PaymentIntent settles as succeeded or requires_capture. */
|
|
70
|
+
onSuccess?(intent: IntentView): void;
|
|
71
|
+
/** Called when the PaymentIntent settles as failed, canceled, or expired. */
|
|
72
|
+
onFailure?(intent: IntentView): void;
|
|
73
|
+
/** Called when the customer dismisses or cancels the sheet. */
|
|
74
|
+
onCancel?(): void;
|
|
75
|
+
/** Called on unexpected transport or runtime errors. */
|
|
76
|
+
onError?(error: unknown): void;
|
|
77
|
+
/** Custom UI labels for localization. */
|
|
78
|
+
labels?: Partial<PaymentSheetLabels>;
|
|
79
|
+
}
|
|
80
|
+
/** Options for mounting WalletTopUpSheet. */
|
|
81
|
+
export interface WalletTopUpSheetOptions {
|
|
82
|
+
/** Target closed-loop wallet key (e.g. "try", "usd"). */
|
|
83
|
+
walletKey: string;
|
|
84
|
+
/** 3-letter ISO 4217 currency code for formatting (e.g. "TRY", "USD"). */
|
|
85
|
+
currency: string;
|
|
86
|
+
/** Preset top-up amounts in minor units (defaults to 100, 250, 500, 1000 major units). */
|
|
87
|
+
presets?: readonly number[];
|
|
88
|
+
/** Minimum allowed top-up in minor units (default 100). */
|
|
89
|
+
minAmount?: number;
|
|
90
|
+
/** Maximum allowed top-up in minor units. */
|
|
91
|
+
maxAmount?: number;
|
|
92
|
+
/** Optional payment channel override. */
|
|
93
|
+
channel?: string;
|
|
94
|
+
/** Allowed app return URL. */
|
|
95
|
+
returnUrl?: string;
|
|
96
|
+
/** Allowed app cancel URL. */
|
|
97
|
+
cancelUrl?: string;
|
|
98
|
+
/** Visual customization options. */
|
|
99
|
+
appearance?: PaymentsAppearance;
|
|
100
|
+
/** Called when the top-up PaymentIntent succeeds. */
|
|
101
|
+
onSuccess?(intent: IntentView): void;
|
|
102
|
+
/** Called when the top-up PaymentIntent fails or is canceled. */
|
|
103
|
+
onFailure?(intent: IntentView): void;
|
|
104
|
+
/** Called when the user cancels top-up. */
|
|
105
|
+
onCancel?(): void;
|
|
106
|
+
/** Called on errors. */
|
|
107
|
+
onError?(error: unknown): void;
|
|
108
|
+
}
|
|
109
|
+
/** Options for mounting SavedCardsView. */
|
|
110
|
+
export interface SavedCardsViewOptions {
|
|
111
|
+
/** Visual customization options. */
|
|
112
|
+
appearance?: PaymentsAppearance;
|
|
113
|
+
/** Allow adding a new tokenized card (default true). */
|
|
114
|
+
allowAdd?: boolean;
|
|
115
|
+
/** Optional channel key override when adding a card. */
|
|
116
|
+
channel?: string;
|
|
117
|
+
/** Optional vault override (e.g. "masterpass"). */
|
|
118
|
+
vault?: string;
|
|
119
|
+
/** Allowed app return URL when adding a card. */
|
|
120
|
+
returnUrl?: string;
|
|
121
|
+
/** Allowed app cancel URL when adding a card. */
|
|
122
|
+
cancelUrl?: string;
|
|
123
|
+
/** Called when a card row is clicked. */
|
|
124
|
+
onSelect?(method: SavedMethodView): void;
|
|
125
|
+
/** Called whenever the list of saved methods is loaded or modified. */
|
|
126
|
+
onChanged?(methods: SavedMethodView[]): void;
|
|
127
|
+
/** Called on errors. */
|
|
128
|
+
onError?(error: unknown): void;
|
|
129
|
+
}
|
|
130
|
+
/** Options for mounting SpendQRView. */
|
|
131
|
+
export interface SpendQRViewOptions {
|
|
132
|
+
/** Closed-loop wallet key to generate single-use QR spend tokens for. */
|
|
133
|
+
walletKey: string;
|
|
134
|
+
/** Optional maximum spend amount cap per token in minor units. */
|
|
135
|
+
maxAmount?: number;
|
|
136
|
+
/** Token lifetime in seconds (default 60, max 300). */
|
|
137
|
+
ttlSeconds?: number;
|
|
138
|
+
/** Automatically mint a fresh token shortly before expiry (default true). */
|
|
139
|
+
autoRefresh?: boolean;
|
|
140
|
+
/** Visual customization options. */
|
|
141
|
+
appearance?: PaymentsAppearance;
|
|
142
|
+
/** Called whenever a new spend token is minted. */
|
|
143
|
+
onToken?(token: SpendToken): void;
|
|
144
|
+
/** Called whenever the wallet's live balance updates. */
|
|
145
|
+
onBalance?(balance: WalletBalance): void;
|
|
146
|
+
/** Called on errors. */
|
|
147
|
+
onError?(error: unknown): void;
|
|
148
|
+
}
|
|
149
|
+
export type PaymentsClient = Payments;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Payments } from '../payments.js';
|
|
2
|
+
import type { PaymentViewHandle, WalletTopUpSheetOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Mounts a closed-loop WalletTopUpSheet with live balance display, preset
|
|
5
|
+
* amount chips, custom amount input, and automatic handoff to PaymentSheet.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mountWalletTopUpSheet(container: HTMLElement, payments: Payments, options: WalletTopUpSheetOptions): PaymentViewHandle;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { payments as paymentsModule } from '../../internal/src/modules/index.js';
|
|
2
|
+
import { type Transport } from '../../internal/src/transport.js';
|
|
3
|
+
import type { SessionManager } from './session.js';
|
|
4
|
+
import type { RealtimeSocket } from './socket.js';
|
|
5
|
+
type P = typeof paymentsModule;
|
|
6
|
+
export type Address = paymentsModule.Address;
|
|
7
|
+
export type Buyer = paymentsModule.Buyer;
|
|
8
|
+
export type Capabilities = paymentsModule.Capabilities;
|
|
9
|
+
export type CapabilitiesResponse = paymentsModule.CapabilitiesResponse;
|
|
10
|
+
export type CancelSubscriptionResponse = paymentsModule.CancelSubscriptionResponse;
|
|
11
|
+
export type InstallmentConfig = paymentsModule.InstallmentConfig;
|
|
12
|
+
export type InstallmentOption = paymentsModule.InstallmentOption;
|
|
13
|
+
export type InstallmentTable = paymentsModule.InstallmentTable;
|
|
14
|
+
export type IntentView = paymentsModule.IntentView;
|
|
15
|
+
export type MasterpassAction = paymentsModule.MasterpassAction;
|
|
16
|
+
export type NextAction = paymentsModule.NextAction;
|
|
17
|
+
export type ProviderOptions = paymentsModule.ProviderOptions;
|
|
18
|
+
export type SavedMethodView = paymentsModule.SavedMethodView;
|
|
19
|
+
export type SpendToken = paymentsModule.SpendToken;
|
|
20
|
+
export type SubscriptionListResponse = paymentsModule.SubscriptionListResponse;
|
|
21
|
+
export type SubscriptionSummary = paymentsModule.SubscriptionSummary;
|
|
22
|
+
export type WalletBalance = paymentsModule.WalletBalance;
|
|
23
|
+
/** PaymentIntent statuses that represent a settled or closed outcome. */
|
|
24
|
+
export declare const TERMINAL_INTENT_STATUSES: ReadonlySet<string>;
|
|
25
|
+
/** Whether a PaymentIntent status is terminal (no further action or waiting required). */
|
|
26
|
+
export declare function isTerminalIntentStatus(status: string): boolean;
|
|
27
|
+
/** Payload posted by the central Palbase callback bridge page to window.parent. */
|
|
28
|
+
export interface PaymentCallbackMessage {
|
|
29
|
+
source: 'palbase.payments';
|
|
30
|
+
intent_id: string;
|
|
31
|
+
status: string;
|
|
32
|
+
decline_code?: string;
|
|
33
|
+
return_url?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Parses and validates a postMessage event payload from the Palbase payments callback bridge. */
|
|
36
|
+
export declare function parseCallbackMessage(data: unknown): PaymentCallbackMessage | null;
|
|
37
|
+
/** Options for confirming a server-created PaymentIntent. */
|
|
38
|
+
export interface ConfirmIntentOptions {
|
|
39
|
+
/** Intent client_secret (required for guest or publishable-key callers). */
|
|
40
|
+
clientSecret?: string;
|
|
41
|
+
/** Saved payment method UUID for one-click card payment. */
|
|
42
|
+
methodId?: string;
|
|
43
|
+
/** Save the card to the customer's vault after the payment succeeds. */
|
|
44
|
+
saveMethod?: boolean;
|
|
45
|
+
/** Initiate a Masterpass OTP payment flow. */
|
|
46
|
+
useMasterpass?: boolean;
|
|
47
|
+
/** Phone number for Masterpass card lookup. */
|
|
48
|
+
phone?: string;
|
|
49
|
+
/** Customer billing and shipping details. */
|
|
50
|
+
buyer?: Buyer;
|
|
51
|
+
/** Installment configuration (e.g. `{ count: 3 }`). */
|
|
52
|
+
installments?: InstallmentConfig;
|
|
53
|
+
/** Typed provider-specific options. */
|
|
54
|
+
providerOptions?: ProviderOptions;
|
|
55
|
+
/** Client-supplied idempotency key for safe retries. */
|
|
56
|
+
idempotencyKey?: string;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
}
|
|
59
|
+
/** Options for submitting a one-time passcode challenge. */
|
|
60
|
+
export interface SubmitOtpOptions {
|
|
61
|
+
/** Challenge identifier from NextAction. */
|
|
62
|
+
challengeId: string;
|
|
63
|
+
/** One-time passcode entered by the customer. */
|
|
64
|
+
otp: string;
|
|
65
|
+
/** Intent client_secret (required for guest callers). */
|
|
66
|
+
clientSecret?: string;
|
|
67
|
+
/** Save the verified card after payment succeeds. */
|
|
68
|
+
saveMethod?: boolean;
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
}
|
|
71
|
+
/** Options for waiting on a PaymentIntent to reach a terminal status with zero polling. */
|
|
72
|
+
export interface WaitForIntentOptions {
|
|
73
|
+
/** Intent client_secret (required for guest callers). */
|
|
74
|
+
clientSecret?: string;
|
|
75
|
+
/** Maximum wait duration in milliseconds (default 300,000 = 5 minutes). */
|
|
76
|
+
timeoutMs?: number;
|
|
77
|
+
signal?: AbortSignal;
|
|
78
|
+
}
|
|
79
|
+
/** Prompt context passed to `present()` when an OTP or Masterpass verification is required. */
|
|
80
|
+
export interface OtpPromptContext {
|
|
81
|
+
intentId: string;
|
|
82
|
+
challengeId: string;
|
|
83
|
+
maskedPhone?: string;
|
|
84
|
+
expiresAt?: string | null;
|
|
85
|
+
masterpass?: MasterpassAction;
|
|
86
|
+
}
|
|
87
|
+
/** Options for executing a PaymentIntent's canonical NextAction. */
|
|
88
|
+
export interface PresentIntentOptions {
|
|
89
|
+
/** Intent client_secret (defaults to `intent.client_secret`). */
|
|
90
|
+
clientSecret?: string;
|
|
91
|
+
/** Container element where an embedded 3DS or checkout iframe is mounted when `onEmbed` is not given. */
|
|
92
|
+
container?: HTMLElement;
|
|
93
|
+
/** Custom redirect handler; when omitted, `window.location.assign(url)` is called. */
|
|
94
|
+
onRedirect?(url: string, action: NextAction): void | Promise<void>;
|
|
95
|
+
/** Custom embed handler; when omitted and `container` is given, a sandboxed iframe is mounted. */
|
|
96
|
+
onEmbed?(action: NextAction): void | (() => void) | Promise<void | (() => void)>;
|
|
97
|
+
/** Collects an OTP code from the customer when `next_action.type` is `otp` or `masterpass`. */
|
|
98
|
+
onOtp?(ctx: OtpPromptContext): Promise<string | {
|
|
99
|
+
otp: string;
|
|
100
|
+
saveMethod?: boolean;
|
|
101
|
+
} | null>;
|
|
102
|
+
/** Maximum wait duration in milliseconds (default 300,000). */
|
|
103
|
+
timeoutMs?: number;
|
|
104
|
+
signal?: AbortSignal;
|
|
105
|
+
}
|
|
106
|
+
/** Options for initiating a real-money wallet top-up. */
|
|
107
|
+
export interface TopUpWalletOptions {
|
|
108
|
+
/** Target wallet key (e.g. `try`, `usd`). */
|
|
109
|
+
walletKey: string;
|
|
110
|
+
/** Top-up amount in minor units. */
|
|
111
|
+
amount: number;
|
|
112
|
+
/** Optional explicit payment channel key override. */
|
|
113
|
+
channel?: string;
|
|
114
|
+
/** Saved payment method UUID for one-click top-up. */
|
|
115
|
+
methodId?: string;
|
|
116
|
+
/** Save the card after top-up succeeds. */
|
|
117
|
+
saveMethod?: boolean;
|
|
118
|
+
/** Pay using Masterpass OTP. */
|
|
119
|
+
useMasterpass?: boolean;
|
|
120
|
+
/** Phone number for Masterpass lookup. */
|
|
121
|
+
phone?: string;
|
|
122
|
+
/** Allowed app return URL. */
|
|
123
|
+
returnUrl?: string;
|
|
124
|
+
/** Allowed app cancel URL. */
|
|
125
|
+
cancelUrl?: string;
|
|
126
|
+
/** Client-supplied idempotency key for safe retries. */
|
|
127
|
+
idempotencyKey?: string;
|
|
128
|
+
signal?: AbortSignal;
|
|
129
|
+
}
|
|
130
|
+
/** Live wallet balance listener: receives all balances for the signed-in user, or null when signed out. */
|
|
131
|
+
export type WalletBalancesListener = (balances: WalletBalance[] | null) => void;
|
|
132
|
+
/** Live event payload emitted on the signed-in user's `payments:<ref>:<uid>` realtime channel. */
|
|
133
|
+
export interface PaymentRealtimeEvent {
|
|
134
|
+
type: string;
|
|
135
|
+
payload: unknown;
|
|
136
|
+
}
|
|
137
|
+
export type PaymentRealtimeListener = (event: PaymentRealtimeEvent) => void;
|
|
138
|
+
/** Minimal intent input accepted by `pb.payments.present()`. */
|
|
139
|
+
export type PresentableIntent = Pick<IntentView, 'id'> & Partial<IntentView>;
|
|
140
|
+
/** Returns a concise, user-safe English message for a canonical Palbase decline code. */
|
|
141
|
+
export declare function declineMessage(code: string | undefined): string;
|
|
142
|
+
/**
|
|
143
|
+
* Core payments client (`pb.payments`): capabilities, installments, PaymentIntents,
|
|
144
|
+
* canonical NextAction execution, saved payment methods, billing profile,
|
|
145
|
+
* closed-loop wallets with QR spend tokens, subscriptions, and billing portal.
|
|
146
|
+
*/
|
|
147
|
+
export declare class Payments {
|
|
148
|
+
/** Every client operation of the payments contract, through the session's transport. */
|
|
149
|
+
readonly api: ReturnType<P['client']>;
|
|
150
|
+
/** Saved billing & shipping profile for the signed-in customer. */
|
|
151
|
+
readonly profile: {
|
|
152
|
+
get(opts?: {
|
|
153
|
+
signal?: AbortSignal;
|
|
154
|
+
}): Promise<Buyer>;
|
|
155
|
+
update(buyer: Buyer, opts?: {
|
|
156
|
+
signal?: AbortSignal;
|
|
157
|
+
}): Promise<Buyer>;
|
|
158
|
+
};
|
|
159
|
+
/** PCI-safe tokenized saved cards for the signed-in customer. */
|
|
160
|
+
readonly methods: {
|
|
161
|
+
list(opts?: {
|
|
162
|
+
signal?: AbortSignal;
|
|
163
|
+
}): Promise<SavedMethodView[]>;
|
|
164
|
+
add(opts?: {
|
|
165
|
+
channel?: string;
|
|
166
|
+
vault?: string;
|
|
167
|
+
phone?: string;
|
|
168
|
+
returnUrl?: string;
|
|
169
|
+
cancelUrl?: string;
|
|
170
|
+
signal?: AbortSignal;
|
|
171
|
+
}): Promise<NextAction>;
|
|
172
|
+
remove(methodId: string, opts?: {
|
|
173
|
+
signal?: AbortSignal;
|
|
174
|
+
}): Promise<void>;
|
|
175
|
+
};
|
|
176
|
+
/** Closed-loop customer wallets: balances, top-ups, single-use QR spend tokens, and live updates. */
|
|
177
|
+
readonly wallet: {
|
|
178
|
+
balances(opts?: {
|
|
179
|
+
signal?: AbortSignal;
|
|
180
|
+
}): Promise<WalletBalance[]>;
|
|
181
|
+
balance(walletKey: string, opts?: {
|
|
182
|
+
signal?: AbortSignal;
|
|
183
|
+
}): Promise<WalletBalance | undefined>;
|
|
184
|
+
topUp(opts: TopUpWalletOptions): Promise<IntentView>;
|
|
185
|
+
createSpendToken(opts: {
|
|
186
|
+
walletKey: string;
|
|
187
|
+
maxAmount?: number;
|
|
188
|
+
ttlSeconds?: number;
|
|
189
|
+
signal?: AbortSignal;
|
|
190
|
+
}): Promise<SpendToken>;
|
|
191
|
+
onChange(listener: WalletBalancesListener): () => void;
|
|
192
|
+
};
|
|
193
|
+
/** Recurring payment subscriptions for the signed-in customer. */
|
|
194
|
+
readonly subscriptions: {
|
|
195
|
+
list(opts?: {
|
|
196
|
+
limit?: number;
|
|
197
|
+
cursor?: string;
|
|
198
|
+
signal?: AbortSignal;
|
|
199
|
+
}): Promise<SubscriptionListResponse>;
|
|
200
|
+
cancel(subscriptionId: string, opts?: {
|
|
201
|
+
signal?: AbortSignal;
|
|
202
|
+
}): Promise<CancelSubscriptionResponse>;
|
|
203
|
+
};
|
|
204
|
+
private session;
|
|
205
|
+
private socket;
|
|
206
|
+
private ref;
|
|
207
|
+
private origin;
|
|
208
|
+
private walletListeners;
|
|
209
|
+
private walletWatch;
|
|
210
|
+
private walletFollowing;
|
|
211
|
+
private lastBalances;
|
|
212
|
+
private eventListeners;
|
|
213
|
+
private eventWatch;
|
|
214
|
+
private eventFollowing;
|
|
215
|
+
constructor(transport: Transport, session: SessionManager, socket: RealtimeSocket, ref: string, origin: string);
|
|
216
|
+
/** Returns the active channel's capabilities (3DS, installments, Masterpass, saved cards, wallets) for a currency. */
|
|
217
|
+
capabilities(opts?: {
|
|
218
|
+
currency?: string;
|
|
219
|
+
channel?: string;
|
|
220
|
+
signal?: AbortSignal;
|
|
221
|
+
}): Promise<CapabilitiesResponse>;
|
|
222
|
+
/** Queries card BIN metadata and available installment options for an amount and currency. */
|
|
223
|
+
installments(opts: {
|
|
224
|
+
amount: number;
|
|
225
|
+
currency: string;
|
|
226
|
+
bin?: string;
|
|
227
|
+
methodId?: string;
|
|
228
|
+
channel?: string;
|
|
229
|
+
signal?: AbortSignal;
|
|
230
|
+
}): Promise<InstallmentTable>;
|
|
231
|
+
/** Reads a PaymentIntent's current canonical status. */
|
|
232
|
+
getIntent(intentId: string, opts?: {
|
|
233
|
+
clientSecret?: string;
|
|
234
|
+
signal?: AbortSignal;
|
|
235
|
+
}): Promise<IntentView>;
|
|
236
|
+
/** Confirms a server-created PaymentIntent and returns its updated view with canonical NextAction. */
|
|
237
|
+
confirm(intentId: string, opts?: ConfirmIntentOptions): Promise<IntentView>;
|
|
238
|
+
/** Submits an OTP verification code for a Masterpass or bank verification step. */
|
|
239
|
+
submitOtp(intentId: string, opts: SubmitOtpOptions): Promise<IntentView>;
|
|
240
|
+
/** Opens a provider-hosted self-service billing portal session for the signed-in customer. */
|
|
241
|
+
portal(returnUrl: string, opts?: {
|
|
242
|
+
channel?: string;
|
|
243
|
+
signal?: AbortSignal;
|
|
244
|
+
}): Promise<string>;
|
|
245
|
+
/**
|
|
246
|
+
* Waits for a PaymentIntent to reach a terminal status with ZERO polling.
|
|
247
|
+
* Joins `payment_intent:<ref>:<intentId>` on the realtime socket and listens
|
|
248
|
+
* for `palbase.payments` callback bridge postMessages; performs an initial
|
|
249
|
+
* authoritative read and a final read when woken up.
|
|
250
|
+
*/
|
|
251
|
+
waitForIntent(intentId: string, opts?: WaitForIntentOptions): Promise<IntentView>;
|
|
252
|
+
/**
|
|
253
|
+
* Executes a PaymentIntent's canonical NextAction (none, redirect, embed, otp,
|
|
254
|
+
* or masterpass) and resolves with the settled PaymentIntent view.
|
|
255
|
+
*/
|
|
256
|
+
present(intent: PresentableIntent, opts?: PresentIntentOptions): Promise<IntentView>;
|
|
257
|
+
/**
|
|
258
|
+
* Subscribes to live payment and wallet events for the signed-in user on
|
|
259
|
+
* `payments:<ref>:<userId>`. Returns an unsubscribe function.
|
|
260
|
+
*/
|
|
261
|
+
onEvent(listener: PaymentRealtimeListener): () => void;
|
|
262
|
+
private onWalletChange;
|
|
263
|
+
private startWalletWatch;
|
|
264
|
+
private stopWalletWatch;
|
|
265
|
+
private followWallet;
|
|
266
|
+
private unfollowWallet;
|
|
267
|
+
private walletChanged;
|
|
268
|
+
private readBalances;
|
|
269
|
+
private offerBalances;
|
|
270
|
+
private tellBalances;
|
|
271
|
+
private startEvents;
|
|
272
|
+
private stopEvents;
|
|
273
|
+
private followEvents;
|
|
274
|
+
private unfollowEvents;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Mounts a sandboxed iframe for a provider's embedded checkout or 3DS challenge.
|
|
278
|
+
* Never allows arbitrary top-level script execution outside the iframe boundary.
|
|
279
|
+
*/
|
|
280
|
+
export declare function mountEmbedFrame(container: HTMLElement, action: NextAction): () => void;
|
|
281
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { iap as iapModule } from '../../../internal/src/modules/index.js';
|
|
2
2
|
import { type PreparedAsset } from '../screen/assets.js';
|
|
3
3
|
import { type PaywallAttribute } from './attributes.js';
|
|
4
4
|
import { type PricedPackage } from './prices.js';
|
|
5
5
|
import { type PaywallHandlers, type PaywallPackage, type PaywallView } from '../screen/render.js';
|
|
6
6
|
import { type Appearance, type PackageValues, type PaywallDefinition } from '../screen/resolve.js';
|
|
7
|
-
type Offerings =
|
|
8
|
-
type OfferView =
|
|
9
|
-
type Api = ReturnType<typeof
|
|
7
|
+
type Offerings = iapModule.Offerings;
|
|
8
|
+
type OfferView = iapModule.OfferView;
|
|
9
|
+
type Api = ReturnType<typeof iapModule.client>;
|
|
10
10
|
export interface PaywallRenderOptions {
|
|
11
11
|
/** Stripe sends the customer back here after buying (one of the project's registered apps). */
|
|
12
12
|
successUrl: string;
|
|
@@ -82,10 +82,8 @@ export declare function webPackages(offerings: Offerings, keys: readonly string[
|
|
|
82
82
|
* when the web sells nothing.
|
|
83
83
|
*/
|
|
84
84
|
export declare function defaultPaywall(offerings: Offerings): PaywallDefinition | null;
|
|
85
|
-
/**
|
|
86
|
-
export declare function
|
|
87
|
-
/** The placement's paywall (see Purchases.paywall). */
|
|
88
|
-
export declare function loadPaywall(api: Api, ref: string, placement: string, checkout: PaywallDeps['checkout'], ask?: {
|
|
85
|
+
/** The placement's paywall (see Iap.paywall). */
|
|
86
|
+
export declare function loadPaywall(api: Api, ref: string, placement: string, installation: string, checkout: PaywallDeps['checkout'], ask?: {
|
|
89
87
|
signal?: AbortSignal;
|
|
90
88
|
fetch?: (input: string, init?: RequestInit) => Promise<Response>;
|
|
91
89
|
/** What the app says of the person, for the placement's targeting rules. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** An asset as the answer lists it (
|
|
1
|
+
/** An asset as the answer lists it (iap's PaywallAssetRef, notify's InAppAssetRef). */
|
|
2
2
|
export interface ScreenAssetRef {
|
|
3
3
|
id: string;
|
|
4
4
|
kind: 'image' | 'video' | 'font' | 'html';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { notify,
|
|
2
|
-
export type PaywallDefinition =
|
|
1
|
+
import type { notify, iap } from '../../../internal/src/modules/index.js';
|
|
2
|
+
export type PaywallDefinition = iap.PaywallDefinition;
|
|
3
3
|
export type MessageDefinition = notify.MessageDefinition;
|
|
4
4
|
/** What a screen is for: a paywall sells the catalog's packages; a message is shown in the app, or as a card of its inbox. */
|
|
5
5
|
export type ScreenKind = 'paywall' | 'message';
|
|
@@ -29,7 +29,7 @@ export interface ResolveOptions {
|
|
|
29
29
|
packages: Record<string, PackageValues>;
|
|
30
30
|
/** The packages whose introductory offer (a trial) the customer can still take. */
|
|
31
31
|
eligible?: readonly string[];
|
|
32
|
-
/** The catalog's offers the customer may take now (GET /
|
|
32
|
+
/** The catalog's offers the customer may take now (GET /iap/offers): a package sold with one is bought with it, its {{offer_price}} the offer's price. */
|
|
33
33
|
offers?: readonly string[];
|
|
34
34
|
/** The package the customer selected; absent, the paywall's own selection. */
|
|
35
35
|
selected?: string;
|
package/types/web/src/vite.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ interface ResolveContext {
|
|
|
23
23
|
skipSelf: boolean;
|
|
24
24
|
}): Promise<unknown>;
|
|
25
25
|
}
|
|
26
|
+
interface AliasEntry {
|
|
27
|
+
find: string | RegExp;
|
|
28
|
+
replacement: string;
|
|
29
|
+
}
|
|
30
|
+
type AliasConfig = AliasEntry[] | Record<string, string> | undefined;
|
|
26
31
|
/** What the plugin is to Vite: its hooks, typed here so the package needs no Vite of its own. */
|
|
27
32
|
export interface PalbaseVitePlugin {
|
|
28
33
|
name: string;
|
|
@@ -41,6 +46,9 @@ export interface PalbaseVitePlugin {
|
|
|
41
46
|
root: string;
|
|
42
47
|
mode: string;
|
|
43
48
|
command?: string;
|
|
49
|
+
resolve?: {
|
|
50
|
+
alias?: AliasConfig;
|
|
51
|
+
};
|
|
44
52
|
}): void;
|
|
45
53
|
buildStart(): Promise<void>;
|
|
46
54
|
resolveId(this: ResolveContext, source: string, importer?: string): string | null | Promise<unknown>;
|