@whop/embedded-components-vanilla-js 0.0.5-beta.9 → 0.0.6

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.
@@ -60,21 +60,55 @@ interface WhopElement<ElementOptions, ElementEvents extends ListenerSignature<El
60
60
  getSnapshot: () => ElementSnapshot;
61
61
  }
62
62
 
63
+ interface AddPayoutMethodElementEvents {
64
+ error: (error: unknown) => void;
65
+ ready: (element: AddPayoutMethodElement) => void;
66
+ optionsUpdated: (options: AddPayoutMethodElementOptions) => void;
67
+ snapshot: (snapshot: AddPayoutMethodElementSnapshot) => void;
68
+ close: (ev: CustomEvent) => void;
69
+ complete: (ev: CustomEvent<AddPayoutMethodElement>) => void;
70
+ }
71
+ interface AddPayoutMethodElementOptions {
72
+ onReady?: (element: AddPayoutMethodElement) => void;
73
+ onClose?: (ev: CustomEvent) => void;
74
+ onComplete?: (ev: CustomEvent<AddPayoutMethodElement>) => void;
75
+ }
76
+ interface AddPayoutMethodElementSnapshot {
77
+ state: "loading" | "ready";
78
+ }
79
+ type AddPayoutMethodElement = WhopElement<AddPayoutMethodElementOptions, AddPayoutMethodElementEvents, AddPayoutMethodElementSnapshot>;
80
+
81
+ interface AutomaticWithdrawElementEvents {
82
+ error: (error: unknown) => void;
83
+ ready: (element: AutomaticWithdrawElement) => void;
84
+ optionsUpdated: (options: AutomaticWithdrawElementOptions) => void;
85
+ snapshot: (snapshot: AutomaticWithdrawElementSnapshot) => void;
86
+ close: (ev: CustomEvent) => void;
87
+ complete: (ev: CustomEvent<AutomaticWithdrawElement>) => void;
88
+ }
89
+ interface AutomaticWithdrawElementOptions {
90
+ onReady?: (element: AutomaticWithdrawElement) => void;
91
+ onClose?: (ev: CustomEvent) => void;
92
+ onComplete?: (ev: CustomEvent<AutomaticWithdrawElement>) => void;
93
+ }
94
+ interface AutomaticWithdrawElementSnapshot {
95
+ state: "loading" | "ready";
96
+ }
97
+ type AutomaticWithdrawElement = WhopElement<AutomaticWithdrawElementOptions, AutomaticWithdrawElementEvents, AutomaticWithdrawElementSnapshot>;
98
+
63
99
  interface BalanceElementEvents {
64
100
  error: (error: unknown) => void;
65
101
  ready: (element: BalanceElement) => void;
66
102
  optionsUpdated: (options: BalanceElementOptions) => void;
67
103
  snapshot: (snapshot: BalanceElementSnapshot) => void;
68
- showTotalBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
69
- showPendingBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
104
+ showAvailableBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
70
105
  showRegularReserveBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
71
106
  showBnplReserveBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
72
107
  }
73
108
  interface BalanceElementOptions {
74
109
  hidePendingBalance?: boolean;
75
110
  onReady?: (element: BalanceElement) => void;
76
- onShowTotalBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
77
- onShowPendingBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
111
+ onShowAvailableBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
78
112
  onShowRegularReserveBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
79
113
  onShowBnplReserveBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
80
114
  }
@@ -140,22 +174,6 @@ interface GenerateWithdrawalReceiptElementSnapshot {
140
174
  }
141
175
  type GenerateWithdrawalReceiptElement = WhopElement<GenerateWithdrawalReceiptElementOptions, GenerateWithdrawalReceiptElementEvents, GenerateWithdrawalReceiptElementSnapshot>;
142
176
 
