@ikas/storefront 1.0.11 → 1.0.12

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.
@@ -17,6 +17,7 @@ export default class CheckoutViewModel {
17
17
  isStepLoading: boolean;
18
18
  isTermsAndConditionsChecked: boolean;
19
19
  isChangingShippingMethod: boolean;
20
+ isContactModalVisible: boolean;
20
21
  step: CheckoutStep;
21
22
  merchantSettings?: IkasMerchantSettings;
22
23
  cardData?: CreditCardData | null;
@@ -95,6 +96,7 @@ export default class CheckoutViewModel {
95
96
  setInstallmentCount: (count: number) => void;
96
97
  changeStep: (step: CheckoutStep) => Promise<void>;
97
98
  logout: () => Promise<void>;
99
+ setContactModalVisible: (value: boolean) => void;
98
100
  }
99
101
  export declare enum CheckoutStep {
100
102
  INFO = "info",
package/build/index.es.js CHANGED
@@ -26266,6 +26266,7 @@ var CheckoutViewModel = /** @class */ (function () {
26266
26266
  this.isStepLoading = false;
26267
26267
  this.isTermsAndConditionsChecked = false;
26268
26268
  this.isChangingShippingMethod = false;
26269
+ this.isContactModalVisible = false;
26269
26270
  this.step = CheckoutStep.INFO;
26270
26271
  this.cardData = null;
26271
26272
  this.paymentGateways = [];
@@ -27153,6 +27154,9 @@ var CheckoutViewModel = /** @class */ (function () {
27153
27154
  }
27154
27155
  });
27155
27156
  }); };
27157
+ this.setContactModalVisible = function (value) {
27158
+ _this.isContactModalVisible = value;
27159
+ };
27156
27160
  this.checkout = checkout;
27157
27161
  this.checkoutSettings = checkoutSettings;
27158
27162
  this.router = router;
@@ -71623,7 +71627,6 @@ var StepSuccess = observer(function (_a) {
71623
71627
  var _b, _c, _d, _e;
71624
71628
  var vm = _a.vm;
71625
71629
  var t = useTranslation().t;
71626
- var _f = useState(false), isContactModalVisible = _f[0], setContactModalVisible = _f[1];
71627
71630
  useEffect(function () {
71628
71631
  if (typeof localStorage !== "undefined") {
71629
71632
  var lsCartId = localStorage.getItem(CART_LS_KEY);
@@ -71723,57 +71726,8 @@ var StepSuccess = observer(function (_a) {
71723
71726
  createElement("div", { className: styles$i.Actions },
71724
71727
  createElement("div", { className: styles$i.HelpText },
71725
71728
  createElement("span", null, t("checkout-page:helpCtaQuestion")),
71726
- createElement("span", { className: styles$i.Cta, onClick: function () { return setContactModalVisible(true); } }, t("checkout-page:helpCta"))),
71727
- createElement(Button, { text: t("checkout-page:actions.backToShopping"), onClick: vm.onBackToShoppingClick, style: { flex: "0 0 auto" } })),
71728
- isContactModalVisible && (createElement(ContactUsModal, { vm: vm, setVisible: setContactModalVisible }))));
71729
- });
71730
- var ContactUsModal = observer(function (_a) {
71731
- var _b, _c;
71732
- var vm = _a.vm, setVisible = _a.setVisible;
71733
- var t = useTranslation().t;
71734
- var _d = useState(false), isLoading = _d[0], setLoading = _d[1];
71735
- var _e = useState(false), isSuccess = _e[0], setSuccess = _e[1];
71736
- var form = useState(new ContactForm({
71737
- message: {
71738
- requiredRule: "",
71739
- emailRule: "",
71740
- minRule: "",
71741
- },
71742
- store: vm.store,
71743
- }))[0];
71744
- form.email = vm.checkout.customerEmail;
71745
- form.firstName = ((_b = vm.checkout.customer) === null || _b === void 0 ? void 0 : _b.firstName) || "";
71746
- form.lastName = ((_c = vm.checkout.customer) === null || _c === void 0 ? void 0 : _c.lastName) || "";
71747
- var onSave = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
71748
- var success;
71749
- return __generator(this, function (_a) {
71750
- switch (_a.label) {
71751
- case 0:
71752
- if (isSuccess) {
71753
- return [2 /*return*/, setVisible(false)];
71754
- }
71755
- setLoading(true);
71756
- return [4 /*yield*/, form.saveContactForm()];
71757
- case 1:
71758
- success = _a.sent();
71759
- if (success) {
71760
- setSuccess(true);
71761
- }
71762
- setLoading(false);
71763
- return [2 /*return*/];
71764
- }
71765
- });
71766
- }); }, [isLoading]);
71767
- return (createElement(Modal, { title: t("checkout-page:contactForm"), modalContent: createElement("div", null,
71768
- isSuccess && (createElement("div", { style: { marginBottom: "12px", maxWidth: "352px" } },
71769
- createElement(NotificationBox$1, { type: "success", title: t("checkout-page:contactFormSent"), content: t("checkout-page:contactFormDescription") }))),
71770
- createElement(FormItem, { type: FormItemType.TEXT_AREA, label: "", value: form.message || "", onChange: form.onMessageChange, textAreaPlaceholder: t("checkout-page:contactFormCta") }),
71771
- createElement(Button, { style: {
71772
- width: "100%",
71773
- marginTop: "24px",
71774
- }, text: isSuccess
71775
- ? t("checkout-page:actions.close")
71776
- : t("checkout-page:actions.sendMessage"), isLoading: isLoading, isDisabled: !form.message, onClick: onSave })), onClose: function () { return setVisible(false); } }));
71729
+ createElement("span", { className: styles$i.Cta, onClick: function () { return vm.setContactModalVisible(true); } }, t("checkout-page:helpCta"))),
71730
+ createElement(Button, { text: t("checkout-page:actions.backToShopping"), onClick: vm.onBackToShoppingClick, style: { flex: "0 0 auto" } }))));
71777
71731
  });
