@bunnyapp/components 1.7.0-beta.23 → 1.7.0-beta.24

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
@@ -1283,7 +1283,7 @@ const DEFAULT_CONFIG = {
1283
1283
  };
1284
1284
 
1285
1285
  // This will be replaced at build time by rollup-plugin-replace
1286
- const PACKAGE_VERSION = '1.7.0-beta.22';
1286
+ const PACKAGE_VERSION = '1.7.0-beta.23';
1287
1287
  const createRequestHeaders = (token) => {
1288
1288
  const headers = createClientDevHeaders({ token });
1289
1289
  // Add the components version header
@@ -21138,12 +21138,13 @@ const useCurrentUserData = (token) => {
21138
21138
  return { currentUser, isCurrentUserDataLoading };
21139
21139
  };
21140
21140
 
21141
- function usePayableCurrency({ payableCurrencyId }) {
21141
+ function usePayableCurrency({ payableCurrencyId, accountCurrencyId }) {
21142
+ var _a;
21142
21143
  const token = useToken();
21143
21144
  const { currentUser, isCurrentUserDataLoading } = useCurrentUserData(token);
21144
21145
  const account = currentUser === null || currentUser === void 0 ? void 0 : currentUser.account;
21145
- const accountCurrencyId = account === null || account === void 0 ? void 0 : account.currencyId;
21146
- const currencyId = react.useMemo(() => { var _a; return (_a = (accountCurrencyId || payableCurrencyId)) === null || _a === void 0 ? void 0 : _a.toLowerCase(); }, [accountCurrencyId, payableCurrencyId]);
21146
+ const accountCurrencyIdValue = (_a = account === null || account === void 0 ? void 0 : account.currencyId) !== null && _a !== void 0 ? _a : accountCurrencyId;
21147
+ const currencyId = react.useMemo(() => { var _a; return (_a = (accountCurrencyIdValue !== null && accountCurrencyIdValue !== void 0 ? accountCurrencyIdValue : payableCurrencyId)) === null || _a === void 0 ? void 0 : _a.toLowerCase(); }, [accountCurrencyIdValue, payableCurrencyId]);
21147
21148
  return { currencyId, isCurrencyIdLoading: isCurrentUserDataLoading };
21148
21149
  }
21149
21150
 
@@ -21261,11 +21262,13 @@ const PaymentForm_QuoteFragment = t(`
21261
21262
  ...PaymentProvider_QuoteFragment
21262
21263
  }
21263
21264
  `, [PaymentProvider_QuoteFragment]);
21264
- function PaymentForm({ invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }) {
21265
+ function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }) {
21266
+ var _a;
21265
21267
  // Read fragments
21266
21268
  const quote = readFragment(PaymentForm_QuoteFragment, maskedQuote);
21267
21269
  const { currencyId, isCurrencyIdLoading } = usePayableCurrency({
21268
- payableCurrencyId: (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId),
21270
+ payableCurrencyId: (_a = quote === null || quote === void 0 ? void 0 : quote.currencyId) !== null && _a !== void 0 ? _a : invoice === null || invoice === void 0 ? void 0 : invoice.currencyId,
21271
+ accountCurrencyId,
21269
21272
  });
21270
21273
  // Return early because PaymentForm should not be rendered without a valid currency ID.
21271
21274
  // For example, sepa / iDeal may not show for Dutch customer if no currencyId
@@ -14,7 +14,8 @@ export declare const PaymentForm_QuoteFragment: import("gql.tada").TadaDocumentN
14
14
  on: "Quote";
15
15
  masked: true;
16
16
  }>;
17
- export declare function PaymentForm({ invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
17
+ export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
18
+ currencyId?: string;
18
19
  invoice?: FormattedInvoice | Invoice;
19
20
  quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
20
21
  onPaymentSuccess?: (response: any) => void;
@@ -1,5 +1,6 @@
1
- export declare function usePayableCurrency({ payableCurrencyId }: {
1
+ export declare function usePayableCurrency({ payableCurrencyId, accountCurrencyId }: {
2
2
  payableCurrencyId?: string;
3
+ accountCurrencyId?: string;
3
4
  }): {
4
5
  currencyId: string | undefined;
5
6
  isCurrencyIdLoading: boolean;
package/dist/esm/index.js CHANGED
@@ -1281,7 +1281,7 @@ const DEFAULT_CONFIG = {
1281
1281
  };
1282
1282
 
1283
1283
  // This will be replaced at build time by rollup-plugin-replace
1284
- const PACKAGE_VERSION = '1.7.0-beta.22';
1284
+ const PACKAGE_VERSION = '1.7.0-beta.23';
1285
1285
  const createRequestHeaders = (token) => {
1286
1286
  const headers = createClientDevHeaders({ token });
1287
1287
  // Add the components version header
@@ -21136,12 +21136,13 @@ const useCurrentUserData = (token) => {
21136
21136
  return { currentUser, isCurrentUserDataLoading };
21137
21137
  };
21138
21138
 
21139
- function usePayableCurrency({ payableCurrencyId }) {
21139
+ function usePayableCurrency({ payableCurrencyId, accountCurrencyId }) {
21140
+ var _a;
21140
21141
  const token = useToken();
21141
21142
  const { currentUser, isCurrentUserDataLoading } = useCurrentUserData(token);
21142
21143
  const account = currentUser === null || currentUser === void 0 ? void 0 : currentUser.account;
21143
- const accountCurrencyId = account === null || account === void 0 ? void 0 : account.currencyId;
21144
- const currencyId = useMemo(() => { var _a; return (_a = (accountCurrencyId || payableCurrencyId)) === null || _a === void 0 ? void 0 : _a.toLowerCase(); }, [accountCurrencyId, payableCurrencyId]);
21144
+ const accountCurrencyIdValue = (_a = account === null || account === void 0 ? void 0 : account.currencyId) !== null && _a !== void 0 ? _a : accountCurrencyId;
21145
+ const currencyId = useMemo(() => { var _a; return (_a = (accountCurrencyIdValue !== null && accountCurrencyIdValue !== void 0 ? accountCurrencyIdValue : payableCurrencyId)) === null || _a === void 0 ? void 0 : _a.toLowerCase(); }, [accountCurrencyIdValue, payableCurrencyId]);
21145
21146
  return { currencyId, isCurrencyIdLoading: isCurrentUserDataLoading };
21146
21147
  }
21147
21148
 
@@ -21259,11 +21260,13 @@ const PaymentForm_QuoteFragment = t(`
21259
21260
  ...PaymentProvider_QuoteFragment
21260
21261
  }
21261
21262
  `, [PaymentProvider_QuoteFragment]);
21262
- function PaymentForm({ invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }) {
21263
+ function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }) {
21264
+ var _a;
21263
21265
  // Read fragments
21264
21266
  const quote = readFragment(PaymentForm_QuoteFragment, maskedQuote);
21265
21267
  const { currencyId, isCurrencyIdLoading } = usePayableCurrency({
21266
- payableCurrencyId: (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId),
21268
+ payableCurrencyId: (_a = quote === null || quote === void 0 ? void 0 : quote.currencyId) !== null && _a !== void 0 ? _a : invoice === null || invoice === void 0 ? void 0 : invoice.currencyId,
21269
+ accountCurrencyId,
21267
21270
  });
21268
21271
  // Return early because PaymentForm should not be rendered without a valid currency ID.
21269
21272
  // For example, sepa / iDeal may not show for Dutch customer if no currencyId
@@ -14,7 +14,8 @@ export declare const PaymentForm_QuoteFragment: import("gql.tada").TadaDocumentN
14
14
  on: "Quote";
15
15
  masked: true;
16
16
  }>;
17
- export declare function PaymentForm({ invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
17
+ export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
18
+ currencyId?: string;
18
19
  invoice?: FormattedInvoice | Invoice;
19
20
  quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
20
21
  onPaymentSuccess?: (response: any) => void;
@@ -1,5 +1,6 @@
1
- export declare function usePayableCurrency({ payableCurrencyId }: {
1
+ export declare function usePayableCurrency({ payableCurrencyId, accountCurrencyId }: {
2
2
  payableCurrencyId?: string;
3
+ accountCurrencyId?: string;
3
4
  }): {
4
5
  currencyId: string | undefined;
5
6
  isCurrencyIdLoading: boolean;
package/dist/index.d.ts CHANGED
@@ -107,7 +107,8 @@ declare const PaymentForm_QuoteFragment: gql_tada.TadaDocumentNode<{
107
107
  on: "Quote";
108
108
  masked: true;
109
109
  }>;
110
- declare function PaymentForm({ invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
110
+ declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
111
+ currencyId?: string;
111
112
  invoice?: FormattedInvoice | Invoice$1;
112
113
  quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
113
114
  onPaymentSuccess?: (response: any) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.7.0-beta.23",
3
+ "version": "1.7.0-beta.24",
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",