@pelcro/react-pelcro-js 3.34.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 +29 -10
- package/dist/index.esm.js +29 -10
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -18765,13 +18765,17 @@ 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
|
|
18772
18772
|
}).then(res => {
|
|
18773
18773
|
var _response$data4;
|
|
18774
18774
|
if (res.error) {
|
|
18775
|
+
dispatch({
|
|
18776
|
+
type: DISABLE_SUBMIT,
|
|
18777
|
+
payload: false
|
|
18778
|
+
});
|
|
18775
18779
|
dispatch({
|
|
18776
18780
|
type: LOADING,
|
|
18777
18781
|
payload: false
|
|
@@ -18785,11 +18789,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18785
18789
|
}
|
|
18786
18790
|
});
|
|
18787
18791
|
}
|
|
18788
|
-
if (flow === "
|
|
18792
|
+
if (flow === "subCreate") {
|
|
18789
18793
|
dispatch({
|
|
18790
18794
|
type: DISABLE_SUBMIT,
|
|
18791
18795
|
payload: false
|
|
18792
18796
|
});
|
|
18797
|
+
dispatch({
|
|
18798
|
+
type: LOADING,
|
|
18799
|
+
payload: false
|
|
18800
|
+
});
|
|
18801
|
+
onSuccess(res);
|
|
18802
|
+
return;
|
|
18803
|
+
}
|
|
18804
|
+
if (flow === "create") {
|
|
18793
18805
|
dispatch({
|
|
18794
18806
|
type: LOADING,
|
|
18795
18807
|
payload: false
|
|
@@ -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 {
|
|
@@ -19142,15 +19157,15 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19142
19157
|
token: source.id
|
|
19143
19158
|
}, (err, res) => {
|
|
19144
19159
|
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
19145
|
-
dispatch({
|
|
19146
|
-
type: DISABLE_SUBMIT,
|
|
19147
|
-
payload: false
|
|
19148
|
-
});
|
|
19149
|
-
dispatch({
|
|
19150
|
-
type: LOADING,
|
|
19151
|
-
payload: false
|
|
19152
|
-
});
|
|
19153
19160
|
if (err) {
|
|
19161
|
+
dispatch({
|
|
19162
|
+
type: DISABLE_SUBMIT,
|
|
19163
|
+
payload: false
|
|
19164
|
+
});
|
|
19165
|
+
dispatch({
|
|
19166
|
+
type: LOADING,
|
|
19167
|
+
payload: false
|
|
19168
|
+
});
|
|
19154
19169
|
onFailure(err);
|
|
19155
19170
|
return dispatch({
|
|
19156
19171
|
type: SHOW_ALERT,
|
|
@@ -19163,6 +19178,10 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19163
19178
|
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") {
|
|
19164
19179
|
confirmStripeIntentSetup(res, "create");
|
|
19165
19180
|
} else {
|
|
19181
|
+
dispatch({
|
|
19182
|
+
type: LOADING,
|
|
19183
|
+
payload: false
|
|
19184
|
+
});
|
|
19166
19185
|
dispatch({
|
|
19167
19186
|
type: SHOW_ALERT,
|
|
19168
19187
|
payload: {
|
package/dist/index.esm.js
CHANGED
|
@@ -18735,13 +18735,17 @@ 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
|
|
18742
18742
|
}).then(res => {
|
|
18743
18743
|
var _response$data4;
|
|
18744
18744
|
if (res.error) {
|
|
18745
|
+
dispatch({
|
|
18746
|
+
type: DISABLE_SUBMIT,
|
|
18747
|
+
payload: false
|
|
18748
|
+
});
|
|
18745
18749
|
dispatch({
|
|
18746
18750
|
type: LOADING,
|
|
18747
18751
|
payload: false
|
|
@@ -18755,11 +18759,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18755
18759
|
}
|
|
18756
18760
|
});
|
|
18757
18761
|
}
|
|
18758
|
-
if (flow === "
|
|
18762
|
+
if (flow === "subCreate") {
|
|
18759
18763
|
dispatch({
|
|
18760
18764
|
type: DISABLE_SUBMIT,
|
|
18761
18765
|
payload: false
|
|
18762
18766
|
});
|
|
18767
|
+
dispatch({
|
|
18768
|
+
type: LOADING,
|
|
18769
|
+
payload: false
|
|
18770
|
+
});
|
|
18771
|
+
onSuccess(res);
|
|
18772
|
+
return;
|
|
18773
|
+
}
|
|
18774
|
+
if (flow === "create") {
|
|
18763
18775
|
dispatch({
|
|
18764
18776
|
type: LOADING,
|
|
18765
18777
|
payload: false
|
|
@@ -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 {
|
|
@@ -19112,15 +19127,15 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19112
19127
|
token: source.id
|
|
19113
19128
|
}, (err, res) => {
|
|
19114
19129
|
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
19115
|
-
dispatch({
|
|
19116
|
-
type: DISABLE_SUBMIT,
|
|
19117
|
-
payload: false
|
|
19118
|
-
});
|
|
19119
|
-
dispatch({
|
|
19120
|
-
type: LOADING,
|
|
19121
|
-
payload: false
|
|
19122
|
-
});
|
|
19123
19130
|
if (err) {
|
|
19131
|
+
dispatch({
|
|
19132
|
+
type: DISABLE_SUBMIT,
|
|
19133
|
+
payload: false
|
|
19134
|
+
});
|
|
19135
|
+
dispatch({
|
|
19136
|
+
type: LOADING,
|
|
19137
|
+
payload: false
|
|
19138
|
+
});
|
|
19124
19139
|
onFailure(err);
|
|
19125
19140
|
return dispatch({
|
|
19126
19141
|
type: SHOW_ALERT,
|
|
@@ -19133,6 +19148,10 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19133
19148
|
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") {
|
|
19134
19149
|
confirmStripeIntentSetup(res, "create");
|
|
19135
19150
|
} else {
|
|
19151
|
+
dispatch({
|
|
19152
|
+
type: LOADING,
|
|
19153
|
+
payload: false
|
|
19154
|
+
});
|
|
19136
19155
|
dispatch({
|
|
19137
19156
|
type: SHOW_ALERT,
|
|
19138
19157
|
payload: {
|