71778
71732
  var OrderStatus = observer(function (_a) {
71779
71733
  var _b, _c, _d;
@@ -72046,7 +72000,8 @@ var IkasCheckoutPage = function (_a) {
72046
72000
  ? "/tr"
72047
72001
  : ""), target: "_blank" },
72048
72002
  createElement(SVGIkas, null))))),
72049
- !!vm.policyModalText && (createElement(Modal, { title: vm.policyModalTitle, modalContent: vm.policyModalText, onClose: onPolicyModalClose })))));
72003
+ !!vm.policyModalText && (createElement(Modal, { title: vm.policyModalTitle, modalContent: vm.policyModalText, onClose: onPolicyModalClose })),
72004
+ vm.isContactModalVisible && (createElement(ContactUsModal, { vm: vm, setVisible: vm.setContactModalVisible })))));
72050
72005
  };
72051
72006
  var IkasCheckoutPage$1 = observer(IkasCheckoutPage);
72052
72007
  var Header = observer(function (_a) {
@@ -72136,6 +72091,54 @@ var Footer = observer(function (_a) {
72136
72091
  createElement("div", { className: styles$4.FooterBullet }, "\u2022"),
72137
72092
  createElement("div", { className: styles$4.FooterItem, onClick: onTermsOfServiceClick }, t("checkout-page:termsOfService"))));
72138
72093
  });
