@whop/embedded-components-vanilla-js 0.0.1 → 0.0.3-beta.1
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/dist/lib/index.d.ts +114 -13
- package/dist/url.js +1 -1
- package/dist/url.mjs +1 -1
- package/package.json +1 -1
package/dist/lib/index.d.ts
CHANGED
|
@@ -129,6 +129,64 @@ interface BalanceElementSnapshot {
|
|
|
129
129
|
}
|
|
130
130
|
type BalanceElement = WhopElement<BalanceElementOptions, BalanceElementEvents, BalanceElementSnapshot>;
|
|
131
131
|
|
|
132
|
+
interface ChangeAccountCountryElementEvents {
|
|
133
|
+
error: (error: unknown) => void;
|
|
134
|
+
ready: (element: ChangeAccountCountryElement) => void;
|
|
135
|
+
optionsUpdated: (options: ChangeAccountCountryElementOptions) => void;
|
|
136
|
+
close: (ev: CustomEvent) => void;
|
|
137
|
+
snapshot: (snapshot: ChangeAccountCountryElementSnapshot) => void;
|
|
138
|
+
countryChanged: (ev: CustomEvent<{
|
|
139
|
+
country: string;
|
|
140
|
+
}>) => void;
|
|
141
|
+
}
|
|
142
|
+
interface ChangeAccountCountryElementOptions {
|
|
143
|
+
onReady?: (element: ChangeAccountCountryElement) => void;
|
|
144
|
+
onClose?: (ev: CustomEvent) => void;
|
|
145
|
+
onCountryChanged?: (ev: CustomEvent<{
|
|
146
|
+
country: string;
|
|
147
|
+
}>) => void;
|
|
148
|
+
}
|
|
149
|
+
interface ChangeAccountCountryElementSnapshot {
|
|
150
|
+
state: "loading" | "ready";
|
|
151
|
+
}
|
|
152
|
+
type ChangeAccountCountryElement = WhopElement<ChangeAccountCountryElementOptions, ChangeAccountCountryElementEvents, ChangeAccountCountryElementSnapshot>;
|
|
153
|
+
|
|
154
|
+
interface ResetAccountElementEvents {
|
|
155
|
+
error: (error: unknown) => void;
|
|
156
|
+
ready: (element: ResetAccountElement) => void;
|
|
157
|
+
optionsUpdated: (options: ResetAccountElementOptions) => void;
|
|
158
|
+
close: (ev: CustomEvent) => void;
|
|
159
|
+
snapshot: (snapshot: ResetAccountElementSnapshot) => void;
|
|
160
|
+
reset: (ev: CustomEvent) => void;
|
|
161
|
+
}
|
|
162
|
+
interface ResetAccountElementOptions {
|
|
163
|
+
onReady?: (element: ResetAccountElement) => void;
|
|
164
|
+
onClose?: (ev: CustomEvent) => void;
|
|
165
|
+
onReset?: (ev: CustomEvent) => void;
|
|
166
|
+
}
|
|
167
|
+
interface ResetAccountElementSnapshot {
|
|
168
|
+
state: "loading" | "ready";
|
|
169
|
+
}
|
|
170
|
+
type ResetAccountElement = WhopElement<ResetAccountElementOptions, ResetAccountElementEvents, ResetAccountElementSnapshot>;
|
|
171
|
+
|
|
172
|
+
interface VerifyElementEvents {
|
|
173
|
+
error: (error: unknown) => void;
|
|
174
|
+
ready: (element: VerifyElement) => void;
|
|
175
|
+
optionsUpdated: (options: VerifyElementOptions) => void;
|
|
176
|
+
close: (ev: CustomEvent) => void;
|
|
177
|
+
snapshot: (snapshot: VerifyElementSnapshot) => void;
|
|
178
|
+
}
|
|
179
|
+
interface VerifyElementOptions {
|
|
180
|
+
includeControls?: boolean;
|
|
181
|
+
onReady?: (element: VerifyElement) => void;
|
|
182
|
+
onVerificationSubmitted?: () => void;
|
|
183
|
+
onClose?: (ev: CustomEvent) => void;
|
|
184
|
+
}
|
|
185
|
+
interface VerifyElementSnapshot {
|
|
186
|
+
state: "loading" | "ready";
|
|
187
|
+
}
|
|
188
|
+
type VerifyElement = WhopElement<VerifyElementOptions, VerifyElementEvents, VerifyElementSnapshot>;
|
|
189
|
+
|
|
132
190
|
interface WithdrawButtonElementEvents {
|
|
133
191
|
error: (error: unknown) => void;
|
|
134
192
|
ready: (element: WithdrawButtonElement) => void;
|
|
@@ -136,12 +194,14 @@ interface WithdrawButtonElementEvents {
|
|
|
136
194
|
verify: (ev: CustomEvent<WithdrawButtonElement>) => void;
|
|
137
195
|
withdraw: (ev: CustomEvent<WithdrawButtonElement>) => void;
|
|
138
196
|
snapshot: (snapshot: WithdrawButtonElementSnapshot) => void;
|
|
197
|
+
verificationSubmitted: (ev: CustomEvent<WithdrawButtonElement>) => void;
|
|
198
|
+
withdrawalRequested: (ev: CustomEvent<WithdrawButtonElement>) => void;
|
|
139
199
|
}
|
|
140
200
|
interface WithdrawButtonElementOptions {
|
|
141
201
|
hidePendingBalance?: boolean;
|
|
142
202
|
onReady?: (element: WithdrawButtonElement) => void;
|
|
143
|
-
onVerificationSubmitted?: () => void;
|
|
144
|
-
|
|
203
|
+
onVerificationSubmitted?: (ev: CustomEvent<WithdrawButtonElement>) => void;
|
|
204
|
+
onWithdrawalRequested?: (ev: CustomEvent<WithdrawButtonElement>) => void;
|
|
145
205
|
}
|
|
146
206
|
interface WithdrawButtonElementSnapshot {
|
|
147
207
|
state: "loading" | "ready";
|
|
@@ -166,23 +226,49 @@ interface WithdrawElementSnapshot {
|
|
|
166
226
|
}
|
|
167
227
|
type WithdrawElement = WhopElement<WithdrawElementOptions, WithdrawElementEvents, WithdrawElementSnapshot>;
|
|
168
228
|
|
|
169
|
-
interface
|
|
229
|
+
interface WithdrawalBreakdownElementEvents {
|
|
170
230
|
error: (error: unknown) => void;
|
|
171
|
-
ready: (element:
|
|
172
|
-
optionsUpdated: (options:
|
|
231
|
+
ready: (element: WithdrawalBreakdownElement) => void;
|
|
232
|
+
optionsUpdated: (options: WithdrawalBreakdownElementOptions) => void;
|
|
173
233
|
close: (ev: CustomEvent) => void;
|
|
174
|
-
snapshot: (snapshot:
|
|
234
|
+
snapshot: (snapshot: WithdrawalBreakdownElementSnapshot) => void;
|
|
175
235
|
}
|
|
176
|
-
interface
|
|
177
|
-
|
|
178
|
-
onReady?: (element:
|
|
179
|
-
onVerificationSubmitted?: () => void;
|
|
236
|
+
interface WithdrawalBreakdownElementOptions {
|
|
237
|
+
withdrawalId: string;
|
|
238
|
+
onReady?: (element: WithdrawalBreakdownElement) => void;
|
|
180
239
|
onClose?: (ev: CustomEvent) => void;
|
|
181
240
|
}
|
|
182
|
-
interface
|
|
241
|
+
interface WithdrawalBreakdownElementSnapshot {
|
|
183
242
|
state: "loading" | "ready";
|
|
184
243
|
}
|
|
185
|
-
type
|
|
244
|
+
type WithdrawalBreakdownElement = WhopElement<WithdrawalBreakdownElementOptions, WithdrawalBreakdownElementEvents, WithdrawalBreakdownElementSnapshot>;
|
|
245
|
+
|
|
246
|
+
interface WithdrawalsElementEvents {
|
|
247
|
+
error: (error: unknown) => void;
|
|
248
|
+
ready: (element: WithdrawalsElement) => void;
|
|
249
|
+
optionsUpdated: (options: WithdrawalsElementOptions) => void;
|
|
250
|
+
snapshot: (snapshot: WithdrawalsElementSnapshot) => void;
|
|
251
|
+
showWithdrawalBreakdown: (ev: CustomEvent<{
|
|
252
|
+
withdrawalId: string;
|
|
253
|
+
}>) => void;
|
|
254
|
+
}
|
|
255
|
+
interface WithdrawalsElementOptions {
|
|
256
|
+
onReady?: (element: WithdrawalsElement) => void;
|
|
257
|
+
}
|
|
258
|
+
interface WithdrawalsElementSnapshot {
|
|
259
|
+
state: "loading" | "ready";
|
|
260
|
+
}
|
|
261
|
+
type WithdrawalsElement = WhopElement<WithdrawalsElementOptions, WithdrawalsElementEvents, WithdrawalsElementSnapshot>;
|
|
262
|
+
|
|
263
|
+
interface ModalContainer {
|
|
264
|
+
overlay: HTMLElement;
|
|
265
|
+
modal: HTMLElement;
|
|
266
|
+
content: HTMLElement;
|
|
267
|
+
mount: () => void;
|
|
268
|
+
close: () => void;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** elements types */
|
|
186
272
|
|
|
187
273
|
type GetToken = (opts: {
|
|
188
274
|
abortSignal: AbortSignal;
|
|
@@ -241,6 +327,16 @@ type PayoutsSessionElements = {
|
|
|
241
327
|
];
|
|
242
328
|
"withdraw-element": [WithdrawElementOptions, WithdrawElement];
|
|
243
329
|
"verify-element": [VerifyElementOptions, VerifyElement];
|
|
330
|
+
"withdrawals-element": [WithdrawalsElementOptions, WithdrawalsElement];
|
|
331
|
+
"withdrawal-breakdown-element": [
|
|
332
|
+
WithdrawalBreakdownElementOptions,
|
|
333
|
+
WithdrawalBreakdownElement
|
|
334
|
+
];
|
|
335
|
+
"change-account-country-element": [
|
|
336
|
+
ChangeAccountCountryElementOptions,
|
|
337
|
+
ChangeAccountCountryElement
|
|
338
|
+
];
|
|
339
|
+
"reset-account-element": [ResetAccountElementOptions, ResetAccountElement];
|
|
244
340
|
};
|
|
245
341
|
interface PayoutsSession extends TypedEmitter<PayoutsSessionEvents> {
|
|
246
342
|
token: Promise<string | null>;
|
|
@@ -249,6 +345,11 @@ interface PayoutsSession extends TypedEmitter<PayoutsSessionEvents> {
|
|
|
249
345
|
createElement<T extends keyof PayoutsSessionElements>(type: T | {
|
|
250
346
|
type: T;
|
|
251
347
|
}, options: PayoutsSessionElements[T][0]): PayoutsSessionElements[T][1];
|
|
348
|
+
showWithdrawModal: <Force extends boolean = false>(options: WithdrawElementOptions | ((modal: ModalContainer) => WithdrawElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
|
|
349
|
+
showVerifyModal: <Force extends boolean = false>(options: VerifyElementOptions | ((modal: ModalContainer) => VerifyElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
|
|
350
|
+
showWithdrawalBreakdownModal: <Force extends boolean = false>(options: WithdrawalBreakdownElementOptions | ((modal: ModalContainer) => WithdrawalBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
|
|
351
|
+
showChangeAccountCountryModal: <Force extends boolean = false>(options: ChangeAccountCountryElementOptions | ((modal: ModalContainer) => ChangeAccountCountryElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
|
|
352
|
+
showResetAccountModal: <Force extends boolean = false>(options: ResetAccountElementOptions | ((modal: ModalContainer) => ResetAccountElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
|
|
252
353
|
}
|
|
253
354
|
|
|
254
355
|
declare global {
|
|
@@ -280,4 +381,4 @@ interface WhopElementsEvents {
|
|
|
280
381
|
optionsUpdated: (options: WhopElementsOptions) => void;
|
|
281
382
|
}
|
|
282
383
|
|
|
283
|
-
export type { Appearance, BalanceElement, BalanceElementOptions, BalanceElementSnapshot, CSSVariableKeys, ExpandedPayoutsSessionOptions, GetToken, I18nSupportedLocale, PayoutsSession, PayoutsSessionEvents, PayoutsSessionOptions, VerifyElement, VerifyElementOptions, VerifyElementSnapshot, WhopElement, WhopElements, WhopElementsConstructor, WhopElementsEvents, WhopElementsOptions, WithdrawButtonElement, WithdrawButtonElementOptions, WithdrawElement, WithdrawElementOptions, WithdrawElementSnapshot };
|
|
384
|
+
export type { Appearance, BalanceElement, BalanceElementOptions, BalanceElementSnapshot, CSSVariableKeys, ChangeAccountCountryElement, ChangeAccountCountryElementOptions, ChangeAccountCountryElementSnapshot, ExpandedPayoutsSessionOptions, GetToken, I18nSupportedLocale, PayoutsSession, PayoutsSessionEvents, PayoutsSessionOptions, ResetAccountElement, ResetAccountElementOptions, ResetAccountElementSnapshot, VerifyElement, VerifyElementOptions, VerifyElementSnapshot, WhopElement, WhopElements, WhopElementsConstructor, WhopElementsEvents, WhopElementsOptions, WithdrawButtonElement, WithdrawButtonElementOptions, WithdrawElement, WithdrawElementOptions, WithdrawElementSnapshot, WithdrawalBreakdownElement, WithdrawalBreakdownElementOptions, WithdrawalBreakdownElementSnapshot, WithdrawalsElement, WithdrawalsElementOptions, WithdrawalsElementSnapshot };
|
package/dist/url.js
CHANGED
|
@@ -22,6 +22,6 @@ __export(url_exports, {
|
|
|
22
22
|
SCRIPT_URL: () => SCRIPT_URL
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(url_exports);
|
|
25
|
-
const ORIGIN = "https://0-0-1.elements.whop.com/";
|
|
25
|
+
const ORIGIN = "https://0-0-3-beta-1.elements.whop.com/";
|
|
26
26
|
const SCRIPT_URL = new URL(`/release/elements.js`, ORIGIN).toString();
|
|
27
27
|
//# sourceMappingURL=url.js.map
|
package/dist/url.mjs
CHANGED