@pelcro/react-pelcro-js 3.12.0-beta.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 +49 -5
- package/dist/index.esm.js +49 -5
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -23670,12 +23670,13 @@ const AddressSelectContainer = ({
|
|
|
23670
23670
|
className = "",
|
|
23671
23671
|
onGiftRedemptionSuccess = () => {},
|
|
23672
23672
|
onMembershipAdressUpdateSuccess = () => {},
|
|
23673
|
+
onFreePlanSubscriptionSuccess = () => {},
|
|
23673
23674
|
onSuccess = () => {},
|
|
23674
23675
|
onFailure = () => {},
|
|
23675
23676
|
children,
|
|
23676
23677
|
...props
|
|
23677
23678
|
}) => {
|
|
23678
|
-
var _props$giftCode, _ref, _props$subscriptionId;
|
|
23679
|
+
var _props$giftCode, _ref, _props$subscriptionId, _window$Pelcro, _window$Pelcro$uiSett;
|
|
23679
23680
|
|
|
23680
23681
|
const {
|
|
23681
23682
|
t
|
|
@@ -23685,10 +23686,13 @@ const AddressSelectContainer = ({
|
|
|
23685
23686
|
giftCode: giftCodeFromStore,
|
|
23686
23687
|
subscriptionIdToRenew: subscriptionIdToRenewFromStore,
|
|
23687
23688
|
set,
|
|
23688
|
-
selectedMembership
|
|
23689
|
+
selectedMembership,
|
|
23690
|
+
plan,
|
|
23691
|
+
product
|
|
23689
23692
|
} = usePelcro();
|
|
23690
23693
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
23691
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;
|
|
23692
23696
|
|
|
23693
23697
|
const submitAddress = ({
|
|
23694
23698
|
selectedAddressId
|
|
@@ -23760,6 +23764,39 @@ const AddressSelectContainer = ({
|
|
|
23760
23764
|
});
|
|
23761
23765
|
}
|
|
23762
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
|
+
|
|
23763
23800
|
onSuccess(selectedAddressId);
|
|
23764
23801
|
};
|
|
23765
23802
|
|
|
@@ -23946,8 +23983,7 @@ const AddressSelectModal = ({
|
|
|
23946
23983
|
|
|
23947
23984
|
const onAddNewAddress = () => {
|
|
23948
23985
|
switchView("address-create");
|
|
23949
|
-
};
|
|
23950
|
-
|
|
23986
|
+
};
|
|
23951
23987
|
|
|
23952
23988
|
const onMembershipAdressUpdateSuccess = () => {
|
|
23953
23989
|
var _otherProps$onMembers;
|
|
@@ -23956,6 +23992,13 @@ const AddressSelectModal = ({
|
|
|
23956
23992
|
resetView();
|
|
23957
23993
|
};
|
|
23958
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
|
+
|
|
23959
24002
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
23960
24003
|
onDisplay: onDisplay,
|
|
23961
24004
|
onClose: onClose,
|
|
@@ -23965,7 +24008,8 @@ const AddressSelectModal = ({
|
|
|
23965
24008
|
}, otherProps, {
|
|
23966
24009
|
onSuccess: onSuccess,
|
|
23967
24010
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
23968
|
-
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
24011
|
+
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess,
|
|
24012
|
+
onFreePlanSubscriptionSuccess: onFreePlanSubscriptionSuccess
|
|
23969
24013
|
}))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
|
|
23970
24014
|
};
|
|
23971
24015
|
AddressSelectModal.viewId = "address-select";
|
package/dist/index.esm.js
CHANGED
|
@@ -23640,12 +23640,13 @@ const AddressSelectContainer = ({
|
|
|
23640
23640
|
className = "",
|
|
23641
23641
|
onGiftRedemptionSuccess = () => {},
|
|
23642
23642
|
onMembershipAdressUpdateSuccess = () => {},
|
|
23643
|
+
onFreePlanSubscriptionSuccess = () => {},
|
|
23643
23644
|
onSuccess = () => {},
|
|
23644
23645
|
onFailure = () => {},
|
|
23645
23646
|
children,
|
|
23646
23647
|
...props
|
|
23647
23648
|
}) => {
|
|
23648
|
-
var _props$giftCode, _ref, _props$subscriptionId;
|
|
23649
|
+
var _props$giftCode, _ref, _props$subscriptionId, _window$Pelcro, _window$Pelcro$uiSett;
|
|
23649
23650
|
|
|
23650
23651
|
const {
|
|
23651
23652
|
t
|
|
@@ -23655,10 +23656,13 @@ const AddressSelectContainer = ({
|
|
|
23655
23656
|
giftCode: giftCodeFromStore,
|
|
23656
23657
|
subscriptionIdToRenew: subscriptionIdToRenewFromStore,
|
|
23657
23658
|
set,
|
|
23658
|
-
selectedMembership
|
|
23659
|
+
selectedMembership,
|
|
23660
|
+
plan,
|
|
23661
|
+
product
|
|
23659
23662
|
} = usePelcro();
|
|
23660
23663
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
23661
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;
|
|
23662
23666
|
|
|
23663
23667
|
const submitAddress = ({
|
|
23664
23668
|
selectedAddressId
|
|
@@ -23730,6 +23734,39 @@ const AddressSelectContainer = ({
|
|
|
23730
23734
|
});
|
|
23731
23735
|
}
|
|
23732
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
|
+
|
|
23733
23770
|
onSuccess(selectedAddressId);
|
|
23734
23771
|
};
|
|
23735
23772
|
|
|
@@ -23916,8 +23953,7 @@ const AddressSelectModal = ({
|
|
|
23916
23953
|
|
|
23917
23954
|
const onAddNewAddress = () => {
|
|
23918
23955
|
switchView("address-create");
|
|
23919
|
-
};
|
|
23920
|
-
|
|
23956
|
+
};
|
|
23921
23957
|
|
|
23922
23958
|
const onMembershipAdressUpdateSuccess = () => {
|
|
23923
23959
|
var _otherProps$onMembers;
|
|
@@ -23926,6 +23962,13 @@ const AddressSelectModal = ({
|
|
|
23926
23962
|
resetView();
|
|
23927
23963
|
};
|
|
23928
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
|
+
|
|
23929
23972
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
23930
23973
|
onDisplay: onDisplay,
|
|
23931
23974
|
onClose: onClose,
|
|
@@ -23935,7 +23978,8 @@ const AddressSelectModal = ({
|
|
|
23935
23978
|
}, otherProps, {
|
|
23936
23979
|
onSuccess: onSuccess,
|
|
23937
23980
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
23938
|
-
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
23981
|
+
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess,
|
|
23982
|
+
onFreePlanSubscriptionSuccess: onFreePlanSubscriptionSuccess
|
|
23939
23983
|
}))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
|
|
23940
23984
|
};
|
|
23941
23985
|
AddressSelectModal.viewId = "address-select";
|