@whop/embedded-components-vanilla-js 0.0.3-beta.2 → 0.0.4-beta.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.
@@ -1,78 +1,23 @@
1
1
  declare const locales: readonly ["en"];
2
2
  type I18nSupportedLocale = (typeof locales)[number];
3
3
 
4
- type CSSVariableKeys =
5
- | "--colorAccent"
6
- | "--colorAccentContrast"
7
- | "--colorDanger"
8
- | "--colorDangerContrast"
9
- | "--colorWarning"
10
- | "--colorWarningContrast"
11
- | "--colorSuccess"
12
- | "--colorSuccessContrast"
13
- | "--colorStroke"
14
- | "--colorTextPrimary"
15
- | "--colorTextSecondary"
16
- | "--colorTextTertiary"
17
- | "--colorBackgroundPrimary"
18
- | "--colorBackgroundPrimaryContrast"
19
- | "--colorBackgroundSecondary"
20
- | "--colorBackgroundSecondaryContrast"
21
- | "--colorSurface"
22
- | "--fontSize1"
23
- | "--fontSize2"
24
- | "--fontSize3"
25
- | "--fontSize4"
26
- | "--fontSize5"
27
- | "--fontSize6"
28
- | "--fontSize7"
29
- | "--fontSize8"
30
- | "--fontSize9"
31
- | "--fontLetterSpacing1"
32
- | "--fontLetterSpacing2"
33
- | "--fontLetterSpacing3"
34
- | "--fontLetterSpacing4"
35
- | "--fontLetterSpacing5"
36
- | "--fontLetterSpacing6"
37
- | "--fontLetterSpacing7"
38
- | "--fontLetterSpacing8"
39
- | "--fontLetterSpacing9"
40
- | "--fontLineHeight1"
41
- | "--fontLineHeight2"
42
- | "--fontLineHeight3"
43
- | "--fontLineHeight4"
44
- | "--fontLineHeight5"
45
- | "--fontLineHeight6"
46
- | "--fontLineHeight7"
47
- | "--fontLineHeight8"
48
- | "--fontLineHeight9"
49
- | "--fontWeightRegular"
50
- | "--fontWeightMedium"
51
- | "--fontWeightSemiBold"
52
- | "--fontWeightBold"
53
- | "--shadowSize1"
54
- | "--cursorButton"
55
- | "--spacing1"
56
- | "--spacing2"
57
- | "--spacing3"
58
- | "--spacing4"
59
- | "--spacing5"
60
- | "--spacing6"
61
- | "--spacing7"
62
- | "--spacing8"
63
- | "--spacing9"
64
- | "--spacing10"
65
- | "--radius1"
66
- | "--radius2"
67
- | "--spinnerOpacity"
68
-
69
4
  type CSSValue = string;
70
5
  type CSSProps = Record<string, CSSValue>;
71
6
  type Classes = Record<string, CSSProps>;
72
- type Variables = Partial<Record<CSSVariableKeys, string>>;
7
+ type Variables = Record<`--${string}`, string>;
8
+ type Theme = {
9
+ appearance?: "light" | "dark";
10
+ 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";
11
+ grayColor?: "gray" | "mauve" | "slate" | "sage" | "olive" | "sand" | "auto";
12
+ dangerColor?: "ruby" | "red" | "tomato";
13
+ warningColor?: "yellow" | "amber";
14
+ successColor?: "green" | "teal" | "jade" | "grass";
15
+ infoColor?: "sky" | "blue";
16
+ };
73
17
  type Appearance = {
74
18
  variables?: Variables | null;
75
19
  classes?: Classes | null;
20
+ theme?: Theme | null;
76
21
  };
77
22
 
