@whop/embedded-components-vanilla-js 0.0.3-beta.1 → 0.0.3

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.
@@ -70,9 +70,19 @@ type CSSValue = string;
70
70
  type CSSProps = Record<string, CSSValue>;
71
71
  type Classes = Record<string, CSSProps>;
72
72
  type Variables = Partial<Record<CSSVariableKeys, string>>;
73
+ type Theme = {
74
+ appearance?: "light" | "dark" | "inherit";
75
+ accentColor?: "ruby" | "blue" | "red" | "yellow" | "green" | "gray" | "tomato" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "cyan" | "teal" | "jade" | "grass" | "brown" | "orange" | "indigo" | "sky" | "mint" | "amber" | "lime" | "lemon" | "magenta" | "gold" | "bronze";
76
+ grayColor?: "gray" | "mauve" | "slate" | "sage" | "olive" | "sand" | "auto";
77
+ dangerColor?: "ruby" | "red" | "tomato";
78
+ warningColor?: "yellow" | "amber";
79
+ successColor?: "green" | "teal" | "jade" | "grass";
80
+ infoColor?: "sky" | "blue";
81
+ };
73
82
  type Appearance = {
74
83
  variables?: Variables | null;
75
84
  classes?: Classes | null;
85
+ theme?: Theme | null;
76
86
  };
77
87
 
