@bunnyapp/components 1.0.56-beta.0.5 → 1.0.56-beta.0.6
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
CHANGED
|
@@ -429,14 +429,16 @@ function InvoicePDF(_a) {
|
|
|
429
429
|
|
|
430
430
|
var paymentMethodsQuery = function (filter) { return "query paymentMethods {\n paymentMethods ".concat(filter ? "(".concat(filter, ")") : '', " {\n nodes {\n id\n disabled\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n }\n isDefault\n }\n }\n}"); };
|
|
431
431
|
var getPaymentMethods = function (_a) {
|
|
432
|
-
var apiHost = _a.apiHost, token = _a.token;
|
|
432
|
+
var apiHost = _a.apiHost, token = _a.token, accountId = _a.accountId;
|
|
433
433
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
434
434
|
var response, paymentMethods;
|
|
435
435
|
var _b;
|
|
436
436
|
return __generator(this, function (_c) {
|
|
437
437
|
switch (_c.label) {
|
|
438
438
|
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
439
|
-
query: paymentMethodsQuery(
|
|
439
|
+
query: paymentMethodsQuery(accountId
|
|
440
|
+
? "filter: \"accountId is ".concat(accountId, " && disabled is false\"")
|
|
441
|
+
: 'filter: "disabled is false"'),
|
|
440
442
|
token: token,
|
|
441
443
|
apiHost: apiHost,
|
|
442
444
|
})];
|
|
@@ -455,7 +457,7 @@ var usePaymentMethod = function (_a) {
|
|
|
455
457
|
accountId: accountId,
|
|
456
458
|
token: token,
|
|
457
459
|
}),
|
|
458
|
-
queryFn: function () { return getPaymentMethods({ apiHost: apiHost, token: token }); },
|
|
460
|
+
queryFn: function () { return getPaymentMethods({ apiHost: apiHost, token: token, accountId: accountId }); },
|
|
459
461
|
}), data = _b.data, isLoading = _b.isLoading;
|
|
460
462
|
return {
|
|
461
463
|
paymentMethods: data,
|
|
@@ -22682,14 +22684,14 @@ function BillingDetailsSection(_a) {
|
|
|
22682
22684
|
}
|
|
22683
22685
|
|
|
22684
22686
|
var BillingDetails = function (_a) {
|
|
22685
|
-
var _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, _c = _a.shadow, shadow = _c === void 0 ?
|
|
22687
|
+
var _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, _c = _a.shadow, shadow = _c === void 0 ? 'shadow-md' : _c, className = _a.className, _d = _a.hidePaymentMethodForm, hidePaymentMethodForm = _d === void 0 ? false : _d, _e = _a.hideBillingDetailsForm, hideBillingDetailsForm = _e === void 0 ? false : _e, countryListFilter = _a.countryListFilter;
|
|
22686
22688
|
// Hooks
|
|
22687
22689
|
var isMobile = common.useIsMobile();
|
|
22688
|
-
return (jsxRuntime.jsx(WrapperComponent, __assign({ isCardEnabled: isCardEnabled, shadow: shadow, className: className }, { children: jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-p-2 bunny-my-2 ".concat(isMobile ?
|
|
22690
|
+
return (jsxRuntime.jsx(WrapperComponent, __assign({ isCardEnabled: isCardEnabled, shadow: shadow, className: className }, { children: jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-p-2 bunny-my-2 ".concat(isMobile ? 'bunny-flex-col bunny-space-y-4' : 'bunny-flex-row', " bunny-gap-4") }, { children: [!hideBillingDetailsForm ? (jsxRuntime.jsx(BillingDetailsSection, { hidePaymentMethodForm: hidePaymentMethodForm, countryListFilter: countryListFilter })) : null, !hideBillingDetailsForm && !hidePaymentMethodForm ? jsxRuntime.jsx(ResponsiveDivider, {}) : null, !hidePaymentMethodForm ? (jsxRuntime.jsx(PaymentFormSection, { hideBillingDetailsForm: hideBillingDetailsForm })) : null] })) })));
|
|
22689
22691
|
};
|
|
22690
22692
|
var WrapperComponent = function (_a) {
|
|
22691
22693
|
var children = _a.children, isCardEnabled = _a.isCardEnabled, shadow = _a.shadow, className = _a.className;
|
|
22692
|
-
return (jsxRuntime.jsx("div", __assign({ className: "".concat(className) }, { children: isCardEnabled ?
|
|
22694
|
+
return (jsxRuntime.jsx("div", __assign({ className: "".concat(className) }, { children: isCardEnabled ? jsxRuntime.jsx(Card, __assign({ className: "".concat(shadow) }, { children: children })) : jsxRuntime.jsx("div", { children: children }) })));
|
|
22693
22695
|
};
|
|
22694
22696
|
var ResponsiveDivider = function () {
|
|
22695
22697
|
var isMobile = common.useIsMobile();
|
|
@@ -22701,10 +22703,10 @@ var PaymentFormSection = function (_a) {
|
|
|
22701
22703
|
var onTokenExpired = react.useContext(BunnyContext).onTokenExpired;
|
|
22702
22704
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
22703
22705
|
var showSuccessNotification = common.useSuccessNotification();
|
|
22704
|
-
return (jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ?
|
|
22706
|
+
return (jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4', " bunny-flex bunny-justify-center") }, { children: jsxRuntime.jsx(PaymentForm, { onFail: function (error) {
|
|
22705
22707
|
handleAllErrorFormats(error);
|
|
22706
22708
|
}, onSavePaymentMethod: function () {
|
|
22707
|
-
showSuccessNotification(
|
|
22709
|
+
showSuccessNotification('Your payment method has been saved');
|
|
22708
22710
|
} }) })));
|
|
22709
22711
|
};
|
|
22710
22712
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ShadowType } from
|
|
1
|
+
import '../../styles/index.less';
|
|
2
|
+
import { ShadowType } from '../../types/shadowType';
|
|
3
3
|
declare const BillingDetails: ({ isCardEnabled, shadow, className, hidePaymentMethodForm, hideBillingDetailsForm, countryListFilter, }: {
|
|
4
4
|
isCardEnabled?: boolean | undefined;
|
|
5
5
|
shadow?: ShadowType | undefined;
|
package/dist/esm/index.js
CHANGED
|
@@ -400,14 +400,16 @@ function InvoicePDF(_a) {
|
|
|
400
400
|
|
|
401
401
|
var paymentMethodsQuery = function (filter) { return "query paymentMethods {\n paymentMethods ".concat(filter ? "(".concat(filter, ")") : '', " {\n nodes {\n id\n disabled\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n }\n isDefault\n }\n }\n}"); };
|
|
402
402
|
var getPaymentMethods = function (_a) {
|
|
403
|
-
var apiHost = _a.apiHost, token = _a.token;
|
|
403
|
+
var apiHost = _a.apiHost, token = _a.token, accountId = _a.accountId;
|
|
404
404
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
405
405
|
var response, paymentMethods;
|
|
406
406
|
var _b;
|
|
407
407
|
return __generator(this, function (_c) {
|
|
408
408
|
switch (_c.label) {
|
|
409
409
|
case 0: return [4 /*yield*/, gqlRequest({
|
|
410
|
-
query: paymentMethodsQuery(
|
|
410
|
+
query: paymentMethodsQuery(accountId
|
|
411
|
+
? "filter: \"accountId is ".concat(accountId, " && disabled is false\"")
|
|
412
|
+
: 'filter: "disabled is false"'),
|
|
411
413
|
token: token,
|
|
412
414
|
apiHost: apiHost,
|
|
413
415
|
})];
|
|
@@ -426,7 +428,7 @@ var usePaymentMethod = function (_a) {
|
|
|
426
428
|
accountId: accountId,
|
|
427
429
|
token: token,
|
|
428
430
|
}),
|
|
429
|
-
queryFn: function () { return getPaymentMethods({ apiHost: apiHost, token: token }); },
|
|
431
|
+
queryFn: function () { return getPaymentMethods({ apiHost: apiHost, token: token, accountId: accountId }); },
|
|
430
432
|
}), data = _b.data, isLoading = _b.isLoading;
|
|
431
433
|
return {
|
|
432
434
|
paymentMethods: data,
|
|
@@ -22653,14 +22655,14 @@ function BillingDetailsSection(_a) {
|
|
|
22653
22655
|
}
|
|
22654
22656
|
|
|
22655
22657
|
var BillingDetails = function (_a) {
|
|
22656
|
-
var _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, _c = _a.shadow, shadow = _c === void 0 ?
|
|
22658
|
+
var _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, _c = _a.shadow, shadow = _c === void 0 ? 'shadow-md' : _c, className = _a.className, _d = _a.hidePaymentMethodForm, hidePaymentMethodForm = _d === void 0 ? false : _d, _e = _a.hideBillingDetailsForm, hideBillingDetailsForm = _e === void 0 ? false : _e, countryListFilter = _a.countryListFilter;
|
|
22657
22659
|
// Hooks
|
|
22658
22660
|
var isMobile = useIsMobile();
|
|
22659
|
-
return (jsx(WrapperComponent, __assign({ isCardEnabled: isCardEnabled, shadow: shadow, className: className }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-p-2 bunny-my-2 ".concat(isMobile ?
|
|
22661
|
+
return (jsx(WrapperComponent, __assign({ isCardEnabled: isCardEnabled, shadow: shadow, className: className }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-p-2 bunny-my-2 ".concat(isMobile ? 'bunny-flex-col bunny-space-y-4' : 'bunny-flex-row', " bunny-gap-4") }, { children: [!hideBillingDetailsForm ? (jsx(BillingDetailsSection, { hidePaymentMethodForm: hidePaymentMethodForm, countryListFilter: countryListFilter })) : null, !hideBillingDetailsForm && !hidePaymentMethodForm ? jsx(ResponsiveDivider, {}) : null, !hidePaymentMethodForm ? (jsx(PaymentFormSection, { hideBillingDetailsForm: hideBillingDetailsForm })) : null] })) })));
|
|
22660
22662
|
};
|
|
22661
22663
|
var WrapperComponent = function (_a) {
|
|
22662
22664
|
var children = _a.children, isCardEnabled = _a.isCardEnabled, shadow = _a.shadow, className = _a.className;
|
|
22663
|
-
return (jsx("div", __assign({ className: "".concat(className) }, { children: isCardEnabled ?
|
|
22665
|
+
return (jsx("div", __assign({ className: "".concat(className) }, { children: isCardEnabled ? jsx(Card, __assign({ className: "".concat(shadow) }, { children: children })) : jsx("div", { children: children }) })));
|
|
22664
22666
|
};
|
|
22665
22667
|
var ResponsiveDivider = function () {
|
|
22666
22668
|
var isMobile = useIsMobile();
|
|
@@ -22672,10 +22674,10 @@ var PaymentFormSection = function (_a) {
|
|
|
22672
22674
|
var onTokenExpired = useContext(BunnyContext).onTokenExpired;
|
|
22673
22675
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
22674
22676
|
var showSuccessNotification = useSuccessNotification();
|
|
22675
|
-
return (jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ?
|
|
22677
|
+
return (jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4', " bunny-flex bunny-justify-center") }, { children: jsx(PaymentForm, { onFail: function (error) {
|
|
22676
22678
|
handleAllErrorFormats(error);
|
|
22677
22679
|
}, onSavePaymentMethod: function () {
|
|
22678
|
-
showSuccessNotification(
|
|
22680
|
+
showSuccessNotification('Your payment method has been saved');
|
|
22679
22681
|
} }) })));
|
|
22680
22682
|
};
|
|
22681
22683
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ShadowType } from
|
|
1
|
+
import '../../styles/index.less';
|
|
2
|
+
import { ShadowType } from '../../types/shadowType';
|
|
3
3
|
declare const BillingDetails: ({ isCardEnabled, shadow, className, hidePaymentMethodForm, hideBillingDetailsForm, countryListFilter, }: {
|
|
4
4
|
isCardEnabled?: boolean | undefined;
|
|
5
5
|
shadow?: ShadowType | 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.6",
|
|
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",
|