@pelcro/react-pelcro-js 3.12.0 → 3.13.0-beta.1
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 +59 -7
- package/dist/index.esm.js +59 -7
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -9610,7 +9610,11 @@ const authenticatedButtons = () => {
|
|
|
9610
9610
|
|
|
9611
9611
|
if (pelcroLoginByClass) {
|
|
9612
9612
|
for (let i = 0; i < pelcroLoginByClass.length; i++) {
|
|
9613
|
-
pelcroLoginByClass.item(i).
|
|
9613
|
+
if (pelcroLoginByClass.item(i).hasAttribute("data-dashboard-text")) {
|
|
9614
|
+
pelcroLoginByClass.item(i).innerHTML = pelcroLoginByClass.item(i).getAttribute("data-dashboard-text");
|
|
9615
|
+
} else {
|
|
9616
|
+
pelcroLoginByClass.item(i).innerHTML = translations.account;
|
|
9617
|
+
}
|
|
9614
9618
|
}
|
|
9615
9619
|
}
|
|
9616
9620
|
|
|
@@ -9630,7 +9634,11 @@ const unauthenticatedButtons = () => {
|
|
|
9630
9634
|
|
|
9631
9635
|
if (pelcroLoginByClass) {
|
|
9632
9636
|
for (let i = 0; i < pelcroLoginByClass.length; i++) {
|
|
9633
|
-
pelcroLoginByClass.item(i).
|
|
9637
|
+
if (pelcroLoginByClass.item(i).hasAttribute("data-login-text")) {
|
|
9638
|
+
pelcroLoginByClass.item(i).innerHTML = pelcroLoginByClass.item(i).getAttribute("data-login-text");
|
|
9639
|
+
} else {
|
|
9640
|
+
pelcroLoginByClass.item(i).innerHTML = translations.login;
|
|
9641
|
+
}
|
|
9634
9642
|
}
|
|
9635
9643
|
}
|
|
9636
9644
|
};
|
|
@@ -23670,12 +23678,13 @@ const AddressSelectContainer = ({
|
|
|
23670
23678
|
className = "",
|
|
23671
23679
|
onGiftRedemptionSuccess = () => {},
|
|
23672
23680
|
onMembershipAdressUpdateSuccess = () => {},
|
|
23681
|
+
onFreePlanSubscriptionSuccess = () => {},
|
|
23673
23682
|
onSuccess = () => {},
|
|
23674
23683
|
onFailure = () => {},
|
|
23675
23684
|
children,
|
|
23676
23685
|
...props
|
|
23677
23686
|
}) => {
|
|
23678
|
-
var _props$giftCode, _ref, _props$subscriptionId;
|
|
23687
|
+
var _props$giftCode, _ref, _props$subscriptionId, _window$Pelcro, _window$Pelcro$uiSett;
|
|
23679
23688
|
|
|
23680
23689
|
const {
|
|
23681
23690
|
t
|
|
@@ -23685,10 +23694,13 @@ const AddressSelectContainer = ({
|
|
|
23685
23694
|
giftCode: giftCodeFromStore,
|
|
23686
23695
|
subscriptionIdToRenew: subscriptionIdToRenewFromStore,
|
|
23687
23696
|
set,
|
|
23688
|
-
selectedMembership
|
|
23697
|
+
selectedMembership,
|
|
23698
|
+
plan,
|
|
23699
|
+
product
|
|
23689
23700
|
} = usePelcro();
|
|
23690
23701
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
23691
23702
|
const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
|
|
23703
|
+
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
23704
|
|
|
23693
23705
|
const submitAddress = ({
|
|
23694
23706
|
selectedAddressId
|
|
@@ -23760,6 +23772,39 @@ const AddressSelectContainer = ({
|
|
|
23760
23772
|
});
|
|
23761
23773
|
}
|
|
23762
23774
|
|
|
23775
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
23776
|
+
dispatch({
|
|
23777
|
+
type: LOADING,
|
|
23778
|
+
payload: true
|
|
23779
|
+
});
|
|
23780
|
+
window.Pelcro.subscription.create({
|
|
23781
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
23782
|
+
plan_id: plan.id,
|
|
23783
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
23784
|
+
quantity: plan.quantity,
|
|
23785
|
+
address_id: product.address_required ? selectedAddressId : null
|
|
23786
|
+
}, (err, res) => {
|
|
23787
|
+
dispatch({
|
|
23788
|
+
type: LOADING,
|
|
23789
|
+
payload: false
|
|
23790
|
+
});
|
|
23791
|
+
|
|
23792
|
+
if (err) {
|
|
23793
|
+
dispatch({
|
|
23794
|
+
type: SHOW_ALERT,
|
|
23795
|
+
payload: {
|
|
23796
|
+
type: "error",
|
|
23797
|
+
content: getErrorMessages(err)
|
|
23798
|
+
}
|
|
23799
|
+
});
|
|
23800
|
+
return notify.error(getErrorMessages(err));
|
|
23801
|
+
}
|
|
23802
|
+
|
|
23803
|
+
return onFreePlanSubscriptionSuccess(res);
|
|
23804
|
+
});
|
|
23805
|
+
return;
|
|
23806
|
+
}
|
|
23807
|
+
|
|
23763
23808
|
onSuccess(selectedAddressId);
|
|
23764
23809
|
};
|
|
23765
23810
|
|
|
@@ -23946,8 +23991,7 @@ const AddressSelectModal = ({
|
|
|
23946
23991
|
|
|
23947
23992
|
const onAddNewAddress = () => {
|
|
23948
23993
|
switchView("address-create");
|
|
23949
|
-
};
|
|
23950
|
-
|
|
23994
|
+
};
|
|
23951
23995
|
|
|
23952
23996
|
const onMembershipAdressUpdateSuccess = () => {
|
|
23953
23997
|
var _otherProps$onMembers;
|
|
@@ -23956,6 +24000,13 @@ const AddressSelectModal = ({
|
|
|
23956
24000
|
resetView();
|
|
23957
24001
|
};
|
|
23958
24002
|
|
|
24003
|
+
const onFreePlanSubscriptionSuccess = () => {
|
|
24004
|
+
var _otherProps$onFreePla;
|
|
24005
|
+
|
|
24006
|
+
(_otherProps$onFreePla = otherProps.onFreePlanSubscriptionSuccess) === null || _otherProps$onFreePla === void 0 ? void 0 : _otherProps$onFreePla.call(otherProps);
|
|
24007
|
+
switchView("subscription-success");
|
|
24008
|
+
};
|
|
24009
|
+
|
|
23959
24010
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
23960
24011
|
onDisplay: onDisplay,
|
|
23961
24012
|
onClose: onClose,
|
|
@@ -23965,7 +24016,8 @@ const AddressSelectModal = ({
|
|
|
23965
24016
|
}, otherProps, {
|
|
23966
24017
|
onSuccess: onSuccess,
|
|
23967
24018
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
23968
|
-
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
24019
|
+
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess,
|
|
24020
|
+
onFreePlanSubscriptionSuccess: onFreePlanSubscriptionSuccess
|
|
23969
24021
|
}))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
|
|
23970
24022
|
};
|
|
23971
24023
|
AddressSelectModal.viewId = "address-select";
|
package/dist/index.esm.js
CHANGED
|
@@ -9580,7 +9580,11 @@ const authenticatedButtons = () => {
|
|
|
9580
9580
|
|
|
9581
9581
|
if (pelcroLoginByClass) {
|
|
9582
9582
|
for (let i = 0; i < pelcroLoginByClass.length; i++) {
|
|
9583
|
-
pelcroLoginByClass.item(i).
|
|
9583
|
+
if (pelcroLoginByClass.item(i).hasAttribute("data-dashboard-text")) {
|
|
9584
|
+
pelcroLoginByClass.item(i).innerHTML = pelcroLoginByClass.item(i).getAttribute("data-dashboard-text");
|
|
9585
|
+
} else {
|
|
9586
|
+
pelcroLoginByClass.item(i).innerHTML = translations.account;
|
|
9587
|
+
}
|
|
9584
9588
|
}
|
|
9585
9589
|
}
|
|
9586
9590
|
|
|
@@ -9600,7 +9604,11 @@ const unauthenticatedButtons = () => {
|
|
|
9600
9604
|
|
|
9601
9605
|
if (pelcroLoginByClass) {
|
|
9602
9606
|
for (let i = 0; i < pelcroLoginByClass.length; i++) {
|
|
9603
|
-
pelcroLoginByClass.item(i).
|
|
9607
|
+
if (pelcroLoginByClass.item(i).hasAttribute("data-login-text")) {
|
|
9608
|
+
pelcroLoginByClass.item(i).innerHTML = pelcroLoginByClass.item(i).getAttribute("data-login-text");
|
|
9609
|
+
} else {
|
|
9610
|
+
pelcroLoginByClass.item(i).innerHTML = translations.login;
|
|
9611
|
+
}
|
|
9604
9612
|
}
|
|
9605
9613
|
}
|
|
9606
9614
|
};
|
|
@@ -23640,12 +23648,13 @@ const AddressSelectContainer = ({
|
|
|
23640
23648
|
className = "",
|
|
23641
23649
|
onGiftRedemptionSuccess = () => {},
|
|
23642
23650
|
onMembershipAdressUpdateSuccess = () => {},
|
|
23651
|
+
onFreePlanSubscriptionSuccess = () => {},
|
|
23643
23652
|
onSuccess = () => {},
|
|
23644
23653
|
onFailure = () => {},
|
|
23645
23654
|
children,
|
|
23646
23655
|
...props
|
|
23647
23656
|
}) => {
|
|
23648
|
-
var _props$giftCode, _ref, _props$subscriptionId;
|
|
23657
|
+
var _props$giftCode, _ref, _props$subscriptionId, _window$Pelcro, _window$Pelcro$uiSett;
|
|
23649
23658
|
|
|
23650
23659
|
const {
|
|
23651
23660
|
t
|
|
@@ -23655,10 +23664,13 @@ const AddressSelectContainer = ({
|
|
|
23655
23664
|
giftCode: giftCodeFromStore,
|
|
23656
23665
|
subscriptionIdToRenew: subscriptionIdToRenewFromStore,
|
|
23657
23666
|
set,
|
|
23658
|
-
selectedMembership
|
|
23667
|
+
selectedMembership,
|
|
23668
|
+
plan,
|
|
23669
|
+
product
|
|
23659
23670
|
} = usePelcro();
|
|
23660
23671
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
23661
23672
|
const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
|
|
23673
|
+
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
23674
|
|
|
23663
23675
|
const submitAddress = ({
|
|
23664
23676
|
selectedAddressId
|
|
@@ -23730,6 +23742,39 @@ const AddressSelectContainer = ({
|
|
|
23730
23742
|
});
|
|
23731
23743
|
}
|
|
23732
23744
|
|
|
23745
|
+
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
23746
|
+
dispatch({
|
|
23747
|
+
type: LOADING,
|
|
23748
|
+
payload: true
|
|
23749
|
+
});
|
|
23750
|
+
window.Pelcro.subscription.create({
|
|
23751
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
23752
|
+
plan_id: plan.id,
|
|
23753
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
23754
|
+
quantity: plan.quantity,
|
|
23755
|
+
address_id: product.address_required ? selectedAddressId : null
|
|
23756
|
+
}, (err, res) => {
|
|
23757
|
+
dispatch({
|
|
23758
|
+
type: LOADING,
|
|
23759
|
+
payload: false
|
|
23760
|
+
});
|
|
23761
|
+
|
|
23762
|
+
if (err) {
|
|
23763
|
+
dispatch({
|
|
23764
|
+
type: SHOW_ALERT,
|
|
23765
|
+
payload: {
|
|
23766
|
+
type: "error",
|
|
23767
|
+
content: getErrorMessages(err)
|
|
23768
|
+
}
|
|
23769
|
+
});
|
|
23770
|
+
return notify.error(getErrorMessages(err));
|
|
23771
|
+
}
|
|
23772
|
+
|
|
23773
|
+
return onFreePlanSubscriptionSuccess(res);
|
|
23774
|
+
});
|
|
23775
|
+
return;
|
|
23776
|
+
}
|
|
23777
|
+
|
|
23733
23778
|
onSuccess(selectedAddressId);
|
|
23734
23779
|
};
|
|
23735
23780
|
|
|
@@ -23916,8 +23961,7 @@ const AddressSelectModal = ({
|
|
|
23916
23961
|
|
|
23917
23962
|
const onAddNewAddress = () => {
|
|
23918
23963
|
switchView("address-create");
|
|
23919
|
-
};
|
|
23920
|
-
|
|
23964
|
+
};
|
|
23921
23965
|
|
|
23922
23966
|
const onMembershipAdressUpdateSuccess = () => {
|
|
23923
23967
|
var _otherProps$onMembers;
|
|
@@ -23926,6 +23970,13 @@ const AddressSelectModal = ({
|
|
|
23926
23970
|
resetView();
|
|
23927
23971
|
};
|
|
23928
23972
|
|
|
23973
|
+
const onFreePlanSubscriptionSuccess = () => {
|
|
23974
|
+
var _otherProps$onFreePla;
|
|
23975
|
+
|
|
23976
|
+
(_otherProps$onFreePla = otherProps.onFreePlanSubscriptionSuccess) === null || _otherProps$onFreePla === void 0 ? void 0 : _otherProps$onFreePla.call(otherProps);
|
|
23977
|
+
switchView("subscription-success");
|
|
23978
|
+
};
|
|
23979
|
+
|
|
23929
23980
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
23930
23981
|
onDisplay: onDisplay,
|
|
23931
23982
|
onClose: onClose,
|
|
@@ -23935,7 +23986,8 @@ const AddressSelectModal = ({
|
|
|
23935
23986
|
}, otherProps, {
|
|
23936
23987
|
onSuccess: onSuccess,
|
|
23937
23988
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
23938
|
-
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
23989
|
+
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess,
|
|
23990
|
+
onFreePlanSubscriptionSuccess: onFreePlanSubscriptionSuccess
|
|
23939
23991
|
}))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
|
|
23940
23992
|
};
|
|
23941
23993
|
AddressSelectModal.viewId = "address-select";
|