@pelcro/react-pelcro-js 4.0.0-alpha.96 → 4.0.0-alpha.97
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 +97 -42
- package/dist/index.esm.js +97 -42
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -29803,12 +29803,13 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
29803
29803
|
* @param {boolean} isSubCreate
|
|
29804
29804
|
* @return {*}
|
|
29805
29805
|
*/
|
|
29806
|
-
const confirmStripeCardPayment = (response, error, isSubCreate = false) => {
|
|
29807
|
-
|
|
29808
|
-
|
|
29809
|
-
|
|
29810
|
-
|
|
29811
|
-
|
|
29806
|
+
const confirmStripeCardPayment = async (response, error, isSubCreate = false) => {
|
|
29807
|
+
try {
|
|
29808
|
+
if (response) {
|
|
29809
|
+
var _response$data;
|
|
29810
|
+
const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
|
|
29811
|
+
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
29812
|
+
const res = await stripe.confirmCardPayment(paymentIntent.client_secret);
|
|
29812
29813
|
if (!isSubCreate) {
|
|
29813
29814
|
dispatch({
|
|
29814
29815
|
type: DISABLE_SUBMIT,
|
|
@@ -29820,6 +29821,18 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
29820
29821
|
payload: false
|
|
29821
29822
|
});
|
|
29822
29823
|
if (res.error) {
|
|
29824
|
+
notifyBugsnag(() => {
|
|
29825
|
+
// eslint-disable-next-line no-undef
|
|
29826
|
+
Bugsnag.notify(`Payment ${res.error}`, event => {
|
|
29827
|
+
var _error$response, _error$response$data, _error$response$data$;
|
|
29828
|
+
event.addMetadata("Stripe Error MetaData", {
|
|
29829
|
+
message: res.error.message,
|
|
29830
|
+
type: res.error.type,
|
|
29831
|
+
code: res.error.code,
|
|
29832
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.error) === null || _error$response$data$ === void 0 ? void 0 : _error$response$data$.message
|
|
29833
|
+
});
|
|
29834
|
+
});
|
|
29835
|
+
});
|
|
29823
29836
|
onFailure(res.error);
|
|
29824
29837
|
return dispatch({
|
|
29825
29838
|
type: SHOW_ALERT,
|
|
@@ -29830,45 +29843,90 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
29830
29843
|
});
|
|
29831
29844
|
}
|
|
29832
29845
|
onSuccess(res);
|
|
29833
|
-
})
|
|
29834
|
-
|
|
29835
|
-
|
|
29846
|
+
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
29847
|
+
if (!isSubCreate) {
|
|
29848
|
+
dispatch({
|
|
29849
|
+
type: DISABLE_SUBMIT,
|
|
29850
|
+
payload: false
|
|
29851
|
+
});
|
|
29852
|
+
}
|
|
29836
29853
|
dispatch({
|
|
29837
|
-
type:
|
|
29854
|
+
type: LOADING,
|
|
29838
29855
|
payload: false
|
|
29839
29856
|
});
|
|
29840
|
-
|
|
29841
|
-
|
|
29842
|
-
|
|
29843
|
-
|
|
29844
|
-
|
|
29845
|
-
|
|
29846
|
-
|
|
29847
|
-
|
|
29848
|
-
|
|
29849
|
-
|
|
29850
|
-
|
|
29857
|
+
onFailure(error);
|
|
29858
|
+
return dispatch({
|
|
29859
|
+
type: SHOW_ALERT,
|
|
29860
|
+
payload: {
|
|
29861
|
+
type: "error",
|
|
29862
|
+
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
29863
|
+
}
|
|
29864
|
+
});
|
|
29865
|
+
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "processing" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
29866
|
+
if (!isSubCreate) {
|
|
29867
|
+
dispatch({
|
|
29868
|
+
type: DISABLE_SUBMIT,
|
|
29869
|
+
payload: false
|
|
29870
|
+
});
|
|
29851
29871
|
}
|
|
29852
|
-
});
|
|
29853
|
-
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "processing" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
29854
|
-
if (!isSubCreate) {
|
|
29855
29872
|
dispatch({
|
|
29856
|
-
type:
|
|
29873
|
+
type: LOADING,
|
|
29857
29874
|
payload: false
|
|
29858
29875
|
});
|
|
29876
|
+
set({
|
|
29877
|
+
isProcessingInvoice: true
|
|
29878
|
+
});
|
|
29879
|
+
onSuccess(response);
|
|
29880
|
+
} else {
|
|
29881
|
+
onSuccess(response);
|
|
29859
29882
|
}
|
|
29883
|
+
} else {
|
|
29860
29884
|
dispatch({
|
|
29861
|
-
type:
|
|
29885
|
+
type: DISABLE_SUBMIT,
|
|
29862
29886
|
payload: false
|
|
29863
29887
|
});
|
|
29864
|
-
|
|
29865
|
-
|
|
29888
|
+
dispatch({
|
|
29889
|
+
type: LOADING,
|
|
29890
|
+
payload: false
|
|
29866
29891
|
});
|
|
29867
|
-
|
|
29868
|
-
|
|
29892
|
+
if (error) {
|
|
29893
|
+
notifyBugsnag(() => {
|
|
29894
|
+
// eslint-disable-next-line no-undef
|
|
29895
|
+
Bugsnag.notify(`Payment ${error}`, event => {
|
|
29896
|
+
var _error$response2, _error$response3, _error$response3$data, _error$response3$data2;
|
|
29897
|
+
event.addMetadata("MetaData", {
|
|
29898
|
+
name: error === null || error === void 0 ? void 0 : error.name,
|
|
29899
|
+
message: error === null || error === void 0 ? void 0 : error.message,
|
|
29900
|
+
type: error === null || error === void 0 ? void 0 : error.type,
|
|
29901
|
+
code: error === null || error === void 0 ? void 0 : error.code,
|
|
29902
|
+
status: error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status,
|
|
29903
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : (_error$response3$data2 = _error$response3$data.error) === null || _error$response3$data2 === void 0 ? void 0 : _error$response3$data2.message
|
|
29904
|
+
});
|
|
29905
|
+
});
|
|
29906
|
+
});
|
|
29907
|
+
onFailure(error);
|
|
29908
|
+
return dispatch({
|
|
29909
|
+
type: SHOW_ALERT,
|
|
29910
|
+
payload: {
|
|
29911
|
+
type: "error",
|
|
29912
|
+
content: getErrorMessages(error)
|
|
29913
|
+
}
|
|
29914
|
+
});
|
|
29915
|
+
}
|
|
29869
29916
|
onSuccess(response);
|
|
29870
29917
|
}
|
|
29871
|
-
}
|
|
29918
|
+
} catch (error) {
|
|
29919
|
+
notifyBugsnag(() => {
|
|
29920
|
+
// eslint-disable-next-line no-undef
|
|
29921
|
+
Bugsnag.notify(`Payment ${error}`, event => {
|
|
29922
|
+
var _error$response4, _error$response4$data, _error$response4$data2;
|
|
29923
|
+
event.addMetadata("UnexpectedError", {
|
|
29924
|
+
message: error.message,
|
|
29925
|
+
stack: error.stack,
|
|
29926
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.error) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2.message
|
|
29927
|
+
});
|
|
29928
|
+
});
|
|
29929
|
+
});
|
|
29872
29930
|
dispatch({
|
|
29873
29931
|
type: DISABLE_SUBMIT,
|
|
29874
29932
|
payload: false
|
|
@@ -29877,17 +29935,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
29877
29935
|
type: LOADING,
|
|
29878
29936
|
payload: false
|
|
29879
29937
|
});
|
|
29880
|
-
|
|
29881
|
-
|
|
29882
|
-
|
|
29883
|
-
|
|
29884
|
-
|
|
29885
|
-
|
|
29886
|
-
|
|
29887
|
-
|
|
29888
|
-
});
|
|
29889
|
-
}
|
|
29890
|
-
onSuccess(response);
|
|
29938
|
+
onFailure(error);
|
|
29939
|
+
return dispatch({
|
|
29940
|
+
type: SHOW_ALERT,
|
|
29941
|
+
payload: {
|
|
29942
|
+
type: "error",
|
|
29943
|
+
content: t("messages.unexpectedError")
|
|
29944
|
+
}
|
|
29945
|
+
});
|
|
29891
29946
|
}
|
|
29892
29947
|
};
|
|
29893
29948
|
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
package/dist/index.esm.js
CHANGED
|
@@ -29773,12 +29773,13 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
29773
29773
|
* @param {boolean} isSubCreate
|
|
29774
29774
|
* @return {*}
|
|
29775
29775
|
*/
|
|
29776
|
-
const confirmStripeCardPayment = (response, error, isSubCreate = false) => {
|
|
29777
|
-
|
|
29778
|
-
|
|
29779
|
-
|
|
29780
|
-
|
|
29781
|
-
|
|
29776
|
+
const confirmStripeCardPayment = async (response, error, isSubCreate = false) => {
|
|
29777
|
+
try {
|
|
29778
|
+
if (response) {
|
|
29779
|
+
var _response$data;
|
|
29780
|
+
const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
|
|
29781
|
+
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
29782
|
+
const res = await stripe.confirmCardPayment(paymentIntent.client_secret);
|
|
29782
29783
|
if (!isSubCreate) {
|
|
29783
29784
|
dispatch({
|
|
29784
29785
|
type: DISABLE_SUBMIT,
|
|
@@ -29790,6 +29791,18 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
29790
29791
|
payload: false
|
|
29791
29792
|
});
|
|
29792
29793
|
if (res.error) {
|
|
29794
|
+
notifyBugsnag(() => {
|
|
29795
|
+
// eslint-disable-next-line no-undef
|
|
29796
|
+
Bugsnag.notify(`Payment ${res.error}`, event => {
|
|
29797
|
+
var _error$response, _error$response$data, _error$response$data$;
|
|
29798
|
+
event.addMetadata("Stripe Error MetaData", {
|
|
29799
|
+
message: res.error.message,
|
|
29800
|
+
type: res.error.type,
|
|
29801
|
+
code: res.error.code,
|
|
29802
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.error) === null || _error$response$data$ === void 0 ? void 0 : _error$response$data$.message
|
|
29803
|
+
});
|
|
29804
|
+
});
|
|
29805
|
+
});
|
|
29793
29806
|
onFailure(res.error);
|
|
29794
29807
|
return dispatch({
|
|
29795
29808
|
type: SHOW_ALERT,
|
|
@@ -29800,45 +29813,90 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
29800
29813
|
});
|
|
29801
29814
|
}
|
|
29802
29815
|
onSuccess(res);
|
|
29803
|
-
})
|
|
29804
|
-
|
|
29805
|
-
|
|
29816
|
+
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
29817
|
+
if (!isSubCreate) {
|
|
29818
|
+
dispatch({
|
|
29819
|
+
type: DISABLE_SUBMIT,
|
|
29820
|
+
payload: false
|
|
29821
|
+
});
|
|
29822
|
+
}
|
|
29806
29823
|
dispatch({
|
|
29807
|
-
type:
|
|
29824
|
+
type: LOADING,
|
|
29808
29825
|
payload: false
|
|
29809
29826
|
});
|
|
29810
|
-
|
|
29811
|
-
|
|
29812
|
-
|
|
29813
|
-
|
|
29814
|
-
|
|
29815
|
-
|
|
29816
|
-
|
|
29817
|
-
|
|
29818
|
-
|
|
29819
|
-
|
|
29820
|
-
|
|
29827
|
+
onFailure(error);
|
|
29828
|
+
return dispatch({
|
|
29829
|
+
type: SHOW_ALERT,
|
|
29830
|
+
payload: {
|
|
29831
|
+
type: "error",
|
|
29832
|
+
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
29833
|
+
}
|
|
29834
|
+
});
|
|
29835
|
+
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "processing" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
29836
|
+
if (!isSubCreate) {
|
|
29837
|
+
dispatch({
|
|
29838
|
+
type: DISABLE_SUBMIT,
|
|
29839
|
+
payload: false
|
|
29840
|
+
});
|
|
29821
29841
|
}
|
|
29822
|
-
});
|
|
29823
|
-
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "processing" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
29824
|
-
if (!isSubCreate) {
|
|
29825
29842
|
dispatch({
|
|
29826
|
-
type:
|
|
29843
|
+
type: LOADING,
|
|
29827
29844
|
payload: false
|
|
29828
29845
|
});
|
|
29846
|
+
set({
|
|
29847
|
+
isProcessingInvoice: true
|
|
29848
|
+
});
|
|
29849
|
+
onSuccess(response);
|
|
29850
|
+
} else {
|
|
29851
|
+
onSuccess(response);
|
|
29829
29852
|
}
|
|
29853
|
+
} else {
|
|
29830
29854
|
dispatch({
|
|
29831
|
-
type:
|
|
29855
|
+
type: DISABLE_SUBMIT,
|
|
29832
29856
|
payload: false
|
|
29833
29857
|
});
|
|
29834
|
-
|
|
29835
|
-
|
|
29858
|
+
dispatch({
|
|
29859
|
+
type: LOADING,
|
|
29860
|
+
payload: false
|
|
29836
29861
|
});
|
|
29837
|
-
|
|
29838
|
-
|
|
29862
|
+
if (error) {
|
|
29863
|
+
notifyBugsnag(() => {
|
|
29864
|
+
// eslint-disable-next-line no-undef
|
|
29865
|
+
Bugsnag.notify(`Payment ${error}`, event => {
|
|
29866
|
+
var _error$response2, _error$response3, _error$response3$data, _error$response3$data2;
|
|
29867
|
+
event.addMetadata("MetaData", {
|
|
29868
|
+
name: error === null || error === void 0 ? void 0 : error.name,
|
|
29869
|
+
message: error === null || error === void 0 ? void 0 : error.message,
|
|
29870
|
+
type: error === null || error === void 0 ? void 0 : error.type,
|
|
29871
|
+
code: error === null || error === void 0 ? void 0 : error.code,
|
|
29872
|
+
status: error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status,
|
|
29873
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : (_error$response3$data2 = _error$response3$data.error) === null || _error$response3$data2 === void 0 ? void 0 : _error$response3$data2.message
|
|
29874
|
+
});
|
|
29875
|
+
});
|
|
29876
|
+
});
|
|
29877
|
+
onFailure(error);
|
|
29878
|
+
return dispatch({
|
|
29879
|
+
type: SHOW_ALERT,
|
|
29880
|
+
payload: {
|
|
29881
|
+
type: "error",
|
|
29882
|
+
content: getErrorMessages(error)
|
|
29883
|
+
}
|
|
29884
|
+
});
|
|
29885
|
+
}
|
|
29839
29886
|
onSuccess(response);
|
|
29840
29887
|
}
|
|
29841
|
-
}
|
|
29888
|
+
} catch (error) {
|
|
29889
|
+
notifyBugsnag(() => {
|
|
29890
|
+
// eslint-disable-next-line no-undef
|
|
29891
|
+
Bugsnag.notify(`Payment ${error}`, event => {
|
|
29892
|
+
var _error$response4, _error$response4$data, _error$response4$data2;
|
|
29893
|
+
event.addMetadata("UnexpectedError", {
|
|
29894
|
+
message: error.message,
|
|
29895
|
+
stack: error.stack,
|
|
29896
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.error) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2.message
|
|
29897
|
+
});
|
|
29898
|
+
});
|
|
29899
|
+
});
|
|
29842
29900
|
dispatch({
|
|
29843
29901
|
type: DISABLE_SUBMIT,
|
|
29844
29902
|
payload: false
|
|
@@ -29847,17 +29905,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
29847
29905
|
type: LOADING,
|
|
29848
29906
|
payload: false
|
|
29849
29907
|
});
|
|
29850
|
-
|
|
29851
|
-
|
|
29852
|
-
|
|
29853
|
-
|
|
29854
|
-
|
|
29855
|
-
|
|
29856
|
-
|
|
29857
|
-
|
|
29858
|
-
});
|
|
29859
|
-
}
|
|
29860
|
-
onSuccess(response);
|
|
29908
|
+
onFailure(error);
|
|
29909
|
+
return dispatch({
|
|
29910
|
+
type: SHOW_ALERT,
|
|
29911
|
+
payload: {
|
|
29912
|
+
type: "error",
|
|
29913
|
+
content: t("messages.unexpectedError")
|
|
29914
|
+
}
|
|
29915
|
+
});
|
|
29861
29916
|
}
|
|
29862
29917
|
};
|
|
29863
29918
|
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|