@pelcro/react-pelcro-js 3.26.0-beta.49 → 3.26.0-beta.50

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
@@ -19713,7 +19713,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19713
19713
  const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
19714
19714
  var _response$data2;
19715
19715
  const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
19716
- if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
19716
+ if ((setupIntent === null || setupIntent === void 0 ? void 0 : setupIntent.status) === "requires_action" && setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
19717
19717
  var _response$data3, _response$data3$sourc;
19718
19718
  stripe.confirmCardSetup(setupIntent.client_secret, {
19719
19719
  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
@@ -19733,6 +19733,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19733
19733
  }
19734
19734
  });
19735
19735
  }
19736
+ if (flow === "subCreate") {
19737
+ dispatch({
19738
+ type: DISABLE_SUBMIT,
19739
+ payload: false
19740
+ });
19741
+ dispatch({
19742
+ type: LOADING,
19743
+ payload: false
19744
+ });
19745
+ onSuccess(res);
19746
+ return;
19747
+ }
19736
19748
  if (flow === "create") {
19737
19749
  dispatch({
19738
19750
  type: DISABLE_SUBMIT,
@@ -19826,6 +19838,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19826
19838
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
19827
19839
  address_id: product.address_required ? selectedAddressId : null
19828
19840
  }, (err, res) => {
19841
+ if (res.data.setup_intent) {
19842
+ return confirmStripeIntentSetup(res, "subCreate");
19843
+ }
19829
19844
  confirmStripeCardPayment(res, err, true);
19830
19845
  });
19831
19846
  } else {
package/dist/index.esm.js CHANGED
@@ -19683,7 +19683,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19683
19683
  const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
19684
19684
  var _response$data2;
19685
19685
  const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
19686
- if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
19686
+ if ((setupIntent === null || setupIntent === void 0 ? void 0 : setupIntent.status) === "requires_action" && setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
19687
19687
  var _response$data3, _response$data3$sourc;
19688
19688
  stripe.confirmCardSetup(setupIntent.client_secret, {
19689
19689
  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
@@ -19703,6 +19703,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19703
19703
  }
19704
19704
  });
19705
19705
  }
19706
+ if (flow === "subCreate") {
19707
+ dispatch({
19708
+ type: DISABLE_SUBMIT,
19709
+ payload: false
19710
+ });
19711
+ dispatch({
19712
+ type: LOADING,
19713
+ payload: false
19714
+ });
19715
+ onSuccess(res);
19716
+ return;
19717
+ }
19706
19718
  if (flow === "create") {
19707
19719
  dispatch({
19708
19720
  type: DISABLE_SUBMIT,
@@ -19796,6 +19808,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19796
19808
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
19797
19809
  address_id: product.address_required ? selectedAddressId : null
19798
19810
  }, (err, res) => {
19811
+ if (res.data.setup_intent) {
19812
+ return confirmStripeIntentSetup(res, "subCreate");
19813
+ }
19799
19814
  confirmStripeCardPayment(res, err, true);
19800
19815
  });
19801
19816
  } 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.26.0-beta.49",
4
+ "version": "3.26.0-beta.50",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",