@pelcro/react-pelcro-js 3.11.1 → 3.12.0-beta.2
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 -5
- package/dist/index.esm.js +54 -5
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -19929,6 +19929,11 @@ const UserUpdateView = props => {
|
|
|
19929
19929
|
errorId: "pelcro-input-phone-error",
|
|
19930
19930
|
label: t("labels.phone"),
|
|
19931
19931
|
required: supportsTap ? true : false
|
|
19932
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19933
|
+
className: "plc-flex plc-items-start"
|
|
19934
|
+
}, /*#__PURE__*/React__default['default'].createElement(UserUpdateTin, {
|
|
19935
|
+
id: "pelcro-input-tin",
|
|
19936
|
+
label: t("labels.tin")
|
|
19932
19937
|
})), /*#__PURE__*/React__default['default'].createElement(UserUpdateButton, {
|
|
19933
19938
|
role: "submit",
|
|
19934
19939
|
className: "plc-w-full plc-mt-2",
|
|
@@ -23665,12 +23670,13 @@ const AddressSelectContainer = ({
|
|
|
23665
23670
|
className = "",
|
|
23666
23671
|
onGiftRedemptionSuccess = () => {},
|
|
23667
23672
|
onMembershipAdressUpdateSuccess = () => {},
|
|
23673
|
+
onFreePlanSubscriptionSuccess = () => {},
|
|
23668
23674
|
onSuccess = () => {},
|
|
23669
23675
|
onFailure = () => {},
|
|
23670
23676
|
children,
|
|
23671
23677
|
...props
|
|
23672
23678
|
}) => {
|
|
23673
|
-
var _props$giftCode, _ref, _props$subscriptionId;
|
|
23679
|
+
var _props$giftCode, _ref, _props$subscriptionId, _window$Pelcro, _window$Pelcro$uiSett;
|
|
23674
23680
|
|
|
23675
23681
|
const {
|
|
23676
23682
|
t
|
|
@@ -23680,10 +23686,13 @@ const AddressSelectContainer = ({
|
|
|
23680
23686
|
giftCode: giftCodeFromStore,
|
|
23681
23687
|
subscriptionIdToRenew: subscriptionIdToRenewFromStore,
|
|
23682
23688
|
set,
|
|
23683
|
-
selectedMembership
|
|
23689
|
+
selectedMembership,
|
|
23690
|
+
plan,
|
|
23691
|
+
product
|
|
23684
23692
|
} = usePelcro();
|
|
23685
23693
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
23686
23694
|
const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
|
|
23695
|
+
const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
|
|
23687
23696
|
|
|
23688
23697
|
const submitAddress = ({
|
|
23689
23698
|
selectedAddressId
|
|
@@ -23755,6 +23764,39 @@ const AddressSelectContainer = ({
|
|
|
23755
23764
|
});
|
|
23756
23765
|
}
|
|
23757
23766
|
|
|
23767
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
23768
|
+
dispatch({
|
|
23769
|
+
type: LOADING,
|
|
23770
|
+
payload: true
|
|
23771
|
+
});
|
|
23772
|
+
window.Pelcro.subscription.create({
|
|
23773
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
23774
|
+
plan_id: plan.id,
|
|
23775
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
23776
|
+
quantity: plan.quantity,
|
|
23777
|
+
address_id: product.address_required ? selectedAddressId : null
|
|
23778
|
+
}, (err, res) => {
|
|
23779
|
+
dispatch({
|
|
23780
|
+
type: LOADING,
|
|
23781
|
+
payload: false
|
|
23782
|
+
});
|
|
23783
|
+
|
|
23784
|
+
if (err) {
|
|
23785
|
+
dispatch({
|
|
23786
|
+
type: SHOW_ALERT,
|
|
23787
|
+
payload: {
|
|
23788
|
+
type: "error",
|
|
23789
|
+
content: getErrorMessages(err)
|
|
23790
|
+
}
|
|
23791
|
+
});
|
|
23792
|
+
return notify.error(getErrorMessages(err));
|
|
23793
|
+
}
|
|
23794
|
+
|
|
23795
|
+
return onFreePlanSubscriptionSuccess(res);
|
|
23796
|
+
});
|
|
23797
|
+
return;
|
|
23798
|
+
}
|
|
23799
|
+
|
|
23758
23800
|
onSuccess(selectedAddressId);
|
|
23759
23801
|
};
|
|
23760
23802
|
|
|
@@ -23941,8 +23983,7 @@ const AddressSelectModal = ({
|
|
|
23941
23983
|
|
|
23942
23984
|
const onAddNewAddress = () => {
|
|
23943
23985
|
switchView("address-create");
|
|
23944
|
-
};
|
|
23945
|
-
|
|
23986
|
+
};
|
|
23946
23987
|
|
|
23947
23988
|
const onMembershipAdressUpdateSuccess = () => {
|
|
23948
23989
|
var _otherProps$onMembers;
|
|
@@ -23951,6 +23992,13 @@ const AddressSelectModal = ({
|
|
|
23951
23992
|
resetView();
|
|
23952
23993
|
};
|
|
23953
23994
|
|
|
23995
|
+
const onFreePlanSubscriptionSuccess = () => {
|
|
23996
|
+
var _otherProps$onFreePla;
|
|
23997
|
+
|
|
23998
|
+
(_otherProps$onFreePla = otherProps.onFreePlanSubscriptionSuccess) === null || _otherProps$onFreePla === void 0 ? void 0 : _otherProps$onFreePla.call(otherProps);
|
|
23999
|
+
switchView("subscription-success");
|
|
24000
|
+
};
|
|
24001
|
+
|
|
23954
24002
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
23955
24003
|
onDisplay: onDisplay,
|
|
23956
24004
|
onClose: onClose,
|
|
@@ -23960,7 +24008,8 @@ const AddressSelectModal = ({
|
|
|
23960
24008
|
}, otherProps, {
|
|
23961
24009
|
onSuccess: onSuccess,
|
|
23962
24010
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
23963
|
-
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
24011
|
+
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess,
|
|
24012
|
+
onFreePlanSubscriptionSuccess: onFreePlanSubscriptionSuccess
|
|
23964
24013
|
}))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
|
|
23965
24014
|
};
|
|
23966
24015
|
AddressSelectModal.viewId = "address-select";
|
package/dist/index.esm.js
CHANGED
|
@@ -19899,6 +19899,11 @@ const UserUpdateView = props => {
|
|
|
19899
19899
|
errorId: "pelcro-input-phone-error",
|
|
19900
19900
|
label: t("labels.phone"),
|
|
19901
19901
|
required: supportsTap ? true : false
|
|
19902
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
19903
|
+
className: "plc-flex plc-items-start"
|
|
19904
|
+
}, /*#__PURE__*/React__default.createElement(UserUpdateTin, {
|
|
19905
|
+
id: "pelcro-input-tin",
|
|
19906
|
+
label: t("labels.tin")
|
|
19902
19907
|
})), /*#__PURE__*/React__default.createElement(UserUpdateButton, {
|
|
19903
19908
|
role: "submit",
|
|
19904
19909
|
className: "plc-w-full plc-mt-2",
|
|
@@ -23635,12 +23640,13 @@ const AddressSelectContainer = ({
|
|
|
23635
23640
|
className = "",
|
|
23636
23641
|
onGiftRedemptionSuccess = () => {},
|
|
23637
23642
|
onMembershipAdressUpdateSuccess = () => {},
|
|
23643
|
+
onFreePlanSubscriptionSuccess = () => {},
|
|
23638
23644
|
onSuccess = () => {},
|
|
23639
23645
|
onFailure = () => {},
|
|
23640
23646
|
children,
|
|
23641
23647
|
...props
|
|
23642
23648
|
}) => {
|
|
23643
|
-
var _props$giftCode, _ref, _props$subscriptionId;
|
|
23649
|
+
var _props$giftCode, _ref, _props$subscriptionId, _window$Pelcro, _window$Pelcro$uiSett;
|
|
23644
23650
|
|
|
23645
23651
|
const {
|
|
23646
23652
|
t
|
|
@@ -23650,10 +23656,13 @@ const AddressSelectContainer = ({
|
|
|
23650
23656
|
giftCode: giftCodeFromStore,
|
|
23651
23657
|
subscriptionIdToRenew: subscriptionIdToRenewFromStore,
|
|
23652
23658
|
set,
|
|
23653
|
-
selectedMembership
|
|
23659
|
+
selectedMembership,
|
|
23660
|
+
plan,
|
|
23661
|
+
product
|
|
23654
23662
|
} = usePelcro();
|
|
23655
23663
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
23656
23664
|
const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
|
|
23665
|
+
const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
|
|
23657
23666
|
|
|
23658
23667
|
const submitAddress = ({
|
|
23659
23668
|
selectedAddressId
|
|
@@ -23725,6 +23734,39 @@ const AddressSelectContainer = ({
|
|
|
23725
23734
|
});
|
|
23726
23735
|
}
|
|
23727
23736
|
|
|
23737
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
23738
|
+
dispatch({
|
|
23739
|
+
type: LOADING,
|
|
23740
|
+
payload: true
|
|
23741
|
+
});
|
|
23742
|
+
window.Pelcro.subscription.create({
|
|
23743
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
23744
|
+
plan_id: plan.id,
|
|
23745
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
23746
|
+
quantity: plan.quantity,
|
|
23747
|
+
address_id: product.address_required ? selectedAddressId : null
|
|
23748
|
+
}, (err, res) => {
|
|
23749
|
+
dispatch({
|
|
23750
|
+
type: LOADING,
|
|
23751
|
+
payload: false
|
|
23752
|
+
});
|
|
23753
|
+
|
|
23754
|
+
if (err) {
|
|
23755
|
+
dispatch({
|
|
23756
|
+
type: SHOW_ALERT,
|
|
23757
|
+
payload: {
|
|
23758
|
+
type: "error",
|
|
23759
|
+
content: getErrorMessages(err)
|
|
23760
|
+
}
|
|
23761
|
+
});
|
|
23762
|
+
return notify.error(getErrorMessages(err));
|
|
23763
|
+
}
|
|
23764
|
+
|
|
23765
|
+
return onFreePlanSubscriptionSuccess(res);
|
|
23766
|
+
});
|
|
23767
|
+
return;
|
|
23768
|
+
}
|
|
23769
|
+
|
|
23728
23770
|
onSuccess(selectedAddressId);
|
|
23729
23771
|
};
|
|
23730
23772
|
|
|
@@ -23911,8 +23953,7 @@ const AddressSelectModal = ({
|
|
|
23911
23953
|
|
|
23912
23954
|
const onAddNewAddress = () => {
|
|
23913
23955
|
switchView("address-create");
|
|
23914
|
-
};
|
|
23915
|
-
|
|
23956
|
+
};
|
|
23916
23957
|
|
|
23917
23958
|
const onMembershipAdressUpdateSuccess = () => {
|
|
23918
23959
|
var _otherProps$onMembers;
|
|
@@ -23921,6 +23962,13 @@ const AddressSelectModal = ({
|
|
|
23921
23962
|
resetView();
|
|
23922
23963
|
};
|
|
23923
23964
|
|
|
23965
|
+
const onFreePlanSubscriptionSuccess = () => {
|
|
23966
|
+
var _otherProps$onFreePla;
|
|
23967
|
+
|
|
23968
|
+
(_otherProps$onFreePla = otherProps.onFreePlanSubscriptionSuccess) === null || _otherProps$onFreePla === void 0 ? void 0 : _otherProps$onFreePla.call(otherProps);
|
|
23969
|
+
switchView("subscription-success");
|
|
23970
|
+
};
|
|
23971
|
+
|
|
23924
23972
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
23925
23973
|
onDisplay: onDisplay,
|
|
23926
23974
|
onClose: onClose,
|
|
@@ -23930,7 +23978,8 @@ const AddressSelectModal = ({
|
|
|
23930
23978
|
}, otherProps, {
|
|
23931
23979
|
onSuccess: onSuccess,
|
|
23932
23980
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
23933
|
-
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
23981
|
+
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess,
|
|
23982
|
+
onFreePlanSubscriptionSuccess: onFreePlanSubscriptionSuccess
|
|
23934
23983
|
}))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
|
|
23935
23984
|
};
|
|
23936
23985
|
AddressSelectModal.viewId = "address-select";
|