143
- interface PendingBalanceBreakdownElementEvents {
144
- error: (error: unknown) => void;
145
- ready: (element: PendingBalanceBreakdownElement) => void;
146
- optionsUpdated: (options: PendingBalanceBreakdownElementOptions) => void;
147
- close: (ev: CustomEvent) => void;
148
- snapshot: (snapshot: PendingBalanceBreakdownElementSnapshot) => void;
149
- }
150
- interface PendingBalanceBreakdownElementOptions {
151
- onReady?: (element: PendingBalanceBreakdownElement) => void;
152
- onClose?: (ev: CustomEvent) => void;
153
- }
154
- interface PendingBalanceBreakdownElementSnapshot {
155
- state: "loading" | "ready";
156
- }
157
- type PendingBalanceBreakdownElement = WhopElement<PendingBalanceBreakdownElementOptions, PendingBalanceBreakdownElementEvents, PendingBalanceBreakdownElementSnapshot>;
158
-
159
177
  interface RegularReserveBalanceBreakdownElementEvents {
160
178
  error: (error: unknown) => void;
161
179
  ready: (element: RegularReserveBalanceBreakdownElement) => void;
@@ -394,12 +412,20 @@ interface PayoutsSessionEvents {
394
412
  ready: () => void;
395
413
  }
396
414
  type PayoutsSessionElements = {
415
+ "add-payout-method-element": [
416
+ AddPayoutMethodElementOptions,
417
+ AddPayoutMethodElement
418
+ ];
397
419
  "balance-element": [BalanceElementOptions, BalanceElement];
398
420
  "withdraw-button-element": [
399
421
  WithdrawButtonElementOptions,
400
422
  WithdrawButtonElement
401
423
  ];
402
424
  "withdraw-element": [WithdrawElementOptions, WithdrawElement];
425
+ "automatic-withdraw-element": [
426
+ AutomaticWithdrawElementOptions,
427
+ AutomaticWithdrawElement
428
+ ];
403
429
  "verify-element": [VerifyElementOptions, VerifyElement];
404
430
  "withdrawals-element": [WithdrawalsElementOptions, WithdrawalsElement];
405
431
  "withdrawal-breakdown-element": [
@@ -423,10 +449,6 @@ type PayoutsSessionElements = {
423
449
  TotalBalanceBreakdownElementOptions,
424
450
  TotalBalanceBreakdownElement
425
451
  ];
426
- "pending-balance-breakdown-element": [
427
- PendingBalanceBreakdownElementOptions,
428
- PendingBalanceBreakdownElement
429
- ];
430
452
  "generate-withdrawal-receipt-element": [
431
453
  GenerateWithdrawalReceiptElementOptions,
432
454
  GenerateWithdrawalReceiptElement
@@ -441,12 +463,13 @@ interface PayoutsSession extends TypedEmitter<PayoutsSessionEvents> {
441
463
  type: T;
442
464
  }, options: PayoutsSessionElements[T][0]): PayoutsSessionElements[T][1];
443
465
  showWithdrawModal: <Force extends boolean = false>(options: WithdrawElementOptions | ((modal: ModalContainer) => WithdrawElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
466
+ showAddPayoutMethodModal: <Force extends boolean = false>(options: AddPayoutMethodElementOptions | ((modal: ModalContainer) => AddPayoutMethodElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
467
+ showAutomaticWithdrawModal: <Force extends boolean = false>(options: AutomaticWithdrawElementOptions | ((modal: ModalContainer) => AutomaticWithdrawElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
444
468
  showVerifyModal: <Force extends boolean = false>(options: VerifyElementOptions | ((modal: ModalContainer) => VerifyElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
445
469
  showWithdrawalBreakdownModal: <Force extends boolean = false>(options: WithdrawalBreakdownElementOptions | ((modal: ModalContainer) => WithdrawalBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
446
470
  showChangeAccountCountryModal: <Force extends boolean = false>(options: ChangeAccountCountryElementOptions | ((modal: ModalContainer) => ChangeAccountCountryElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
447
471
  showResetAccountModal: <Force extends boolean = false>(options: ResetAccountElementOptions | ((modal: ModalContainer) => ResetAccountElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
448
472
  showTotalBalanceBreakdownModal: <Force extends boolean = false>(options: TotalBalanceBreakdownElementOptions | ((modal: ModalContainer) => TotalBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
449
- showPendingBalanceBreakdownModal: <Force extends boolean = false>(options: PendingBalanceBreakdownElementOptions | ((modal: ModalContainer) => PendingBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
450
473
  showRegularReserveBalanceBreakdownModal: <Force extends boolean = false>(options: RegularReserveBalanceBreakdownElementOptions | ((modal: ModalContainer) => RegularReserveBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
451
474
  showBnplReserveBalanceBreakdownModal: <Force extends boolean = false>(options: BnplReserveBalanceBreakdownElementOptions | ((modal: ModalContainer) => BnplReserveBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
452
475
  showGenerateWithdrawalReceiptModal: <Force extends boolean = false>(options: GenerateWithdrawalReceiptElementOptions | ((modal: ModalContainer) => GenerateWithdrawalReceiptElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
@@ -457,6 +480,7 @@ declare global {
457
480
  WhopElements: WhopElementsConstructor;
458
481
  }
459
482
  }
483
+ type WhopElementsEnvironment = "production" | "sandbox";
460
484
  type WhopElementsOptions = {
461
485
  /**
462
486
  * Customize the appearance of the Whop embedded Elements
@@ -468,6 +492,13 @@ type WhopElementsOptions = {
468
492
  * @default "en"
469
493
  */
470
494
  locale?: I18nSupportedLocale;
495
+ /**
496
+ * The environment to use for API calls.
497
+ * Use "sandbox" for testing with sandbox-components-api.whop.com
498
+ *
499
+ * @default "production"
500
+ */
501
+ environment?: WhopElementsEnvironment;
471
502
  };
472
503
  type WhopElementsConstructor = {
473
504
  new (options?: WhopElementsOptions): WhopElements;
@@ -481,4 +512,4 @@ interface WhopElementsEvents {
481
512
  optionsUpdated: (options: WhopElementsOptions) => void;
482
513
  }
483
514
 
484
- export type { Appearance, BalanceElement, BalanceElementOptions, BalanceElementSnapshot, BnplReserveBalanceBreakdownElement, BnplReserveBalanceBreakdownElementOptions, BnplReserveBalanceBreakdownElementSnapshot, ChangeAccountCountryElement, ChangeAccountCountryElementOptions, ChangeAccountCountryElementSnapshot, ExpandedPayoutsSessionOptions, GenerateWithdrawalReceiptElement, GenerateWithdrawalReceiptElementOptions, GenerateWithdrawalReceiptElementSnapshot, GetToken, I18nSupportedLocale, PayoutsSession, PayoutsSessionElements, PayoutsSessionEvents, PayoutsSessionOptions, PendingBalanceBreakdownElement, PendingBalanceBreakdownElementOptions, PendingBalanceBreakdownElementSnapshot, RegularReserveBalanceBreakdownElement, RegularReserveBalanceBreakdownElementOptions, RegularReserveBalanceBreakdownElementSnapshot, ResetAccountElement, ResetAccountElementOptions, ResetAccountElementSnapshot, StatusBannerElement, StatusBannerElementOptions, StatusBannerElementSnapshot, StatusBannerType, TotalBalanceBreakdownElement, TotalBalanceBreakdownElementOptions, TotalBalanceBreakdownElementSnapshot, VerifyElement, VerifyElementOptions, VerifyElementSnapshot, WhopElement, WhopElements, WhopElementsConstructor, WhopElementsEvents, WhopElementsOptions, WithdrawButtonElement, WithdrawButtonElementOptions, WithdrawElement, WithdrawElementOptions, WithdrawElementSnapshot, WithdrawalBreakdownElement, WithdrawalBreakdownElementOptions, WithdrawalBreakdownElementSnapshot, WithdrawalsElement, WithdrawalsElementOptions, WithdrawalsElementSnapshot };
515
+ export type { AddPayoutMethodElement, AddPayoutMethodElementOptions, AddPayoutMethodElementSnapshot, Appearance, AutomaticWithdrawElement, AutomaticWithdrawElementOptions, AutomaticWithdrawElementSnapshot, BalanceElement, BalanceElementOptions, BalanceElementSnapshot, BnplReserveBalanceBreakdownElement, BnplReserveBalanceBreakdownElementOptions, BnplReserveBalanceBreakdownElementSnapshot, ChangeAccountCountryElement, ChangeAccountCountryElementOptions, ChangeAccountCountryElementSnapshot, ExpandedPayoutsSessionOptions, GenerateWithdrawalReceiptElement, GenerateWithdrawalReceiptElementOptions, GenerateWithdrawalReceiptElementSnapshot, GetToken, I18nSupportedLocale, PayoutsSession, PayoutsSessionElements, PayoutsSessionEvents, PayoutsSessionOptions, RegularReserveBalanceBreakdownElement, RegularReserveBalanceBreakdownElementOptions, RegularReserveBalanceBreakdownElementSnapshot, ResetAccountElement, ResetAccountElementOptions, ResetAccountElementSnapshot, StatusBannerElement, StatusBannerElementOptions, StatusBannerElementSnapshot, StatusBannerType, TotalBalanceBreakdownElement, TotalBalanceBreakdownElementOptions, TotalBalanceBreakdownElementSnapshot, VerifyElement, VerifyElementOptions, VerifyElementSnapshot, WhopElement, WhopElements, WhopElementsConstructor, WhopElementsEnvironment, 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-5-beta-9.elements.whop.com/";
25
+ const ORIGIN = "https://0-0-6.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
@@ -1,3 +1,3 @@
1
- const ORIGIN = "https://0-0-5-beta-9.elements.whop.com/";
1
+ const ORIGIN = "https://0-0-6.elements.whop.com/";
2
2
  const SCRIPT_URL = new URL(`/release/elements.js`, ORIGIN).toString();
3
3
  export { ORIGIN, SCRIPT_URL };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whop/embedded-components-vanilla-js",
3
- "version": "0.0.5-beta.9",
3
+ "version": "0.0.6",
4
4
  "description": "Whop Elements loading utility",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",