@pelcro/react-pelcro-js 4.0.0-alpha.53 → 4.0.0-alpha.55

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
@@ -24218,7 +24218,7 @@ const PaymentMethodContainerWithoutStripe = ({
24218
24218
 
24219
24219
  const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
24220
24220
 
24221
- if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
24221
+ if ((setupIntent === null || setupIntent === void 0 ? void 0 : setupIntent.status) === "requires_action" && setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
24222
24222
  var _response$data3, _response$data3$sourc;
24223
24223
 
24224
24224
  stripe.confirmCardSetup(setupIntent.client_secret, {
@@ -24227,6 +24227,10 @@ const PaymentMethodContainerWithoutStripe = ({
24227
24227
  var _response$data4;
24228
24228
 
24229
24229
  if (res.error) {
24230
+ dispatch({
24231
+ type: DISABLE_SUBMIT,
24232
+ payload: false
24233
+ });
24230
24234
  dispatch({
24231
24235
  type: LOADING,
24232
24236
  payload: false
@@ -24241,11 +24245,20 @@ const PaymentMethodContainerWithoutStripe = ({
24241
24245
  });
24242
24246
  }
24243
24247
 
24244
- if (flow === "create") {
24248
+ if (flow === "subCreate") {
24245
24249
  dispatch({
24246
24250
  type: DISABLE_SUBMIT,
24247
24251
  payload: false
24248
24252
  });
24253
+ dispatch({
24254
+ type: LOADING,
24255
+ payload: false
24256
+ });
24257
+ onSuccess(res);
24258
+ return;
24259
+ }
24260
+
24261
+ if (flow === "create") {
24249
24262
  dispatch({
24250
24263
  type: LOADING,
24251
24264
  payload: false
@@ -24341,6 +24354,10 @@ const PaymentMethodContainerWithoutStripe = ({
24341
24354
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
24342
24355
  address_id: product.address_required ? selectedAddressId : null
24343
24356
  }, (err, res) => {
24357
+ if (res.data.setup_intent) {
24358
+ return confirmStripeIntentSetup(res, "subCreate");
24359
+ }
24360
+
24344
24361
  confirmStripeCardPayment(res, err, true);
24345
24362
  });
24346
24363
  } else {
@@ -24621,16 +24638,15 @@ const PaymentMethodContainerWithoutStripe = ({
24621
24638
  }, (err, res) => {
24622
24639
  var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
24623
24640
 
24624
- dispatch({
24625
- type: DISABLE_SUBMIT,
24626
- payload: false
24627
- });
24628
- dispatch({
24629
- type: LOADING,
24630
- payload: false
24631
- });
24632
-
24633
24641
  if (err) {
24642
+ dispatch({
24643
+ type: DISABLE_SUBMIT,
24644
+ payload: false
24645
+ });
24646
+ dispatch({
24647
+ type: LOADING,
24648
+ payload: false
24649
+ });
24634
24650
  onFailure(err);
24635
24651
  return dispatch({
24636
24652
  type: SHOW_ALERT,
@@ -24644,6 +24660,10 @@ const PaymentMethodContainerWithoutStripe = ({
24644
24660
  if (((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$setup_inten = _res$data.setup_intent) === null || _res$data$setup_inten === void 0 ? void 0 : _res$data$setup_inten.status) === "requires_action" || ((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$setup_inte = _res$data2.setup_intent) === null || _res$data2$setup_inte === void 0 ? void 0 : _res$data2$setup_inte.status) === "requires_confirmation") {
24645
24661
  confirmStripeIntentSetup(res, "create");
24646
24662
  } else {
24663
+ dispatch({
24664
+ type: LOADING,
24665
+ payload: false
24666
+ });
24647
24667
  dispatch({
24648
24668
  type: SHOW_ALERT,
24649
24669
  payload: {
package/dist/index.esm.js CHANGED
@@ -24188,7 +24188,7 @@ const PaymentMethodContainerWithoutStripe = ({
24188
24188
 
24189
24189
  const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
24190
24190
 
24191
- if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
24191
+ if ((setupIntent === null || setupIntent === void 0 ? void 0 : setupIntent.status) === "requires_action" && setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
24192
24192
  var _response$data3, _response$data3$sourc;
24193
24193
 
24194
24194
  stripe.confirmCardSetup(setupIntent.client_secret, {
@@ -24197,6 +24197,10 @@ const PaymentMethodContainerWithoutStripe = ({
24197
24197
  var _response$data4;
24198
24198
 
24199
24199
  if (res.error) {
24200
+ dispatch({
24201
+ type: DISABLE_SUBMIT,
24202
+ payload: false
24203
+ });
24200
24204
  dispatch({
24201
24205
  type: LOADING,
24202
24206
  payload: false
@@ -24211,11 +24215,20 @@ const PaymentMethodContainerWithoutStripe = ({
24211
24215
  });
24212
24216
  }
24213
24217
 
24214
- if (flow === "create") {
24218
+ if (flow === "subCreate") {
24215
24219
  dispatch({
24216
24220
  type: DISABLE_SUBMIT,
24217
24221
  payload: false
24218
24222
  });
24223
+ dispatch({
24224
+ type: LOADING,
24225
+ payload: false
24226
+ });
24227
+ onSuccess(res);
24228
+ return;
24229
+ }
24230
+
24231
+ if (flow === "create") {
24219
24232
  dispatch({
24220
24233
  type: LOADING,
24221
24234
  payload: false
@@ -24311,6 +24324,10 @@ const PaymentMethodContainerWithoutStripe = ({
24311
24324
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
24312
24325
  address_id: product.address_required ? selectedAddressId : null
24313
24326
  }, (err, res) => {
24327
+ if (res.data.setup_intent) {
24328
+ return confirmStripeIntentSetup(res, "subCreate");
24329
+ }
24330
+
24314
24331
  confirmStripeCardPayment(res, err, true);
24315
24332
  });
24316
24333
  } else {
@@ -24591,16 +24608,15 @@ const PaymentMethodContainerWithoutStripe = ({
24591
24608
  }, (err, res) => {
24592
24609
  var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
24593
24610
 
24594
- dispatch({
24595
- type: DISABLE_SUBMIT,
24596
- payload: false
24597
- });
24598
- dispatch({
24599
- type: LOADING,
24600
- payload: false
24601
- });
24602
-
24603
24611
  if (err) {
24612
+ dispatch({
24613
+ type: DISABLE_SUBMIT,
24614
+ payload: false
24615
+ });
24616
+ dispatch({
24617
+ type: LOADING,
24618
+ payload: false
24619
+ });
24604
24620
  onFailure(err);
24605
24621
  return dispatch({
24606
24622
  type: SHOW_ALERT,
@@ -24614,6 +24630,10 @@ const PaymentMethodContainerWithoutStripe = ({
24614
24630
  if (((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$setup_inten = _res$data.setup_intent) === null || _res$data$setup_inten === void 0 ? void 0 : _res$data$setup_inten.status) === "requires_action" || ((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$setup_inte = _res$data2.setup_intent) === null || _res$data2$setup_inte === void 0 ? void 0 : _res$data2$setup_inte.status) === "requires_confirmation") {
24615
24631
  confirmStripeIntentSetup(res, "create");
24616
24632
  } else {
24633
+ dispatch({
24634
+ type: LOADING,
24635
+ payload: false
24636
+ });
24617
24637
  dispatch({
24618
24638
  type: SHOW_ALERT,
24619
24639
  payload: {
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": "4.0.0-alpha.53",
4
+ "version": "4.0.0-alpha.55",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",