@whop/embedded-components-react-js 0.0.5-beta.5 → 0.0.5-beta.7

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.
Files changed (109) hide show
  1. package/dist/chunk-NSSMTXJJ.mjs +9 -0
  2. package/dist/chunk-NSSMTXJJ.mjs.map +1 -0
  3. package/dist/index.d.ts +19 -0
  4. package/dist/index.js +21 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +3 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/lib/use-element-snapshot.d.ts +5 -0
  9. package/dist/lib/use-element-snapshot.js +64 -0
  10. package/dist/lib/use-element-snapshot.js.map +1 -0
  11. package/dist/lib/use-element-snapshot.mjs +41 -0
  12. package/dist/lib/use-element-snapshot.mjs.map +1 -0
  13. package/dist/lib/with-fallback.d.ts +55 -0
  14. package/dist/lib/with-fallback.js +85 -0
  15. package/dist/lib/with-fallback.js.map +1 -0
  16. package/dist/lib/with-fallback.mjs +58 -0
  17. package/dist/lib/with-fallback.mjs.map +1 -0
  18. package/dist/payouts/elements/balance.d.ts +11 -0
  19. package/dist/payouts/elements/balance.js +30 -0
  20. package/dist/payouts/elements/balance.js.map +1 -0
  21. package/dist/payouts/elements/balance.mjs +8 -0
  22. package/dist/payouts/elements/balance.mjs.map +1 -0
  23. package/dist/payouts/elements/bnpl-reserve-balance-breakdown.d.ts +11 -0
  24. package/dist/payouts/elements/bnpl-reserve-balance-breakdown.js +30 -0
  25. package/dist/payouts/elements/bnpl-reserve-balance-breakdown.js.map +1 -0
  26. package/dist/payouts/elements/bnpl-reserve-balance-breakdown.mjs +8 -0
  27. package/dist/payouts/elements/bnpl-reserve-balance-breakdown.mjs.map +1 -0
  28. package/dist/payouts/elements/change-account-country.d.ts +11 -0
  29. package/dist/payouts/elements/change-account-country.js +30 -0
  30. package/dist/payouts/elements/change-account-country.js.map +1 -0
  31. package/dist/payouts/elements/change-account-country.mjs +8 -0
  32. package/dist/payouts/elements/change-account-country.mjs.map +1 -0
  33. package/dist/payouts/elements/generate-withdrawal-receipt.d.ts +11 -0
  34. package/dist/payouts/elements/generate-withdrawal-receipt.js +30 -0
  35. package/dist/payouts/elements/generate-withdrawal-receipt.js.map +1 -0
  36. package/dist/payouts/elements/generate-withdrawal-receipt.mjs +8 -0
  37. package/dist/payouts/elements/generate-withdrawal-receipt.mjs.map +1 -0
  38. package/dist/payouts/elements/index.d.ts +16 -0
  39. package/dist/payouts/elements/index.js +31 -0
  40. package/dist/payouts/elements/index.js.map +1 -0
  41. package/dist/payouts/elements/index.mjs +13 -0
  42. package/dist/payouts/elements/index.mjs.map +1 -0
  43. package/dist/payouts/elements/pending-balance-breakdown.d.ts +11 -0
  44. package/dist/payouts/elements/pending-balance-breakdown.js +30 -0
  45. package/dist/payouts/elements/pending-balance-breakdown.js.map +1 -0
  46. package/dist/payouts/elements/pending-balance-breakdown.mjs +8 -0
  47. package/dist/payouts/elements/pending-balance-breakdown.mjs.map +1 -0
  48. package/dist/payouts/elements/regular-reserve-balance-breakdown.d.ts +11 -0
  49. package/dist/payouts/elements/regular-reserve-balance-breakdown.js +30 -0
  50. package/dist/payouts/elements/regular-reserve-balance-breakdown.js.map +1 -0
  51. package/dist/payouts/elements/regular-reserve-balance-breakdown.mjs +8 -0
  52. package/dist/payouts/elements/regular-reserve-balance-breakdown.mjs.map +1 -0
  53. package/dist/payouts/elements/reset-account.d.ts +11 -0
  54. package/dist/payouts/elements/reset-account.js +30 -0
  55. package/dist/payouts/elements/reset-account.js.map +1 -0
  56. package/dist/payouts/elements/reset-account.mjs +8 -0
  57. package/dist/payouts/elements/reset-account.mjs.map +1 -0
  58. package/dist/payouts/elements/status-banner.d.ts +18 -0
  59. package/dist/payouts/elements/status-banner.js +102 -0
  60. package/dist/payouts/elements/status-banner.js.map +1 -0
  61. package/dist/payouts/elements/status-banner.mjs +76 -0
  62. package/dist/payouts/elements/status-banner.mjs.map +1 -0
  63. package/dist/payouts/elements/total-balance-breakdown.d.ts +11 -0
  64. package/dist/payouts/elements/total-balance-breakdown.js +30 -0
  65. package/dist/payouts/elements/total-balance-breakdown.js.map +1 -0
  66. package/dist/payouts/elements/total-balance-breakdown.mjs +8 -0
  67. package/dist/payouts/elements/total-balance-breakdown.mjs.map +1 -0
  68. package/dist/payouts/elements/verify.d.ts +11 -0
  69. package/dist/payouts/elements/verify.js +30 -0
  70. package/dist/payouts/elements/verify.js.map +1 -0
  71. package/dist/payouts/elements/verify.mjs +8 -0
  72. package/dist/payouts/elements/verify.mjs.map +1 -0
  73. package/dist/payouts/elements/withdraw-button.d.ts +11 -0
  74. package/dist/payouts/elements/withdraw-button.js +30 -0
  75. package/dist/payouts/elements/withdraw-button.js.map +1 -0
  76. package/dist/payouts/elements/withdraw-button.mjs +8 -0
  77. package/dist/payouts/elements/withdraw-button.mjs.map +1 -0
  78. package/dist/payouts/elements/withdrawal-breakdown.d.ts +11 -0
  79. package/dist/payouts/elements/withdrawal-breakdown.js +30 -0
  80. package/dist/payouts/elements/withdrawal-breakdown.js.map +1 -0
  81. package/dist/payouts/elements/withdrawal-breakdown.mjs +8 -0
  82. package/dist/payouts/elements/withdrawal-breakdown.mjs.map +1 -0
  83. package/dist/payouts/elements/withdrawals.d.ts +11 -0
  84. package/dist/payouts/elements/withdrawals.js +30 -0
  85. package/dist/payouts/elements/withdrawals.js.map +1 -0
  86. package/dist/payouts/elements/withdrawals.mjs +8 -0
  87. package/dist/payouts/elements/withdrawals.mjs.map +1 -0
  88. package/dist/payouts/index.d.ts +17 -0
  89. package/dist/payouts/index.js +20 -0
  90. package/dist/payouts/index.js.map +1 -0
  91. package/dist/payouts/index.mjs +2 -0
  92. package/dist/payouts/index.mjs.map +1 -0
  93. package/dist/payouts/session.d.ts +11 -0
  94. package/dist/payouts/session.js +84 -0
  95. package/dist/payouts/session.js.map +1 -0
  96. package/dist/payouts/session.mjs +55 -0
  97. package/dist/payouts/session.mjs.map +1 -0
  98. package/dist/payouts/use-session-ref.d.ts +8 -0
  99. package/dist/payouts/use-session-ref.js +29 -0
  100. package/dist/payouts/use-session-ref.js.map +1 -0
  101. package/dist/payouts/use-session-ref.mjs +7 -0
  102. package/dist/payouts/use-session-ref.mjs.map +1 -0
  103. package/dist/provider.d.ts +11 -0
  104. package/dist/provider.js +116 -0
  105. package/dist/provider.js.map +1 -0
  106. package/dist/provider.mjs +87 -0
  107. package/dist/provider.mjs.map +1 -0
  108. package/package.json +2 -2
  109. package/package.json.temp +0 -44
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var verify_exports = {};
21
+ __export(verify_exports, {
22
+ VerifyElement: () => VerifyElement
23
+ });
24
+ module.exports = __toCommonJS(verify_exports);
25
+ var import_with_fallback = require("../../lib/with-fallback");
26
+ const VerifyElement = (0, import_with_fallback.withFallback)({
27
+ displayName: "VerifyElement",
28
+ type: "verify-element"
29
+ });
30
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/payouts/elements/verify.tsx"],"sourcesContent":["\"use client\";\n\nimport { withFallback } from \"../../lib/with-fallback\";\n\nexport const VerifyElement = withFallback({\n\tdisplayName: \"VerifyElement\",\n\ttype: \"verify-element\",\n} as const);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAA6B;AAEtB,MAAM,oBAAgB,mCAAa;AAAA,EACzC,aAAa;AAAA,EACb,MAAM;AACP,CAAU;","names":[]}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import "../../chunk-NSSMTXJJ.mjs";
3
+ import { withFallback } from "../../lib/with-fallback.mjs";
4
+ const VerifyElement = withFallback({
5
+ displayName: "VerifyElement",
6
+ type: "verify-element"
7
+ });
8
+ export { VerifyElement };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/payouts/elements/verify.tsx"],"sourcesContent":["\"use client\";\n\nimport { withFallback } from \"../../lib/with-fallback\";\n\nexport const VerifyElement = withFallback({\n\tdisplayName: \"VerifyElement\",\n\ttype: \"verify-element\",\n} as const);\n"],"mappings":";;AAEA,SAAS,oBAAoB;AAEtB,MAAM,gBAAgB,aAAa;AAAA,EACzC,aAAa;AAAA,EACb,MAAM;AACP,CAAU;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { WithFallbackPropsOptional } from '../../lib/with-fallback.js';
2
+ import * as _whop_embedded_components_vanilla_js_types from '@whop/embedded-components-vanilla-js/types';
3
+ import 'react';
4
+
5
+ declare const WithdrawButtonElement: {
6
+ (props: WithFallbackPropsOptional<_whop_embedded_components_vanilla_js_types.WithdrawButtonElementOptions>): React.ReactNode;
7
+ displayName: string;
8
+ type: string;
9
+ };
10
+
11
+ export { WithdrawButtonElement };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var withdraw_button_exports = {};
21
+ __export(withdraw_button_exports, {
22
+ WithdrawButtonElement: () => WithdrawButtonElement
23
+ });
24
+ module.exports = __toCommonJS(withdraw_button_exports);
25
+ var import_with_fallback = require("../../lib/with-fallback");
26
+ const WithdrawButtonElement = (0, import_with_fallback.withFallback)({
27
+ displayName: "WithdrawButtonElement",
28
+ type: "withdraw-button-element"
29
+ });
30
+ //# sourceMappingURL=withdraw-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/payouts/elements/withdraw-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { withFallback } from \"../../lib/with-fallback\";\n\nexport const WithdrawButtonElement = withFallback({\n\tdisplayName: \"WithdrawButtonElement\",\n\ttype: \"withdraw-button-element\",\n} as const);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAA6B;AAEtB,MAAM,4BAAwB,mCAAa;AAAA,EACjD,aAAa;AAAA,EACb,MAAM;AACP,CAAU;","names":[]}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import "../../chunk-NSSMTXJJ.mjs";
3
+ import { withFallback } from "../../lib/with-fallback.mjs";
4
+ const WithdrawButtonElement = withFallback({
5
+ displayName: "WithdrawButtonElement",
6
+ type: "withdraw-button-element"
7
+ });
8
+ export { WithdrawButtonElement };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/payouts/elements/withdraw-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { withFallback } from \"../../lib/with-fallback\";\n\nexport const WithdrawButtonElement = withFallback({\n\tdisplayName: \"WithdrawButtonElement\",\n\ttype: \"withdraw-button-element\",\n} as const);\n"],"mappings":";;AAEA,SAAS,oBAAoB;AAEtB,MAAM,wBAAwB,aAAa;AAAA,EACjD,aAAa;AAAA,EACb,MAAM;AACP,CAAU;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { WithFallbackPropsRequired } from '../../lib/with-fallback.js';
2
+ import * as _whop_embedded_components_vanilla_js_types from '@whop/embedded-components-vanilla-js/types';
3
+ import 'react';
4
+
5
+ declare const WithdrawalBreakdownElement: {
6
+ (props: WithFallbackPropsRequired<_whop_embedded_components_vanilla_js_types.WithdrawalBreakdownElementOptions>): React.ReactNode;
7
+ displayName: string;
8
+ type: string;
9
+ };
10
+
11
+ export { WithdrawalBreakdownElement };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var withdrawal_breakdown_exports = {};
21
+ __export(withdrawal_breakdown_exports, {
22
+ WithdrawalBreakdownElement: () => WithdrawalBreakdownElement
23
+ });
24
+ module.exports = __toCommonJS(withdrawal_breakdown_exports);
25
+ var import_with_fallback = require("../../lib/with-fallback");
26
+ const WithdrawalBreakdownElement = (0, import_with_fallback.withFallback)({
27
+ displayName: "WithdrawalBreakdownElement",
28
+ type: "withdrawal-breakdown-element"
29
+ });
30
+ //# sourceMappingURL=withdrawal-breakdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/payouts/elements/withdrawal-breakdown.tsx"],"sourcesContent":["\"use client\";\n\nimport { withFallback } from \"../../lib/with-fallback\";\n\nexport const WithdrawalBreakdownElement = withFallback<\n\t\"withdrawal-breakdown-element\",\n\ttrue\n>({\n\tdisplayName: \"WithdrawalBreakdownElement\",\n\ttype: \"withdrawal-breakdown-element\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAA6B;AAEtB,MAAM,iCAA6B,mCAGxC;AAAA,EACD,aAAa;AAAA,EACb,MAAM;AACP,CAAC;","names":[]}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import "../../chunk-NSSMTXJJ.mjs";
3
+ import { withFallback } from "../../lib/with-fallback.mjs";
4
+ const WithdrawalBreakdownElement = withFallback({
5
+ displayName: "WithdrawalBreakdownElement",
6
+ type: "withdrawal-breakdown-element"
7
+ });
8
+ export { WithdrawalBreakdownElement };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/payouts/elements/withdrawal-breakdown.tsx"],"sourcesContent":["\"use client\";\n\nimport { withFallback } from \"../../lib/with-fallback\";\n\nexport const WithdrawalBreakdownElement = withFallback<\n\t\"withdrawal-breakdown-element\",\n\ttrue\n>({\n\tdisplayName: \"WithdrawalBreakdownElement\",\n\ttype: \"withdrawal-breakdown-element\",\n});\n"],"mappings":";;AAEA,SAAS,oBAAoB;AAEtB,MAAM,6BAA6B,aAGxC;AAAA,EACD,aAAa;AAAA,EACb,MAAM;AACP,CAAC;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { WithFallbackPropsOptional } from '../../lib/with-fallback.js';
2
+ import * as _whop_embedded_components_vanilla_js_types from '@whop/embedded-components-vanilla-js/types';
3
+ import 'react';
4
+
5
+ declare const WithdrawalsElement: {
6
+ (props: WithFallbackPropsOptional<_whop_embedded_components_vanilla_js_types.WithdrawalsElementOptions>): React.ReactNode;
7
+ displayName: string;
8
+ type: string;
9
+ };
10
+
11
+ export { WithdrawalsElement };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var withdrawals_exports = {};
21
+ __export(withdrawals_exports, {
22
+ WithdrawalsElement: () => WithdrawalsElement
23
+ });
24
+ module.exports = __toCommonJS(withdrawals_exports);
25
+ var import_with_fallback = require("../../lib/with-fallback");
26
+ const WithdrawalsElement = (0, import_with_fallback.withFallback)({
27
+ displayName: "WithdrawalsElement",
28
+ type: "withdrawals-element"
29
+ });
30
+ //# sourceMappingURL=withdrawals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/payouts/elements/withdrawals.tsx"],"sourcesContent":["\"use client\";\n\nimport { withFallback } from \"../../lib/with-fallback\";\n\nexport const WithdrawalsElement = withFallback({\n\tdisplayName: \"WithdrawalsElement\",\n\ttype: \"withdrawals-element\",\n} as const);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAA6B;AAEtB,MAAM,yBAAqB,mCAAa;AAAA,EAC9C,aAAa;AAAA,EACb,MAAM;AACP,CAAU;","names":[]}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import "../../chunk-NSSMTXJJ.mjs";
3
+ import { withFallback } from "../../lib/with-fallback.mjs";
4
+ const WithdrawalsElement = withFallback({
5
+ displayName: "WithdrawalsElement",
6
+ type: "withdrawals-element"
7
+ });
8
+ export { WithdrawalsElement };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/payouts/elements/withdrawals.tsx"],"sourcesContent":["\"use client\";\n\nimport { withFallback } from \"../../lib/with-fallback\";\n\nexport const WithdrawalsElement = withFallback({\n\tdisplayName: \"WithdrawalsElement\",\n\ttype: \"withdrawals-element\",\n} as const);\n"],"mappings":";;AAEA,SAAS,oBAAoB;AAEtB,MAAM,qBAAqB,aAAa;AAAA,EAC9C,aAAa;AAAA,EACb,MAAM;AACP,CAAU;","names":[]}
@@ -0,0 +1,17 @@
1
+ export { PayoutsSession, usePayoutsSession } from './session.js';
2
+ export { BalanceElement } from './elements/balance.js';
3
+ export { ChangeAccountCountryElement } from './elements/change-account-country.js';
4
+ export { ResetAccountElement } from './elements/reset-account.js';
5
+ export { VerifyElement } from './elements/verify.js';
6
+ export { WithdrawButtonElement } from './elements/withdraw-button.js';
7
+ export { WithdrawalBreakdownElement } from './elements/withdrawal-breakdown.js';
8
+ export { WithdrawalsElement } from './elements/withdrawals.js';
9
+ export { TotalBalanceBreakdownElement } from './elements/total-balance-breakdown.js';
10
+ export { PendingBalanceBreakdownElement } from './elements/pending-balance-breakdown.js';
11
+ export { RegularReserveBalanceBreakdownElement } from './elements/regular-reserve-balance-breakdown.js';
12
+ export { BnplReserveBalanceBreakdownElement } from './elements/bnpl-reserve-balance-breakdown.js';
13
+ export { GenerateWithdrawalReceiptElement } from './elements/generate-withdrawal-receipt.js';
14
+ export { StatusBannerElement } from './elements/status-banner.js';
15
+ import '@whop/embedded-components-vanilla-js/types';
16
+ import 'react';
17
+ import '../lib/with-fallback.js';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var payouts_exports = {};
17
+ module.exports = __toCommonJS(payouts_exports);
18
+ __reExport(payouts_exports, require("./session"), module.exports);
19
+ __reExport(payouts_exports, require("./elements"), module.exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/payouts/index.tsx"],"sourcesContent":["export * from \"./session\";\nexport * from \"./elements\";\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,sBAAd;AACA,4BAAc,uBADd;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./session.mjs";
2
+ export * from "./elements/index.mjs";
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/payouts/index.tsx"],"sourcesContent":["export * from \"./session\";\nexport * from \"./elements\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { PayoutsSession as PayoutsSession$1, PayoutsSessionOptions } from '@whop/embedded-components-vanilla-js/types';
2
+ import React__default, { PropsWithChildren } from 'react';
3
+
4
+ declare function usePayoutsSession(): PayoutsSession$1 | null;
5
+ declare function PayoutsSession({ children, currency, companyId, token, redirectUrl, ref, }: PropsWithChildren<PayoutsSessionOptions & {
6
+ ref?: React__default.RefObject<{
7
+ payoutsSession: PayoutsSession$1 | null;
8
+ } | null>;
9
+ }>): React__default.JSX.Element;
10
+
11
+ export { PayoutsSession, usePayoutsSession };
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var session_exports = {};
31
+ __export(session_exports, {
32
+ PayoutsSession: () => PayoutsSession,
33
+ usePayoutsSession: () => usePayoutsSession
34
+ });
35
+ module.exports = __toCommonJS(session_exports);
36
+ var import_react = __toESM(require("react"));
37
+ var import_provider = require("../provider");
38
+ const PayoutsSessionContext = (0, import_react.createContext)(null);
39
+ function usePayoutsSession() {
40
+ const ctx = (0, import_react.useContext)(PayoutsSessionContext);
41
+ if (!ctx) {
42
+ throw new Error(
43
+ "usePayoutsSession must be used within a PayoutsSessionProvider"
44
+ );
45
+ }
46
+ return ctx.payoutsSession;
47
+ }
48
+ function PayoutsSession({
49
+ children,
50
+ currency,
51
+ companyId,
52
+ token,
53
+ redirectUrl,
54
+ ref
55
+ }) {
56
+ const elements = (0, import_provider.useElements)();
57
+ const payoutsSession = (0, import_react.useMemo)(() => {
58
+ if (!elements) return null;
59
+ return elements.createPayoutsSession({
60
+ token,
61
+ currency,
62
+ companyId,
63
+ redirectUrl
64
+ });
65
+ }, [elements]);
66
+ (0, import_react.useEffect)(() => {
67
+ if (!payoutsSession) return;
68
+ payoutsSession.updateOptions({
69
+ token,
70
+ currency,
71
+ companyId,
72
+ redirectUrl
73
+ });
74
+ }, [payoutsSession, currency, token, companyId, redirectUrl]);
75
+ const value = (0, import_react.useMemo)(
76
+ () => ({
77
+ payoutsSession
78
+ }),
79
+ [payoutsSession]
80
+ );
81
+ (0, import_react.useImperativeHandle)(ref, () => ({ payoutsSession }), [payoutsSession]);
82
+ return /* @__PURE__ */ import_react.default.createElement(PayoutsSessionContext.Provider, { value }, children);
83
+ }
84
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/payouts/session.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n\tPayoutsSessionOptions,\n\tPayoutsSession as PayoutsSessionType,\n} from \"@whop/embedded-components-vanilla-js/types\";\nimport type { PropsWithChildren } from \"react\";\n\nimport React, {\n\tcreateContext,\n\tuseContext,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseMemo,\n} from \"react\";\nimport { useElements } from \"../provider\";\n\ninterface ContextState {\n\tpayoutsSession: PayoutsSessionType | null;\n}\n\nconst PayoutsSessionContext = createContext<ContextState | null>(null);\n\nexport function usePayoutsSession() {\n\tconst ctx = useContext(PayoutsSessionContext);\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t\"usePayoutsSession must be used within a PayoutsSessionProvider\",\n\t\t);\n\t}\n\treturn ctx.payoutsSession;\n}\n\nexport function PayoutsSession({\n\tchildren,\n\tcurrency,\n\tcompanyId,\n\ttoken,\n\tredirectUrl,\n\tref,\n}: PropsWithChildren<\n\tPayoutsSessionOptions & {\n\t\tref?: React.RefObject<{\n\t\t\tpayoutsSession: PayoutsSessionType | null;\n\t\t} | null>;\n\t}\n>) {\n\tconst elements = useElements();\n\n\tconst payoutsSession = useMemo(() => {\n\t\tif (!elements) return null;\n\t\treturn elements.createPayoutsSession({\n\t\t\ttoken,\n\t\t\tcurrency,\n\t\t\tcompanyId,\n\t\t\tredirectUrl,\n\t\t});\n\t}, [elements]);\n\n\tuseEffect(() => {\n\t\tif (!payoutsSession) return;\n\n\t\tpayoutsSession.updateOptions({\n\t\t\ttoken,\n\t\t\tcurrency,\n\t\t\tcompanyId,\n\t\t\tredirectUrl,\n\t\t});\n\t}, [payoutsSession, currency, token, companyId, redirectUrl]);\n\n\tconst value: ContextState = useMemo(\n\t\t() => ({\n\t\t\tpayoutsSession,\n\t\t}),\n\t\t[payoutsSession],\n\t);\n\n\tuseImperativeHandle(ref, () => ({ payoutsSession }), [payoutsSession]);\n\n\treturn (\n\t\t<PayoutsSessionContext.Provider value={value}>\n\t\t\t{children}\n\t\t</PayoutsSessionContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,mBAMO;AACP,sBAA4B;AAM5B,MAAM,4BAAwB,4BAAmC,IAAI;AAE9D,SAAS,oBAAoB;AACnC,QAAM,UAAM,yBAAW,qBAAqB;AAC5C,MAAI,CAAC,KAAK;AACT,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,SAAO,IAAI;AACZ;AAEO,SAAS,eAAe;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAMG;AACF,QAAM,eAAW,6BAAY;AAE7B,QAAM,qBAAiB,sBAAQ,MAAM;AACpC,QAAI,CAAC,SAAU,QAAO;AACtB,WAAO,SAAS,qBAAqB;AAAA,MACpC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,8BAAU,MAAM;AACf,QAAI,CAAC,eAAgB;AAErB,mBAAe,cAAc;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAAA,EACF,GAAG,CAAC,gBAAgB,UAAU,OAAO,WAAW,WAAW,CAAC;AAE5D,QAAM,YAAsB;AAAA,IAC3B,OAAO;AAAA,MACN;AAAA,IACD;AAAA,IACA,CAAC,cAAc;AAAA,EAChB;AAEA,wCAAoB,KAAK,OAAO,EAAE,eAAe,IAAI,CAAC,cAAc,CAAC;AAErE,SACC,6BAAAA,QAAA,cAAC,sBAAsB,UAAtB,EAA+B,SAC9B,QACF;AAEF;","names":["React"]}
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import "../chunk-NSSMTXJJ.mjs";
3
+ import React, { createContext, useContext, useEffect, useImperativeHandle, useMemo } from "react";
4
+ import { useElements } from "../provider.mjs";
5
+ const PayoutsSessionContext = createContext(null);
6
+ function usePayoutsSession() {
7
+ const ctx = useContext(PayoutsSessionContext);
8
+ if (!ctx) {
9
+ throw new Error("usePayoutsSession must be used within a PayoutsSessionProvider");
10
+ }
11
+ return ctx.payoutsSession;
12
+ }
13
+ function PayoutsSession({ children, currency, companyId, token, redirectUrl, ref }) {
14
+ const elements = useElements();
15
+ const payoutsSession = useMemo(()=>{
16
+ if (!elements) return null;
17
+ return elements.createPayoutsSession({
18
+ token,
19
+ currency,
20
+ companyId,
21
+ redirectUrl
22
+ });
23
+ }, [
24
+ elements
25
+ ]);
26
+ useEffect(()=>{
27
+ if (!payoutsSession) return;
28
+ payoutsSession.updateOptions({
29
+ token,
30
+ currency,
31
+ companyId,
32
+ redirectUrl
33
+ });
34
+ }, [
35
+ payoutsSession,
36
+ currency,
37
+ token,
38
+ companyId,
39
+ redirectUrl
40
+ ]);
41
+ const value = useMemo(()=>({
42
+ payoutsSession
43
+ }), [
44
+ payoutsSession
45
+ ]);
46
+ useImperativeHandle(ref, ()=>({
47
+ payoutsSession
48
+ }), [
49
+ payoutsSession
50
+ ]);
51
+ return React.createElement(PayoutsSessionContext.Provider, {
52
+ value
53
+ }, children);
54
+ }
55
+ export { PayoutsSession, usePayoutsSession };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/payouts/session.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n\tPayoutsSessionOptions,\n\tPayoutsSession as PayoutsSessionType,\n} from \"@whop/embedded-components-vanilla-js/types\";\nimport type { PropsWithChildren } from \"react\";\n\nimport React, {\n\tcreateContext,\n\tuseContext,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseMemo,\n} from \"react\";\nimport { useElements } from \"../provider\";\n\ninterface ContextState {\n\tpayoutsSession: PayoutsSessionType | null;\n}\n\nconst PayoutsSessionContext = createContext<ContextState | null>(null);\n\nexport function usePayoutsSession() {\n\tconst ctx = useContext(PayoutsSessionContext);\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t\"usePayoutsSession must be used within a PayoutsSessionProvider\",\n\t\t);\n\t}\n\treturn ctx.payoutsSession;\n}\n\nexport function PayoutsSession({\n\tchildren,\n\tcurrency,\n\tcompanyId,\n\ttoken,\n\tredirectUrl,\n\tref,\n}: PropsWithChildren<\n\tPayoutsSessionOptions & {\n\t\tref?: React.RefObject<{\n\t\t\tpayoutsSession: PayoutsSessionType | null;\n\t\t} | null>;\n\t}\n>) {\n\tconst elements = useElements();\n\n\tconst payoutsSession = useMemo(() => {\n\t\tif (!elements) return null;\n\t\treturn elements.createPayoutsSession({\n\t\t\ttoken,\n\t\t\tcurrency,\n\t\t\tcompanyId,\n\t\t\tredirectUrl,\n\t\t});\n\t}, [elements]);\n\n\tuseEffect(() => {\n\t\tif (!payoutsSession) return;\n\n\t\tpayoutsSession.updateOptions({\n\t\t\ttoken,\n\t\t\tcurrency,\n\t\t\tcompanyId,\n\t\t\tredirectUrl,\n\t\t});\n\t}, [payoutsSession, currency, token, companyId, redirectUrl]);\n\n\tconst value: ContextState = useMemo(\n\t\t() => ({\n\t\t\tpayoutsSession,\n\t\t}),\n\t\t[payoutsSession],\n\t);\n\n\tuseImperativeHandle(ref, () => ({ payoutsSession }), [payoutsSession]);\n\n\treturn (\n\t\t<PayoutsSessionContext.Provider value={value}>\n\t\t\t{children}\n\t\t</PayoutsSessionContext.Provider>\n\t);\n}\n"],"mappings":";;AAQA,OAAO;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,mBAAmB;AAM5B,MAAM,wBAAwB,cAAmC,IAAI;AAE9D,SAAS,oBAAoB;AACnC,QAAM,MAAM,WAAW,qBAAqB;AAC5C,MAAI,CAAC,KAAK;AACT,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,SAAO,IAAI;AACZ;AAEO,SAAS,eAAe;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAMG;AACF,QAAM,WAAW,YAAY;AAE7B,QAAM,iBAAiB,QAAQ,MAAM;AACpC,QAAI,CAAC,SAAU,QAAO;AACtB,WAAO,SAAS,qBAAqB;AAAA,MACpC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,YAAU,MAAM;AACf,QAAI,CAAC,eAAgB;AAErB,mBAAe,cAAc;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAAA,EACF,GAAG,CAAC,gBAAgB,UAAU,OAAO,WAAW,WAAW,CAAC;AAE5D,QAAM,QAAsB;AAAA,IAC3B,OAAO;AAAA,MACN;AAAA,IACD;AAAA,IACA,CAAC,cAAc;AAAA,EAChB;AAEA,sBAAoB,KAAK,OAAO,EAAE,eAAe,IAAI,CAAC,cAAc,CAAC;AAErE,SACC,oCAAC,sBAAsB,UAAtB,EAA+B,SAC9B,QACF;AAEF;","names":[]}
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { PayoutsSession } from '@whop/embedded-components-vanilla-js/types';
3
+
4
+ declare function usePayoutsSessionRef(): React.RefObject<{
5
+ payoutsSession: PayoutsSession | null;
6
+ } | null>;
7
+
8
+ export { usePayoutsSessionRef };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var use_session_ref_exports = {};
20
+ __export(use_session_ref_exports, {
21
+ usePayoutsSessionRef: () => usePayoutsSessionRef
22
+ });
23
+ module.exports = __toCommonJS(use_session_ref_exports);
24
+ var import_react = require("react");
25
+ function usePayoutsSessionRef() {
26
+ const ref = (0, import_react.useRef)(null);
27
+ return ref;
28
+ }
29
+ //# sourceMappingURL=use-session-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/payouts/use-session-ref.ts"],"sourcesContent":["import type { PayoutsSession as PayoutsSessionType } from \"@whop/embedded-components-vanilla-js/types\";\n\nimport { useRef } from \"react\";\n\nexport function usePayoutsSessionRef() {\n\tconst ref = useRef<{\n\t\tpayoutsSession: PayoutsSessionType | null;\n\t}>(null);\n\treturn ref;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAuB;AAEhB,SAAS,uBAAuB;AACtC,QAAM,UAAM,qBAET,IAAI;AACP,SAAO;AACR;","names":[]}
@@ -0,0 +1,7 @@
1
+ import "../chunk-NSSMTXJJ.mjs";
2
+ import { useRef } from "react";
3
+ function usePayoutsSessionRef() {
4
+ const ref = useRef(null);
5
+ return ref;
6
+ }
7
+ export { usePayoutsSessionRef };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/payouts/use-session-ref.ts"],"sourcesContent":["import type { PayoutsSession as PayoutsSessionType } from \"@whop/embedded-components-vanilla-js/types\";\n\nimport { useRef } from \"react\";\n\nexport function usePayoutsSessionRef() {\n\tconst ref = useRef<{\n\t\tpayoutsSession: PayoutsSessionType | null;\n\t}>(null);\n\treturn ref;\n}\n"],"mappings":";AAEA,SAAS,cAAc;AAEhB,SAAS,uBAAuB;AACtC,QAAM,MAAM,OAET,IAAI;AACP,SAAO;AACR;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { WhopElements, WhopElementsOptions } from '@whop/embedded-components-vanilla-js/types';
2
+ import React__default from 'react';
3
+
4
+ declare function useElements(): WhopElements | null;
5
+ type ElementsProp = PromiseLike<WhopElements | null> | WhopElements | null;
6
+ declare function Elements({ children, elements: elementsProp, appearance, locale, }: {
7
+ children: React__default.ReactNode;
8
+ elements: ElementsProp;
9
+ } & WhopElementsOptions): React__default.JSX.Element;
10
+
11
+ export { Elements, useElements };
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
+ var provider_exports = {};
33
+ __export(provider_exports, {
34
+ Elements: () => Elements,
35
+ useElements: () => useElements
36
+ });
37
+ module.exports = __toCommonJS(provider_exports);
38
+ var import_react = __toESM(require("react"));
39
+ var import_react2 = require("react");
40
+ const ElementsContext = (0, import_react2.createContext)(null);
41
+ function useElements() {
42
+ const ctx = (0, import_react2.useContext)(ElementsContext);
43
+ if (!ctx) {
44
+ throw new Error("useElements must be used within a ElementsProvider");
45
+ }
46
+ return ctx.elements;
47
+ }
48
+ function normalizeElementsProp(prop) {
49
+ if (prop instanceof Promise) return prop;
50
+ return Promise.resolve(prop);
51
+ }
52
+ class PromiseStore {
53
+ constructor(promise) {
54
+ __publicField(this, "subscribers", /* @__PURE__ */ new Set());
55
+ __publicField(this, "value", { state: "pending" });
56
+ __publicField(this, "subscribe", (listener) => {
57
+ this.subscribers.add(listener);
58
+ return () => {
59
+ this.subscribers.delete(listener);
60
+ };
61
+ });
62
+ promise.then((value) => {
63
+ this.value = { state: "fulfilled", value };
64
+ for (const subscriber of this.subscribers) {
65
+ subscriber();
66
+ }
67
+ }).catch((err) => {
68
+ this.value = { state: "rejected", error: err };
69
+ for (const subscriber of this.subscribers) {
70
+ subscriber();
71
+ }
72
+ });
73
+ }
74
+ getSnapshot() {
75
+ return this.value;
76
+ }
77
+ }
78
+ function useAwaitElements(elements) {
79
+ const store = (0, import_react2.useMemo)(
80
+ () => new PromiseStore(Promise.resolve(elements)),
81
+ [elements]
82
+ );
83
+ const state = (0, import_react.useSyncExternalStore)(
84
+ store.subscribe,
85
+ () => {
86
+ const snapshot = store.getSnapshot();
87
+ if (snapshot.state === "fulfilled") {
88
+ return snapshot.value;
89
+ }
90
+ return null;
91
+ },
92
+ () => null
93
+ );
94
+ return state;
95
+ }
96
+ function Elements({
97
+ children,
98
+ elements: elementsProp,
99
+ appearance,
100
+ locale
101
+ }) {
102
+ const elementsPromise = normalizeElementsProp(elementsProp);
103
+ const elements = useAwaitElements(elementsPromise);
104
+ (0, import_react2.useEffect)(() => {
105
+ if (!elements) return;
106
+ elements.updateOptions({ appearance, locale });
107
+ }, [elements, appearance, locale]);
108
+ const value = (0, import_react2.useMemo)(
109
+ () => ({
110
+ elements
111
+ }),
112
+ [elements]
113
+ );
114
+ return /* @__PURE__ */ import_react.default.createElement(ElementsContext.Provider, { value }, children);
115
+ }
116
+ //# sourceMappingURL=provider.js.map