@bunnyapp/components 1.0.56-beta.0.7 → 1.0.56-beta.0.9
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 +5 -2
- package/dist/cjs/playground/main.d.ts +1 -1
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +2 -1
- package/dist/cjs/src/components/PaymentForm/useSetDefaultPaymentMethod.d.ts +1 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/playground/main.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +2 -1
- package/dist/esm/src/components/PaymentForm/useSetDefaultPaymentMethod.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1489,7 +1489,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId, onRem
|
|
|
1489
1489
|
return removePaymentMethod;
|
|
1490
1490
|
}
|
|
1491
1491
|
|
|
1492
|
-
function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, onError) {
|
|
1492
|
+
function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, onError, onSuccess) {
|
|
1493
1493
|
var _this = this;
|
|
1494
1494
|
var queryClient = reactQuery.useQueryClient();
|
|
1495
1495
|
var showErrorNotification = common.useErrorNotification();
|
|
@@ -1515,6 +1515,7 @@ function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, o
|
|
|
1515
1515
|
})
|
|
1516
1516
|
.then(function () {
|
|
1517
1517
|
showSuccessNotification("Payment method ".concat(data.metadata.identifier, " was set as default"), 'Success');
|
|
1518
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
1518
1519
|
// TODO: rename accountPaymentMethodKey to accountPaymentMethodsKey (pluralized)
|
|
1519
1520
|
queryClient.invalidateQueries({
|
|
1520
1521
|
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({
|
|
@@ -1548,7 +1549,7 @@ var Panel = antd.Collapse.Panel;
|
|
|
1548
1549
|
var showErrorNotification$1 = common.useErrorNotification();
|
|
1549
1550
|
var PaymentForm = function (_a) {
|
|
1550
1551
|
var _b;
|
|
1551
|
-
var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, customPaymentForms = _a.customPaymentForms, _c = _a.useAllPaymentPlugins, useAllPaymentPlugins = _c === void 0 ? false : _c;
|
|
1552
|
+
var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, onSetDefaultPaymentMethod = _a.onSetDefaultPaymentMethod, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, customPaymentForms = _a.customPaymentForms, _c = _a.useAllPaymentPlugins, useAllPaymentPlugins = _c === void 0 ? false : _c;
|
|
1552
1553
|
// Local state
|
|
1553
1554
|
var _d = react.useState(false), showPaymentMethodForm = _d[0], setShowPaymentMethodForm = _d[1];
|
|
1554
1555
|
// Simple hooks
|
|
@@ -1581,6 +1582,8 @@ var PaymentForm = function (_a) {
|
|
|
1581
1582
|
// Custom hooks
|
|
1582
1583
|
var _g = useSetDefaultPaymentMethod(paymentMethodAllowedPlugins || [], apiHost, token, accountId, function (message) {
|
|
1583
1584
|
showErrorNotification$1(message, 'Error setting default payment method');
|
|
1585
|
+
}, function () {
|
|
1586
|
+
onSetDefaultPaymentMethod === null || onSetDefaultPaymentMethod === void 0 ? void 0 : onSetDefaultPaymentMethod();
|
|
1584
1587
|
}), handleSetDefault = _g.setDefaultPaymentMethod, setDefaultPaymentMethodLoading = _g.loading;
|
|
1585
1588
|
useAutoSetDefaultPaymentMethod({
|
|
1586
1589
|
accountId: accountId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../src/styles/output.less";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormattedInvoice, PluginData, Quote } from '@bunnyapp/common';
|
|
3
|
-
export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
3
|
+
export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
4
4
|
invoice?: FormattedInvoice | undefined;
|
|
5
5
|
quote?: Quote | undefined;
|
|
6
6
|
onFail: (error: any) => void;
|
|
7
7
|
onPaymentSuccess?: (() => void) | undefined;
|
|
8
8
|
onSavePaymentMethod?: (() => void) | undefined;
|
|
9
9
|
onRemovePaymentMethod?: (() => void) | undefined;
|
|
10
|
+
onSetDefaultPaymentMethod?: (() => void) | undefined;
|
|
10
11
|
accountId?: string | undefined;
|
|
11
12
|
overrideToken?: string | undefined;
|
|
12
13
|
customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PluginData } from '@bunnyapp/common';
|
|
2
|
-
declare function useSetDefaultPaymentMethod(paymentPlugins: PluginData[], apiHost: string, token?: string, accountId?: string, onError?: (message: string) => void): {
|
|
2
|
+
declare function useSetDefaultPaymentMethod(paymentPlugins: PluginData[], apiHost: string, token?: string, accountId?: string, onError?: (message: string) => void, onSuccess?: () => void): {
|
|
3
3
|
setDefaultPaymentMethod: (data: any) => Promise<void>;
|
|
4
4
|
loading: boolean;
|
|
5
5
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1460,7 +1460,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId, onRem
|
|
|
1460
1460
|
return removePaymentMethod;
|
|
1461
1461
|
}
|
|
1462
1462
|
|
|
1463
|
-
function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, onError) {
|
|
1463
|
+
function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, onError, onSuccess) {
|
|
1464
1464
|
var _this = this;
|
|
1465
1465
|
var queryClient = useQueryClient();
|
|
1466
1466
|
var showErrorNotification = useErrorNotification();
|
|
@@ -1486,6 +1486,7 @@ function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, o
|
|
|
1486
1486
|
})
|
|
1487
1487
|
.then(function () {
|
|
1488
1488
|
showSuccessNotification("Payment method ".concat(data.metadata.identifier, " was set as default"), 'Success');
|
|
1489
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
1489
1490
|
// TODO: rename accountPaymentMethodKey to accountPaymentMethodsKey (pluralized)
|
|
1490
1491
|
queryClient.invalidateQueries({
|
|
1491
1492
|
queryKey: QueryKeyFactory.default.accountPaymentMethodKey({
|
|
@@ -1519,7 +1520,7 @@ var Panel = Collapse.Panel;
|
|
|
1519
1520
|
var showErrorNotification$1 = useErrorNotification();
|
|
1520
1521
|
var PaymentForm = function (_a) {
|
|
1521
1522
|
var _b;
|
|
1522
|
-
var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, customPaymentForms = _a.customPaymentForms, _c = _a.useAllPaymentPlugins, useAllPaymentPlugins = _c === void 0 ? false : _c;
|
|
1523
|
+
var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, onSetDefaultPaymentMethod = _a.onSetDefaultPaymentMethod, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, customPaymentForms = _a.customPaymentForms, _c = _a.useAllPaymentPlugins, useAllPaymentPlugins = _c === void 0 ? false : _c;
|
|
1523
1524
|
// Local state
|
|
1524
1525
|
var _d = useState(false), showPaymentMethodForm = _d[0], setShowPaymentMethodForm = _d[1];
|
|
1525
1526
|
// Simple hooks
|
|
@@ -1552,6 +1553,8 @@ var PaymentForm = function (_a) {
|
|
|
1552
1553
|
// Custom hooks
|
|
1553
1554
|
var _g = useSetDefaultPaymentMethod(paymentMethodAllowedPlugins || [], apiHost, token, accountId, function (message) {
|
|
1554
1555
|
showErrorNotification$1(message, 'Error setting default payment method');
|
|
1556
|
+
}, function () {
|
|
1557
|
+
onSetDefaultPaymentMethod === null || onSetDefaultPaymentMethod === void 0 ? void 0 : onSetDefaultPaymentMethod();
|
|
1555
1558
|
}), handleSetDefault = _g.setDefaultPaymentMethod, setDefaultPaymentMethodLoading = _g.loading;
|
|
1556
1559
|
useAutoSetDefaultPaymentMethod({
|
|
1557
1560
|
accountId: accountId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../src/styles/output.less";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormattedInvoice, PluginData, Quote } from '@bunnyapp/common';
|
|
3
|
-
export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
3
|
+
export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
4
4
|
invoice?: FormattedInvoice | undefined;
|
|
5
5
|
quote?: Quote | undefined;
|
|
6
6
|
onFail: (error: any) => void;
|
|
7
7
|
onPaymentSuccess?: (() => void) | undefined;
|
|
8
8
|
onSavePaymentMethod?: (() => void) | undefined;
|
|
9
9
|
onRemovePaymentMethod?: (() => void) | undefined;
|
|
10
|
+
onSetDefaultPaymentMethod?: (() => void) | undefined;
|
|
10
11
|
accountId?: string | undefined;
|
|
11
12
|
overrideToken?: string | undefined;
|
|
12
13
|
customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PluginData } from '@bunnyapp/common';
|
|
2
|
-
declare function useSetDefaultPaymentMethod(paymentPlugins: PluginData[], apiHost: string, token?: string, accountId?: string, onError?: (message: string) => void): {
|
|
2
|
+
declare function useSetDefaultPaymentMethod(paymentPlugins: PluginData[], apiHost: string, token?: string, accountId?: string, onError?: (message: string) => void, onSuccess?: () => void): {
|
|
3
3
|
setDefaultPaymentMethod: (data: any) => Promise<void>;
|
|
4
4
|
loading: boolean;
|
|
5
5
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -71,13 +71,14 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
|
|
|
71
71
|
noQuotesMessage?: string;
|
|
72
72
|
}): react_jsx_runtime.JSX.Element;
|
|
73
73
|
|
|
74
|
-
declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
74
|
+
declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
75
75
|
invoice?: FormattedInvoice | undefined;
|
|
76
76
|
quote?: Quote$1 | undefined;
|
|
77
77
|
onFail: (error: any) => void;
|
|
78
78
|
onPaymentSuccess?: (() => void) | undefined;
|
|
79
79
|
onSavePaymentMethod?: (() => void) | undefined;
|
|
80
80
|
onRemovePaymentMethod?: (() => void) | undefined;
|
|
81
|
+
onSetDefaultPaymentMethod?: (() => void) | undefined;
|
|
81
82
|
accountId?: string | undefined;
|
|
82
83
|
overrideToken?: string | undefined;
|
|
83
84
|
customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunnyapp/components",
|
|
3
|
-
"version": "1.0.56-beta.0.
|
|
3
|
+
"version": "1.0.56-beta.0.9",
|
|
4
4
|
"description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|