@pelcro/react-pelcro-js 3.1.0-beta.2 → 3.1.0-beta.3

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
@@ -15303,7 +15303,7 @@ const getSuccessContent = i18n => {
15303
15303
  className: "plc-w-32 plc-my-4 plc-text-green-500"
15304
15304
  }),
15305
15305
  successTitle: i18n("messages.invoicePayment.title"),
15306
- successContent: i18n("messages.invoicePayment.title")
15306
+ successContent: i18n("messages.invoicePayment.content")
15307
15307
  }
15308
15308
  };
15309
15309
  return wordingDictionary[flow];
@@ -20171,9 +20171,23 @@ const PaymentMethodSelectContainer = ({
20171
20171
  return onSuccess(selectedPaymentMethodId);
20172
20172
  };
20173
20173
 
20174
- const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20175
- var _window$Pelcro$user$r2, _window$Pelcro$user$r3;
20174
+ const getInitialSelectedMethodId = () => {
20175
+ var _window$Pelcro$user$r2;
20176
+
20177
+ if (selectedPaymentMethodIdFromStore) {
20178
+ return selectedPaymentMethodIdFromStore;
20179
+ }
20180
+
20181
+ const defaultMethod = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.source;
20182
+
20183
+ if (defaultMethod && defaultMethod.status === "chargeable") {
20184
+ return String(defaultMethod.id);
20185
+ }
20176
20186
 
20187
+ return null;
20188
+ };
20189
+
20190
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20177
20191
  switch (action.type) {
20178
20192
  case SELECT_PAYMENT_METHOD:
20179
20193
  return lib_7({ ...state,
@@ -20183,7 +20197,7 @@ const PaymentMethodSelectContainer = ({
20183
20197
  case LOAD_PAYMENT_METHODS:
20184
20198
  return lib_7({ ...state,
20185
20199
  paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
20186
- 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)
20200
+ selectedPaymentMethodId: getInitialSelectedMethodId()
20187
20201
  });
20188
20202
 
20189
20203
  case HANDLE_SUBMIT:
@@ -20196,11 +20210,11 @@ const PaymentMethodSelectContainer = ({
20196
20210
  }
20197
20211
  }, initialState$4);
20198
20212
  React.useEffect(() => {
20199
- var _window$Pelcro$user$r4;
20213
+ var _window$Pelcro$user$r3;
20200
20214
 
20201
20215
  dispatch({
20202
20216
  type: LOAD_PAYMENT_METHODS,
20203
- payload: (_window$Pelcro$user$r4 = window.Pelcro.user.read().sources) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : []
20217
+ payload: (_window$Pelcro$user$r3 = window.Pelcro.user.read().sources) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : []
20204
20218
  });
20205
20219
  }, []);
20206
20220
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -25249,7 +25263,7 @@ const InvoiceDetailsView = props => {
25249
25263
  }, t("labels.amountPaid")), /*#__PURE__*/React__default['default'].createElement("p", {
25250
25264
  className: "plc-font-semibold pelcro-invoice-total-text"
25251
25265
  }, t("labels.amountDue"))), /*#__PURE__*/React__default['default'].createElement("div", {
25252
- className: "plc-flex plc-flex-col"
25266
+ className: "plc-flex plc-flex-col plc-items-end"
25253
25267
  }, /*#__PURE__*/React__default['default'].createElement("p", {
25254
25268
  className: "pelcro-invoice-total"
25255
25269
  }, getFormattedPriceByLocal(invoice.total, invoice.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default['default'].createElement("p", {
package/dist/index.esm.js CHANGED
@@ -15273,7 +15273,7 @@ const getSuccessContent = i18n => {
15273
15273
  className: "plc-w-32 plc-my-4 plc-text-green-500"
15274
15274
  }),
15275
15275
  successTitle: i18n("messages.invoicePayment.title"),
15276
- successContent: i18n("messages.invoicePayment.title")
15276
+ successContent: i18n("messages.invoicePayment.content")
15277
15277
  }
15278
15278
  };
15279
15279
  return wordingDictionary[flow];
@@ -20141,9 +20141,23 @@ const PaymentMethodSelectContainer = ({
20141
20141
  return onSuccess(selectedPaymentMethodId);
20142
20142
  };
20143
20143
 
20144
- const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20145
- var _window$Pelcro$user$r2, _window$Pelcro$user$r3;
20144
+ const getInitialSelectedMethodId = () => {
20145
+ var _window$Pelcro$user$r2;
20146
+
20147
+ if (selectedPaymentMethodIdFromStore) {
20148
+ return selectedPaymentMethodIdFromStore;
20149
+ }
20150
+
20151
+ const defaultMethod = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.source;
20152
+
20153
+ if (defaultMethod && defaultMethod.status === "chargeable") {
20154
+ return String(defaultMethod.id);
20155
+ }
20146
20156
 
20157
+ return null;
20158
+ };
20159
+
20160
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
20147
20161
  switch (action.type) {
20148
20162
  case SELECT_PAYMENT_METHOD:
20149
20163
  return lib_7({ ...state,
@@ -20153,7 +20167,7 @@ const PaymentMethodSelectContainer = ({
20153
20167
  case LOAD_PAYMENT_METHODS:
20154
20168
  return lib_7({ ...state,
20155
20169
  paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
20156
- 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)
20170
+ selectedPaymentMethodId: getInitialSelectedMethodId()
20157
20171
  });
20158
20172
 
20159
20173
  case HANDLE_SUBMIT:
@@ -20166,11 +20180,11 @@ const PaymentMethodSelectContainer = ({
20166
20180
  }
20167
20181
  }, initialState$4);
20168
20182
  useEffect(() => {
20169
- var _window$Pelcro$user$r4;
20183
+ var _window$Pelcro$user$r3;
20170
20184
 
20171
20185
  dispatch({
20172
20186
  type: LOAD_PAYMENT_METHODS,
20173
- payload: (_window$Pelcro$user$r4 = window.Pelcro.user.read().sources) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : []
20187
+ payload: (_window$Pelcro$user$r3 = window.Pelcro.user.read().sources) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : []
20174
20188
  });
20175
20189
  }, []);
20176
20190
  return /*#__PURE__*/React__default.createElement("div", {
@@ -25219,7 +25233,7 @@ const InvoiceDetailsView = props => {
25219
25233
  }, t("labels.amountPaid")), /*#__PURE__*/React__default.createElement("p", {
25220
25234
  className: "plc-font-semibold pelcro-invoice-total-text"
25221
25235
  }, t("labels.amountDue"))), /*#__PURE__*/React__default.createElement("div", {
25222
- className: "plc-flex plc-flex-col"
25236
+ className: "plc-flex plc-flex-col plc-items-end"
25223
25237
  }, /*#__PURE__*/React__default.createElement("p", {
25224
25238
  className: "pelcro-invoice-total"
25225
25239
  }, 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.2",
4
+ "version": "3.1.0-beta.3",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",