@pelcro/react-pelcro-js 3.47.0 → 3.49.0
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 +146 -8
- package/dist/index.esm.js +146 -8
- package/dist/pelcro.css +5 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3823,7 +3823,8 @@ var buttons$h = {
|
|
|
3823
3823
|
var messages$Y = {
|
|
3824
3824
|
orderConfirmed: {
|
|
3825
3825
|
title: "Order confirmed!",
|
|
3826
|
-
body: "Your order has been confirmed and will be shipped within the next few days. You'll shortly receive an email confirmation of this order."
|
|
3826
|
+
body: "Your order has been confirmed and will be shipped within the next few days. You'll shortly receive an email confirmation of this order.",
|
|
3827
|
+
bodyDigital: "Your order has been confirmed. You'll shortly receive an email confirmation of this order."
|
|
3827
3828
|
},
|
|
3828
3829
|
haveQuestions: "If you have any queries please don't hesitate to contact us!",
|
|
3829
3830
|
multipleCurrencies: "Your cart currently contains items which are available in different currencies. In order to proceed with the checkout, please make sure that all items have the same currency.",
|
|
@@ -3969,6 +3970,10 @@ var labels$V = {
|
|
|
3969
3970
|
},
|
|
3970
3971
|
subCancellation: {
|
|
3971
3972
|
goBack: "Go back"
|
|
3973
|
+
},
|
|
3974
|
+
emailPreferences: {
|
|
3975
|
+
label: "Email Notifications",
|
|
3976
|
+
description: "Select which email updates you would like to receive:"
|
|
3972
3977
|
}
|
|
3973
3978
|
};
|
|
3974
3979
|
var messages$W = {
|
|
@@ -4720,7 +4725,8 @@ var buttons$c = {
|
|
|
4720
4725
|
var messages$G = {
|
|
4721
4726
|
orderConfirmed: {
|
|
4722
4727
|
title: "Votre commande est confirmée !",
|
|
4723
|
-
body: "Votre commande a été confirmée et vous sera expédiée dans les prochains jours. Vous recevrez un courriel de confirmation sous peu."
|
|
4728
|
+
body: "Votre commande a été confirmée et vous sera expédiée dans les prochains jours. Vous recevrez un courriel de confirmation sous peu.",
|
|
4729
|
+
bodyDigital: "Votre commande a été confirmée et vous sera disponible pour téléchargement sous peu. Vous recevrez un courriel de confirmation sous peu."
|
|
4724
4730
|
},
|
|
4725
4731
|
haveQuestions: "N’hésitez pas à nous contacter pour toute question !",
|
|
4726
4732
|
multipleCurrencies: "Votre panier contient des articles disponibles dans différentes devises. Avant de passer à la caisse, veuillez vous assurer que tous les articles ont la même devise.",
|
|
@@ -4864,6 +4870,10 @@ var labels$E = {
|
|
|
4864
4870
|
},
|
|
4865
4871
|
subCancellation: {
|
|
4866
4872
|
goBack: "Retourner"
|
|
4873
|
+
},
|
|
4874
|
+
emailPreferences: {
|
|
4875
|
+
label: "Notifications par courriel",
|
|
4876
|
+
description: "Sélectionnez les mises à jour par courriel que vous souhaitez recevoir:"
|
|
4867
4877
|
}
|
|
4868
4878
|
};
|
|
4869
4879
|
var messages$E = {
|
|
@@ -5606,7 +5616,8 @@ var buttons$7 = {
|
|
|
5606
5616
|
var messages$o = {
|
|
5607
5617
|
orderConfirmed: {
|
|
5608
5618
|
title: "주문이 확인되었습니다!",
|
|
5609
|
-
body: "귀하의 주문이 확인되었으며 며칠 안에 배송될 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다."
|
|
5619
|
+
body: "귀하의 주문이 확인되었으며 며칠 안에 배송될 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다.",
|
|
5620
|
+
bodyDigital: "귀하의 주문이 확인되었으며 며칠 안에 다운로드 가능할 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다."
|
|
5610
5621
|
},
|
|
5611
5622
|
haveQuestions: "질문이 있으면 언제든 저희에게 연락주시기 바랍니다!",
|
|
5612
5623
|
multipleCurrencies: "장바구니에 다른 통화로만 결제가 가능한 아이템이 있습니다. 결제를 계속 진행하려면 모든 아이템의 결제 통화가 동일한지 확인하십시오.",
|
|
@@ -6594,7 +6605,8 @@ var buttons$2 = {
|
|
|
6594
6605
|
var messages$6 = {
|
|
6595
6606
|
orderConfirmed: {
|
|
6596
6607
|
title: "¡Orden confirmada!",
|
|
6597
|
-
body: "Tu orden ha sido confirmada y será enviada en los próximos días. En breve recibirás un correo electrónico de confirmación de esta orden."
|
|
6608
|
+
body: "Tu orden ha sido confirmada y será enviada en los próximos días. En breve recibirás un correo electrónico de confirmación de esta orden.",
|
|
6609
|
+
bodyDigital: "Tu orden ha sido confirmada y estará disponible para descargar en breve. En breve recibirás un correo electrónico de confirmación de esta orden."
|
|
6598
6610
|
},
|
|
6599
6611
|
haveQuestions: "¡Si tienes alguna pregunta, no dudes en contactarnos!",
|
|
6600
6612
|
multipleCurrencies: "Tu carrito actualmente contiene artículos que están disponibles en diferentes divisas. Para proceder a la compra, asegúrate de que todos los artículos tengan la misma divisa.",
|
|
@@ -27622,6 +27634,7 @@ const OrderConfirmModal = props => {
|
|
|
27622
27634
|
props === null || props === void 0 ? void 0 : (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
|
|
27623
27635
|
resetView();
|
|
27624
27636
|
};
|
|
27637
|
+
const hasShippableItems = (latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.shipping_rate) !== null;
|
|
27625
27638
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
27626
27639
|
id: "pelcro-order-confirm-modal",
|
|
27627
27640
|
className: "plc-border-t-8 plc-border-primary-500",
|
|
@@ -27637,7 +27650,7 @@ const OrderConfirmModal = props => {
|
|
|
27637
27650
|
className: "plc-text-center plc-text-gray-900"
|
|
27638
27651
|
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
27639
27652
|
className: "plc-mb-4 plc-text-3xl"
|
|
27640
|
-
}, t("messages.orderConfirmed.title")), /*#__PURE__*/React__default['default'].createElement("p", null, t("messages.orderConfirmed.body")), /*#__PURE__*/React__default['default'].createElement("p", null, t("messages.haveQuestions")))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27653
|
+
}, t("messages.orderConfirmed.title")), /*#__PURE__*/React__default['default'].createElement("p", null, hasShippableItems ? t("messages.orderConfirmed.body") : t("messages.orderConfirmed.bodyDigital")), /*#__PURE__*/React__default['default'].createElement("p", null, t("messages.haveQuestions")))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27641
27654
|
className: "plc-mt-5 pelcro-order-summary-wrapper"
|
|
27642
27655
|
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
27643
27656
|
className: "plc-font-bold pelcro-order-summary-title"
|
|
@@ -31562,6 +31575,123 @@ function getMemberShipStatus(status) {
|
|
|
31562
31575
|
};
|
|
31563
31576
|
}
|
|
31564
31577
|
|
|
31578
|
+
const EmailPreferencesMenu = props => {
|
|
31579
|
+
const {
|
|
31580
|
+
t
|
|
31581
|
+
} = useTranslation("dashboard");
|
|
31582
|
+
const [options, setOptions] = React.useState([]);
|
|
31583
|
+
const [loading, setLoading] = React.useState({});
|
|
31584
|
+
const [alert, setAlert] = React.useState({});
|
|
31585
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
31586
|
+
const [error, setError] = React.useState(null);
|
|
31587
|
+
React.useEffect(() => {
|
|
31588
|
+
var _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
31589
|
+
const options = ((_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.newsletters) || [];
|
|
31590
|
+
const email = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.email) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : window.Pelcro.helpers.getURLParameter("email");
|
|
31591
|
+
setIsLoading(true);
|
|
31592
|
+
window.Pelcro.newsletter.getByEmail(email, (err, res) => {
|
|
31593
|
+
var _res$data$lists$split, _res$data, _res$data$lists;
|
|
31594
|
+
if (err) {
|
|
31595
|
+
setIsLoading(false);
|
|
31596
|
+
setError(t("messages.error") || "Failed to load preferences.");
|
|
31597
|
+
return;
|
|
31598
|
+
}
|
|
31599
|
+
const selectedIds = (_res$data$lists$split = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$lists = _res$data.lists) === null || _res$data$lists === void 0 ? void 0 : _res$data$lists.split(",")) !== null && _res$data$lists$split !== void 0 ? _res$data$lists$split : [];
|
|
31600
|
+
setOptions(options.map(opt => ({
|
|
31601
|
+
...opt,
|
|
31602
|
+
id: String(opt.id),
|
|
31603
|
+
selected: selectedIds.includes(String(opt.id))
|
|
31604
|
+
})));
|
|
31605
|
+
setIsLoading(false);
|
|
31606
|
+
setError(null);
|
|
31607
|
+
});
|
|
31608
|
+
}, [t]);
|
|
31609
|
+
const handleCheckboxChange = id => e => {
|
|
31610
|
+
const checked = e.target.checked;
|
|
31611
|
+
setOptions(prevOptions => {
|
|
31612
|
+
var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
|
|
31613
|
+
const newOptions = prevOptions.map(opt => opt.id === id ? {
|
|
31614
|
+
...opt,
|
|
31615
|
+
selected: checked
|
|
31616
|
+
} : opt);
|
|
31617
|
+
// Set loading for this checkbox
|
|
31618
|
+
setLoading(prev => ({
|
|
31619
|
+
...prev,
|
|
31620
|
+
[id]: true
|
|
31621
|
+
}));
|
|
31622
|
+
setAlert(prev => ({
|
|
31623
|
+
...prev,
|
|
31624
|
+
[id]: null
|
|
31625
|
+
}));
|
|
31626
|
+
// Save to backend
|
|
31627
|
+
const selectedIds = newOptions.filter(opt => opt.selected).map(opt => opt.id);
|
|
31628
|
+
const email = (_window$Pelcro$user$r3 = (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.email) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : window.Pelcro.helpers.getURLParameter("email");
|
|
31629
|
+
const requestData = {
|
|
31630
|
+
email,
|
|
31631
|
+
source: "web",
|
|
31632
|
+
lists: selectedIds.join(",")
|
|
31633
|
+
};
|
|
31634
|
+
|
|
31635
|
+
// Check if this is a new subscription
|
|
31636
|
+
window.Pelcro.newsletter.getByEmail(email, (err, res) => {
|
|
31637
|
+
if (err) {
|
|
31638
|
+
setLoading(prev => ({
|
|
31639
|
+
...prev,
|
|
31640
|
+
[id]: false
|
|
31641
|
+
}));
|
|
31642
|
+
setAlert(prev => ({
|
|
31643
|
+
...prev,
|
|
31644
|
+
[id]: "Error checking subscription status"
|
|
31645
|
+
}));
|
|
31646
|
+
return;
|
|
31647
|
+
}
|
|
31648
|
+
const didSubToNewslettersBefore = Boolean(res.data.email);
|
|
31649
|
+
const callback = err => {
|
|
31650
|
+
setLoading(prev => ({
|
|
31651
|
+
...prev,
|
|
31652
|
+
[id]: false
|
|
31653
|
+
}));
|
|
31654
|
+
setAlert(prev => ({
|
|
31655
|
+
...prev,
|
|
31656
|
+
[id]: err ? "Error saving" : "Saved!"
|
|
31657
|
+
}));
|
|
31658
|
+
};
|
|
31659
|
+
if (didSubToNewslettersBefore) {
|
|
31660
|
+
window.Pelcro.newsletter.update(requestData, callback);
|
|
31661
|
+
} else {
|
|
31662
|
+
window.Pelcro.newsletter.create(requestData, callback);
|
|
31663
|
+
}
|
|
31664
|
+
});
|
|
31665
|
+
return newOptions;
|
|
31666
|
+
});
|
|
31667
|
+
};
|
|
31668
|
+
if (isLoading) return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
31669
|
+
className: "plc-flex plc-justify-center plc-items-center plc-h-32"
|
|
31670
|
+
}, /*#__PURE__*/React__default['default'].createElement(Loader, {
|
|
31671
|
+
width: 60,
|
|
31672
|
+
height: 100
|
|
31673
|
+
}));
|
|
31674
|
+
if (error) return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
31675
|
+
className: "plc-text-red-600 plc-p-4"
|
|
31676
|
+
}, error);
|
|
31677
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
31678
|
+
className: "plc-mb-4 plc-text-sm plc-text-gray-600"
|
|
31679
|
+
}, t("labels.emailPreferences.description") || "Select which email updates you would like to receive."), options.map(opt => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
31680
|
+
key: opt.id,
|
|
31681
|
+
className: "plc-flex plc-items-center plc-mb-2"
|
|
31682
|
+
}, /*#__PURE__*/React__default['default'].createElement("input", {
|
|
31683
|
+
type: "checkbox",
|
|
31684
|
+
id: `email-pref-${opt.id}`,
|
|
31685
|
+
checked: !!opt.selected,
|
|
31686
|
+
onChange: handleCheckboxChange(opt.id),
|
|
31687
|
+
disabled: loading[opt.id],
|
|
31688
|
+
className: "plc-mr-2"
|
|
31689
|
+
}), /*#__PURE__*/React__default['default'].createElement("label", {
|
|
31690
|
+
htmlFor: `email-pref-${opt.id}`,
|
|
31691
|
+
className: "plc-text-base"
|
|
31692
|
+
}, opt.label))));
|
|
31693
|
+
};
|
|
31694
|
+
|
|
31565
31695
|
const SUB_MENUS = {
|
|
31566
31696
|
PROFILE: "profile",
|
|
31567
31697
|
SUBSCRIPTIONS: "subscriptions",
|
|
@@ -31572,7 +31702,8 @@ const SUB_MENUS = {
|
|
|
31572
31702
|
GIFTS: "gifts",
|
|
31573
31703
|
ORDERS: "orders",
|
|
31574
31704
|
INVOICES: "invoices",
|
|
31575
|
-
SAVED_ITEMS: "saved-items"
|
|
31705
|
+
SAVED_ITEMS: "saved-items",
|
|
31706
|
+
EMAIL_PREFERENCES: "email-preferences"
|
|
31576
31707
|
};
|
|
31577
31708
|
|
|
31578
31709
|
/**
|
|
@@ -32066,13 +32197,14 @@ class Dashboard extends React.Component {
|
|
|
32066
32197
|
this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_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.enableReactGA4;
|
|
32067
32198
|
}
|
|
32068
32199
|
render() {
|
|
32069
|
-
var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
32200
|
+
var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _window$Pelcro3, _window$Pelcro3$uiSet;
|
|
32070
32201
|
const {
|
|
32071
32202
|
isOpen
|
|
32072
32203
|
} = this.state;
|
|
32073
32204
|
const userHasName = this.user.first_name || this.user.last_name;
|
|
32074
32205
|
const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
|
|
32075
32206
|
const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
|
|
32207
|
+
const emailNotifications = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.emailNotifications;
|
|
32076
32208
|
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
32077
32209
|
return /*#__PURE__*/React__default['default'].createElement(Transition, {
|
|
32078
32210
|
className: "plc-fixed plc-inset-y-0 plc-right-0 plc-h-full plc-max-w-xl plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max",
|
|
@@ -32150,7 +32282,7 @@ class Dashboard extends React.Component {
|
|
|
32150
32282
|
}),
|
|
32151
32283
|
className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
|
|
32152
32284
|
onClick: this.displayChangePassword
|
|
32153
|
-
}, this.locale("labels.changePassword")), siteHasNewslettersDefined && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
32285
|
+
}, this.locale("labels.changePassword")), siteHasNewslettersDefined && emailNotifications !== true && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
32154
32286
|
variant: "ghost",
|
|
32155
32287
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgNewsletter, {
|
|
32156
32288
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -32240,6 +32372,12 @@ class Dashboard extends React.Component {
|
|
|
32240
32372
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgBookmark, null),
|
|
32241
32373
|
title: this.locale("labels.savedItems.label"),
|
|
32242
32374
|
content: /*#__PURE__*/React__default['default'].createElement(SavedItemsMenu, null)
|
|
32375
|
+
}), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
|
|
32376
|
+
show: emailNotifications === true,
|
|
32377
|
+
name: SUB_MENUS.EMAIL_PREFERENCES,
|
|
32378
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgBookmark, null),
|
|
32379
|
+
title: this.locale("labels.emailPreferences.label"),
|
|
32380
|
+
content: /*#__PURE__*/React__default['default'].createElement(EmailPreferencesMenu, null)
|
|
32243
32381
|
}), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
32244
32382
|
variant: "outline",
|
|
32245
32383
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgExit, null),
|
package/dist/index.esm.js
CHANGED
|
@@ -3793,7 +3793,8 @@ var buttons$h = {
|
|
|
3793
3793
|
var messages$Y = {
|
|
3794
3794
|
orderConfirmed: {
|
|
3795
3795
|
title: "Order confirmed!",
|
|
3796
|
-
body: "Your order has been confirmed and will be shipped within the next few days. You'll shortly receive an email confirmation of this order."
|
|
3796
|
+
body: "Your order has been confirmed and will be shipped within the next few days. You'll shortly receive an email confirmation of this order.",
|
|
3797
|
+
bodyDigital: "Your order has been confirmed. You'll shortly receive an email confirmation of this order."
|
|
3797
3798
|
},
|
|
3798
3799
|
haveQuestions: "If you have any queries please don't hesitate to contact us!",
|
|
3799
3800
|
multipleCurrencies: "Your cart currently contains items which are available in different currencies. In order to proceed with the checkout, please make sure that all items have the same currency.",
|
|
@@ -3939,6 +3940,10 @@ var labels$V = {
|
|
|
3939
3940
|
},
|
|
3940
3941
|
subCancellation: {
|
|
3941
3942
|
goBack: "Go back"
|
|
3943
|
+
},
|
|
3944
|
+
emailPreferences: {
|
|
3945
|
+
label: "Email Notifications",
|
|
3946
|
+
description: "Select which email updates you would like to receive:"
|
|
3942
3947
|
}
|
|
3943
3948
|
};
|
|
3944
3949
|
var messages$W = {
|
|
@@ -4690,7 +4695,8 @@ var buttons$c = {
|
|
|
4690
4695
|
var messages$G = {
|
|
4691
4696
|
orderConfirmed: {
|
|
4692
4697
|
title: "Votre commande est confirmée !",
|
|
4693
|
-
body: "Votre commande a été confirmée et vous sera expédiée dans les prochains jours. Vous recevrez un courriel de confirmation sous peu."
|
|
4698
|
+
body: "Votre commande a été confirmée et vous sera expédiée dans les prochains jours. Vous recevrez un courriel de confirmation sous peu.",
|
|
4699
|
+
bodyDigital: "Votre commande a été confirmée et vous sera disponible pour téléchargement sous peu. Vous recevrez un courriel de confirmation sous peu."
|
|
4694
4700
|
},
|
|
4695
4701
|
haveQuestions: "N’hésitez pas à nous contacter pour toute question !",
|
|
4696
4702
|
multipleCurrencies: "Votre panier contient des articles disponibles dans différentes devises. Avant de passer à la caisse, veuillez vous assurer que tous les articles ont la même devise.",
|
|
@@ -4834,6 +4840,10 @@ var labels$E = {
|
|
|
4834
4840
|
},
|
|
4835
4841
|
subCancellation: {
|
|
4836
4842
|
goBack: "Retourner"
|
|
4843
|
+
},
|
|
4844
|
+
emailPreferences: {
|
|
4845
|
+
label: "Notifications par courriel",
|
|
4846
|
+
description: "Sélectionnez les mises à jour par courriel que vous souhaitez recevoir:"
|
|
4837
4847
|
}
|
|
4838
4848
|
};
|
|
4839
4849
|
var messages$E = {
|
|
@@ -5576,7 +5586,8 @@ var buttons$7 = {
|
|
|
5576
5586
|
var messages$o = {
|
|
5577
5587
|
orderConfirmed: {
|
|
5578
5588
|
title: "주문이 확인되었습니다!",
|
|
5579
|
-
body: "귀하의 주문이 확인되었으며 며칠 안에 배송될 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다."
|
|
5589
|
+
body: "귀하의 주문이 확인되었으며 며칠 안에 배송될 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다.",
|
|
5590
|
+
bodyDigital: "귀하의 주문이 확인되었으며 며칠 안에 다운로드 가능할 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다."
|
|
5580
5591
|
},
|
|
5581
5592
|
haveQuestions: "질문이 있으면 언제든 저희에게 연락주시기 바랍니다!",
|
|
5582
5593
|
multipleCurrencies: "장바구니에 다른 통화로만 결제가 가능한 아이템이 있습니다. 결제를 계속 진행하려면 모든 아이템의 결제 통화가 동일한지 확인하십시오.",
|
|
@@ -6564,7 +6575,8 @@ var buttons$2 = {
|
|
|
6564
6575
|
var messages$6 = {
|
|
6565
6576
|
orderConfirmed: {
|
|
6566
6577
|
title: "¡Orden confirmada!",
|
|
6567
|
-
body: "Tu orden ha sido confirmada y será enviada en los próximos días. En breve recibirás un correo electrónico de confirmación de esta orden."
|
|
6578
|
+
body: "Tu orden ha sido confirmada y será enviada en los próximos días. En breve recibirás un correo electrónico de confirmación de esta orden.",
|
|
6579
|
+
bodyDigital: "Tu orden ha sido confirmada y estará disponible para descargar en breve. En breve recibirás un correo electrónico de confirmación de esta orden."
|
|
6568
6580
|
},
|
|
6569
6581
|
haveQuestions: "¡Si tienes alguna pregunta, no dudes en contactarnos!",
|
|
6570
6582
|
multipleCurrencies: "Tu carrito actualmente contiene artículos que están disponibles en diferentes divisas. Para proceder a la compra, asegúrate de que todos los artículos tengan la misma divisa.",
|
|
@@ -27592,6 +27604,7 @@ const OrderConfirmModal = props => {
|
|
|
27592
27604
|
props === null || props === void 0 ? void 0 : (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
|
|
27593
27605
|
resetView();
|
|
27594
27606
|
};
|
|
27607
|
+
const hasShippableItems = (latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.shipping_rate) !== null;
|
|
27595
27608
|
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
27596
27609
|
id: "pelcro-order-confirm-modal",
|
|
27597
27610
|
className: "plc-border-t-8 plc-border-primary-500",
|
|
@@ -27607,7 +27620,7 @@ const OrderConfirmModal = props => {
|
|
|
27607
27620
|
className: "plc-text-center plc-text-gray-900"
|
|
27608
27621
|
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
27609
27622
|
className: "plc-mb-4 plc-text-3xl"
|
|
27610
|
-
}, t("messages.orderConfirmed.title")), /*#__PURE__*/React__default.createElement("p", null, t("messages.orderConfirmed.body")), /*#__PURE__*/React__default.createElement("p", null, t("messages.haveQuestions")))), /*#__PURE__*/React__default.createElement("div", {
|
|
27623
|
+
}, t("messages.orderConfirmed.title")), /*#__PURE__*/React__default.createElement("p", null, hasShippableItems ? t("messages.orderConfirmed.body") : t("messages.orderConfirmed.bodyDigital")), /*#__PURE__*/React__default.createElement("p", null, t("messages.haveQuestions")))), /*#__PURE__*/React__default.createElement("div", {
|
|
27611
27624
|
className: "plc-mt-5 pelcro-order-summary-wrapper"
|
|
27612
27625
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
27613
27626
|
className: "plc-font-bold pelcro-order-summary-title"
|
|
@@ -31532,6 +31545,123 @@ function getMemberShipStatus(status) {
|
|
|
31532
31545
|
};
|
|
31533
31546
|
}
|
|
31534
31547
|
|
|
31548
|
+
const EmailPreferencesMenu = props => {
|
|
31549
|
+
const {
|
|
31550
|
+
t
|
|
31551
|
+
} = useTranslation("dashboard");
|
|
31552
|
+
const [options, setOptions] = useState([]);
|
|
31553
|
+
const [loading, setLoading] = useState({});
|
|
31554
|
+
const [alert, setAlert] = useState({});
|
|
31555
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
31556
|
+
const [error, setError] = useState(null);
|
|
31557
|
+
useEffect(() => {
|
|
31558
|
+
var _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
31559
|
+
const options = ((_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.newsletters) || [];
|
|
31560
|
+
const email = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.email) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : window.Pelcro.helpers.getURLParameter("email");
|
|
31561
|
+
setIsLoading(true);
|
|
31562
|
+
window.Pelcro.newsletter.getByEmail(email, (err, res) => {
|
|
31563
|
+
var _res$data$lists$split, _res$data, _res$data$lists;
|
|
31564
|
+
if (err) {
|
|
31565
|
+
setIsLoading(false);
|
|
31566
|
+
setError(t("messages.error") || "Failed to load preferences.");
|
|
31567
|
+
return;
|
|
31568
|
+
}
|
|
31569
|
+
const selectedIds = (_res$data$lists$split = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$lists = _res$data.lists) === null || _res$data$lists === void 0 ? void 0 : _res$data$lists.split(",")) !== null && _res$data$lists$split !== void 0 ? _res$data$lists$split : [];
|
|
31570
|
+
setOptions(options.map(opt => ({
|
|
31571
|
+
...opt,
|
|
31572
|
+
id: String(opt.id),
|
|
31573
|
+
selected: selectedIds.includes(String(opt.id))
|
|
31574
|
+
})));
|
|
31575
|
+
setIsLoading(false);
|
|
31576
|
+
setError(null);
|
|
31577
|
+
});
|
|
31578
|
+
}, [t]);
|
|
31579
|
+
const handleCheckboxChange = id => e => {
|
|
31580
|
+
const checked = e.target.checked;
|
|
31581
|
+
setOptions(prevOptions => {
|
|
31582
|
+
var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
|
|
31583
|
+
const newOptions = prevOptions.map(opt => opt.id === id ? {
|
|
31584
|
+
...opt,
|
|
31585
|
+
selected: checked
|
|
31586
|
+
} : opt);
|
|
31587
|
+
// Set loading for this checkbox
|
|
31588
|
+
setLoading(prev => ({
|
|
31589
|
+
...prev,
|
|
31590
|
+
[id]: true
|
|
31591
|
+
}));
|
|
31592
|
+
setAlert(prev => ({
|
|
31593
|
+
...prev,
|
|
31594
|
+
[id]: null
|
|
31595
|
+
}));
|
|
31596
|
+
// Save to backend
|
|
31597
|
+
const selectedIds = newOptions.filter(opt => opt.selected).map(opt => opt.id);
|
|
31598
|
+
const email = (_window$Pelcro$user$r3 = (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.email) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : window.Pelcro.helpers.getURLParameter("email");
|
|
31599
|
+
const requestData = {
|
|
31600
|
+
email,
|
|
31601
|
+
source: "web",
|
|
31602
|
+
lists: selectedIds.join(",")
|
|
31603
|
+
};
|
|
31604
|
+
|
|
31605
|
+
// Check if this is a new subscription
|
|
31606
|
+
window.Pelcro.newsletter.getByEmail(email, (err, res) => {
|
|
31607
|
+
if (err) {
|
|
31608
|
+
setLoading(prev => ({
|
|
31609
|
+
...prev,
|
|
31610
|
+
[id]: false
|
|
31611
|
+
}));
|
|
31612
|
+
setAlert(prev => ({
|
|
31613
|
+
...prev,
|
|
31614
|
+
[id]: "Error checking subscription status"
|
|
31615
|
+
}));
|
|
31616
|
+
return;
|
|
31617
|
+
}
|
|
31618
|
+
const didSubToNewslettersBefore = Boolean(res.data.email);
|
|
31619
|
+
const callback = err => {
|
|
31620
|
+
setLoading(prev => ({
|
|
31621
|
+
...prev,
|
|
31622
|
+
[id]: false
|
|
31623
|
+
}));
|
|
31624
|
+
setAlert(prev => ({
|
|
31625
|
+
...prev,
|
|
31626
|
+
[id]: err ? "Error saving" : "Saved!"
|
|
31627
|
+
}));
|
|
31628
|
+
};
|
|
31629
|
+
if (didSubToNewslettersBefore) {
|
|
31630
|
+
window.Pelcro.newsletter.update(requestData, callback);
|
|
31631
|
+
} else {
|
|
31632
|
+
window.Pelcro.newsletter.create(requestData, callback);
|
|
31633
|
+
}
|
|
31634
|
+
});
|
|
31635
|
+
return newOptions;
|
|
31636
|
+
});
|
|
31637
|
+
};
|
|
31638
|
+
if (isLoading) return /*#__PURE__*/React__default.createElement("div", {
|
|
31639
|
+
className: "plc-flex plc-justify-center plc-items-center plc-h-32"
|
|
31640
|
+
}, /*#__PURE__*/React__default.createElement(Loader, {
|
|
31641
|
+
width: 60,
|
|
31642
|
+
height: 100
|
|
31643
|
+
}));
|
|
31644
|
+
if (error) return /*#__PURE__*/React__default.createElement("div", {
|
|
31645
|
+
className: "plc-text-red-600 plc-p-4"
|
|
31646
|
+
}, error);
|
|
31647
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
31648
|
+
className: "plc-mb-4 plc-text-sm plc-text-gray-600"
|
|
31649
|
+
}, t("labels.emailPreferences.description") || "Select which email updates you would like to receive."), options.map(opt => /*#__PURE__*/React__default.createElement("div", {
|
|
31650
|
+
key: opt.id,
|
|
31651
|
+
className: "plc-flex plc-items-center plc-mb-2"
|
|
31652
|
+
}, /*#__PURE__*/React__default.createElement("input", {
|
|
31653
|
+
type: "checkbox",
|
|
31654
|
+
id: `email-pref-${opt.id}`,
|
|
31655
|
+
checked: !!opt.selected,
|
|
31656
|
+
onChange: handleCheckboxChange(opt.id),
|
|
31657
|
+
disabled: loading[opt.id],
|
|
31658
|
+
className: "plc-mr-2"
|
|
31659
|
+
}), /*#__PURE__*/React__default.createElement("label", {
|
|
31660
|
+
htmlFor: `email-pref-${opt.id}`,
|
|
31661
|
+
className: "plc-text-base"
|
|
31662
|
+
}, opt.label))));
|
|
31663
|
+
};
|
|
31664
|
+
|
|
31535
31665
|
const SUB_MENUS = {
|
|
31536
31666
|
PROFILE: "profile",
|
|
31537
31667
|
SUBSCRIPTIONS: "subscriptions",
|
|
@@ -31542,7 +31672,8 @@ const SUB_MENUS = {
|
|
|
31542
31672
|
GIFTS: "gifts",
|
|
31543
31673
|
ORDERS: "orders",
|
|
31544
31674
|
INVOICES: "invoices",
|
|
31545
|
-
SAVED_ITEMS: "saved-items"
|
|
31675
|
+
SAVED_ITEMS: "saved-items",
|
|
31676
|
+
EMAIL_PREFERENCES: "email-preferences"
|
|
31546
31677
|
};
|
|
31547
31678
|
|
|
31548
31679
|
/**
|
|
@@ -32036,13 +32167,14 @@ class Dashboard extends Component {
|
|
|
32036
32167
|
this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_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.enableReactGA4;
|
|
32037
32168
|
}
|
|
32038
32169
|
render() {
|
|
32039
|
-
var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
32170
|
+
var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _window$Pelcro3, _window$Pelcro3$uiSet;
|
|
32040
32171
|
const {
|
|
32041
32172
|
isOpen
|
|
32042
32173
|
} = this.state;
|
|
32043
32174
|
const userHasName = this.user.first_name || this.user.last_name;
|
|
32044
32175
|
const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
|
|
32045
32176
|
const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
|
|
32177
|
+
const emailNotifications = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.emailNotifications;
|
|
32046
32178
|
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
32047
32179
|
return /*#__PURE__*/React__default.createElement(Transition, {
|
|
32048
32180
|
className: "plc-fixed plc-inset-y-0 plc-right-0 plc-h-full plc-max-w-xl plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max",
|
|
@@ -32120,7 +32252,7 @@ class Dashboard extends Component {
|
|
|
32120
32252
|
}),
|
|
32121
32253
|
className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
|
|
32122
32254
|
onClick: this.displayChangePassword
|
|
32123
|
-
}, this.locale("labels.changePassword")), siteHasNewslettersDefined && /*#__PURE__*/React__default.createElement(Button, {
|
|
32255
|
+
}, this.locale("labels.changePassword")), siteHasNewslettersDefined && emailNotifications !== true && /*#__PURE__*/React__default.createElement(Button, {
|
|
32124
32256
|
variant: "ghost",
|
|
32125
32257
|
icon: /*#__PURE__*/React__default.createElement(SvgNewsletter, {
|
|
32126
32258
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -32210,6 +32342,12 @@ class Dashboard extends Component {
|
|
|
32210
32342
|
icon: /*#__PURE__*/React__default.createElement(SvgBookmark, null),
|
|
32211
32343
|
title: this.locale("labels.savedItems.label"),
|
|
32212
32344
|
content: /*#__PURE__*/React__default.createElement(SavedItemsMenu, null)
|
|
32345
|
+
}), /*#__PURE__*/React__default.createElement(Accordion.item, {
|
|
32346
|
+
show: emailNotifications === true,
|
|
32347
|
+
name: SUB_MENUS.EMAIL_PREFERENCES,
|
|
32348
|
+
icon: /*#__PURE__*/React__default.createElement(SvgBookmark, null),
|
|
32349
|
+
title: this.locale("labels.emailPreferences.label"),
|
|
32350
|
+
content: /*#__PURE__*/React__default.createElement(EmailPreferencesMenu, null)
|
|
32213
32351
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
32214
32352
|
variant: "outline",
|
|
32215
32353
|
icon: /*#__PURE__*/React__default.createElement(SvgExit, null),
|
package/dist/pelcro.css
CHANGED
|
@@ -2838,6 +2838,11 @@ apple-pay-button {
|
|
|
2838
2838
|
color: rgba(180, 48, 43, var(--tw-text-opacity));
|
|
2839
2839
|
}
|
|
2840
2840
|
|
|
2841
|
+
.pelcro-root .plc-text-red-600 {
|
|
2842
|
+
--tw-text-opacity: 1;
|
|
2843
|
+
color: rgba(139, 37, 33, var(--tw-text-opacity));
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2841
2846
|
.pelcro-root .plc-text-red-700 {
|
|
2842
2847
|
--tw-text-opacity: 1;
|
|
2843
2848
|
color: rgba(98, 26, 23, var(--tw-text-opacity));
|