@pelcro/react-pelcro-js 3.23.0-beta.11 → 3.23.0-beta.12
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 +54 -18
- package/dist/index.esm.js +54 -18
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -17991,6 +17991,22 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17991
17991
|
});
|
|
17992
17992
|
updateTotalAmountWithTax();
|
|
17993
17993
|
}, []);
|
|
17994
|
+
const fireBugSnag = _ref2 => {
|
|
17995
|
+
let {
|
|
17996
|
+
error,
|
|
17997
|
+
title
|
|
17998
|
+
} = _ref2;
|
|
17999
|
+
notifyBugsnag(() => {
|
|
18000
|
+
Bugsnag.notify(title !== null && title !== void 0 ? title : "ERROR", event => {
|
|
18001
|
+
var _document$getElementB, _document$querySelect;
|
|
18002
|
+
event.addMetadata("MetaData", {
|
|
18003
|
+
error: error !== null && error !== void 0 ? error : "ERROR",
|
|
18004
|
+
paymentModalViewed: (_document$getElementB = !!document.getElementById("pelcro-subscription-create-modal")) !== null && _document$getElementB !== void 0 ? _document$getElementB : false,
|
|
18005
|
+
errorAppeared: (_document$querySelect = !!document.querySelector(".pelcro-alert-error")) !== null && _document$querySelect !== void 0 ? _document$querySelect : false
|
|
18006
|
+
});
|
|
18007
|
+
});
|
|
18008
|
+
});
|
|
18009
|
+
};
|
|
17994
18010
|
|
|
17995
18011
|
/*====== Start Cybersource integration ========*/
|
|
17996
18012
|
const cybersourceErrorHandle = err => {
|
|
@@ -18000,10 +18016,10 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18000
18016
|
const errorMessages = [];
|
|
18001
18017
|
|
|
18002
18018
|
// enumerable error (ex: validation errors)
|
|
18003
|
-
Object.values(err === null || err === void 0 ? void 0 : (_err$details2 = err.details) === null || _err$details2 === void 0 ? void 0 : (_err$details2$respons = _err$details2.responseStatus) === null || _err$details2$respons === void 0 ? void 0 : _err$details2$respons.details).forEach(
|
|
18019
|
+
Object.values(err === null || err === void 0 ? void 0 : (_err$details2 = err.details) === null || _err$details2 === void 0 ? void 0 : (_err$details2$respons = _err$details2.responseStatus) === null || _err$details2$respons === void 0 ? void 0 : _err$details2$respons.details).forEach(_ref3 => {
|
|
18004
18020
|
let {
|
|
18005
18021
|
message
|
|
18006
|
-
} =
|
|
18022
|
+
} = _ref3;
|
|
18007
18023
|
errorMessages.push(message);
|
|
18008
18024
|
});
|
|
18009
18025
|
|
|
@@ -18241,7 +18257,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18241
18257
|
|
|
18242
18258
|
/*====== Start Tap integration ========*/
|
|
18243
18259
|
const submitUsingTap = state => {
|
|
18244
|
-
var
|
|
18260
|
+
var _ref4, _ref5, _getPlanAmount;
|
|
18245
18261
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
18246
18262
|
if (isUsingExistingPaymentMethod) {
|
|
18247
18263
|
// no need to create a new source using tap
|
|
@@ -18273,7 +18289,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18273
18289
|
return plan.amount;
|
|
18274
18290
|
}
|
|
18275
18291
|
}
|
|
18276
|
-
const totalAmount = (
|
|
18292
|
+
const totalAmount = (_ref4 = (_ref5 = (_getPlanAmount = getPlanAmount()) !== null && _getPlanAmount !== void 0 ? _getPlanAmount : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref5 !== void 0 ? _ref5 : getOrderItemsTotal()) !== null && _ref4 !== void 0 ? _ref4 : 10;
|
|
18277
18293
|
tapInstanceRef.current.createToken(tapInstanceCard.current).then(function (result) {
|
|
18278
18294
|
if (result.error) {
|
|
18279
18295
|
// Inform the user if there was an error
|
|
@@ -18771,13 +18787,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18771
18787
|
});
|
|
18772
18788
|
|
|
18773
18789
|
// When Google pay / Apple pay source created
|
|
18774
|
-
paymentRequest.on("source",
|
|
18790
|
+
paymentRequest.on("source", _ref6 => {
|
|
18775
18791
|
var _source$card;
|
|
18776
18792
|
let {
|
|
18777
18793
|
complete,
|
|
18778
18794
|
source,
|
|
18779
18795
|
...data
|
|
18780
|
-
} =
|
|
18796
|
+
} = _ref6;
|
|
18781
18797
|
dispatch({
|
|
18782
18798
|
type: DISABLE_COUPON_BUTTON,
|
|
18783
18799
|
payload: true
|
|
@@ -18792,13 +18808,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18792
18808
|
});
|
|
18793
18809
|
complete("success");
|
|
18794
18810
|
if ((source === null || source === void 0 ? void 0 : (_source$card = source.card) === null || _source$card === void 0 ? void 0 : _source$card.three_d_secure) === "required") {
|
|
18795
|
-
return generate3DSecureSource(source).then(
|
|
18811
|
+
return generate3DSecureSource(source).then(_ref7 => {
|
|
18796
18812
|
let {
|
|
18797
18813
|
source,
|
|
18798
18814
|
error
|
|
18799
|
-
} =
|
|
18815
|
+
} = _ref7;
|
|
18800
18816
|
if (error) {
|
|
18801
|
-
|
|
18817
|
+
handlePaymentError(error);
|
|
18818
|
+
fireBugSnag({
|
|
18819
|
+
error,
|
|
18820
|
+
title: "generate3DSecureSource - ERROR"
|
|
18821
|
+
});
|
|
18822
|
+
return;
|
|
18802
18823
|
}
|
|
18803
18824
|
toggleAuthenticationPendingView(true, source);
|
|
18804
18825
|
});
|
|
@@ -19082,13 +19103,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19082
19103
|
});
|
|
19083
19104
|
if (res.error) {
|
|
19084
19105
|
onFailure(res.error);
|
|
19085
|
-
|
|
19106
|
+
dispatch({
|
|
19086
19107
|
type: SHOW_ALERT,
|
|
19087
19108
|
payload: {
|
|
19088
19109
|
type: "error",
|
|
19089
19110
|
content: isSubCreate ? t("messages.tryAgainFromInvoice") : getErrorMessages(res.error)
|
|
19090
19111
|
}
|
|
19091
19112
|
});
|
|
19113
|
+
fireBugSnag({
|
|
19114
|
+
error: getErrorMessages(res.error),
|
|
19115
|
+
title: "StripeConfirmCardPayment - ERROR"
|
|
19116
|
+
});
|
|
19117
|
+
return;
|
|
19092
19118
|
}
|
|
19093
19119
|
onSuccess(res);
|
|
19094
19120
|
});
|
|
@@ -19104,13 +19130,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19104
19130
|
payload: false
|
|
19105
19131
|
});
|
|
19106
19132
|
onFailure(error);
|
|
19107
|
-
|
|
19133
|
+
dispatch({
|
|
19108
19134
|
type: SHOW_ALERT,
|
|
19109
19135
|
payload: {
|
|
19110
19136
|
type: "error",
|
|
19111
19137
|
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
19112
19138
|
}
|
|
19113
19139
|
});
|
|
19140
|
+
fireBugSnag({
|
|
19141
|
+
error: getErrorMessages(error),
|
|
19142
|
+
title: "StripeConfirmCardPayment - ERROR"
|
|
19143
|
+
});
|
|
19144
|
+
return;
|
|
19114
19145
|
} else {
|
|
19115
19146
|
onSuccess(response);
|
|
19116
19147
|
}
|
|
@@ -19125,13 +19156,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19125
19156
|
});
|
|
19126
19157
|
if (error) {
|
|
19127
19158
|
onFailure(error);
|
|
19128
|
-
|
|
19159
|
+
dispatch({
|
|
19129
19160
|
type: SHOW_ALERT,
|
|
19130
19161
|
payload: {
|
|
19131
19162
|
type: "error",
|
|
19132
19163
|
content: getErrorMessages(error)
|
|
19133
19164
|
}
|
|
19134
19165
|
});
|
|
19166
|
+
fireBugSnag({
|
|
19167
|
+
error: getErrorMessages(error),
|
|
19168
|
+
title: "StripeConfirmCardPayment - ERROR"
|
|
19169
|
+
});
|
|
19170
|
+
return;
|
|
19135
19171
|
}
|
|
19136
19172
|
onSuccess(response);
|
|
19137
19173
|
}
|
|
@@ -19397,12 +19433,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19397
19433
|
const updatePaymentSource = (state, dispatch) => {
|
|
19398
19434
|
return stripe.createSource({
|
|
19399
19435
|
type: "card"
|
|
19400
|
-
}).then(
|
|
19436
|
+
}).then(_ref8 => {
|
|
19401
19437
|
var _source$card2;
|
|
19402
19438
|
let {
|
|
19403
19439
|
source,
|
|
19404
19440
|
error
|
|
19405
|
-
} =
|
|
19441
|
+
} = _ref8;
|
|
19406
19442
|
if (error) {
|
|
19407
19443
|
return handlePaymentError(error);
|
|
19408
19444
|
}
|
|
@@ -19527,12 +19563,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19527
19563
|
}
|
|
19528
19564
|
stripe.createSource({
|
|
19529
19565
|
type: "card"
|
|
19530
|
-
}).then(
|
|
19531
|
-
var
|
|
19566
|
+
}).then(_ref9 => {
|
|
19567
|
+
var _ref10, _ref11, _state$updatedPrice;
|
|
19532
19568
|
let {
|
|
19533
19569
|
source,
|
|
19534
19570
|
error
|
|
19535
|
-
} =
|
|
19571
|
+
} = _ref9;
|
|
19536
19572
|
if (error) {
|
|
19537
19573
|
return handlePaymentError(error);
|
|
19538
19574
|
}
|
|
@@ -19551,7 +19587,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19551
19587
|
return total + item.price * item.quantity;
|
|
19552
19588
|
}, 0);
|
|
19553
19589
|
};
|
|
19554
|
-
(
|
|
19590
|
+
(_ref10 = (_ref11 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref11 !== void 0 ? _ref11 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref10 !== void 0 ? _ref10 : getOrderItemsTotal();
|
|
19555
19591
|
return handlePayment(source);
|
|
19556
19592
|
}).catch(error => {
|
|
19557
19593
|
return handlePaymentError(error);
|
package/dist/index.esm.js
CHANGED
|
@@ -17961,6 +17961,22 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17961
17961
|
});
|
|
17962
17962
|
updateTotalAmountWithTax();
|
|
17963
17963
|
}, []);
|
|
17964
|
+
const fireBugSnag = _ref2 => {
|
|
17965
|
+
let {
|
|
17966
|
+
error,
|
|
17967
|
+
title
|
|
17968
|
+
} = _ref2;
|
|
17969
|
+
notifyBugsnag(() => {
|
|
17970
|
+
Bugsnag.notify(title !== null && title !== void 0 ? title : "ERROR", event => {
|
|
17971
|
+
var _document$getElementB, _document$querySelect;
|
|
17972
|
+
event.addMetadata("MetaData", {
|
|
17973
|
+
error: error !== null && error !== void 0 ? error : "ERROR",
|
|
17974
|
+
paymentModalViewed: (_document$getElementB = !!document.getElementById("pelcro-subscription-create-modal")) !== null && _document$getElementB !== void 0 ? _document$getElementB : false,
|
|
17975
|
+
errorAppeared: (_document$querySelect = !!document.querySelector(".pelcro-alert-error")) !== null && _document$querySelect !== void 0 ? _document$querySelect : false
|
|
17976
|
+
});
|
|
17977
|
+
});
|
|
17978
|
+
});
|
|
17979
|
+
};
|
|
17964
17980
|
|
|
17965
17981
|
/*====== Start Cybersource integration ========*/
|
|
17966
17982
|
const cybersourceErrorHandle = err => {
|
|
@@ -17970,10 +17986,10 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17970
17986
|
const errorMessages = [];
|
|
17971
17987
|
|
|
17972
17988
|
// enumerable error (ex: validation errors)
|
|
17973
|
-
Object.values(err === null || err === void 0 ? void 0 : (_err$details2 = err.details) === null || _err$details2 === void 0 ? void 0 : (_err$details2$respons = _err$details2.responseStatus) === null || _err$details2$respons === void 0 ? void 0 : _err$details2$respons.details).forEach(
|
|
17989
|
+
Object.values(err === null || err === void 0 ? void 0 : (_err$details2 = err.details) === null || _err$details2 === void 0 ? void 0 : (_err$details2$respons = _err$details2.responseStatus) === null || _err$details2$respons === void 0 ? void 0 : _err$details2$respons.details).forEach(_ref3 => {
|
|
17974
17990
|
let {
|
|
17975
17991
|
message
|
|
17976
|
-
} =
|
|
17992
|
+
} = _ref3;
|
|
17977
17993
|
errorMessages.push(message);
|
|
17978
17994
|
});
|
|
17979
17995
|
|
|
@@ -18211,7 +18227,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18211
18227
|
|
|
18212
18228
|
/*====== Start Tap integration ========*/
|
|
18213
18229
|
const submitUsingTap = state => {
|
|
18214
|
-
var
|
|
18230
|
+
var _ref4, _ref5, _getPlanAmount;
|
|
18215
18231
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
18216
18232
|
if (isUsingExistingPaymentMethod) {
|
|
18217
18233
|
// no need to create a new source using tap
|
|
@@ -18243,7 +18259,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18243
18259
|
return plan.amount;
|
|
18244
18260
|
}
|
|
18245
18261
|
}
|
|
18246
|
-
const totalAmount = (
|
|
18262
|
+
const totalAmount = (_ref4 = (_ref5 = (_getPlanAmount = getPlanAmount()) !== null && _getPlanAmount !== void 0 ? _getPlanAmount : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref5 !== void 0 ? _ref5 : getOrderItemsTotal()) !== null && _ref4 !== void 0 ? _ref4 : 10;
|
|
18247
18263
|
tapInstanceRef.current.createToken(tapInstanceCard.current).then(function (result) {
|
|
18248
18264
|
if (result.error) {
|
|
18249
18265
|
// Inform the user if there was an error
|
|
@@ -18741,13 +18757,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18741
18757
|
});
|
|
18742
18758
|
|
|
18743
18759
|
// When Google pay / Apple pay source created
|
|
18744
|
-
paymentRequest.on("source",
|
|
18760
|
+
paymentRequest.on("source", _ref6 => {
|
|
18745
18761
|
var _source$card;
|
|
18746
18762
|
let {
|
|
18747
18763
|
complete,
|
|
18748
18764
|
source,
|
|
18749
18765
|
...data
|
|
18750
|
-
} =
|
|
18766
|
+
} = _ref6;
|
|
18751
18767
|
dispatch({
|
|
18752
18768
|
type: DISABLE_COUPON_BUTTON,
|
|
18753
18769
|
payload: true
|
|
@@ -18762,13 +18778,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18762
18778
|
});
|
|
18763
18779
|
complete("success");
|
|
18764
18780
|
if ((source === null || source === void 0 ? void 0 : (_source$card = source.card) === null || _source$card === void 0 ? void 0 : _source$card.three_d_secure) === "required") {
|
|
18765
|
-
return generate3DSecureSource(source).then(
|
|
18781
|
+
return generate3DSecureSource(source).then(_ref7 => {
|
|
18766
18782
|
let {
|
|
18767
18783
|
source,
|
|
18768
18784
|
error
|
|
18769
|
-
} =
|
|
18785
|
+
} = _ref7;
|
|
18770
18786
|
if (error) {
|
|
18771
|
-
|
|
18787
|
+
handlePaymentError(error);
|
|
18788
|
+
fireBugSnag({
|
|
18789
|
+
error,
|
|
18790
|
+
title: "generate3DSecureSource - ERROR"
|
|
18791
|
+
});
|
|
18792
|
+
return;
|
|
18772
18793
|
}
|
|
18773
18794
|
toggleAuthenticationPendingView(true, source);
|
|
18774
18795
|
});
|
|
@@ -19052,13 +19073,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19052
19073
|
});
|
|
19053
19074
|
if (res.error) {
|
|
19054
19075
|
onFailure(res.error);
|
|
19055
|
-
|
|
19076
|
+
dispatch({
|
|
19056
19077
|
type: SHOW_ALERT,
|
|
19057
19078
|
payload: {
|
|
19058
19079
|
type: "error",
|
|
19059
19080
|
content: isSubCreate ? t("messages.tryAgainFromInvoice") : getErrorMessages(res.error)
|
|
19060
19081
|
}
|
|
19061
19082
|
});
|
|
19083
|
+
fireBugSnag({
|
|
19084
|
+
error: getErrorMessages(res.error),
|
|
19085
|
+
title: "StripeConfirmCardPayment - ERROR"
|
|
19086
|
+
});
|
|
19087
|
+
return;
|
|
19062
19088
|
}
|
|
19063
19089
|
onSuccess(res);
|
|
19064
19090
|
});
|
|
@@ -19074,13 +19100,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19074
19100
|
payload: false
|
|
19075
19101
|
});
|
|
19076
19102
|
onFailure(error);
|
|
19077
|
-
|
|
19103
|
+
dispatch({
|
|
19078
19104
|
type: SHOW_ALERT,
|
|
19079
19105
|
payload: {
|
|
19080
19106
|
type: "error",
|
|
19081
19107
|
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
19082
19108
|
}
|
|
19083
19109
|
});
|
|
19110
|
+
fireBugSnag({
|
|
19111
|
+
error: getErrorMessages(error),
|
|
19112
|
+
title: "StripeConfirmCardPayment - ERROR"
|
|
19113
|
+
});
|
|
19114
|
+
return;
|
|
19084
19115
|
} else {
|
|
19085
19116
|
onSuccess(response);
|
|
19086
19117
|
}
|
|
@@ -19095,13 +19126,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19095
19126
|
});
|
|
19096
19127
|
if (error) {
|
|
19097
19128
|
onFailure(error);
|
|
19098
|
-
|
|
19129
|
+
dispatch({
|
|
19099
19130
|
type: SHOW_ALERT,
|
|
19100
19131
|
payload: {
|
|
19101
19132
|
type: "error",
|
|
19102
19133
|
content: getErrorMessages(error)
|
|
19103
19134
|
}
|
|
19104
19135
|
});
|
|
19136
|
+
fireBugSnag({
|
|
19137
|
+
error: getErrorMessages(error),
|
|
19138
|
+
title: "StripeConfirmCardPayment - ERROR"
|
|
19139
|
+
});
|
|
19140
|
+
return;
|
|
19105
19141
|
}
|
|
19106
19142
|
onSuccess(response);
|
|
19107
19143
|
}
|
|
@@ -19367,12 +19403,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19367
19403
|
const updatePaymentSource = (state, dispatch) => {
|
|
19368
19404
|
return stripe.createSource({
|
|
19369
19405
|
type: "card"
|
|
19370
|
-
}).then(
|
|
19406
|
+
}).then(_ref8 => {
|
|
19371
19407
|
var _source$card2;
|
|
19372
19408
|
let {
|
|
19373
19409
|
source,
|
|
19374
19410
|
error
|
|
19375
|
-
} =
|
|
19411
|
+
} = _ref8;
|
|
19376
19412
|
if (error) {
|
|
19377
19413
|
return handlePaymentError(error);
|
|
19378
19414
|
}
|
|
@@ -19497,12 +19533,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19497
19533
|
}
|
|
19498
19534
|
stripe.createSource({
|
|
19499
19535
|
type: "card"
|
|
19500
|
-
}).then(
|
|
19501
|
-
var
|
|
19536
|
+
}).then(_ref9 => {
|
|
19537
|
+
var _ref10, _ref11, _state$updatedPrice;
|
|
19502
19538
|
let {
|
|
19503
19539
|
source,
|
|
19504
19540
|
error
|
|
19505
|
-
} =
|
|
19541
|
+
} = _ref9;
|
|
19506
19542
|
if (error) {
|
|
19507
19543
|
return handlePaymentError(error);
|
|
19508
19544
|
}
|
|
@@ -19521,7 +19557,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19521
19557
|
return total + item.price * item.quantity;
|
|
19522
19558
|
}, 0);
|
|
19523
19559
|
};
|
|
19524
|
-
(
|
|
19560
|
+
(_ref10 = (_ref11 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref11 !== void 0 ? _ref11 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref10 !== void 0 ? _ref10 : getOrderItemsTotal();
|
|
19525
19561
|
return handlePayment(source);
|
|
19526
19562
|
}).catch(error => {
|
|
19527
19563
|
return handlePaymentError(error);
|