78
88
  interface EmbeddableElement {
@@ -119,16 +129,40 @@ interface BalanceElementEvents {
119
129
  ready: (element: BalanceElement) => void;
120
130
  optionsUpdated: (options: BalanceElementOptions) => void;
121
131
  snapshot: (snapshot: BalanceElementSnapshot) => void;
132
+ showTotalBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
133
+ showPendingBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
134
+ showRegularReserveBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
135
+ showBnplReserveBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
122
136
  }
123
137
  interface BalanceElementOptions {
124
138
  hidePendingBalance?: boolean;
125
139
  onReady?: (element: BalanceElement) => void;
140
+ onShowTotalBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
141
+ onShowPendingBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
142
+ onShowRegularReserveBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
143
+ onShowBnplReserveBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
126
144
  }
127
145
  interface BalanceElementSnapshot {
128
146
  state: "loading" | "ready";
129
147
  }
130
148
  type BalanceElement = WhopElement<BalanceElementOptions, BalanceElementEvents, BalanceElementSnapshot>;
131
149
 
150
+ interface BnplReserveBalanceBreakdownElementEvents {
151
+ error: (error: unknown) => void;
152
+ ready: (element: BnplReserveBalanceBreakdownElement) => void;
153
+ optionsUpdated: (options: BnplReserveBalanceBreakdownElementOptions) => void;
154
+ close: (ev: CustomEvent) => void;
155
+ snapshot: (snapshot: BnplReserveBalanceBreakdownElementSnapshot) => void;
156
+ }
157
+ interface BnplReserveBalanceBreakdownElementOptions {
158
+ onReady?: (element: BnplReserveBalanceBreakdownElement) => void;
159
+ onClose?: (ev: CustomEvent) => void;
160
+ }
161
+ interface BnplReserveBalanceBreakdownElementSnapshot {
162
+ state: "loading" | "ready";
163
+ }
164
+ type BnplReserveBalanceBreakdownElement = WhopElement<BnplReserveBalanceBreakdownElementOptions, BnplReserveBalanceBreakdownElementEvents, BnplReserveBalanceBreakdownElementSnapshot>;
165
+
132
166
  interface ChangeAccountCountryElementEvents {
133
167
  error: (error: unknown) => void;
134
168
  ready: (element: ChangeAccountCountryElement) => void;
@@ -151,6 +185,38 @@ interface ChangeAccountCountryElementSnapshot {
151
185
  }
152
186
  type ChangeAccountCountryElement = WhopElement<ChangeAccountCountryElementOptions, ChangeAccountCountryElementEvents, ChangeAccountCountryElementSnapshot>;
153
187
 
188
+ interface PendingBalanceBreakdownElementEvents {
189
+ error: (error: unknown) => void;
190
+ ready: (element: PendingBalanceBreakdownElement) => void;
191
+ optionsUpdated: (options: PendingBalanceBreakdownElementOptions) => void;
192
+ close: (ev: CustomEvent) => void;
193
+ snapshot: (snapshot: PendingBalanceBreakdownElementSnapshot) => void;
194
+ }
195
+ interface PendingBalanceBreakdownElementOptions {
196
+ onReady?: (element: PendingBalanceBreakdownElement) => void;
197
+ onClose?: (ev: CustomEvent) => void;
198
+ }
199
+ interface PendingBalanceBreakdownElementSnapshot {
200
+ state: "loading" | "ready";
201
+ }
202
+ type PendingBalanceBreakdownElement = WhopElement<PendingBalanceBreakdownElementOptions, PendingBalanceBreakdownElementEvents, PendingBalanceBreakdownElementSnapshot>;
203
+
204
+ interface RegularReserveBalanceBreakdownElementEvents {
205
+ error: (error: unknown) => void;
206
+ ready: (element: RegularReserveBalanceBreakdownElement) => void;
207
+ optionsUpdated: (options: RegularReserveBalanceBreakdownElementOptions) => void;
208
+ close: (ev: CustomEvent) => void;
209
+ snapshot: (snapshot: RegularReserveBalanceBreakdownElementSnapshot) => void;
210
+ }
211
+ interface RegularReserveBalanceBreakdownElementOptions {
212
+ onReady?: (element: RegularReserveBalanceBreakdownElement) => void;
213
+ onClose?: (ev: CustomEvent) => void;
214
+ }
215
+ interface RegularReserveBalanceBreakdownElementSnapshot {
216
+ state: "loading" | "ready";
217
+ }
218
+ type RegularReserveBalanceBreakdownElement = WhopElement<RegularReserveBalanceBreakdownElementOptions, RegularReserveBalanceBreakdownElementEvents, RegularReserveBalanceBreakdownElementSnapshot>;
219
+
154
220
  interface ResetAccountElementEvents {
155
221
  error: (error: unknown) => void;
156
222
  ready: (element: ResetAccountElement) => void;
@@ -169,6 +235,22 @@ interface ResetAccountElementSnapshot {
169
235
  }
170
236
  type ResetAccountElement = WhopElement<ResetAccountElementOptions, ResetAccountElementEvents, ResetAccountElementSnapshot>;
171
237
 
238
+ interface TotalBalanceBreakdownElementEvents {
239
+ error: (error: unknown) => void;
240
+ ready: (element: TotalBalanceBreakdownElement) => void;
241
+ optionsUpdated: (options: TotalBalanceBreakdownElementOptions) => void;
242
+ close: (ev: CustomEvent) => void;
243
+ snapshot: (snapshot: TotalBalanceBreakdownElementSnapshot) => void;
244
+ }
245
+ interface TotalBalanceBreakdownElementOptions {
246
+ onReady?: (element: TotalBalanceBreakdownElement) => void;
247
+ onClose?: (ev: CustomEvent) => void;
248
+ }
249
+ interface TotalBalanceBreakdownElementSnapshot {
250
+ state: "loading" | "ready";
251
+ }
252
+ type TotalBalanceBreakdownElement = WhopElement<TotalBalanceBreakdownElementOptions, TotalBalanceBreakdownElementEvents, TotalBalanceBreakdownElementSnapshot>;
253
+
172
254
  interface VerifyElementEvents {
173
255
  error: (error: unknown) => void;
174
256
  ready: (element: VerifyElement) => void;
@@ -310,6 +392,10 @@ interface PayoutsSessionOptions {
310
392
  * @default "USD"
311
393
  */
312
394
  currency?: string;
395
+ /**
396
+ * The company ID to use in the Elements
397
+ */
398
+ companyId: string;
313
399
  }
314
400
  interface ExpandedPayoutsSessionOptions extends PayoutsSessionOptions {
315
401
  }
@@ -337,6 +423,22 @@ type PayoutsSessionElements = {
337
423
  ChangeAccountCountryElement
338
424
  ];
339
425
  "reset-account-element": [ResetAccountElementOptions, ResetAccountElement];
426
+ "regular-reserve-balance-breakdown-element": [
427
+ RegularReserveBalanceBreakdownElementOptions,
428
+ RegularReserveBalanceBreakdownElement
429
+ ];
430
+ "bnpl-reserve-balance-breakdown-element": [
431
+ BnplReserveBalanceBreakdownElementOptions,
432
+ BnplReserveBalanceBreakdownElement
433
+ ];
434
+ "total-balance-breakdown-element": [
435
+ TotalBalanceBreakdownElementOptions,
436
+ TotalBalanceBreakdownElement
437
+ ];
438
+ "pending-balance-breakdown-element": [
439
+ PendingBalanceBreakdownElementOptions,
440
+ PendingBalanceBreakdownElement
441
+ ];
340
442
  };
341
443
  interface PayoutsSession extends TypedEmitter<PayoutsSessionEvents> {
342
444
  token: Promise<string | null>;
@@ -350,6 +452,10 @@ interface PayoutsSession extends TypedEmitter<PayoutsSessionEvents> {
350
452
  showWithdrawalBreakdownModal: <Force extends boolean = false>(options: WithdrawalBreakdownElementOptions | ((modal: ModalContainer) => WithdrawalBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
351
453
  showChangeAccountCountryModal: <Force extends boolean = false>(options: ChangeAccountCountryElementOptions | ((modal: ModalContainer) => ChangeAccountCountryElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
352
454
  showResetAccountModal: <Force extends boolean = false>(options: ResetAccountElementOptions | ((modal: ModalContainer) => ResetAccountElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
455
+ showTotalBalanceBreakdownModal: <Force extends boolean = false>(options: TotalBalanceBreakdownElementOptions | ((modal: ModalContainer) => TotalBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
456
+ showPendingBalanceBreakdownModal: <Force extends boolean = false>(options: PendingBalanceBreakdownElementOptions | ((modal: ModalContainer) => PendingBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
457
+ showRegularReserveBalanceBreakdownModal: <Force extends boolean = false>(options: RegularReserveBalanceBreakdownElementOptions | ((modal: ModalContainer) => RegularReserveBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
458
+ showBnplReserveBalanceBreakdownModal: <Force extends boolean = false>(options: BnplReserveBalanceBreakdownElementOptions | ((modal: ModalContainer) => BnplReserveBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
353
459
  }
354
460
 
355
461
  declare global {
@@ -381,4 +487,4 @@ interface WhopElementsEvents {
381
487
  optionsUpdated: (options: WhopElementsOptions) => void;
382
488
  }
383
489
 
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 };
490
+ export type { Appearance, BalanceElement, BalanceElementOptions, BalanceElementSnapshot, BnplReserveBalanceBreakdownElement, BnplReserveBalanceBreakdownElementOptions, BnplReserveBalanceBreakdownElementSnapshot, CSSVariableKeys, ChangeAccountCountryElement, ChangeAccountCountryElementOptions, ChangeAccountCountryElementSnapshot, ExpandedPayoutsSessionOptions, GetToken, I18nSupportedLocale, PayoutsSession, PayoutsSessionEvents, PayoutsSessionOptions, PendingBalanceBreakdownElement, PendingBalanceBreakdownElementOptions, PendingBalanceBreakdownElementSnapshot, RegularReserveBalanceBreakdownElement, RegularReserveBalanceBreakdownElementOptions, RegularReserveBalanceBreakdownElementSnapshot, ResetAccountElement, ResetAccountElementOptions, ResetAccountElementSnapshot, TotalBalanceBreakdownElement, TotalBalanceBreakdownElementOptions, TotalBalanceBreakdownElementSnapshot, 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-3-beta-1.elements.whop.com/";
25
+ const ORIGIN = "https://0-0-3.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-3-beta-1.elements.whop.com/";
1
+ const ORIGIN = "https://0-0-3.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.3-beta.1",
3
+ "version": "0.0.3",
4
4
  "description": "Whop Elements loading utility",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",