@bunnyapp/components 1.0.28 → 1.0.29
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/cjs/index.js +42 -37
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +2 -1
- package/dist/cjs/src/types/billingDetails.d.ts +2 -0
- package/dist/esm/index.js +42 -37
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +2 -1
- package/dist/esm/src/types/billingDetails.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2742,12 +2742,14 @@ function useRemovePaymentMethod(paymentPlugins, token, apiHost, entityId, accoun
|
|
|
2742
2742
|
var Panel = antd.Collapse.Panel;
|
|
2743
2743
|
var PaymentForm = function (_a) {
|
|
2744
2744
|
var _b;
|
|
2745
|
-
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction;
|
|
2745
|
+
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId;
|
|
2746
2746
|
// Local state
|
|
2747
2747
|
var _c = React.useState(), selectedPaymentMethod = _c[0], setSelectedPaymentMethod = _c[1];
|
|
2748
2748
|
var _d = React.useState(false), showPaymentMethodForm = _d[0], setShowPaymentMethodForm = _d[1];
|
|
2749
2749
|
var paying = !!(quote || invoice);
|
|
2750
|
-
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
|
|
2750
|
+
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
|
|
2751
|
+
(invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) ||
|
|
2752
|
+
currencyIdFromProps)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
2751
2753
|
// Hooks
|
|
2752
2754
|
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
2753
2755
|
var token = useToken();
|
|
@@ -2794,9 +2796,6 @@ var PaymentForm = function (_a) {
|
|
|
2794
2796
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2795
2797
|
setShowPaymentMethodForm(false);
|
|
2796
2798
|
};
|
|
2797
|
-
if (!currencyId) {
|
|
2798
|
-
return jsxRuntime.jsx("div", { children: "No currency id found from quote or invoice" });
|
|
2799
|
-
}
|
|
2800
2799
|
return (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: {
|
|
2801
2800
|
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2802
2801
|
accountId: accountId,
|
|
@@ -2811,7 +2810,7 @@ var PaymentForm = function (_a) {
|
|
|
2811
2810
|
};
|
|
2812
2811
|
function StripeWrapper(_a) {
|
|
2813
2812
|
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, currencyId = _a.currencyId, accountId = _a.accountId;
|
|
2814
|
-
var _b = useStripePlugin(plugin, token, apiHost, currencyId, accountId), stripe = _b.stripe, options = _b.options;
|
|
2813
|
+
var _b = useStripePlugin(plugin, token, apiHost, currencyId || "usd", accountId), stripe = _b.stripe, options = _b.options;
|
|
2815
2814
|
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: children })));
|
|
2816
2815
|
}
|
|
2817
2816
|
|
|
@@ -3639,9 +3638,37 @@ var DrawerHeader = function (_a) {
|
|
|
3639
3638
|
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsxRuntime.jsx(Text$5, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), jsxRuntime.jsx("button", __assign({ onClick: onClose, className: "ant-drawer-close" }, { children: jsxRuntime.jsx(CloseOutlined$1, {}) }))] })), description && jsxRuntime.jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
|
|
3640
3639
|
};
|
|
3641
3640
|
|
|
3641
|
+
// TODO: move this to common
|
|
3642
|
+
var billingDetailsQuery = function () {
|
|
3643
|
+
return "\nquery BillingDetails {\n billingDetails {\n billingCity\n billingContact {\n email\n }\n billingCountry\n billingState\n billingStreet\n billingZip\n name\n taxNumber\n currency {\n id\n }\n }\n}";
|
|
3644
|
+
};
|
|
3645
|
+
var getBillingDetails = function (_a) {
|
|
3646
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
3647
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3648
|
+
var response;
|
|
3649
|
+
var _b;
|
|
3650
|
+
return __generator(this, function (_c) {
|
|
3651
|
+
switch (_c.label) {
|
|
3652
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3653
|
+
query: billingDetailsQuery(),
|
|
3654
|
+
token: token,
|
|
3655
|
+
apiHost: apiHost,
|
|
3656
|
+
})];
|
|
3657
|
+
case 1:
|
|
3658
|
+
response = _c.sent();
|
|
3659
|
+
if (response === null || response === void 0 ? void 0 : response.errors) {
|
|
3660
|
+
throw new Error((_b = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _b === void 0 ? void 0 : _b.message);
|
|
3661
|
+
}
|
|
3662
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.billingDetails];
|
|
3663
|
+
}
|
|
3664
|
+
});
|
|
3665
|
+
});
|
|
3666
|
+
};
|
|
3667
|
+
|
|
3642
3668
|
var PaymentMethod = function (_a) {
|
|
3643
|
-
var
|
|
3644
|
-
var
|
|
3669
|
+
var _b;
|
|
3670
|
+
var entityId = _a.entityId, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, _d = _a.cardEnabled, cardEnabled = _d === void 0 ? true : _d;
|
|
3671
|
+
var _e = React.useContext(BunnyContext), apiHost = _e.apiHost, graphQLClient = _e.graphQLClient, onTokenExpired = _e.onTokenExpired;
|
|
3645
3672
|
var token = useToken();
|
|
3646
3673
|
// Hooks
|
|
3647
3674
|
var queryClient = reactQuery.useQueryClient();
|
|
@@ -3651,8 +3678,13 @@ var PaymentMethod = function (_a) {
|
|
|
3651
3678
|
var isMobile = common.useIsMobile();
|
|
3652
3679
|
var data = usePaymentMethod(graphQLClient, entityId, token).data;
|
|
3653
3680
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], token, apiHost, entityId);
|
|
3681
|
+
// Queries
|
|
3682
|
+
var _f = reactQuery.useQuery({
|
|
3683
|
+
queryKey: common.QueryKeyFactory.default.billingDetailsKey(token, entityId),
|
|
3684
|
+
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
3685
|
+
}), billingDetails = _f.data; _f.isLoading;
|
|
3654
3686
|
// Local state
|
|
3655
|
-
var
|
|
3687
|
+
var _g = React.useState(false), showModal = _g[0], setShowModal = _g[1];
|
|
3656
3688
|
var onSuccess = function () {
|
|
3657
3689
|
queryClient.invalidateQueries({
|
|
3658
3690
|
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey(token, entityId),
|
|
@@ -3681,7 +3713,7 @@ var PaymentMethod = function (_a) {
|
|
|
3681
3713
|
handleAllErrorFormats(error);
|
|
3682
3714
|
}, onPaymentSuccess: function () {
|
|
3683
3715
|
onSuccess();
|
|
3684
|
-
}, graphQLClient: graphQLClient }) }))] })));
|
|
3716
|
+
}, graphQLClient: graphQLClient, currencyId: (_b = billingDetails === null || billingDetails === void 0 ? void 0 : billingDetails.currency) === null || _b === void 0 ? void 0 : _b.id }) }))] })));
|
|
3685
3717
|
};
|
|
3686
3718
|
|
|
3687
3719
|
var pageWrapperClassName = function (isMobile) {
|
|
@@ -4834,33 +4866,6 @@ var billingDetailsUpdate = function (_a) {
|
|
|
4834
4866
|
});
|
|
4835
4867
|
};
|
|
4836
4868
|
|
|
4837
|
-
// TODO: move this to common
|
|
4838
|
-
var billingDetailsQuery = function () {
|
|
4839
|
-
return "\nquery BillingDetails {\n billingDetails {\n billingCity\n billingContact {\n email\n }\n billingCountry\n billingState\n billingStreet\n billingZip\n name\n taxNumber\n }\n}";
|
|
4840
|
-
};
|
|
4841
|
-
var getBillingDetails = function (_a) {
|
|
4842
|
-
var token = _a.token, apiHost = _a.apiHost;
|
|
4843
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
4844
|
-
var response;
|
|
4845
|
-
var _b;
|
|
4846
|
-
return __generator(this, function (_c) {
|
|
4847
|
-
switch (_c.label) {
|
|
4848
|
-
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4849
|
-
query: billingDetailsQuery(),
|
|
4850
|
-
token: token,
|
|
4851
|
-
apiHost: apiHost,
|
|
4852
|
-
})];
|
|
4853
|
-
case 1:
|
|
4854
|
-
response = _c.sent();
|
|
4855
|
-
if (response === null || response === void 0 ? void 0 : response.errors) {
|
|
4856
|
-
throw new Error((_b = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _b === void 0 ? void 0 : _b.message);
|
|
4857
|
-
}
|
|
4858
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.billingDetails];
|
|
4859
|
-
}
|
|
4860
|
-
});
|
|
4861
|
-
});
|
|
4862
|
-
};
|
|
4863
|
-
|
|
4864
4869
|
var BillingDetails = function (_a) {
|
|
4865
4870
|
var entityId = _a.entityId, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, className = _a.className, hidePaymentMethodForm = _a.hidePaymentMethodForm, countryListFilter = _a.countryListFilter;
|
|
4866
4871
|
var _d = React.useContext(BunnyContext), apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired, graphQLClient = _d.graphQLClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
|
|
2
2
|
import { GraphQLClient } from "graphql-request";
|
|
3
|
-
export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, }: {
|
|
3
|
+
export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, }: {
|
|
4
4
|
entityId: string;
|
|
5
5
|
invoice?: FormattedInvoice | undefined;
|
|
6
6
|
quote?: Quote | undefined;
|
|
@@ -11,4 +11,5 @@ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess
|
|
|
11
11
|
overrideToken?: string | undefined;
|
|
12
12
|
graphQLClient: GraphQLClient;
|
|
13
13
|
customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
|
|
14
|
+
currencyId?: string | undefined;
|
|
14
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Currency } from "@bunnyapp/common";
|
|
1
2
|
export default interface BillingDetails {
|
|
2
3
|
name?: string;
|
|
3
4
|
billingCity?: string;
|
|
@@ -9,4 +10,5 @@ export default interface BillingDetails {
|
|
|
9
10
|
billingStreet?: string;
|
|
10
11
|
billingZip?: string;
|
|
11
12
|
taxNumber?: string;
|
|
13
|
+
currency?: Currency;
|
|
12
14
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -2714,12 +2714,14 @@ function useRemovePaymentMethod(paymentPlugins, token, apiHost, entityId, accoun
|
|
|
2714
2714
|
var Panel = Collapse.Panel;
|
|
2715
2715
|
var PaymentForm = function (_a) {
|
|
2716
2716
|
var _b;
|
|
2717
|
-
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction;
|
|
2717
|
+
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId;
|
|
2718
2718
|
// Local state
|
|
2719
2719
|
var _c = useState(), selectedPaymentMethod = _c[0], setSelectedPaymentMethod = _c[1];
|
|
2720
2720
|
var _d = useState(false), showPaymentMethodForm = _d[0], setShowPaymentMethodForm = _d[1];
|
|
2721
2721
|
var paying = !!(quote || invoice);
|
|
2722
|
-
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
|
|
2722
|
+
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
|
|
2723
|
+
(invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) ||
|
|
2724
|
+
currencyIdFromProps)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
2723
2725
|
// Hooks
|
|
2724
2726
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
2725
2727
|
var token = useToken();
|
|
@@ -2766,9 +2768,6 @@ var PaymentForm = function (_a) {
|
|
|
2766
2768
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2767
2769
|
setShowPaymentMethodForm(false);
|
|
2768
2770
|
};
|
|
2769
|
-
if (!currencyId) {
|
|
2770
|
-
return jsx("div", { children: "No currency id found from quote or invoice" });
|
|
2771
|
-
}
|
|
2772
2771
|
return (jsx(PaymentContext.Provider, __assign({ value: {
|
|
2773
2772
|
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2774
2773
|
accountId: accountId,
|
|
@@ -2783,7 +2782,7 @@ var PaymentForm = function (_a) {
|
|
|
2783
2782
|
};
|
|
2784
2783
|
function StripeWrapper(_a) {
|
|
2785
2784
|
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, currencyId = _a.currencyId, accountId = _a.accountId;
|
|
2786
|
-
var _b = useStripePlugin(plugin, token, apiHost, currencyId, accountId), stripe = _b.stripe, options = _b.options;
|
|
2785
|
+
var _b = useStripePlugin(plugin, token, apiHost, currencyId || "usd", accountId), stripe = _b.stripe, options = _b.options;
|
|
2787
2786
|
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: children })));
|
|
2788
2787
|
}
|
|
2789
2788
|
|
|
@@ -3611,9 +3610,37 @@ var DrawerHeader = function (_a) {
|
|
|
3611
3610
|
return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx(Text$5, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), jsx("button", __assign({ onClick: onClose, className: "ant-drawer-close" }, { children: jsx(CloseOutlined$1, {}) }))] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
|
|
3612
3611
|
};
|
|
3613
3612
|
|
|
3613
|
+
// TODO: move this to common
|
|
3614
|
+
var billingDetailsQuery = function () {
|
|
3615
|
+
return "\nquery BillingDetails {\n billingDetails {\n billingCity\n billingContact {\n email\n }\n billingCountry\n billingState\n billingStreet\n billingZip\n name\n taxNumber\n currency {\n id\n }\n }\n}";
|
|
3616
|
+
};
|
|
3617
|
+
var getBillingDetails = function (_a) {
|
|
3618
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
3619
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3620
|
+
var response;
|
|
3621
|
+
var _b;
|
|
3622
|
+
return __generator(this, function (_c) {
|
|
3623
|
+
switch (_c.label) {
|
|
3624
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
3625
|
+
query: billingDetailsQuery(),
|
|
3626
|
+
token: token,
|
|
3627
|
+
apiHost: apiHost,
|
|
3628
|
+
})];
|
|
3629
|
+
case 1:
|
|
3630
|
+
response = _c.sent();
|
|
3631
|
+
if (response === null || response === void 0 ? void 0 : response.errors) {
|
|
3632
|
+
throw new Error((_b = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _b === void 0 ? void 0 : _b.message);
|
|
3633
|
+
}
|
|
3634
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.billingDetails];
|
|
3635
|
+
}
|
|
3636
|
+
});
|
|
3637
|
+
});
|
|
3638
|
+
};
|
|
3639
|
+
|
|
3614
3640
|
var PaymentMethod = function (_a) {
|
|
3615
|
-
var
|
|
3616
|
-
var
|
|
3641
|
+
var _b;
|
|
3642
|
+
var entityId = _a.entityId, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, _d = _a.cardEnabled, cardEnabled = _d === void 0 ? true : _d;
|
|
3643
|
+
var _e = useContext(BunnyContext), apiHost = _e.apiHost, graphQLClient = _e.graphQLClient, onTokenExpired = _e.onTokenExpired;
|
|
3617
3644
|
var token = useToken();
|
|
3618
3645
|
// Hooks
|
|
3619
3646
|
var queryClient = useQueryClient();
|
|
@@ -3623,8 +3650,13 @@ var PaymentMethod = function (_a) {
|
|
|
3623
3650
|
var isMobile = useIsMobile();
|
|
3624
3651
|
var data = usePaymentMethod(graphQLClient, entityId, token).data;
|
|
3625
3652
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], token, apiHost, entityId);
|
|
3653
|
+
// Queries
|
|
3654
|
+
var _f = useQuery({
|
|
3655
|
+
queryKey: QueryKeyFactory.default.billingDetailsKey(token, entityId),
|
|
3656
|
+
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
3657
|
+
}), billingDetails = _f.data; _f.isLoading;
|
|
3626
3658
|
// Local state
|
|
3627
|
-
var
|
|
3659
|
+
var _g = useState(false), showModal = _g[0], setShowModal = _g[1];
|
|
3628
3660
|
var onSuccess = function () {
|
|
3629
3661
|
queryClient.invalidateQueries({
|
|
3630
3662
|
queryKey: QueryKeyFactory.default.accountPaymentMethodKey(token, entityId),
|
|
@@ -3653,7 +3685,7 @@ var PaymentMethod = function (_a) {
|
|
|
3653
3685
|
handleAllErrorFormats(error);
|
|
3654
3686
|
}, onPaymentSuccess: function () {
|
|
3655
3687
|
onSuccess();
|
|
3656
|
-
}, graphQLClient: graphQLClient }) }))] })));
|
|
3688
|
+
}, graphQLClient: graphQLClient, currencyId: (_b = billingDetails === null || billingDetails === void 0 ? void 0 : billingDetails.currency) === null || _b === void 0 ? void 0 : _b.id }) }))] })));
|
|
3657
3689
|
};
|
|
3658
3690
|
|
|
3659
3691
|
var pageWrapperClassName = function (isMobile) {
|
|
@@ -4806,33 +4838,6 @@ var billingDetailsUpdate = function (_a) {
|
|
|
4806
4838
|
});
|
|
4807
4839
|
};
|
|
4808
4840
|
|
|
4809
|
-
// TODO: move this to common
|
|
4810
|
-
var billingDetailsQuery = function () {
|
|
4811
|
-
return "\nquery BillingDetails {\n billingDetails {\n billingCity\n billingContact {\n email\n }\n billingCountry\n billingState\n billingStreet\n billingZip\n name\n taxNumber\n }\n}";
|
|
4812
|
-
};
|
|
4813
|
-
var getBillingDetails = function (_a) {
|
|
4814
|
-
var token = _a.token, apiHost = _a.apiHost;
|
|
4815
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
4816
|
-
var response;
|
|
4817
|
-
var _b;
|
|
4818
|
-
return __generator(this, function (_c) {
|
|
4819
|
-
switch (_c.label) {
|
|
4820
|
-
case 0: return [4 /*yield*/, gqlRequest({
|
|
4821
|
-
query: billingDetailsQuery(),
|
|
4822
|
-
token: token,
|
|
4823
|
-
apiHost: apiHost,
|
|
4824
|
-
})];
|
|
4825
|
-
case 1:
|
|
4826
|
-
response = _c.sent();
|
|
4827
|
-
if (response === null || response === void 0 ? void 0 : response.errors) {
|
|
4828
|
-
throw new Error((_b = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _b === void 0 ? void 0 : _b.message);
|
|
4829
|
-
}
|
|
4830
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.billingDetails];
|
|
4831
|
-
}
|
|
4832
|
-
});
|
|
4833
|
-
});
|
|
4834
|
-
};
|
|
4835
|
-
|
|
4836
4841
|
var BillingDetails = function (_a) {
|
|
4837
4842
|
var entityId = _a.entityId, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, className = _a.className, hidePaymentMethodForm = _a.hidePaymentMethodForm, countryListFilter = _a.countryListFilter;
|
|
4838
4843
|
var _d = useContext(BunnyContext), apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired, graphQLClient = _d.graphQLClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
|
|
2
2
|
import { GraphQLClient } from "graphql-request";
|
|
3
|
-
export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, }: {
|
|
3
|
+
export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, }: {
|
|
4
4
|
entityId: string;
|
|
5
5
|
invoice?: FormattedInvoice | undefined;
|
|
6
6
|
quote?: Quote | undefined;
|
|
@@ -11,4 +11,5 @@ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess
|
|
|
11
11
|
overrideToken?: string | undefined;
|
|
12
12
|
graphQLClient: GraphQLClient;
|
|
13
13
|
customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
|
|
14
|
+
currencyId?: string | undefined;
|
|
14
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Currency } from "@bunnyapp/common";
|
|
1
2
|
export default interface BillingDetails {
|
|
2
3
|
name?: string;
|
|
3
4
|
billingCity?: string;
|
|
@@ -9,4 +10,5 @@ export default interface BillingDetails {
|
|
|
9
10
|
billingStreet?: string;
|
|
10
11
|
billingZip?: string;
|
|
11
12
|
taxNumber?: string;
|
|
13
|
+
currency?: Currency;
|
|
12
14
|
}
|
package/package.json
CHANGED