@whop/checkout 0.0.42 → 0.0.44

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.
@@ -1,132 +0,0 @@
1
- declare global {
2
- interface Window {
3
- wco?: {
4
- injected: true;
5
- listening: boolean;
6
- frames: Map<HTMLIFrameElement, () => void>;
7
- identifiedFrames: Map<string, HTMLIFrameElement>;
8
- submit: (identifier: string, data?: WhopCheckoutSubmitDetails) => void;
9
- getEmail: (identifier: string, timeout?: number) => Promise<string>;
10
- setEmail: (
11
- identifier: string,
12
- email: string,
13
- timeout?: number,
14
- ) => Promise<void>;
15
- getAddress: (
16
- identifier: string,
17
- timeout?: number,
18
- ) => Promise<{
19
- address: WhopCheckoutAddress;
20
- isComplete: boolean;
21
- }>;
22
- setAddress: (
23
- identifier: string,
24
- address: WhopCheckoutAddress,
25
- timeout?: number,
26
- ) => Promise<void>;
27
- };
28
- }
29
-
30
- interface HTMLElementEventMap {
31
- "checkout:submit": CustomEvent<WhopCheckoutSubmitDetails>;
32
- }
33
- }
34
-
35
- type WhopCheckoutSubmitDetails = Record<never, never>;
36
-
37
- type WhopCheckoutAddress = {
38
- name: string;
39
- country: string;
40
- line1: string;
41
- line2?: string;
42
- city: string;
43
- state: string;
44
- postalCode: string;
45
- };
46
-
47
- type WhopCheckoutState = "loading" | "ready" | "disabled";
48
- type WhopCheckoutMessage = {
49
- event: "resize";
50
- height: number;
51
- } | {
52
- event: "center";
53
- } | {
54
- event: "complete";
55
- receipt_id?: string;
56
- plan_id: string;
57
- } | {
58
- event: "state";
59
- state: WhopCheckoutState;
60
- } | {
61
- event: "get-email-result";
62
- email: string;
63
- event_id: string;
64
- } | {
65
- event: "set-email-result";
66
- ok: true;
67
- error?: never;
68
- event_id: string;
69
- } | {
70
- event: "set-email-result";
71
- ok: false;
72
- error: string;
73
- event_id: string;
74
- } | {
75
- event: "set-address-result";
76
- ok: true;
77
- error?: never;
78
- event_id: string;
79
- } | {
80
- event: "set-address-result";
81
- ok: false;
82
- error: string;
83
- event_id: string;
84
- } | {
85
- event: "get-address-result";
86
- ok: true;
87
- address: WhopCheckoutAddress;
88
- is_complete: boolean;
89
- event_id: string;
90
- } | {
91
- event: "get-address-result";
92
- ok: false;
93
- error: string;
94
- event_id: string;
95
- } | {
96
- event: "address-validation-error";
97
- error_message: string;
98
- error_code: string;
99
- };
100
- declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
101
-
102
- declare function onWhopCheckoutMessage(iframe: HTMLIFrameElement, callback: (message: WhopCheckoutMessage) => void): () => void;
103
- declare function setEmail(frame: HTMLIFrameElement, email: string, timeout?: number): Promise<void>;
104
- declare function getEmail(frame: HTMLIFrameElement, timeout?: number): Promise<string>;
105
- declare function setAddress(frame: HTMLIFrameElement, address: WhopCheckoutAddress, timeout?: number): Promise<void>;
106
- declare function getAddress(frame: HTMLIFrameElement, timeout?: number): Promise<{
107
- address: WhopCheckoutAddress;
108
- isComplete: boolean;
109
- }>;
110
- declare function submitCheckoutFrame(frame: HTMLIFrameElement, _data?: WhopCheckoutSubmitDetails): void;
111
- declare function parseSetupFutureUsage(val?: string): "off_session" | undefined;
112
-
113
- interface WhopEmbeddedCheckoutStyleOptions {
114
- container?: {
115
- paddingTop?: number | string;
116
- paddingBottom?: number | string;
117
- paddingY?: number | string;
118
- };
119
- }
120
- interface WhopEmbeddedCheckoutPrefillOptions {
121
- email?: string;
122
- address?: Partial<WhopCheckoutAddress>;
123
- }
124
- interface WhopEmbeddedCheckoutThemeOptions {
125
- accentColor?: string;
126
- highContrast?: boolean;
127
- }
128
- declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string, hidePrice?: boolean, skipRedirect?: boolean, utm?: Record<string, string | string[]>, styles?: WhopEmbeddedCheckoutStyleOptions, prefill?: WhopEmbeddedCheckoutPrefillOptions, themeOptions?: WhopEmbeddedCheckoutThemeOptions, hideSubmitButton?: boolean, hideTermsAndConditions?: boolean, hideEmail?: boolean, disableEmail?: boolean, hideAddressForm?: boolean, affiliateCode?: string, setupFutureUsage?: "off_session"): string;
129
- declare const EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST: string[];
130
- declare const EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING = "document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";
131
-
132
- export { EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST as E, type WhopCheckoutSubmitDetails as W, type WhopCheckoutAddress as a, type WhopCheckoutState as b, type WhopEmbeddedCheckoutStyleOptions as c, type WhopEmbeddedCheckoutPrefillOptions as d, type WhopCheckoutMessage as e, setAddress as f, getEmail as g, getAddress as h, isWhopCheckoutMessage as i, submitCheckoutFrame as j, type WhopEmbeddedCheckoutThemeOptions as k, getEmbeddedCheckoutIframeUrl as l, EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING as m, onWhopCheckoutMessage as o, parseSetupFutureUsage as p, setEmail as s };
@@ -1,132 +0,0 @@
1
- declare global {
2
- interface Window {
3
- wco?: {
4
- injected: true;
5
- listening: boolean;
6
- frames: Map<HTMLIFrameElement, () => void>;
7
- identifiedFrames: Map<string, HTMLIFrameElement>;
8
- submit: (identifier: string, data?: WhopCheckoutSubmitDetails) => void;
9
- getEmail: (identifier: string, timeout?: number) => Promise<string>;
10
- setEmail: (
11
- identifier: string,
12
- email: string,
13
- timeout?: number,
14
- ) => Promise<void>;
15
- getAddress: (
16
- identifier: string,
17
- timeout?: number,
18
- ) => Promise<{
19
- address: WhopCheckoutAddress;
20
- isComplete: boolean;
21
- }>;
22
- setAddress: (
23
- identifier: string,
24
- address: WhopCheckoutAddress,
25
- timeout?: number,
26
- ) => Promise<void>;
27
- };
28
- }
29
-
30
- interface HTMLElementEventMap {
31
- "checkout:submit": CustomEvent<WhopCheckoutSubmitDetails>;
32
- }
33
- }
34
-
35
- type WhopCheckoutSubmitDetails = Record<never, never>;
36
-
37
- type WhopCheckoutAddress = {
38
- name: string;
39
- country: string;
40
- line1: string;
41
- line2?: string;
42
- city: string;
43
- state: string;
44
- postalCode: string;
45
- };
46
-
47
- type WhopCheckoutState = "loading" | "ready" | "disabled";
48
- type WhopCheckoutMessage = {
49
- event: "resize";
50
- height: number;
51
- } | {
52
- event: "center";
53
- } | {
54
- event: "complete";
55
- receipt_id?: string;
56
- plan_id: string;
57
- } | {
58
- event: "state";
59
- state: WhopCheckoutState;
60
- } | {
61
- event: "get-email-result";
62
- email: string;
63
- event_id: string;
64
- } | {
65
- event: "set-email-result";
66
- ok: true;
67
- error?: never;
68
- event_id: string;
69
- } | {
70
- event: "set-email-result";
71
- ok: false;
72
- error: string;
73
- event_id: string;
74
- } | {
75
- event: "set-address-result";
76
- ok: true;
77
- error?: never;
78
- event_id: string;
79
- } | {
80
- event: "set-address-result";
81
- ok: false;
82
- error: string;
83
- event_id: string;
84
- } | {
85
- event: "get-address-result";
86
- ok: true;
87
- address: WhopCheckoutAddress;
88
- is_complete: boolean;
89
- event_id: string;
90
- } | {
91
- event: "get-address-result";
92
- ok: false;
93
- error: string;
94
- event_id: string;
95
- } | {
96
- event: "address-validation-error";
97
- error_message: string;
98
- error_code: string;
99
- };
100
- declare function isWhopCheckoutMessage(event: MessageEvent<unknown>): event is MessageEvent<WhopCheckoutMessage>;
101
-
102
- declare function onWhopCheckoutMessage(iframe: HTMLIFrameElement, callback: (message: WhopCheckoutMessage) => void): () => void;
103
- declare function setEmail(frame: HTMLIFrameElement, email: string, timeout?: number): Promise<void>;
104
- declare function getEmail(frame: HTMLIFrameElement, timeout?: number): Promise<string>;
105
- declare function setAddress(frame: HTMLIFrameElement, address: WhopCheckoutAddress, timeout?: number): Promise<void>;
106
- declare function getAddress(frame: HTMLIFrameElement, timeout?: number): Promise<{
107
- address: WhopCheckoutAddress;
108
- isComplete: boolean;
109
- }>;
110
- declare function submitCheckoutFrame(frame: HTMLIFrameElement, _data?: WhopCheckoutSubmitDetails): void;
111
- declare function parseSetupFutureUsage(val?: string): "off_session" | undefined;
112
-
113
- interface WhopEmbeddedCheckoutStyleOptions {
114
- container?: {
115
- paddingTop?: number | string;
116
- paddingBottom?: number | string;
117
- paddingY?: number | string;
118
- };
119
- }
120
- interface WhopEmbeddedCheckoutPrefillOptions {
121
- email?: string;
122
- address?: Partial<WhopCheckoutAddress>;
123
- }
124
- interface WhopEmbeddedCheckoutThemeOptions {
125
- accentColor?: string;
126
- highContrast?: boolean;
127
- }
128
- declare function getEmbeddedCheckoutIframeUrl(planId: string, theme?: "light" | "dark" | "system", sessionId?: string, origin?: string, hidePrice?: boolean, skipRedirect?: boolean, utm?: Record<string, string | string[]>, styles?: WhopEmbeddedCheckoutStyleOptions, prefill?: WhopEmbeddedCheckoutPrefillOptions, themeOptions?: WhopEmbeddedCheckoutThemeOptions, hideSubmitButton?: boolean, hideTermsAndConditions?: boolean, hideEmail?: boolean, disableEmail?: boolean, hideAddressForm?: boolean, affiliateCode?: string, setupFutureUsage?: "off_session"): string;
129
- declare const EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST: string[];
130
- declare const EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING = "document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";
131
-
132
- export { EMBEDDED_CHECKOUT_IFRAME_SANDBOX_LIST as E, type WhopCheckoutSubmitDetails as W, type WhopCheckoutAddress as a, type WhopCheckoutState as b, type WhopEmbeddedCheckoutStyleOptions as c, type WhopEmbeddedCheckoutPrefillOptions as d, type WhopCheckoutMessage as e, setAddress as f, getEmail as g, getAddress as h, isWhopCheckoutMessage as i, submitCheckoutFrame as j, type WhopEmbeddedCheckoutThemeOptions as k, getEmbeddedCheckoutIframeUrl as l, EMBEDDED_CHECKOUT_IFRAME_ALLOW_STRING as m, onWhopCheckoutMessage as o, parseSetupFutureUsage as p, setEmail as s };