72094
+ var ContactUsModal = observer(function (_a) {
72095
+ var _b, _c;
72096
+ var vm = _a.vm, setVisible = _a.setVisible;
72097
+ var t = useTranslation().t;
72098
+ var _d = useState(false), isLoading = _d[0], setLoading = _d[1];
72099
+ var _e = useState(false), isSuccess = _e[0], setSuccess = _e[1];
72100
+ var form = useState(new ContactForm({
72101
+ message: {
72102
+ requiredRule: "",
72103
+ emailRule: "",
72104
+ minRule: "",
72105
+ },
72106
+ store: vm.store,
72107
+ }))[0];
72108
+ form.email = vm.checkout.customerEmail;
72109
+ form.firstName = ((_b = vm.checkout.customer) === null || _b === void 0 ? void 0 : _b.firstName) || "";
72110
+ form.lastName = ((_c = vm.checkout.customer) === null || _c === void 0 ? void 0 : _c.lastName) || "";
72111
+ var onSave = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
72112
+ var success;
72113
+ return __generator(this, function (_a) {
72114
+ switch (_a.label) {
72115
+ case 0:
72116
+ if (isSuccess) {
72117
+ return [2 /*return*/, setVisible(false)];
72118
+ }
72119
+ setLoading(true);
72120
+ return [4 /*yield*/, form.saveContactForm()];
72121
+ case 1:
72122
+ success = _a.sent();
72123
+ if (success) {
72124
+ setSuccess(true);
72125
+ }
72126
+ setLoading(false);
72127
+ return [2 /*return*/];
72128
+ }
72129
+ });
72130
+ }); }, [isLoading]);
72131
+ return (createElement(Modal, { title: t("checkout-page:contactForm"), modalContent: createElement("div", null,
72132
+ isSuccess && (createElement("div", { style: { marginBottom: "12px", maxWidth: "352px" } },
72133
+ createElement(NotificationBox$1, { type: "success", title: t("checkout-page:contactFormSent"), content: t("checkout-page:contactFormDescription") }))),
72134
+ createElement(FormItem, { type: FormItemType.TEXT_AREA, label: "", value: form.message || "", onChange: form.onMessageChange, textAreaPlaceholder: t("checkout-page:contactFormCta") }),
72135
+ createElement(Button, { style: {
72136
+ width: "100%",
72137
+ marginTop: "24px",
72138
+ }, text: isSuccess
72139
+ ? t("checkout-page:actions.close")
72140
+ : t("checkout-page:actions.sendMessage"), isLoading: isLoading, isDisabled: !form.message, onClick: onSave })), onClose: function () { return setVisible(false); } }));
72141
+ });
72139
72142
  function setCheckoutCustomizationProps(customizationProps) {
72140
72143
  document.documentElement.style.setProperty("--checkout-button-bg-color", (customizationProps === null || customizationProps === void 0 ? void 0 : customizationProps.buttonBgColor) || "#272727");
72141
72144
  document.documentElement.style.setProperty("--checkout-button-text-color", (customizationProps === null || customizationProps === void 0 ? void 0 : customizationProps.buttonTextColor) || "#FFFFFF");
package/build/index.js CHANGED
@@ -26246,6 +26246,7 @@ var CheckoutViewModel = /** @class */ (function () {
26246
26246
  this.isStepLoading = false;
26247
26247
  this.isTermsAndConditionsChecked = false;
26248
26248
  this.isChangingShippingMethod = false;
26249
+ this.isContactModalVisible = false;
26249
26250
  this.step = CheckoutStep.INFO;
26250
26251
  this.cardData = null;
26251
26252
  this.paymentGateways = [];
@@ -27133,6 +27134,9 @@ var CheckoutViewModel = /** @class */ (function () {
27133
27134
  }
27134
27135
  });
27135
27136
  }); };
27137
+ this.setContactModalVisible = function (value) {
27138
+ _this.isContactModalVisible = value;
27139
+ };
27136
27140
  this.checkout = checkout;
27137
27141
  this.checkoutSettings = checkoutSettings;
27138
27142
  this.router = router;
