@pelcro/react-pelcro-js 3.9.0-beta.9 → 3.9.1-beta.1

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
@@ -3823,7 +3823,7 @@ var labels$F = {
3823
3823
  "for": "for",
3824
3824
  interval: "{{count}} {{interval}}",
3825
3825
  interval_plural: "{{count}} {{interval}}s",
3826
- tax: "+ Tax",
3826
+ tax: "Tax",
3827
3827
  removeCoupon: "REMOVE",
3828
3828
  firstName: "First name",
3829
3829
  lastName: "Last name",
@@ -3853,7 +3853,7 @@ var labels$E = {
3853
3853
  "for": "pour",
3854
3854
  interval: "{{count}} {{interval}}",
3855
3855
  interval_plural: "{{count}} {{interval}}s",
3856
- tax: "+ Taxe",
3856
+ tax: "Taxe",
3857
3857
  removeCoupon: "RETIRER",
3858
3858
  firstName: "Prénom",
3859
3859
  lastName: "Nom de famille",
@@ -3883,7 +3883,7 @@ var labels$D = {
3883
3883
  "for": "관련",
3884
3884
  interval: "{{count}} {{interval}}",
3885
3885
  interval_plural: "{{count}} {{interval}}",
3886
- tax: "+ 세금",
3886
+ tax: "세금",
3887
3887
  removeCoupon: "제거",
3888
3888
  firstName: "이름",
3889
3889
  lastName: "성",
@@ -7256,8 +7256,7 @@ class PelcroActions {
7256
7256
  return this.set({
7257
7257
  view: "login"
7258
7258
  });
7259
- } // console.log(this.get().isAuthenticated(), );
7260
-
7259
+ }
7261
7260
 
7262
7261
  if (["passwordless-request"].includes(view) && (this.get().isAuthenticated() || !((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.passwordless_enabled))) {
7263
7262
  return this.set({
@@ -15541,21 +15540,6 @@ const PaymentMethodContainerWithoutStripe = ({
15541
15540
  };
15542
15541
 
15543
15542
  function handleTapPayment(paymentRequest) {
15544
- // if (paymentRequest) {
15545
- // const SUCCESS_STATUS = "870";
15546
- // if (paymentRequest.response !== SUCCESS_STATUS) {
15547
- // switch (paymentRequest.response) {
15548
- // case "871":
15549
- // return handlePaymentError({
15550
- // error: new Error("Invalid account number")
15551
- // });
15552
- // default:
15553
- // return handlePaymentError({
15554
- // error: new Error(paymentRequest.message)
15555
- // });
15556
- // }
15557
- // }
15558
- // }
15559
15543
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
15560
15544
 
15561
15545
  if (type === "createPayment") {
@@ -17209,7 +17193,7 @@ const CheckoutForm = () => {
17209
17193
  };
17210
17194
 
17211
17195
  const DiscountedPrice = props => {
17212
- var _order$currency, _order$, _plan$quantity;
17196
+ var _window$Pelcro$site, _window$Pelcro$site$r, _order$currency, _order$, _plan$quantity;
17213
17197
 
17214
17198
  const {
17215
17199
  t
@@ -17226,9 +17210,10 @@ const DiscountedPrice = props => {
17226
17210
  order,
17227
17211
  plan
17228
17212
  } = usePelcro();
17213
+ const isTaxInclusive = (_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tax_inclusive;
17229
17214
  const ecommOrderCurrency = (_order$currency = order === null || order === void 0 ? void 0 : order.currency) !== null && _order$currency !== void 0 ? _order$currency : order === null || order === void 0 ? void 0 : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
17230
17215
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
17231
- const discountedPriceWithoutTax = updatedPrice - taxAmount;
17216
+ const discountedPriceWithoutTax = isTaxInclusive ? updatedPrice : updatedPrice - taxAmount;
17232
17217
  const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
17233
17218
 
17234
17219
  const onCouponRemove = () => {
@@ -17852,7 +17837,7 @@ const SelectedPaymentMethod = () => {
17852
17837
  };
17853
17838
 
17854
17839
  const TaxAmount = () => {
17855
- var _plan$quantity;
17840
+ var _plan$quantity, _window$Pelcro$site, _window$Pelcro$site$r;
17856
17841
 
17857
17842
  const {
17858
17843
  t
@@ -17867,13 +17852,14 @@ const TaxAmount = () => {
17867
17852
  } = usePelcro();
17868
17853
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
17869
17854
  const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
17855
+ const isTaxInclusive = (_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tax_inclusive;
17870
17856
 
17871
17857
  if (taxAmount) {
17872
17858
  return /*#__PURE__*/React__default['default'].createElement("div", {
17873
17859
  className: "plc-text-center pelcro-tax-amount"
17874
- }, t("labels.tax"), " ", /*#__PURE__*/React__default['default'].createElement("span", {
17860
+ }, isTaxInclusive && "(", isTaxInclusive ? `Includes ${t("labels.tax")}` : `+ ${t("labels.tax")}`, " ", /*#__PURE__*/React__default['default'].createElement("span", {
17875
17861
  className: "plc-font-bold"
17876
- }, priceFormatted));
17862
+ }, priceFormatted), isTaxInclusive && ")");
17877
17863
  }
17878
17864
 
17879
17865
  return null;
package/dist/index.esm.js CHANGED
@@ -3793,7 +3793,7 @@ var labels$F = {
3793
3793
  "for": "for",
3794
3794
  interval: "{{count}} {{interval}}",
3795
3795
  interval_plural: "{{count}} {{interval}}s",
3796
- tax: "+ Tax",
3796
+ tax: "Tax",
3797
3797
  removeCoupon: "REMOVE",
3798
3798
  firstName: "First name",
3799
3799
  lastName: "Last name",
@@ -3823,7 +3823,7 @@ var labels$E = {
3823
3823
  "for": "pour",
3824
3824
  interval: "{{count}} {{interval}}",
3825
3825
  interval_plural: "{{count}} {{interval}}s",
3826
- tax: "+ Taxe",
3826
+ tax: "Taxe",
3827
3827
  removeCoupon: "RETIRER",
3828
3828
  firstName: "Prénom",
3829
3829
  lastName: "Nom de famille",
@@ -3853,7 +3853,7 @@ var labels$D = {
3853
3853
  "for": "관련",
3854
3854
  interval: "{{count}} {{interval}}",
3855
3855
  interval_plural: "{{count}} {{interval}}",
3856
- tax: "+ 세금",
3856
+ tax: "세금",
3857
3857
  removeCoupon: "제거",
3858
3858
  firstName: "이름",
3859
3859
  lastName: "성",
@@ -7226,8 +7226,7 @@ class PelcroActions {
7226
7226
  return this.set({
7227
7227
  view: "login"
7228
7228
  });
7229
- } // console.log(this.get().isAuthenticated(), );
7230
-
7229
+ }
7231
7230
 
7232
7231
  if (["passwordless-request"].includes(view) && (this.get().isAuthenticated() || !((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.passwordless_enabled))) {
7233
7232
  return this.set({
@@ -15511,21 +15510,6 @@ const PaymentMethodContainerWithoutStripe = ({
15511
15510
  };
15512
15511
 
15513
15512
  function handleTapPayment(paymentRequest) {
15514
- // if (paymentRequest) {
15515
- // const SUCCESS_STATUS = "870";
15516
- // if (paymentRequest.response !== SUCCESS_STATUS) {
15517
- // switch (paymentRequest.response) {
15518
- // case "871":
15519
- // return handlePaymentError({
15520
- // error: new Error("Invalid account number")
15521
- // });
15522
- // default:
15523
- // return handlePaymentError({
15524
- // error: new Error(paymentRequest.message)
15525
- // });
15526
- // }
15527
- // }
15528
- // }
15529
15513
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
15530
15514
 
15531
15515
  if (type === "createPayment") {
@@ -17179,7 +17163,7 @@ const CheckoutForm = () => {
17179
17163
  };
17180
17164
 
17181
17165
  const DiscountedPrice = props => {
17182
- var _order$currency, _order$, _plan$quantity;
17166
+ var _window$Pelcro$site, _window$Pelcro$site$r, _order$currency, _order$, _plan$quantity;
17183
17167
 
17184
17168
  const {
17185
17169
  t
@@ -17196,9 +17180,10 @@ const DiscountedPrice = props => {
17196
17180
  order,
17197
17181
  plan
17198
17182
  } = usePelcro();
17183
+ const isTaxInclusive = (_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tax_inclusive;
17199
17184
  const ecommOrderCurrency = (_order$currency = order === null || order === void 0 ? void 0 : order.currency) !== null && _order$currency !== void 0 ? _order$currency : order === null || order === void 0 ? void 0 : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
17200
17185
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
17201
- const discountedPriceWithoutTax = updatedPrice - taxAmount;
17186
+ const discountedPriceWithoutTax = isTaxInclusive ? updatedPrice : updatedPrice - taxAmount;
17202
17187
  const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
17203
17188
 
17204
17189
  const onCouponRemove = () => {
@@ -17822,7 +17807,7 @@ const SelectedPaymentMethod = () => {
17822
17807
  };
17823
17808
 
17824
17809
  const TaxAmount = () => {
17825
- var _plan$quantity;
17810
+ var _plan$quantity, _window$Pelcro$site, _window$Pelcro$site$r;
17826
17811
 
17827
17812
  const {
17828
17813
  t
@@ -17837,13 +17822,14 @@ const TaxAmount = () => {
17837
17822
  } = usePelcro();
17838
17823
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
17839
17824
  const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
17825
+ const isTaxInclusive = (_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tax_inclusive;
17840
17826
 
17841
17827
  if (taxAmount) {
17842
17828
  return /*#__PURE__*/React__default.createElement("div", {
17843
17829
  className: "plc-text-center pelcro-tax-amount"
17844
- }, t("labels.tax"), " ", /*#__PURE__*/React__default.createElement("span", {
17830
+ }, isTaxInclusive && "(", isTaxInclusive ? `Includes ${t("labels.tax")}` : `+ ${t("labels.tax")}`, " ", /*#__PURE__*/React__default.createElement("span", {
17845
17831
  className: "plc-font-bold"
17846
- }, priceFormatted));
17832
+ }, priceFormatted), isTaxInclusive && ")");
17847
17833
  }
17848
17834
 
17849
17835
  return null;
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.9.0-beta.9",
4
+ "version": "3.9.1-beta.1",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",