78
23
  interface EmbeddableElement {
@@ -119,16 +64,40 @@ interface BalanceElementEvents {
119
64
  ready: (element: BalanceElement) => void;
120
65
  optionsUpdated: (options: BalanceElementOptions) => void;
121
66
  snapshot: (snapshot: BalanceElementSnapshot) => void;
67
+ showTotalBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
68
+ showPendingBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
69
+ showRegularReserveBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
70
+ showBnplReserveBalanceBreakdown: (ev: CustomEvent<BalanceElement>) => void;
122
71
  }
123
72
  interface BalanceElementOptions {
124
73
  hidePendingBalance?: boolean;
125
74
  onReady?: (element: BalanceElement) => void;
75
+ onShowTotalBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
76
+ onShowPendingBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
77
+ onShowRegularReserveBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
78
+ onShowBnplReserveBalanceBreakdown?: (ev: CustomEvent<BalanceElement>) => void;
126
79
  }
127
80
  interface BalanceElementSnapshot {
128
81
  state: "loading" | "ready";
129
82
  }
130
83
  type BalanceElement = WhopElement<BalanceElementOptions, BalanceElementEvents, BalanceElementSnapshot>;
131
84
 
85
+ interface BnplReserveBalanceBreakdownElementEvents {
86
+ error: (error: unknown) => void;
87
+ ready: (element: BnplReserveBalanceBreakdownElement) => void;
88
+ optionsUpdated: (options: BnplReserveBalanceBreakdownElementOptions) => void;
89
+ close: (ev: CustomEvent) => void;
90
+ snapshot: (snapshot: BnplReserveBalanceBreakdownElementSnapshot) => void;
91
+ }
92
+ interface BnplReserveBalanceBreakdownElementOptions {
93
+ onReady?: (element: BnplReserveBalanceBreakdownElement) => void;
94
+ onClose?: (ev: CustomEvent) => void;
95
+ }
96
+ interface BnplReserveBalanceBreakdownElementSnapshot {
97
+ state: "loading" | "ready";
98
+ }
99
+ type BnplReserveBalanceBreakdownElement = WhopElement<BnplReserveBalanceBreakdownElementOptions, BnplReserveBalanceBreakdownElementEvents, BnplReserveBalanceBreakdownElementSnapshot>;
100
+
132
101
  interface ChangeAccountCountryElementEvents {
133
102
  error: (error: unknown) => void;
134
103
  ready: (element: ChangeAccountCountryElement) => void;
@@ -151,6 +120,38 @@ interface ChangeAccountCountryElementSnapshot {
151
120
  }
152
121
  type ChangeAccountCountryElement = WhopElement<ChangeAccountCountryElementOptions, ChangeAccountCountryElementEvents, ChangeAccountCountryElementSnapshot>;
153
122
 
123
+ interface PendingBalanceBreakdownElementEvents {
124
+ error: (error: unknown) => void;
125
+ ready: (element: PendingBalanceBreakdownElement) => void;
126
+ optionsUpdated: (options: PendingBalanceBreakdownElementOptions) => void;
127
+ close: (ev: CustomEvent) => void;
128
+ snapshot: (snapshot: PendingBalanceBreakdownElementSnapshot) => void;
129
+ }
130
+ interface PendingBalanceBreakdownElementOptions {
131
+ onReady?: (element: PendingBalanceBreakdownElement) => void;
132
+ onClose?: (ev: CustomEvent) => void;
133
+ }
134
+ interface PendingBalanceBreakdownElementSnapshot {
135
+ state: "loading" | "ready";
136
+ }
137
+ type PendingBalanceBreakdownElement = WhopElement<PendingBalanceBreakdownElementOptions, PendingBalanceBreakdownElementEvents, PendingBalanceBreakdownElementSnapshot>;
138
+
139
+ interface RegularReserveBalanceBreakdownElementEvents {
140
+ error: (error: unknown) => void;
141
+ ready: (element: RegularReserveBalanceBreakdownElement) => void;
142
+ optionsUpdated: (options: RegularReserveBalanceBreakdownElementOptions) => void;
143
+ close: (ev: CustomEvent) => void;
144
+ snapshot: (snapshot: RegularReserveBalanceBreakdownElementSnapshot) => void;
145
+ }
146
+ interface RegularReserveBalanceBreakdownElementOptions {
147
+ onReady?: (element: RegularReserveBalanceBreakdownElement) => void;
148
+ onClose?: (ev: CustomEvent) => void;
149
+ }
150
+ interface RegularReserveBalanceBreakdownElementSnapshot {
151
+ state: "loading" | "ready";
152
+ }
153
+ type RegularReserveBalanceBreakdownElement = WhopElement<RegularReserveBalanceBreakdownElementOptions, RegularReserveBalanceBreakdownElementEvents, RegularReserveBalanceBreakdownElementSnapshot>;
154
+
154
155
  interface ResetAccountElementEvents {
155
156
  error: (error: unknown) => void;
156
157
  ready: (element: ResetAccountElement) => void;
@@ -169,6 +170,22 @@ interface ResetAccountElementSnapshot {
169
170
  }
170
171
  type ResetAccountElement = WhopElement<ResetAccountElementOptions, ResetAccountElementEvents, ResetAccountElementSnapshot>;
171
172
 
173
+ interface TotalBalanceBreakdownElementEvents {
174
+ error: (error: unknown) => void;
175
+ ready: (element: TotalBalanceBreakdownElement) => void;
176
+ optionsUpdated: (options: TotalBalanceBreakdownElementOptions) => void;
177
+ close: (ev: CustomEvent) => void;
178
+ snapshot: (snapshot: TotalBalanceBreakdownElementSnapshot) => void;
179
+ }
180
+ interface TotalBalanceBreakdownElementOptions {
181
+ onReady?: (element: TotalBalanceBreakdownElement) => void;
182
+ onClose?: (ev: CustomEvent) => void;
183
+ }
184
+ interface TotalBalanceBreakdownElementSnapshot {
185
+ state: "loading" | "ready";
186
+ }
187
+ type TotalBalanceBreakdownElement = WhopElement<TotalBalanceBreakdownElementOptions, TotalBalanceBreakdownElementEvents, TotalBalanceBreakdownElementSnapshot>;
188
+
172
189
  interface VerifyElementEvents {
173
190
  error: (error: unknown) => void;
174
191
  ready: (element: VerifyElement) => void;
@@ -341,6 +358,22 @@ type PayoutsSessionElements = {
341
358
  ChangeAccountCountryElement
342
359
  ];
343
360
  "reset-account-element": [ResetAccountElementOptions, ResetAccountElement];
361
+ "regular-reserve-balance-breakdown-element": [
362
+ RegularReserveBalanceBreakdownElementOptions,
363
+ RegularReserveBalanceBreakdownElement
364
+ ];
365
+ "bnpl-reserve-balance-breakdown-element": [
366
+ BnplReserveBalanceBreakdownElementOptions,
367
+ BnplReserveBalanceBreakdownElement
368
+ ];
369
+ "total-balance-breakdown-element": [
370
+ TotalBalanceBreakdownElementOptions,
371
+ TotalBalanceBreakdownElement
372
+ ];
373
+ "pending-balance-breakdown-element": [
374
+ PendingBalanceBreakdownElementOptions,
375
+ PendingBalanceBreakdownElement
376
+ ];
344
377
  };
345
378
  interface PayoutsSession extends TypedEmitter<PayoutsSessionEvents> {
346
379
  token: Promise<string | null>;
@@ -354,6 +387,10 @@ interface PayoutsSession extends TypedEmitter<PayoutsSessionEvents> {
354
387
  showWithdrawalBreakdownModal: <Force extends boolean = false>(options: WithdrawalBreakdownElementOptions | ((modal: ModalContainer) => WithdrawalBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
355
388
  showChangeAccountCountryModal: <Force extends boolean = false>(options: ChangeAccountCountryElementOptions | ((modal: ModalContainer) => ChangeAccountCountryElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
356
389
  showResetAccountModal: <Force extends boolean = false>(options: ResetAccountElementOptions | ((modal: ModalContainer) => ResetAccountElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
390
+ showTotalBalanceBreakdownModal: <Force extends boolean = false>(options: TotalBalanceBreakdownElementOptions | ((modal: ModalContainer) => TotalBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
391
+ showPendingBalanceBreakdownModal: <Force extends boolean = false>(options: PendingBalanceBreakdownElementOptions | ((modal: ModalContainer) => PendingBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
392
+ showRegularReserveBalanceBreakdownModal: <Force extends boolean = false>(options: RegularReserveBalanceBreakdownElementOptions | ((modal: ModalContainer) => RegularReserveBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
393
+ showBnplReserveBalanceBreakdownModal: <Force extends boolean = false>(options: BnplReserveBalanceBreakdownElementOptions | ((modal: ModalContainer) => BnplReserveBalanceBreakdownElementOptions), force?: Force) => Force extends true ? ModalContainer : ModalContainer | undefined;
357
394
  }
358
395
 
359
396
  declare global {
@@ -376,7 +413,7 @@ type WhopElementsOptions = {
376
413
  type WhopElementsConstructor = {
377
414
  new (options?: WhopElementsOptions): WhopElements;
378
415
  };
379
- interface WhopElements {
416
+ interface WhopElements extends TypedEmitter<WhopElementsEvents> {
380
417
  createPayoutsSession: (options: PayoutsSessionOptions) => PayoutsSession;
381
418
  updateOptions: (options: Partial<WhopElementsOptions>) => void;
382
419
  options: WhopElementsOptions;
@@ -385,4 +422,4 @@ interface WhopElementsEvents {
385
422
  optionsUpdated: (options: WhopElementsOptions) => void;
386
423
  }
387
424
 
388
- 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 };
425
+ export type { Appearance, BalanceElement, BalanceElementOptions, BalanceElementSnapshot, BnplReserveBalanceBreakdownElement, BnplReserveBalanceBreakdownElementOptions, BnplReserveBalanceBreakdownElementSnapshot, 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-2.elements.whop.com/";
25
+ const ORIGIN = "https://0-0-4-beta-0.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-2.elements.whop.com/";
1
+ const ORIGIN = "https://0-0-4-beta-0.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.2",
3
+ "version": "0.0.4-beta.0",
4
4
  "description": "Whop Elements loading utility",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",