@@ -71600,7 +71604,6 @@ var StepSuccess = mobxReactLite.observer(function (_a) {
71600
71604
  var _b, _c, _d, _e;
71601
71605
  var vm = _a.vm;
71602
71606
  var t = useTranslation().t;
71603
- var _f = React.useState(false), isContactModalVisible = _f[0], setContactModalVisible = _f[1];
71604
71607
  React.useEffect(function () {
71605
71608
  if (typeof localStorage !== "undefined") {
71606
71609
  var lsCartId = localStorage.getItem(CART_LS_KEY);
@@ -71700,57 +71703,8 @@ var StepSuccess = mobxReactLite.observer(function (_a) {
71700
71703
  React.createElement("div", { className: styles$i.Actions },
71701
71704
  React.createElement("div", { className: styles$i.HelpText },
71702
71705
  React.createElement("span", null, t("checkout-page:helpCtaQuestion")),
71703
- React.createElement("span", { className: styles$i.Cta, onClick: function () { return setContactModalVisible(true); } }, t("checkout-page:helpCta"))),
71704
- React.createElement(Button, { text: t("checkout-page:actions.backToShopping"), onClick: vm.onBackToShoppingClick, style: { flex: "0 0 auto" } })),
71705
- isContactModalVisible && (React.createElement(ContactUsModal, { vm: vm, setVisible: setContactModalVisible }))));
71706
- });
71707
- var ContactUsModal = mobxReactLite.observer(function (_a) {
71708
- var _b, _c;
71709
- var vm = _a.vm, setVisible = _a.setVisible;
71710
- var t = useTranslation().t;
71711
- var _d = React.useState(false), isLoading = _d[0], setLoading = _d[1];
71712
- var _e = React.useState(false), isSuccess = _e[0], setSuccess = _e[1];
71713
- var form = React.useState(new ContactForm({
71714
- message: {
71715
- requiredRule: "",
71716
- emailRule: "",
71717
- minRule: "",
71718
- },
71719
- store: vm.store,
71720
- }))[0];
71721
- form.email = vm.checkout.customerEmail;
71722
- form.firstName = ((_b = vm.checkout.customer) === null || _b === void 0 ? void 0 : _b.firstName) || "";
71723
- form.lastName = ((_c = vm.checkout.customer) === null || _c === void 0 ? void 0 : _c.lastName) || "";
71724
- var onSave = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
71725
- var success;
71726
- return __generator(this, function (_a) {
71727
- switch (_a.label) {
71728
- case 0:
71729
- if (isSuccess) {
71730
- return [2 /*return*/, setVisible(false)];
71731
- }
71732
- setLoading(true);
71733
- return [4 /*yield*/, form.saveContactForm()];
71734
- case 1:
71735
- success = _a.sent();
71736
- if (success) {
71737
- setSuccess(true);
71738
- }
71739
- setLoading(false);
71740
- return [2 /*return*/];
71741
- }
71742
- });
71743
- }); }, [isLoading]);
71744
- return (React.createElement(Modal, { title: t("checkout-page:contactForm"), modalContent: React.createElement("div", null,
71745
- isSuccess && (React.createElement("div", { style: { marginBottom: "12px", maxWidth: "352px" } },
71746
- React.createElement(NotificationBox$1, { type: "success", title: t("checkout-page:contactFormSent"), content: t("checkout-page:contactFormDescription") }))),
71747
- React.createElement(FormItem, { type: FormItemType.TEXT_AREA, label: "", value: form.message || "", onChange: form.onMessageChange, textAreaPlaceholder: t("checkout-page:contactFormCta") }),
71748
- React.createElement(Button, { style: {
71749
- width: "100%",
71750
- marginTop: "24px",
71751
- }, text: isSuccess
71752
- ? t("checkout-page:actions.close")
71753
- : t("checkout-page:actions.sendMessage"), isLoading: isLoading, isDisabled: !form.message, onClick: onSave })), onClose: function () { return setVisible(false); } }));
71706
+ React.createElement("span", { className: styles$i.Cta, onClick: function () { return vm.setContactModalVisible(true); } }, t("checkout-page:helpCta"))),
71707
+ React.createElement(Button, { text: t("checkout-page:actions.backToShopping"), onClick: vm.onBackToShoppingClick, style: { flex: "0 0 auto" } }))));
71754
71708
  });
71755
71709
  var OrderStatus = mobxReactLite.observer(function (_a) {
71756
71710
  var _b, _c, _d;
@@ -72023,7 +71977,8 @@ var IkasCheckoutPage = function (_a) {
72023
71977
  ? "/tr"
72024
71978
  : ""), target: "_blank" },
72025
71979
  React.createElement(SVGIkas, null))))),
