@pelcro/react-pelcro-js 3.1.0-beta.1 → 3.1.0-beta.4

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/index.cjs.js CHANGED
@@ -15207,7 +15207,7 @@ const getSuccessContent = i18n => {
15207
15207
  className: "plc-w-32 plc-my-4 plc-text-green-500"
15208
15208
  }),
15209
15209
  successTitle: i18n("messages.invoicePayment.title"),
15210
- successContent: i18n("messages.invoicePayment.title")
15210
+ successContent: i18n("messages.invoicePayment.content")
15211
15211
  }
15212
15212
  };
15213
15213
  return wordingDictionary[flow];
@@ -20075,9 +20075,23 @@ const PaymentMethodSelectContainer = ({
20075
20075
  return onSuccess(selectedPaymentMethodId);
20076
20076
  };
20077
20077
 
20078
- const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20079
- var _window$Pelcro$user$r2, _window$Pelcro$user$r3;
20078
+ const getInitialSelectedMethodId = () => {
20079
+ var _window$Pelcro$user$r2;
20080
+
20081
+ if (selectedPaymentMethodIdFromStore) {
20082
+ return selectedPaymentMethodIdFromStore;
20083
+ }
20084
+
20085
+ const defaultMethod = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.source;
20086
+
20087
+ if (defaultMethod && defaultMethod.status === "chargeable") {
20088
+ return String(defaultMethod.id);
20089
+ }
20080
20090
 
20091
+ return null;
20092
+ };
20093
+
20094
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20081
20095
  switch (action.type) {
20082
20096
  case SELECT_PAYMENT_METHOD:
20083
20097
  return lib_7({ ...state,
@@ -20087,7 +20101,7 @@ const PaymentMethodSelectContainer = ({
20087
20101
  case LOAD_PAYMENT_METHODS:
20088
20102
  return lib_7({ ...state,
20089
20103
  paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
20090
- selectedPaymentMethodId: selectedPaymentMethodIdFromStore !== null && selectedPaymentMethodIdFromStore !== void 0 ? selectedPaymentMethodIdFromStore : String((_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : (_window$Pelcro$user$r3 = _window$Pelcro$user$r2.source) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.id)
20104
+ selectedPaymentMethodId: getInitialSelectedMethodId()
20091
20105
  });
20092
20106
 
20093
20107
  case HANDLE_SUBMIT:
@@ -20100,11 +20114,11 @@ const PaymentMethodSelectContainer = ({
20100
20114
  }
20101
20115
  }, initialState$3);
20102
20116
  React.useEffect(() => {
20103
- var _window$Pelcro$user$r4;
20117
+ var _window$Pelcro$user$r3;
20104
20118
 
20105
20119
  dispatch({
20106
20120
  type: LOAD_PAYMENT_METHODS,
20107
- payload: (_window$Pelcro$user$r4 = window.Pelcro.user.read().sources) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : []
20121
+ payload: (_window$Pelcro$user$r3 = window.Pelcro.user.read().sources) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : []
20108
20122
  });
20109
20123
  }, []);
20110
20124
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -25146,7 +25160,7 @@ const InvoiceDetailsView = props => {
25146
25160
  }, t("labels.amountPaid")), /*#__PURE__*/React__default['default'].createElement("p", {
25147
25161
  className: "plc-font-semibold pelcro-invoice-total-text"
25148
25162
  }, t("labels.amountDue"))), /*#__PURE__*/React__default['default'].createElement("div", {
25149
- className: "plc-flex plc-flex-col"
25163
+ className: "plc-flex plc-flex-col plc-items-end"
25150
25164
  }, /*#__PURE__*/React__default['default'].createElement("p", {
25151
25165
  className: "pelcro-invoice-total"
25152
25166
  }, getFormattedPriceByLocal(invoice.total, invoice.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default['default'].createElement("p", {
package/dist/index.esm.js CHANGED
@@ -15177,7 +15177,7 @@ const getSuccessContent = i18n => {
15177
15177
  className: "plc-w-32 plc-my-4 plc-text-green-500"
15178
15178
  }),
15179
15179
  successTitle: i18n("messages.invoicePayment.title"),
15180
- successContent: i18n("messages.invoicePayment.title")
15180
+ successContent: i18n("messages.invoicePayment.content")
15181
15181
  }
15182
15182
  };
15183
15183
  return wordingDictionary[flow];
@@ -20045,9 +20045,23 @@ const PaymentMethodSelectContainer = ({
20045
20045
  return onSuccess(selectedPaymentMethodId);
20046
20046
  };
20047
20047
 
20048
- const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20049
- var _window$Pelcro$user$r2, _window$Pelcro$user$r3;
20048
+ const getInitialSelectedMethodId = () => {
20049
+ var _window$Pelcro$user$r2;
20050
+
20051
+ if (selectedPaymentMethodIdFromStore) {
20052
+ return selectedPaymentMethodIdFromStore;
20053
+ }
20054
+
20055
+ const defaultMethod = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.source;
20056
+
20057
+ if (defaultMethod && defaultMethod.status === "chargeable") {
20058
+ return String(defaultMethod.id);
20059
+ }
20050
20060
 
20061
+ return null;
20062
+ };
20063
+
20064
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20051
20065
  switch (action.type) {
20052
20066
  case SELECT_PAYMENT_METHOD:
20053
20067
  return lib_7({ ...state,
@@ -20057,7 +20071,7 @@ const PaymentMethodSelectContainer = ({
20057
20071
  case LOAD_PAYMENT_METHODS:
20058
20072
  return lib_7({ ...state,
20059
20073
  paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
20060
- selectedPaymentMethodId: selectedPaymentMethodIdFromStore !== null && selectedPaymentMethodIdFromStore !== void 0 ? selectedPaymentMethodIdFromStore : String((_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : (_window$Pelcro$user$r3 = _window$Pelcro$user$r2.source) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.id)
20074
+ selectedPaymentMethodId: getInitialSelectedMethodId()
20061
20075
  });
20062
20076
 
20063
20077
  case HANDLE_SUBMIT:
@@ -20070,11 +20084,11 @@ const PaymentMethodSelectContainer = ({
20070
20084
  }
20071
20085
  }, initialState$3);
20072
20086
  useEffect(() => {
20073
- var _window$Pelcro$user$r4;
20087
+ var _window$Pelcro$user$r3;
20074
20088
 
20075
20089
  dispatch({
20076
20090
  type: LOAD_PAYMENT_METHODS,
20077
- payload: (_window$Pelcro$user$r4 = window.Pelcro.user.read().sources) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : []
20091
+ payload: (_window$Pelcro$user$r3 = window.Pelcro.user.read().sources) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : []
20078
20092
  });
20079
20093
  }, []);
20080
20094
  return /*#__PURE__*/React__default.createElement("div", {
@@ -25116,7 +25130,7 @@ const InvoiceDetailsView = props => {
25116
25130
  }, t("labels.amountPaid")), /*#__PURE__*/React__default.createElement("p", {
25117
25131
  className: "plc-font-semibold pelcro-invoice-total-text"
25118
25132
  }, t("labels.amountDue"))), /*#__PURE__*/React__default.createElement("div", {
25119
- className: "plc-flex plc-flex-col"
25133
+ className: "plc-flex plc-flex-col plc-items-end"
25120
25134
  }, /*#__PURE__*/React__default.createElement("p", {
25121
25135
  className: "pelcro-invoice-total"
25122
25136
  }, getFormattedPriceByLocal(invoice.total, invoice.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default.createElement("p", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.1.0-beta.1",
4
+ "version": "3.1.0-beta.4",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",