@pelcro/react-pelcro-js 3.51.0 → 3.52.0

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
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var ReactDOM = require('react-dom');
7
6
  var PropTypes = require('prop-types');
7
+ var ReactDOM = require('react-dom');
8
8
 
9
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
10
 
@@ -30,8 +30,8 @@ function _interopNamespace(e) {
30
30
 
31
31
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
32
32
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
- var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
34
33
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
34
+ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
35
35
 
36
36
  function _typeof$3(obj) {
37
37
  "@babel/helpers - typeof";
@@ -2574,7 +2574,7 @@ var voidElements = {
2574
2574
  "wbr": true
2575
2575
  };
2576
2576
 
2577
- var t$1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$1(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(voidElements[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$1),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i$2=/^\s*$/,s$1=Object.create(null);function a$1(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a$1,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c$2={parse:function(e,t){t||(t={}),t.components||(t.components=s$1);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n$1(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$1(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i$2.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a$1("",t)},"")}};
2577
+ var t$1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$1(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(voidElements[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$1),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i$2=/^\s*$/,s$1=Object.create(null);function a$1(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a$1,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c$1={parse:function(e,t){t||(t={}),t.components||(t.components=s$1);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n$1(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$1(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i$2.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a$1("",t)},"")}};
2578
2578
 
2579
2579
  var classCallCheck = createCommonjsModule(function (module) {
2580
2580
  function _classCallCheck(instance, Constructor) {
@@ -2836,7 +2836,7 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts) {
2836
2836
 
2837
2837
  getData(children);
2838
2838
  var interpolatedString = i18n.services.interpolator.interpolate(targetString, _objectSpread$5(_objectSpread$5({}, data), combinedTOpts), i18n.language);
2839
- var ast = c$2.parse("<0>".concat(interpolatedString, "</0>"));
2839
+ var ast = c$1.parse("<0>".concat(interpolatedString, "</0>"));
2840
2840
 
2841
2841
  function renderInner(child, node, rootReactNode) {
2842
2842
  var childs = getChildren(child);
@@ -7098,8 +7098,6 @@ exports.default = create;
7098
7098
 
7099
7099
  var createStore = unwrapExports(vanilla);
7100
7100
 
7101
- function c$1(c,r,d){const u={count:0},s=t=>{const o=React.useRef(u.count);return React.useEffect(()=>{o.current+=1,o.current===u.count+1&&(o.current-=1,r.setState(t));}),null};if(s.displayName=`((${c})) devtool`,!d){let t=document.getElementById("simple-zustand-devtools");t||(t=document.createElement("div"),t.id="simple-zustand-devtools"),document.body.appendChild(t),d=t;}const m=e=>{e&&(ReactDOM.render(React__default['default'].createElement(s,Object.assign({},e)),d),u.count+=1);};m(r.getState()),r.subscribe(m);}
7102
-
7103
7101
  var _extends_1 = createCommonjsModule(function (module) {
7104
7102
  function _extends() {
7105
7103
  module.exports = _extends = Object.assign || function (target) {
@@ -9301,7 +9299,8 @@ const usePelcro = createPelcroHook(pelcroStore);
9301
9299
 
9302
9300
  /* istanbul ignore next */
9303
9301
  if (process.env.NODE_ENV === "development") {
9304
- c$1("Pelcro Store", usePelcro);
9302
+ // mountStoreDevtool("Pelcro Store", usePelcro);
9303
+ console.log("Pelcro Store devtools disabled - simple-zustand-devtools incompatible with React 16");
9305
9304
  }
9306
9305
 
9307
9306
  /**
@@ -17892,6 +17891,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17892
17891
  onSuccess = () => {},
17893
17892
  onGiftRenewalSuccess = () => {},
17894
17893
  onFailure = () => {},
17894
+ onPriceUpdate = () => {},
17895
17895
  ...props
17896
17896
  } = _ref;
17897
17897
  const [vantivPaymentRequest, setVantivPaymentRequest] = React.useState(null);
@@ -20788,10 +20788,10 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20788
20788
  setVantivPaymentRequest(action.payload);
20789
20789
  });
20790
20790
  case SET_UPDATED_PRICE:
20791
- return lib_7({
20791
+ return lib_5({
20792
20792
  ...state,
20793
20793
  updatedPrice: action.payload
20794
- });
20794
+ }, () => onPriceUpdate(action.payload));
20795
20795
  case SET_TAX_AMOUNT:
20796
20796
  return lib_7({
20797
20797
  ...state,
@@ -22368,7 +22368,8 @@ function PaymentMethodView(_ref) {
22368
22368
  showSubscriptionButton,
22369
22369
  showOrderButton,
22370
22370
  showApplePayButton,
22371
- order
22371
+ order,
22372
+ onPriceUpdate
22372
22373
  } = _ref;
22373
22374
  const {
22374
22375
  t
@@ -22411,7 +22412,8 @@ function PaymentMethodView(_ref) {
22411
22412
  onSuccess: onSuccess,
22412
22413
  onGiftRenewalSuccess: onGiftRenewalSuccess,
22413
22414
  onFailure: onFailure,
22414
- freeOrders: showOrderButton
22415
+ freeOrders: showOrderButton,
22416
+ onPriceUpdate: onPriceUpdate
22415
22417
  }, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
22416
22418
  className: "plc-mb-2"
22417
22419
  }), showSubscriptionButton && /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default['default'].createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -22458,8 +22460,11 @@ const SubscriptionRenewView = _ref => {
22458
22460
  product,
22459
22461
  plan
22460
22462
  } = usePelcro();
22463
+ const [updatedPrice, setUpdatedPrice] = React.useState(null);
22461
22464
  const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
22462
- const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
22465
+
22466
+ // Check both original plan amount and final amount after coupon
22467
+ const showSubscriptionButton = skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || updatedPrice === 0);
22463
22468
  const getPricingText = plan => {
22464
22469
  const autoRenewed = plan.auto_renew;
22465
22470
  const {
@@ -22496,7 +22501,8 @@ const SubscriptionRenewView = _ref => {
22496
22501
  onSuccess: onSuccess,
22497
22502
  onGiftRenewalSuccess: onGiftRenewalSuccess,
22498
22503
  onFailure: onFailure,
22499
- showSubscriptionButton: showSubscriptionButton
22504
+ showSubscriptionButton: showSubscriptionButton,
22505
+ onPriceUpdate: setUpdatedPrice
22500
22506
  }));
22501
22507
  };
22502
22508
 
@@ -23829,8 +23835,11 @@ const SubscriptionCreateView = _ref => {
23829
23835
  product,
23830
23836
  plan
23831
23837
  } = usePelcro();
23838
+ const [updatedPrice, setUpdatedPrice] = React.useState(null);
23832
23839
  const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
23833
- const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
23840
+
23841
+ // Check both original plan amount and final amount after coupon
23842
+ const showSubscriptionButton = skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || updatedPrice === 0);
23834
23843
  const getPricingText = plan => {
23835
23844
  var _plan$quantity;
23836
23845
  const autoRenewed = plan.auto_renew;
@@ -23868,7 +23877,8 @@ const SubscriptionCreateView = _ref => {
23868
23877
  showApplePayButton: true,
23869
23878
  onSuccess: onSuccess,
23870
23879
  onFailure: onFailure,
23871
- showSubscriptionButton: showSubscriptionButton
23880
+ showSubscriptionButton: showSubscriptionButton,
23881
+ onPriceUpdate: setUpdatedPrice
23872
23882
  }));
23873
23883
  };
23874
23884
 
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useContext, useState, useRef, useEffect, useReducer, useLayoutEffect, Component, memo, createElement, Fragment, useMemo, forwardRef, createContext, useCallback, isValidElement, cloneElement } from 'react';
3
- import ReactDOM, { render as render$1 } from 'react-dom';
4
3
  import PropTypes from 'prop-types';
4
+ import ReactDOM from 'react-dom';
5
5
 
6
6
  function _typeof$3(obj) {
7
7
  "@babel/helpers - typeof";
@@ -2544,7 +2544,7 @@ var voidElements = {
2544
2544
  "wbr": true
2545
2545
  };
2546
2546
 
2547
- var t$1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$1(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(voidElements[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$1),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i$2=/^\s*$/,s$1=Object.create(null);function a$1(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a$1,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c$2={parse:function(e,t){t||(t={}),t.components||(t.components=s$1);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n$1(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$1(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i$2.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a$1("",t)},"")}};
2547
+ var t$1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$1(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(voidElements[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$1),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i$2=/^\s*$/,s$1=Object.create(null);function a$1(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a$1,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c$1={parse:function(e,t){t||(t={}),t.components||(t.components=s$1);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n$1(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$1(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i$2.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a$1("",t)},"")}};
2548
2548
 
2549
2549
  var classCallCheck = createCommonjsModule(function (module) {
2550
2550
  function _classCallCheck(instance, Constructor) {
@@ -2806,7 +2806,7 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts) {
2806
2806
 
2807
2807
  getData(children);
2808
2808
  var interpolatedString = i18n.services.interpolator.interpolate(targetString, _objectSpread$5(_objectSpread$5({}, data), combinedTOpts), i18n.language);
2809
- var ast = c$2.parse("<0>".concat(interpolatedString, "</0>"));
2809
+ var ast = c$1.parse("<0>".concat(interpolatedString, "</0>"));
2810
2810
 
2811
2811
  function renderInner(child, node, rootReactNode) {
2812
2812
  var childs = getChildren(child);
@@ -7068,8 +7068,6 @@ exports.default = create;
7068
7068
 
7069
7069
  var createStore = unwrapExports(vanilla);
7070
7070
 
7071
- function c$1(c,r,d){const u={count:0},s=t=>{const o=useRef(u.count);return useEffect(()=>{o.current+=1,o.current===u.count+1&&(o.current-=1,r.setState(t));}),null};if(s.displayName=`((${c})) devtool`,!d){let t=document.getElementById("simple-zustand-devtools");t||(t=document.createElement("div"),t.id="simple-zustand-devtools"),document.body.appendChild(t),d=t;}const m=e=>{e&&(render$1(React__default.createElement(s,Object.assign({},e)),d),u.count+=1);};m(r.getState()),r.subscribe(m);}
7072
-
7073
7071
  var _extends_1 = createCommonjsModule(function (module) {
7074
7072
  function _extends() {
7075
7073
  module.exports = _extends = Object.assign || function (target) {
@@ -9271,7 +9269,8 @@ const usePelcro = createPelcroHook(pelcroStore);
9271
9269
 
9272
9270
  /* istanbul ignore next */
9273
9271
  if (process.env.NODE_ENV === "development") {
9274
- c$1("Pelcro Store", usePelcro);
9272
+ // mountStoreDevtool("Pelcro Store", usePelcro);
9273
+ console.log("Pelcro Store devtools disabled - simple-zustand-devtools incompatible with React 16");
9275
9274
  }
9276
9275
 
9277
9276
  /**
@@ -17862,6 +17861,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17862
17861
  onSuccess = () => {},
17863
17862
  onGiftRenewalSuccess = () => {},
17864
17863
  onFailure = () => {},
17864
+ onPriceUpdate = () => {},
17865
17865
  ...props
17866
17866
  } = _ref;
17867
17867
  const [vantivPaymentRequest, setVantivPaymentRequest] = useState(null);
@@ -20758,10 +20758,10 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20758
20758
  setVantivPaymentRequest(action.payload);
20759
20759
  });
20760
20760
  case SET_UPDATED_PRICE:
20761
- return lib_7({
20761
+ return lib_5({
20762
20762
  ...state,
20763
20763
  updatedPrice: action.payload
20764
- });
20764
+ }, () => onPriceUpdate(action.payload));
20765
20765
  case SET_TAX_AMOUNT:
20766
20766
  return lib_7({
20767
20767
  ...state,
@@ -22338,7 +22338,8 @@ function PaymentMethodView(_ref) {
22338
22338
  showSubscriptionButton,
22339
22339
  showOrderButton,
22340
22340
  showApplePayButton,
22341
- order
22341
+ order,
22342
+ onPriceUpdate
22342
22343
  } = _ref;
22343
22344
  const {
22344
22345
  t
@@ -22381,7 +22382,8 @@ function PaymentMethodView(_ref) {
22381
22382
  onSuccess: onSuccess,
22382
22383
  onGiftRenewalSuccess: onGiftRenewalSuccess,
22383
22384
  onFailure: onFailure,
22384
- freeOrders: showOrderButton
22385
+ freeOrders: showOrderButton,
22386
+ onPriceUpdate: onPriceUpdate
22385
22387
  }, /*#__PURE__*/React__default.createElement(AlertWithContext, {
22386
22388
  className: "plc-mb-2"
22387
22389
  }), showSubscriptionButton && /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default.createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
@@ -22428,8 +22430,11 @@ const SubscriptionRenewView = _ref => {
22428
22430
  product,
22429
22431
  plan
22430
22432
  } = usePelcro();
22433
+ const [updatedPrice, setUpdatedPrice] = useState(null);
22431
22434
  const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
22432
- const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
22435
+
22436
+ // Check both original plan amount and final amount after coupon
22437
+ const showSubscriptionButton = skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || updatedPrice === 0);
22433
22438
  const getPricingText = plan => {
22434
22439
  const autoRenewed = plan.auto_renew;
22435
22440
  const {
@@ -22466,7 +22471,8 @@ const SubscriptionRenewView = _ref => {
22466
22471
  onSuccess: onSuccess,
22467
22472
  onGiftRenewalSuccess: onGiftRenewalSuccess,
22468
22473
  onFailure: onFailure,
22469
- showSubscriptionButton: showSubscriptionButton
22474
+ showSubscriptionButton: showSubscriptionButton,
22475
+ onPriceUpdate: setUpdatedPrice
22470
22476
  }));
22471
22477
  };
22472
22478
 
@@ -23799,8 +23805,11 @@ const SubscriptionCreateView = _ref => {
23799
23805
  product,
23800
23806
  plan
23801
23807
  } = usePelcro();
23808
+ const [updatedPrice, setUpdatedPrice] = useState(null);
23802
23809
  const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
23803
- const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
23810
+
23811
+ // Check both original plan amount and final amount after coupon
23812
+ const showSubscriptionButton = skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || updatedPrice === 0);
23804
23813
  const getPricingText = plan => {
23805
23814
  var _plan$quantity;
23806
23815
  const autoRenewed = plan.auto_renew;
@@ -23838,7 +23847,8 @@ const SubscriptionCreateView = _ref => {
23838
23847
  showApplePayButton: true,
23839
23848
  onSuccess: onSuccess,
23840
23849
  onFailure: onFailure,
23841
- showSubscriptionButton: showSubscriptionButton
23850
+ showSubscriptionButton: showSubscriptionButton,
23851
+ onPriceUpdate: setUpdatedPrice
23842
23852
  }));
23843
23853
  };
23844
23854
 
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.51.0",
4
+ "version": "3.52.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",