72026
- !!vm.policyModalText && (React.createElement(Modal, { title: vm.policyModalTitle, modalContent: vm.policyModalText, onClose: onPolicyModalClose })))));
71980
+ !!vm.policyModalText && (React.createElement(Modal, { title: vm.policyModalTitle, modalContent: vm.policyModalText, onClose: onPolicyModalClose })),
71981
+ vm.isContactModalVisible && (React.createElement(ContactUsModal, { vm: vm, setVisible: vm.setContactModalVisible })))));
72027
71982
  };
72028
71983
  var IkasCheckoutPage$1 = mobxReactLite.observer(IkasCheckoutPage);
72029
71984
  var Header = mobxReactLite.observer(function (_a) {
@@ -72113,6 +72068,54 @@ var Footer = mobxReactLite.observer(function (_a) {
72113
72068
  React.createElement("div", { className: styles$4.FooterBullet }, "\u2022"),
72114
72069
  React.createElement("div", { className: styles$4.FooterItem, onClick: onTermsOfServiceClick }, t("checkout-page:termsOfService"))));
72115
72070
  });
72071
+ var ContactUsModal = mobxReactLite.observer(function (_a) {
72072
+ var _b, _c;
72073
+ var vm = _a.vm, setVisible = _a.setVisible;
72074
+ var t = useTranslation().t;
72075
+ var _d = React.useState(false), isLoading = _d[0], setLoading = _d[1];
72076
+ var _e = React.useState(false), isSuccess = _e[0], setSuccess = _e[1];
72077
+ var form = React.useState(new ContactForm({
72078
+ message: {
72079
+ requiredRule: "",
72080
+ emailRule: "",
72081
+ minRule: "",
72082
+ },
72083
+ store: vm.store,
72084
+ }))[0];
72085
+ form.email = vm.checkout.customerEmail;
72086
+ form.firstName = ((_b = vm.checkout.customer) === null || _b === void 0 ? void 0 : _b.firstName) || "";
72087
+ form.lastName = ((_c = vm.checkout.customer) === null || _c === void 0 ? void 0 : _c.lastName) || "";
72088
+ var onSave = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
72089
+ var success;
72090
+ return __generator(this, function (_a) {
72091
+ switch (_a.label) {
72092
+ case 0:
72093
+ if (isSuccess) {
72094
+ return [2 /*return*/, setVisible(false)];
72095
+ }
72096
+ setLoading(true);
72097
+ return [4 /*yield*/, form.saveContactForm()];
72098
+ case 1:
72099
+ success = _a.sent();
72100
+ if (success) {
72101
+ setSuccess(true);
72102
+ }
72103
+ setLoading(false);
72104
+ return [2 /*return*/];
72105
+ }
72106
+ });
72107
+ }); }, [isLoading]);
72108
+ return (React.createElement(Modal, { title: t("checkout-page:contactForm"), modalContent: React.createElement("div", null,
72109
+ isSuccess && (React.createElement("div", { style: { marginBottom: "12px", maxWidth: "352px" } },
72110
+ React.createElement(NotificationBox$1, { type: "success", title: t("checkout-page:contactFormSent"), content: t("checkout-page:contactFormDescription") }))),
72111
+ React.createElement(FormItem, { type: FormItemType.TEXT_AREA, label: "", value: form.message || "", onChange: form.onMessageChange, textAreaPlaceholder: t("checkout-page:contactFormCta") }),
72112
+ React.createElement(Button, { style: {
72113
+ width: "100%",
72114
+ marginTop: "24px",
72115
+ }, text: isSuccess
72116
+ ? t("checkout-page:actions.close")
72117
+ : t("checkout-page:actions.sendMessage"), isLoading: isLoading, isDisabled: !form.message, onClick: onSave })), onClose: function () { return setVisible(false); } }));
72118
+ });
72116
72119
  function setCheckoutCustomizationProps(customizationProps) {
72117
72120
  document.documentElement.style.setProperty("--checkout-button-bg-color", (customizationProps === null || customizationProps === void 0 ? void 0 : customizationProps.buttonBgColor) || "#272727");
72118
72121
  document.documentElement.style.setProperty("--checkout-button-text-color", (customizationProps === null || customizationProps === void 0 ? void 0 : customizationProps.buttonTextColor) || "#FFFFFF");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",