@pelcro/react-pelcro-js 3.35.0 → 3.36.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
@@ -18765,7 +18765,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18765
18765
  const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
18766
18766
  var _response$data2;
18767
18767
  const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
18768
- if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
18768
+ if ((setupIntent === null || setupIntent === void 0 ? void 0 : setupIntent.status) === "requires_action" && setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
18769
18769
  var _response$data3, _response$data3$sourc;
18770
18770
  stripe.confirmCardSetup(setupIntent.client_secret, {
18771
18771
  payment_method: (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : (_response$data3$sourc = _response$data3.source) === null || _response$data3$sourc === void 0 ? void 0 : _response$data3$sourc.object_id
@@ -18789,6 +18789,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18789
18789
  }
18790
18790
  });
18791
18791
  }
18792
+ if (flow === "subCreate") {
18793
+ dispatch({
18794
+ type: DISABLE_SUBMIT,
18795
+ payload: false
18796
+ });
18797
+ dispatch({
18798
+ type: LOADING,
18799
+ payload: false
18800
+ });
18801
+ onSuccess(res);
18802
+ return;
18803
+ }
18792
18804
  if (flow === "create") {
18793
18805
  dispatch({
18794
18806
  type: LOADING,
@@ -18878,6 +18890,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18878
18890
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
18879
18891
  address_id: product.address_required ? selectedAddressId : null
18880
18892
  }, (err, res) => {
18893
+ if (res.data.setup_intent) {
18894
+ return confirmStripeIntentSetup(res, "subCreate");
18895
+ }
18881
18896
  confirmStripeCardPayment(res, err, true);
18882
18897
  });
18883
18898
  } else {
package/dist/index.esm.js CHANGED
@@ -18735,7 +18735,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18735
18735
  const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
18736
18736
  var _response$data2;
18737
18737
  const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
18738
- if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
18738
+ if ((setupIntent === null || setupIntent === void 0 ? void 0 : setupIntent.status) === "requires_action" && setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
18739
18739
  var _response$data3, _response$data3$sourc;
18740
18740
  stripe.confirmCardSetup(setupIntent.client_secret, {
18741
18741
  payment_method: (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : (_response$data3$sourc = _response$data3.source) === null || _response$data3$sourc === void 0 ? void 0 : _response$data3$sourc.object_id
@@ -18759,6 +18759,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18759
18759
  }
18760
18760
  });
18761
18761
  }
18762
+ if (flow === "subCreate") {
18763
+ dispatch({
18764
+ type: DISABLE_SUBMIT,
18765
+ payload: false
18766
+ });
18767
+ dispatch({
18768
+ type: LOADING,
18769
+ payload: false
18770
+ });
18771
+ onSuccess(res);
18772
+ return;
18773
+ }
18762
18774
  if (flow === "create") {
18763
18775
  dispatch({
18764
18776
  type: LOADING,
@@ -18848,6 +18860,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18848
18860
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
18849
18861
  address_id: product.address_required ? selectedAddressId : null
18850
18862
  }, (err, res) => {
18863
+ if (res.data.setup_intent) {
18864
+ return confirmStripeIntentSetup(res, "subCreate");
18865
+ }
18851
18866
  confirmStripeCardPayment(res, err, true);
18852
18867
  });
18853
18868
  } else {
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.35.0",
4
+ "version": "3.36.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",