@ikas/storefront 6.1.0-beta.9 → 6.1.0-beta.90
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/build/analytics/analytics.d.ts +3 -3
- package/build/analytics/analytics.js +1 -1
- package/build/analytics/googleAnalytics.js +1 -1
- package/build/analytics/googleTagManager.d.ts +3 -2
- package/build/analytics/googleTagManager.js +1 -1
- package/build/analytics/ikasV3.d.ts +5 -0
- package/build/analytics/ikasV3.js +1 -1
- package/build/components/checkout/components/address-form/index.js +1 -1
- package/build/components/checkout/components/address-form/model.d.ts +3 -0
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/components/checkout/components/cart-summary/index.d.ts +2 -0
- package/build/components/checkout/components/cart-summary/index.js +1 -1
- package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
- package/build/components/checkout/components/customer-addresses/index.d.ts +1 -0
- package/build/components/checkout/components/customer-addresses/index.js +1 -1
- package/build/components/checkout/components/form-item/index.js +1 -1
- package/build/components/checkout/components/form-item/model.d.ts +2 -0
- package/build/components/checkout/components/form-item/model.js +1 -1
- package/build/components/checkout/components/form-item/style.module.scss.js +1 -1
- package/build/components/checkout/components/hepsipay/index.d.ts +9 -0
- package/build/components/checkout/components/hepsipay/index.js +1 -0
- package/build/components/checkout/components/input-with-button/style.module.scss.js +1 -1
- package/build/components/checkout/components/modal/index.d.ts +1 -0
- package/build/components/checkout/components/modal/index.js +1 -1
- package/build/components/checkout/components/modal/style.module.scss.js +1 -1
- package/build/components/checkout/components/offer-product/index.js +1 -1
- package/build/components/checkout/components/stripe/checkout-form.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.d.ts +13 -3
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-info/index.js +1 -1
- package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/image/index.d.ts +1 -0
- package/build/components/image/index.js +1 -1
- package/build/components/index.d.ts +2 -0
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page-editor/ThemeComponentEditor.js +1 -1
- package/build/components/page-editor/model.js +1 -1
- package/build/components/paypal-express-checkout/index.d.ts +9 -0
- package/build/components/paypal-express-checkout/index.js +1 -0
- package/build/components/plain-image/index.d.ts +13 -0
- package/build/components/plain-image/index.js +1 -0
- package/build/components/popup/index.js +1 -1
- package/build/components/popup/renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/getCountries.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountries.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountryCallingCode.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/isSupportedCountry.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/parsePhoneNumber.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/ObserverComponent.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/index.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/observer.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/useObserver.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/assertEnvironment.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerBatching.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerFinalizationRegistry.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/printDebugValue.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/get-countries.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/index.js +1 -0
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js +1 -1
- package/build/hooks/useCustomerReviews.d.ts +1 -0
- package/build/hooks/useCustomerReviews.js +1 -1
- package/build/hooks/useStore.js +1 -1
- package/build/index.js +1 -1
- package/build/models/data/checkout-settings/index.d.ts +1 -0
- package/build/models/data/checkout-settings/index.js +1 -1
- package/build/models/data/customer/review/index.d.ts +4 -1
- package/build/models/data/customer/review/index.js +1 -1
- package/build/models/data/order/gift-card-line/index.d.ts +8 -0
- package/build/models/data/order/gift-card-line/index.js +1 -0
- package/build/models/data/order/index.d.ts +2 -0
- package/build/models/data/order/index.js +1 -1
- package/build/models/data/order/line-item/bundle-product-settings/index.d.ts +7 -0
- package/build/models/data/order/line-item/bundle-product-settings/index.js +1 -0
- package/build/models/data/order/line-item/index.d.ts +2 -0
- package/build/models/data/order/line-item/index.js +1 -1
- package/build/models/data/product/index.d.ts +1 -0
- package/build/models/data/product/index.js +1 -1
- package/build/models/data/product/variant/index.d.ts +1 -0
- package/build/models/data/product/variant/index.js +1 -1
- package/build/models/ui/customer-review-list/index.d.ts +4 -0
- package/build/models/ui/customer-review-list/index.js +1 -1
- package/build/models/ui/product-list/index.js +1 -1
- package/build/page-data-init/index.js +1 -1
- package/build/pages/checkout.js +1 -1
- package/build/store/cart/api.d.ts +2 -1
- package/build/store/cart/api.js +1 -1
- package/build/store/checkout/index.d.ts +3 -1
- package/build/store/checkout/index.js +1 -1
- package/build/store/customer/index.js +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as e}from'./../../../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as a}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as s}from"../../../../store/cart/index.js";import r from"./style.module.scss.js";import i from"../../components/svg/success-circle.js";import n from"../../components/expandable-section/index.js";import c from"../../components/credit-card-form/svg/amex.js";import d from"../../components/credit-card-form/svg/master-card.js";import l from"../../components/credit-card-form/svg/troy.js";import m from"../../components/credit-card-form/svg/visa.js";import"@ikas/storefront-config";import{formatCurrency as p}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import"../../../../models/data/blog/category/index.js";import"../../../../models/data/blog/content/index.js";import"../../../../models/data/blog/meta-data/index.js";import"../../../../models/data/blog/tag/index.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import{IkasPaymentMethodType as f,IkasPaymentGatewayType as v,IkasOrderPackageStatus as g,IkasTransactionCardAssociation as E}from"@ikas/storefront-models";import"mobx";import"../../../../models/data/campaign-offer/index.js";import"../../../../models/data/cart/campaign-offer/index.js";import"../../../../models/data/cart/index.js";import"../../../../models/data/category/path-item/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/checkout-settings/index.js";import"../../../../models/data/city/index.js";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/region/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../models/data/customer/attribute/index.js";import"../../../../models/data/customer/review/summary/index.js";import"../../../../models/data/customer/review/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-form-data-input/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/filter-category/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/order/address/region/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/line-item/option/value/index.js";import"../../../../models/data/order/line-item/variant/value/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/order-transaction-with-prices/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/transaction/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/payment-gateway/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/filter/index.js";import"../../../../models/data/product/campaign-offer/index.js";import"../../../../models/data/product/option-set/option/index.js";import"../../../../models/data/product/option-set/index.js";import"../../../../models/data/product/stock-location/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../../models/data/storefront-popup/index.js";import"../../../../models/data/theme-json/index.js";import"../../../../models/data/theme-json/component/index.js";import"../../../../models/data/theme-json/custom-data/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/customer-review-summary-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/ikas-address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import h from"../../components/offer-product/index.js";import{Analytics as x}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import{QuickRegistration as k}from"../../components/quick-registration/index.js";import{ProductFiles as j}from"../../components/product-files/index.js";import y from"../../components/offer-product/offer-arrows/index.js";import N from"../../components/offer-product/offer-dots/index.js";import I from"../../components/svg/shopping-bag.js";import{CartSummary as A}from"../../components/cart-summary/index.js";import T from"../../components/offer-product/useCampaignOffer.js";var P="eventSentCartIds",S=a((function(a){var g,P,S,L,C,D,R,O,b,_,M,w=a.vm,F=u().t,Y=T(w,!0),U=Y.setActiveIndex,V=Y.setIsActiveOverlay,z=Y.handlePrev,B=Y.handleNext,K=Y.isActiveOverlay,G=Y.activeIndex,H=Y.isMobile;t.useEffect((function(){if("undefined"!=typeof localStorage){var t=localStorage.getItem(s),a=localStorage.getItem("eventSentCartIds");if(t&&t===w.checkout.id){if(w.successTransaction){var o=JSON.parse(a||"[]");if(!o.some((function(e){return e===w.checkout.id}))){var r=w.checkout.orderedAt,i=Date.now();Math.floor(Math.abs(i-r)/1e3)<30&&x.purchase(w.checkout,w.successTransaction),localStorage.setItem("eventSentCartIds",JSON.stringify(e(e([],o,!0),[w.checkout.id],!1)))}}localStorage.removeItem(s)}window&&window.handleKlarna&&window.handleKlarna(void 0)}}),[]);var Q=((null===(g=w.checkout.customer)||void 0===g?void 0:g.firstName)||"")+" "+((null===(P=w.checkout.customer)||void 0===P?void 0:P.lastName)||""),J=((null===(S=w.checkout.shippingAddress)||void 0===S?void 0:S.firstName)||"")+" "+((null===(L=w.checkout.shippingAddress)||void 0===L?void 0:L.lastName)||""),q=w.paymentGateways.find((function(e){var t;return e.id===(null===(t=w.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),X=function(e){switch(e){case f.APP_PAYMENT:return F("checkout-page:appPayment");case f.BANK_REDIRECT:return F("checkout-page:bankRedirect");case f.BUY_ONLINE_PAY_AT_STORE:return F("checkout-page:buyOnlinePayAtStore");case f.CASH:return F("checkout-page:cash");case f.CASH_ON_DELIVERY:return F("checkout-page:cashOnDelivery");case f.CREDIT_CARD:return F("checkout-page:creditCard");case f.CREDIT_CARD_ON_DELIVERY:return F("checkout-page:creditCardOnDelivery");case f.DIRECT_DEBIT:return F("checkout-page:directDebit");case f.GIFT_CARD:return F("checkout-page:giftCard");case f.MONEY_ORDER:return F("checkout-page:moneyOrder");case f.OTHER:return F("checkout-page:other");case f.PAY_LATER:return F("checkout-page:payLater");case f.SLICE_IT:return F("checkout-page:sliceIt");case f.WALLET:return F("checkout-page:wallet");default:return""}},W=null===(C=w.successTransaction)||void 0===C?void 0:C.paymentMethodDetail,Z=null===(D=w.successTransaction)||void 0===D?void 0:D.paymentGatewayCode,$=t.useMemo((function(){var e,a,o,s,i,n,u,g,h,x;return t.createElement("div",{className:[r.InfoGrid].join(" ")},!w.isFree&&t.createElement("div",{className:r.PaymentMethodMain},t.createElement("div",{className:r.InfoTitle},F("checkout-page:paymentMethod")),q&&t.createElement(t.Fragment,null,!!q.logoUrl&&t.createElement("div",{className:r.PaymentLogoContainer},t.createElement("img",{src:q.logoUrl})),!q.logoUrl&&t.createElement("div",{className:r.InfoText},q.paymentMethodType===f.CREDIT_CARD&&q.type===v.INTERNAL?F("checkout-page:creditCard"):q.name),"STRIPE"!==q.code&&"STRIPE_EU"!==q.code&&"PAYPAL"!==q.code&&"KLARNA"!==q.code||!(null===(e=w.successTransaction)||void 0===e?void 0:e.paymentMethod)?!!q.description&&q.type!==v.EXTERNAL&&t.createElement("div",{className:r.InfoText},t.createElement("div",{dangerouslySetInnerHTML:{__html:q.description}})):t.createElement("div",{className:r.InfoText},X(w.successTransaction.paymentMethod))),"E_PAY_KOLAY"===Z&&t.createElement(t.Fragment,null,t.createElement("div",{className:r.EPayKolayLogoContainer},t.createElement("img",{src:"https://cdn.myikas.com/sf/assets/payment/epaykolay.png"})),!!(null===(a=w.successTransaction)||void 0===a?void 0:a.paymentMethod)&&t.createElement("div",{className:r.InfoText},X(null===(o=w.successTransaction)||void 0===o?void 0:o.paymentMethod))),"E_PAY_KOLAY"!==Z&&"STRIPE"!==Z&&"STRIPE_EU"!==Z&&"PAYPAL"!==Z&&"KLARNA"!==Z&&"CREDIT_CARD"===(null===(s=w.successTransaction)||void 0===s?void 0:s.paymentMethod)&&t.createElement(t.Fragment,null,t.createElement("div",{className:r.InfoText},t.createElement("div",{className:r.CardLogoContainer},function(){var e,a;switch(null===(a=null===(e=w.successTransaction)||void 0===e?void 0:e.paymentMethodDetail)||void 0===a?void 0:a.cardAssociation){case E.AMERICAN_EXPRESS:return t.createElement(c,null);case E.MASTER_CARD:return t.createElement(d,null);case E.TROY:return t.createElement(l,null);case E.VISA:return t.createElement(m,null);default:return t.createElement("div",null)}}()),t.createElement("span",null,"**** ".concat((null==W?void 0:W.lastFourDigits)||""))),(null===(i=null==W?void 0:W.installment)||void 0===i?void 0:i.installmentCount)&&W.installment.installmentCount>1&&t.createElement(t.Fragment,null,t.createElement("div",{className:r.InfoText},"".concat(W.installment.installmentCount," ").concat(F("checkout-page:installments"))),null!==W.installment.installmentPrice&&t.createElement("div",{className:r.InfoText},"".concat(W.installment.installmentCount," x ").concat(p(W.installment.installmentPrice,w.checkout.currencyCode,w.checkout.currencySymbol)))))),t.createElement("div",null,t.createElement("div",{className:r.InfoTitle},F("checkout-page:billingAddress")),!!(null===(n=w.checkout.billingAddress)||void 0===n?void 0:n.firstName)&&t.createElement("div",{className:[r.InfoText,r.InfoTextPrimary].join(" ")},w.checkout.billingAddress.firstName," ",w.checkout.billingAddress.lastName),!!(null===(u=w.checkout.billingAddress)||void 0===u?void 0:u.company)&&t.createElement("div",{className:r.InfoText},w.checkout.billingAddress.company),(!!(null===(g=w.checkout.billingAddress)||void 0===g?void 0:g.taxOffice)||!!(null===(h=w.checkout.billingAddress)||void 0===h?void 0:h.taxNumber))&&t.createElement("div",{className:r.InfoText},w.checkout.billingAddress.taxOffice," ",w.checkout.billingAddress.taxNumber),t.createElement("div",{className:r.InfoText},null===(x=w.checkout.billingAddress)||void 0===x?void 0:x.addressText)))}),[]),ee=t.useMemo((function(){return t.createElement(A,{vm:w,isSuccessPageSummary:!0})}),[]),te=t.useMemo((function(){var e,a,o,s,i,n;return t.createElement("div",{className:[r.InfoGrid].join(" ")},t.createElement("div",null,t.createElement("div",{className:r.InfoTitle},F("checkout-page:contactInfo")),t.createElement("div",{className:r.InfoText},null===(e=w.checkout.customer)||void 0===e?void 0:e.email),t.createElement("div",{className:r.InfoText},Q),!!(null===(a=w.checkout.shippingAddress)||void 0===a?void 0:a.phone)&&t.createElement("div",{className:r.InfoText},null===(o=w.checkout.shippingAddress)||void 0===o?void 0:o.phone)),t.createElement("div",null,"in-store"===w.deliveryMethod&&t.createElement(t.Fragment,null,t.createElement("div",{className:r.InfoTitle},F("checkout-page:receiver")),t.createElement("div",{className:[r.InfoText,r.withMBottom].join(" ")},J)),t.createElement("div",{className:r.InfoTitle},"address"===w.deliveryMethod?F("checkout-page:shippingAddress"):F("checkout-page:pickUpLocation")),!!(null===(s=w.checkout.shippingAddress)||void 0===s?void 0:s.firstName)&&t.createElement("div",{className:[r.InfoText,r.InfoTextPrimary].join(" ")},w.checkout.shippingAddress.firstName," ",w.checkout.shippingAddress.lastName),!!(null===(i=w.checkout.shippingAddress)||void 0===i?void 0:i.company)&&t.createElement("div",{className:r.InfoText},w.checkout.shippingAddress.company),t.createElement("div",{className:r.InfoText},null===(n=w.checkout.shippingAddress)||void 0===n?void 0:n.addressText)))}),[]),ae=!!(null===(R=w.customizationProps)||void 0===R?void 0:R.campaignOffersEnableMiddlePhase)&&!!(null===(O=w.customizationProps)||void 0===O?void 0:O.showCampaignIsBiggerImage)&&H&&K,oe=!!(null===(b=w.customizationProps)||void 0===b?void 0:b.campaignOffersEnableMiddlePhase)&&!!(null===(_=w.customizationProps)||void 0===_?void 0:_.showCampaignIsBiggerImage)&&H&&!K;return t.createElement(t.Fragment,null,!!(null===(M=w.customizationProps)||void 0===M?void 0:M.campaignOffersEnableMiddlePhase)&&K&&w.campaignOffers&&w.campaignOffers.length>0&&H&&t.createElement("div",{className:[r.MiddlePhaseOverlay,ae?r.MiddlePhaseOverlayPopup:""].join(" ")}),w.campaignOffers&&!!w.campaignOffers.length&&w.isCampaignOfferLoaded&&t.createElement("div",{className:[r.CampaignOfferMain,ae?r.OverlayPopupMain:""].join(" ")},t.createElement("div",{className:r.OfferSlider},w.campaignOffers.map((function(e,a){var o;return t.createElement(h,{vm:w,campaignOffer:e,index:a,activeIndex:G,offersLength:(null===(o=w.campaignOffers)||void 0===o?void 0:o.length)||0,handlePrev:z,handleNext:B,setActiveIndex:function(e){return U(e)},isPopupShow:ae,closePopup:function(){return V(!1)},isPopupClosed:oe,showPopup:function(){return V(!0)},step:w.step})}))),w.campaignOffers.length>1&&t.createElement(y,{handlePrev:z,handleNext:B}),w.campaignOffers.length>1&&t.createElement(N,{isPopupShow:ae,vm:w,activeIndex:G})),t.createElement("div",{className:r.StepSuccess},t.createElement("div",{className:r.SuccessTitleContainer},t.createElement(i,{className:r.SuccessCircle}),t.createElement("span",{className:r.SuccessTitle},F("checkout-page:orderSuccessTitle"))),t.createElement("div",{className:r.SuccessSubTitle},F(w.isDigitalOnly?"checkout-page:orderSuccessDigitalOnlyDescription":"address"===w.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:Q})),w.productFiles.length>0&&t.createElement(j,{vm:w}),t.createElement("div",null,t.createElement("div",{className:r.OrderSummaryMain},t.createElement("div",null,t.createElement("span",{className:r.InfoTitle},F("checkout-page:orderNo")),t.createElement("span",{className:r.InfoText},"#"+(w.checkout.orderNumber||""))),t.createElement("div",null,t.createElement("span",{className:r.InfoTitle},F("checkout-page:orderDate")),t.createElement("span",{className:r.InfoText},w.checkout.dateStr)),t.createElement("div",{className:r.OrderAmountInfoMain},t.createElement("span",{className:r.InfoTitle},F("checkout-page:orderAmount")),t.createElement("span",{className:r.OrderAmountInfo},t.createElement("span",null,"".concat(p(w.finalPrice||0,w.checkout.currencyCode,w.checkout.currencySymbol))),t.createElement("span",{className:r.Slash},"/"),t.createElement("span",{className:r.OrderItemCount},t.createElement(I,null),t.createElement("span",null," ",w.checkout.itemQuantity," ",F("checkout-page:cartItemProduct"))))))),w.hasQuickRegistration&&t.createElement(k,{vm:w}),t.createElement("div",{className:r.HideOnDesktop},t.createElement(n,{title:F("checkout-page:summary")},ee)),t.createElement(n,{expanded:!0,title:F("checkout-page:paymentSummary")},$),!w.isDigitalOnly&&t.createElement(n,{title:F("checkout-page:shippingSummary")},te),t.createElement("div",{className:r.Actions},t.createElement("div",{className:r.HelpText},t.createElement("span",null,F("checkout-page:helpCtaQuestion")),t.createElement("span",{style:{marginLeft:"4px"},className:r.Cta,onClick:function(){return w.setContactModalVisible(!0)}},F("checkout-page:helpCta"))),t.createElement(o,{text:F("checkout-page:actions.backToShopping"),onClick:w.onBackToShoppingClick,style:{flex:"0 0 auto"}}))))}));a((function(e){var a,o=e.vm,s=u().t,i=r.Yellow;switch(o.checkout.orderPackageStatus){case g.FULFILLED:case g.PARTIALLY_FULFILLED:case g.DELIVERED:case g.PARTIALLY_DELIVERED:i=r.Green;break;case g.CANCELLED:case g.PARTIALLY_CANCELLED:case g.CANCEL_REJECTED:case g.CANCEL_REQUESTED:i=r.Red}return t.createElement("div",{className:[r.OrderStatus,i].join(" ")},o.checkout.orderPackageStatus?null===(a=[{types:[g.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[g.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[g.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[g.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[g.DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[g.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.partiallyDelivered")},{types:[g.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[g.CANCELLED,g.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[g.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[g.REFUNDED,g.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[g.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[g.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[g.REFUND_REQUESTED],text:s("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(o.checkout.orderPackageStatus)})))||void 0===a?void 0:a.text:"")}));export{P as SENT_CART_IDS_LS_KEY,S as StepSuccess};
|
|
1
|
+
import{__spreadArray as e}from'./../../../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as a}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as s}from"../../../../store/cart/index.js";import n from"./style.module.scss.js";import r from"../../components/svg/success-circle.js";import i from"../../components/expandable-section/index.js";import c from"../../components/credit-card-form/svg/amex.js";import l from"../../components/credit-card-form/svg/master-card.js";import d from"../../components/credit-card-form/svg/troy.js";import m from"../../components/credit-card-form/svg/visa.js";import"@ikas/storefront-config";import{formatCurrency as u}from"../../../../utils/currency.js";import{useTranslation as p}from"../../../../utils/i18n.js";import"../../../../models/data/blog/category/index.js";import"../../../../models/data/blog/content/index.js";import"../../../../models/data/blog/meta-data/index.js";import"../../../../models/data/blog/tag/index.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import{IkasPaymentMethodType as v,IkasPaymentGatewayType as f,IkasOrderPackageStatus as g,IkasTransactionCardAssociation as E}from"@ikas/storefront-models";import"mobx";import"../../../../models/data/campaign-offer/index.js";import"../../../../models/data/cart/campaign-offer/index.js";import"../../../../models/data/cart/index.js";import"../../../../models/data/category/path-item/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/checkout-settings/index.js";import"../../../../models/data/city/index.js";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/region/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../models/data/customer/attribute/index.js";import"../../../../models/data/customer/review/summary/index.js";import"../../../../models/data/customer/review/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-form-data-input/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/filter-category/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/order/address/region/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/line-item/option/value/index.js";import"../../../../models/data/order/line-item/variant/value/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/order-transaction-with-prices/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/transaction/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/payment-gateway/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/filter/index.js";import"../../../../models/data/product/campaign-offer/index.js";import"../../../../models/data/product/option-set/option/index.js";import"../../../../models/data/product/option-set/index.js";import"../../../../models/data/product/stock-location/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../../models/data/storefront-popup/index.js";import"../../../../models/data/theme-json/index.js";import"../../../../models/data/theme-json/component/index.js";import"../../../../models/data/theme-json/custom-data/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/customer-review-summary-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/ikas-address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import h from"../../components/offer-product/index.js";import{Analytics as x}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import{QuickRegistration as k}from"../../components/quick-registration/index.js";import{ProductFiles as y}from"../../components/product-files/index.js";import j from"../../components/offer-product/offer-arrows/index.js";import N from"../../components/offer-product/offer-dots/index.js";import I from"../../components/svg/shopping-bag.js";import{CartSummary as T}from"../../components/cart-summary/index.js";import A from"../../components/offer-product/useCampaignOffer.js";var C="eventSentCartIds",D=a((function(a){var g,C,D,P,S,L,R,M,b,O,_,F,w=a.vm,Y=p().t,U=A(w,!0),V=U.setActiveIndex,z=U.setIsActiveOverlay,B=U.handlePrev,G=U.handleNext,K=U.isActiveOverlay,H=U.activeIndex,Q=U.isMobile;t.useEffect((function(){if("undefined"!=typeof localStorage){var t=localStorage.getItem(s),a=localStorage.getItem("eventSentCartIds");if(t&&t===w.checkout.id){if(w.successTransaction){var o=JSON.parse(a||"[]");if(!o.some((function(e){return e===w.checkout.id}))){var n=w.checkout.orderedAt,r=Date.now();Math.floor(Math.abs(r-n)/1e3)<30&&x.purchase(w.checkout,w.successTransaction),localStorage.setItem("eventSentCartIds",JSON.stringify(e(e([],o,!0),[w.checkout.id],!1)))}}localStorage.removeItem(s)}window&&window.handleKlarna&&window.handleKlarna(void 0)}}),[]);var J=((null===(g=w.checkout.customer)||void 0===g?void 0:g.firstName)||"")+" "+((null===(C=w.checkout.customer)||void 0===C?void 0:C.lastName)||""),q=((null===(D=w.checkout.shippingAddress)||void 0===D?void 0:D.firstName)||"")+" "+((null===(P=w.checkout.shippingAddress)||void 0===P?void 0:P.lastName)||""),X=w.paymentGateways.find((function(e){var t;return e.id===(null===(t=w.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),W=function(e){var a,o;switch(e||(null===(o=null===(a=w.successTransaction)||void 0===a?void 0:a.paymentMethodDetail)||void 0===o?void 0:o.cardAssociation)){case E.AMERICAN_EXPRESS:return t.createElement(c,null);case E.MASTER_CARD:return t.createElement(l,null);case E.TROY:return t.createElement(d,null);case E.VISA:return t.createElement(m,null);default:return t.createElement("div",null)}},Z=function(e){switch(e){case v.APP_PAYMENT:return Y("checkout-page:appPayment");case v.BANK_REDIRECT:return Y("checkout-page:bankRedirect");case v.BUY_ONLINE_PAY_AT_STORE:return Y("checkout-page:buyOnlinePayAtStore");case v.CASH:return Y("checkout-page:cash");case v.CASH_ON_DELIVERY:return Y("checkout-page:cashOnDelivery");case v.CREDIT_CARD:return Y("checkout-page:creditCard");case v.CREDIT_CARD_ON_DELIVERY:return Y("checkout-page:creditCardOnDelivery");case v.DIRECT_DEBIT:return Y("checkout-page:directDebit");case v.GIFT_CARD:return Y("checkout-page:giftCard");case v.MONEY_ORDER:return Y("checkout-page:moneyOrder");case v.OTHER:return Y("checkout-page:other");case v.PAY_LATER:return Y("checkout-page:payLater");case v.SLICE_IT:return Y("checkout-page:sliceIt");case v.WALLET:return Y("checkout-page:wallet");default:return""}},$=null===(S=w.successTransaction)||void 0===S?void 0:S.paymentMethodDetail,ee=null===(L=w.successTransaction)||void 0===L?void 0:L.paymentGatewayCode,te=null===(R=w.successTransactions)||void 0===R?void 0:R.some((function(e){return e.paymentMethod===v.GIFT_CARD})),ae=t.useMemo((function(){var e;return null===(e=w.successTransactions)||void 0===e?void 0:e.map((function(e){var a,o,s;return t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},Z(e.paymentMethod)),e.paymentMethod===v.CREDIT_CARD&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},t.createElement("div",{className:n.CardLogoContainer},W(null===(a=e.paymentMethodDetail)||void 0===a?void 0:a.cardAssociation)),t.createElement("span",null,"**** ".concat((null==$?void 0:$.lastFourDigits)||""))),(null===(s=null===(o=e.paymentMethodDetail)||void 0===o?void 0:o.installment)||void 0===s?void 0:s.installmentCount)&&e.paymentMethodDetail.installment.installmentCount>1&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},"".concat(e.paymentMethodDetail.installment.installmentCount," ").concat(Y("checkout-page:installments"))),null!==e.paymentMethodDetail.installment.installmentPrice&&t.createElement("div",{className:n.InfoText},"".concat(e.paymentMethodDetail.installment.installmentCount," x ").concat(u(e.paymentMethodDetail.installment.installmentPrice,w.checkout.currencyCode,w.checkout.currencySymbol))))))}))}),[]),oe=t.useMemo((function(){var e,a,o,s,r,i,c,l,d,m;return t.createElement("div",{className:[n.InfoGrid].join(" ")},!w.isFree&&t.createElement("div",{className:n.PaymentMethodMain},t.createElement("div",{className:n.InfoTitle},Y("checkout-page:paymentMethod")),te?ae:t.createElement(t.Fragment,null,X&&t.createElement(t.Fragment,null,!!X.logoUrl&&t.createElement("div",{className:n.PaymentLogoContainer},t.createElement("img",{src:X.logoUrl})),!X.logoUrl&&t.createElement("div",{className:n.InfoText},X.paymentMethodType===v.CREDIT_CARD&&X.type===f.INTERNAL?Y("checkout-page:creditCard"):X.name),"STRIPE"!==X.code&&"STRIPE_EU"!==X.code&&"PAYPAL"!==X.code&&"KLARNA"!==X.code||!(null===(e=w.successTransaction)||void 0===e?void 0:e.paymentMethod)?!!X.description&&X.type!==f.EXTERNAL&&t.createElement("div",{className:n.InfoText},t.createElement("div",{dangerouslySetInnerHTML:{__html:X.description}})):t.createElement("div",{className:n.InfoText},Z(w.successTransaction.paymentMethod))),"E_PAY_KOLAY"===ee&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.EPayKolayLogoContainer},t.createElement("img",{src:"https://cdn.myikas.com/sf/assets/payment/epaykolay.png"})),!!(null===(a=w.successTransaction)||void 0===a?void 0:a.paymentMethod)&&t.createElement("div",{className:n.InfoText},Z(null===(o=w.successTransaction)||void 0===o?void 0:o.paymentMethod))),"E_PAY_KOLAY"!==ee&&"STRIPE"!==ee&&"STRIPE_EU"!==ee&&"PAYPAL"!==ee&&"KLARNA"!==ee&&"CREDIT_CARD"===(null===(s=w.successTransaction)||void 0===s?void 0:s.paymentMethod)&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},t.createElement("div",{className:n.CardLogoContainer},W()),t.createElement("span",null,"**** ".concat((null==$?void 0:$.lastFourDigits)||""))),(null===(r=null==$?void 0:$.installment)||void 0===r?void 0:r.installmentCount)&&$.installment.installmentCount>1&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},"".concat($.installment.installmentCount," ").concat(Y("checkout-page:installments"))),null!==$.installment.installmentPrice&&t.createElement("div",{className:n.InfoText},"".concat($.installment.installmentCount," x ").concat(u($.installment.installmentPrice,w.checkout.currencyCode,w.checkout.currencySymbol))))))),!!w.isFree&&!!te&&t.createElement("div",{className:n.PaymentMethodMain},t.createElement("div",{className:n.InfoTitle},Y("checkout-page:paymentMethod")),ae),t.createElement("div",null,t.createElement("div",{className:n.InfoTitle},Y("checkout-page:billingAddress")),!!(null===(i=w.checkout.billingAddress)||void 0===i?void 0:i.firstName)&&t.createElement("div",{className:[n.InfoText,n.InfoTextPrimary].join(" ")},w.checkout.billingAddress.firstName," ",w.checkout.billingAddress.lastName),!!(null===(c=w.checkout.billingAddress)||void 0===c?void 0:c.company)&&t.createElement("div",{className:n.InfoText},w.checkout.billingAddress.company),(!!(null===(l=w.checkout.billingAddress)||void 0===l?void 0:l.taxOffice)||!!(null===(d=w.checkout.billingAddress)||void 0===d?void 0:d.taxNumber))&&t.createElement("div",{className:n.InfoText},w.checkout.billingAddress.taxOffice," ",w.checkout.billingAddress.taxNumber),t.createElement("div",{className:n.InfoText},null===(m=w.checkout.billingAddress)||void 0===m?void 0:m.addressText)))}),[]),se=t.useMemo((function(){return t.createElement(T,{vm:w,isSuccessPageSummary:!0})}),[]),ne=t.useMemo((function(){var e,a,o,s,r,i;return t.createElement("div",{className:[n.InfoGrid].join(" ")},t.createElement("div",null,t.createElement("div",{className:n.InfoTitle},Y("checkout-page:contactInfo")),t.createElement("div",{className:n.InfoText},null===(e=w.checkout.customer)||void 0===e?void 0:e.email),t.createElement("div",{className:n.InfoText},J),!!(null===(a=w.checkout.shippingAddress)||void 0===a?void 0:a.phone)&&t.createElement("div",{className:n.InfoText},null===(o=w.checkout.shippingAddress)||void 0===o?void 0:o.phone)),t.createElement("div",null,"in-store"===w.deliveryMethod&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoTitle},Y("checkout-page:receiver")),t.createElement("div",{className:[n.InfoText,n.withMBottom].join(" ")},q)),t.createElement("div",{className:n.InfoTitle},"address"===w.deliveryMethod?Y("checkout-page:shippingAddress"):Y("checkout-page:pickUpLocation")),!!(null===(s=w.checkout.shippingAddress)||void 0===s?void 0:s.firstName)&&t.createElement("div",{className:[n.InfoText,n.InfoTextPrimary].join(" ")},w.checkout.shippingAddress.firstName," ",w.checkout.shippingAddress.lastName),!!(null===(r=w.checkout.shippingAddress)||void 0===r?void 0:r.company)&&t.createElement("div",{className:n.InfoText},w.checkout.shippingAddress.company),t.createElement("div",{className:n.InfoText},null===(i=w.checkout.shippingAddress)||void 0===i?void 0:i.addressText)))}),[]),re=!!(null===(M=w.customizationProps)||void 0===M?void 0:M.campaignOffersEnableMiddlePhase)&&!!(null===(b=w.customizationProps)||void 0===b?void 0:b.showCampaignIsBiggerImage)&&Q&&K,ie=!!(null===(O=w.customizationProps)||void 0===O?void 0:O.campaignOffersEnableMiddlePhase)&&!!(null===(_=w.customizationProps)||void 0===_?void 0:_.showCampaignIsBiggerImage)&&Q&&!K;return t.createElement(t.Fragment,null,!!(null===(F=w.customizationProps)||void 0===F?void 0:F.campaignOffersEnableMiddlePhase)&&K&&w.campaignOffers&&w.campaignOffers.length>0&&Q&&t.createElement("div",{className:[n.MiddlePhaseOverlay,re?n.MiddlePhaseOverlayPopup:""].join(" ")}),w.campaignOffers&&!!w.campaignOffers.length&&w.isCampaignOfferLoaded&&t.createElement("div",{className:[n.CampaignOfferMain,re?n.OverlayPopupMain:""].join(" ")},t.createElement("div",{className:n.OfferSlider},w.campaignOffers.map((function(e,a){var o;return t.createElement(h,{vm:w,campaignOffer:e,index:a,activeIndex:H,offersLength:(null===(o=w.campaignOffers)||void 0===o?void 0:o.length)||0,handlePrev:B,handleNext:G,setActiveIndex:function(e){return V(e)},isPopupShow:re,closePopup:function(){return z(!1)},isPopupClosed:ie,showPopup:function(){return z(!0)},step:w.step})}))),w.campaignOffers.length>1&&t.createElement(j,{handlePrev:B,handleNext:G}),w.campaignOffers.length>1&&t.createElement(N,{isPopupShow:re,vm:w,activeIndex:H})),t.createElement("div",{className:n.StepSuccess},t.createElement("div",{className:n.SuccessTitleContainer},t.createElement(r,{className:n.SuccessCircle}),t.createElement("span",{className:n.SuccessTitle},Y("checkout-page:orderSuccessTitle"))),t.createElement("div",{className:n.SuccessSubTitle},Y(w.isDigitalOnly?"checkout-page:orderSuccessDigitalOnlyDescription":"address"===w.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:J})),w.productFiles.length>0&&t.createElement(y,{vm:w}),t.createElement("div",null,t.createElement("div",{className:n.OrderSummaryMain},t.createElement("div",null,t.createElement("span",{className:n.InfoTitle},Y("checkout-page:orderNo")),t.createElement("span",{className:n.InfoText},"#"+(w.checkout.orderNumber||""))),t.createElement("div",null,t.createElement("span",{className:n.InfoTitle},Y("checkout-page:orderDate")),t.createElement("span",{className:n.InfoText},w.checkout.dateStr)),t.createElement("div",{className:n.OrderAmountInfoMain},t.createElement("span",{className:n.InfoTitle},Y("checkout-page:orderAmount")),t.createElement("span",{className:n.OrderAmountInfo},t.createElement("span",null,"".concat(u(w.finalPrice||0,w.checkout.currencyCode,w.checkout.currencySymbol))),t.createElement("span",{className:n.Slash},"/"),t.createElement("span",{className:n.OrderItemCount},t.createElement(I,null),t.createElement("span",null," ",w.checkout.itemQuantity," ",Y("checkout-page:cartItemProduct"))))))),w.hasQuickRegistration&&t.createElement(k,{vm:w}),t.createElement("div",{className:n.HideOnDesktop},t.createElement(i,{title:Y("checkout-page:summary")},se)),t.createElement(i,{expanded:!0,title:Y("checkout-page:paymentSummary")},oe),!w.isDigitalOnly&&t.createElement(i,{title:Y("checkout-page:shippingSummary")},ne),t.createElement("div",{className:n.Actions},t.createElement("div",{className:n.HelpText},t.createElement("span",null,Y("checkout-page:helpCtaQuestion")),t.createElement("span",{style:{marginLeft:"4px"},className:n.Cta,onClick:function(){return w.setContactModalVisible(!0)}},Y("checkout-page:helpCta"))),t.createElement(o,{text:Y("checkout-page:actions.backToShopping"),onClick:w.onBackToShoppingClick,style:{flex:"0 0 auto"}}))))}));a((function(e){var a,o=e.vm,s=p().t,r=n.Yellow;switch(o.checkout.orderPackageStatus){case g.FULFILLED:case g.PARTIALLY_FULFILLED:case g.DELIVERED:case g.PARTIALLY_DELIVERED:r=n.Green;break;case g.CANCELLED:case g.PARTIALLY_CANCELLED:case g.CANCEL_REJECTED:case g.CANCEL_REQUESTED:r=n.Red}return t.createElement("div",{className:[n.OrderStatus,r].join(" ")},o.checkout.orderPackageStatus?null===(a=[{types:[g.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[g.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[g.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[g.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[g.DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[g.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.partiallyDelivered")},{types:[g.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[g.CANCELLED,g.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[g.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[g.REFUNDED,g.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[g.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[g.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[g.REFUND_REQUESTED],text:s("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(o.checkout.orderPackageStatus)})))||void 0===a?void 0:a.text:"")}));export{C as SENT_CART_IDS_LS_KEY,D as StepSuccess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as e,__assign as r}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import s from"next/image.js";import{IkasImageFunctions as o}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as a}from"@ikas/storefront-config";var l=[180,360,540,720,900,1080,1296,1512,1728,1950,2560,3840],i=function(i){var m=i.image,n=i.useBlur,u=i.lossless,f=e(i,["image","useBlur","lossless"]),c=o.getDefaultSrc,d=o.getSrc;return m?t.createElement(s,r({},f,{loader:function(e){var r=e.width,t=l.reduce((function(e,t){return Math.abs(t-r)<Math.abs(e-r)?t:e})),s=u||a.getIsLosslessImageEnabled();return d(m,t,s)},quality:100,src:c(m),alt:f.alt||"Image",placeholder:n?"blur":"empty",blurDataURL:n?d(m,10):void 0})):null};export{i as Image};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { IkasPage } from "./page";
|
|
2
2
|
export { IkasPageHead } from "./page/head";
|
|
3
3
|
export { Image } from "./image";
|
|
4
|
+
export { PlainImage } from "./plain-image";
|
|
4
5
|
export { default as Link } from "./link";
|
|
5
6
|
export * from "./page-editor/loader";
|
|
6
7
|
export { GoogleCaptcha } from "../components/google-captcha";
|
|
8
|
+
export { PaypalExpressCheckout } from "../components/paypal-express-checkout";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import i from"next/head.js";import{useRouter as a}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductList as s}from"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as d}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import{IkasBaseStore as l}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var c=o((function(o){var s,c=o.pageType,g=o.pageTitle,f=o.pageDescription,v=o.canonicals,h=o.disableIndex,j=o.pageSpecificData,x=o.merchantSettings,y=o.addOgpMetas,b=o.productReviewSummary,C=o.pageComponentPropValues,T=a(),D="undefined"!=typeof window,L="local"===process.env.NEXT_PUBLIC_ENV,w=T.asPath.split("?")[0].replace("/",""),k=(w="/"===w.charAt(w.length-1)?w.slice(0,-1):w).startsWith("pages/"),O=d.getCurrentRouting(),P=(null==O?void 0:O.path)?"/"+O.path:"",R=L?"http://localhost:3333":"https://"+d.getDomain(),E=null===(s=d.getIndexPageSeoSettings())||void 0===s?void 0:s.find((function(e){return e.locale===d.getCurrentLocale()})),_=E?new n(E):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[c,j]);var I=t.useMemo((function(){if(j&&j.href)return"".concat(R).concat(j.href)}),[j]),V=t.useMemo((function(){var e,t,o,i=[];if(y){if(i.push({property:"og:type",content:"website"}),i.push({property:"og:site_name",content:"https://"+d.getDomain()}),g&&i.push({property:"og:title",content:g}),f&&i.push({property:"og:description",content:f}),c===r.INDEX){var a=null,n=null;!g&&(null==_?void 0:_.pageTitle)&&(a=_.pageTitle),!f&&(null==_?void 0:_.description)&&(n=_.description),(s=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===c})))&&(a=u(j,c,s.titleTemplate||""),n=u(j,c,s.descriptionTemplate||"")),a&&i.push({property:"og:title",content:a}),n&&i.push({property:"og:description",content:n})}if(c===r.PRODUCT){var s,l=null,p=null;(s=null===(t=d.getMetaTemplates())||void 0===t?void 0:t.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===c})))&&(l=u(j,c,s.titleTemplate||""),p=u(j,c,s.descriptionTemplate||"")),l&&!g&&i.push({property:"og:title",content:l}),p&&!f&&i.push({property:"og:description",content:p})}i.push({property:"og:url",content:I||(D?window.location.href:"")||"https://".concat(d.getDomain())});var m=null;if(j&&c===r.PRODUCT){var v=j.selectedVariant.mainImage;(null==v?void 0:v.image)&&(m={property:"og:image",content:v.image.src.replace(".webp",".jpg")})}if(j&&c===r.CATEGORY){var h=j;h.image&&(m={property:"og:image",content:h.image.src.replace(".webp",".jpg")})}if(j&&c===r.BRAND){var b=j;b.image&&(m={property:"og:image",content:b.image.src.replace(".webp",".jpg")})}if(j&&c===r.BLOG_CATEGORY){var C=j;C.image&&(m={property:"og:image",content:C.image.src.replace(".webp",".jpg")})}if(j&&c===r.BLOG){var T=j;T.image&&(m={property:"og:image",content:T.image.src.replace(".webp",".jpg")})}!m&&(null==_?void 0:_.icon)&&(m={property:"og:image",content:null===(o=null==_?void 0:_.icon)||void 0===o?void 0:o.src.replace(".webp",".jpg")}),!m&&(null==x?void 0:x.logo)&&(m={property:"og:image",content:x.logo.src.replace(".webp",".jpg")}),m&&i.push(m)}return i}),[g,j,I,f,x,y,x]),S=t.useMemo((function(){var t=[],o=(null==_?void 0:_.pageTitle)||(null==x?void 0:x.merchantName)||"";if(x){var i={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},a=function(t){var o,i,a,r,n,s,l=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:l,image:l,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(a=null===(i=t.address)||void 0===i?void 0:i.city)||void 0===a?void 0:a.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(x);t.push(i),t.push(a)}if(j&&c===r.PRODUCT){var n=j,s=function(t,o){var i,a,r,n,s;try{var l=d.getCurrentRouting(),c=null==l?void 0:l.path,p=function(e){return c?"https://".concat(d.getDomain(),"/").concat(c).concat(e):"https://".concat(d.getDomain()).concat(e)},m=t.selectedVariant;return e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:null===(i=t.metaData)||void 0===i?void 0:i.description,image:null===(a=m.images)||void 0===a?void 0:a.map((function(e){return e.image?e.image.src:""})),productId:m.id,sku:m.sku,mpn:(null===(r=m.barcodeList)||void 0===r?void 0:r.length)?m.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(n=t.brand)||void 0===n?void 0:n.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:p(t.href),priceCurrency:m.price.currency||"TRY",price:(null!==(s=m.campaignPrice)&&void 0!==s?s:m.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:m.stock>0||m.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(n,b||null);if(s&&t.push(s),n.categories.length)(u=p(n.categories[0],o,n))&&t.push(u)}if(j&&c===r.CATEGORY){var l=function(e){var t,o;try{var i=d.getCurrentRouting(),a=null==i?void 0:i.path,r=function(e){return a?"https://".concat(d.getDomain(),"/").concat(a).concat(e):"https://".concat(d.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(j),u=p(j,o),g=m(C);l&&t.push(l),u&&t.push(u),g&&t.push(g)}j&&c===r.BRAND&&((g=m(C))&&t.push(g));if(j&&c===r.BLOG){var f=function(t){var o;try{var i="https://".concat(d.getDomain()).concat(t.href),a=function(e){var t=new Date(e),o=t.getFullYear(),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(i,"-").concat(a)},r="".concat(t.writer.firstName," ").concat(t.writer.lastName),n=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:i,datePublished:a(t.createdAt),dateCreated:a(t.createdAt),dateModified:a(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(j);f&&t.push(f)}return t}),[j,x]),N=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===c}));return t?u(j,c,t.titleTemplate||""):null}),[c,j]),A=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===c}));return t?u(j,c,t.descriptionTemplate||""):null}),[c,j]),M=t.useMemo((function(){return!d.getFavicon()&&(null==_?void 0:_.favIcon)?_.favIcon:null}),[]),B=[];d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){B.push({routing:e,hrefLang:e.locale+"-"+t})})):B.push({routing:e,hrefLang:e.locale})}));var F=function(e){var t,o,i,a,r,n=j,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=B.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(a=null===(i=null==n?void 0:n.metaData)||void 0===i?void 0:i.translations)||void 0===a?void 0:a.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""},G=l.getInstance();return t.createElement(i,null,t.createElement("title",null,g||N||(null==_?void 0:_.pageTitle)||""),t.createElement("meta",{name:"description",content:f||A||(null==_?void 0:_.description)||""}),B.length>1&&B.filter((function(e){return!k||e.routing.id===(null==O?void 0:O.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(R+(e.routing.path?"/"+e.routing.path:""),"/").concat(F(e.routing))})})),!!h&&t.createElement("meta",{name:"robots",content:"noindex"}),!!y&&V.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!v&&v.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(R).concat(P).concat(e)})})),M&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(M,"/image_180.webp"),type:"image/webp"}),!v&&G.currentPageType!==r.NOT_FOUND&&t.createElement("link",{rel:"canonical",href:"".concat(R).concat(P,"/").concat(w)}),!!S.length&&S.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function p(e,t,o){try{var i=l.getInstance(),a=d.getCurrentRouting(),n=null==a?void 0:a.path,s=function(e){return n?"https://".concat(d.getDomain(),"/").concat(n).concat(e):"https://".concat(d.getDomain()).concat(e)},c=[{"@type":"ListItem",position:1,name:t,item:"https://".concat(d.getDomain())}];return(c=c.concat(e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+2,name:e.name,item:s(e.href)}})))).push({"@type":"ListItem",position:c.length+1,name:e.name,item:s(e.href)}),i.currentPageType===r.PRODUCT&&o&&c.push({"@type":"ListItem",position:c.length+1,name:o.name,item:s(o.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:c}}catch(e){}}function m(e){try{var t=d.getCurrentRouting(),o=null==t?void 0:t.path;if(e){var i=(e.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[]).find((function(e){return Object.values(e.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}))}));if(i){var a=Object.values(i.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}));if(a)return{"@context":"http://schema.org","@type":"ItemList",itemListElement:(a.data||[]).slice(0,10).map((function(e,t){var i,a,r,n;return{"@type":"ListItem",position:t+1,item:{"@type":"Product",name:e.name,image:(null===(a=null===(i=e.selectedVariant.mainImage)||void 0===i?void 0:i.image)||void 0===a?void 0:a.src)||"",offers:{"@type":"Offer",url:(n=e.href,o?"https://".concat(d.getDomain(),"/").concat(o).concat(n):"https://".concat(d.getDomain()).concat(n)),priceCurrency:e.selectedVariant.price.currency||"TRY",price:(null!==(r=e.selectedVariant.campaignPrice)&&void 0!==r?r:e.selectedVariant.finalPrice).toFixed(2),availability:e.selectedVariant.stock>0||e.selectedVariant.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}}))}}}}catch(e){}}function u(e,t,o){var i,a,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,l=(null===(i=s.brand)||void 0===i?void 0:i.name)||"",c=s.selectedVariant.sku||"",p=(null===(a=s.selectedVariant.barcodeList)||void 0===a?void 0:a.length)?s.selectedVariant.barcodeList[0]:"",m=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=g(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=g(n,"{{brand}}",l)),n.includes("{{sku}}")&&(n=g(n,"{{sku}}",c)),n.includes("{{barcode}}")&&(n=g(n,"{{barcode}}",p)),n.includes("{{price}}")&&(n=g(n,"{{price}}",m.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=g(n,"{{name}}",u));break;case r.BLOG:var f=e.title;n.includes("{{name}}")&&(n=g(n,"{{name}}",f))}}catch(e){}return n.trimEnd()}function g(e,t,o){var i=new RegExp(t,"g");return e.replace(i,o)}export{c as IkasPageHead};
|
|
1
|
+
import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import i from"next/head.js";import{useRouter as a}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductList as s}from"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as d}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../paypal-express-checkout/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import{IkasBaseStore as c}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var l=o((function(o){var s,l=o.pageType,g=o.pageTitle,f=o.pageDescription,v=o.canonicals,h=o.disableIndex,j=o.pageSpecificData,x=o.merchantSettings,y=o.addOgpMetas,b=o.productReviewSummary,T=o.pageComponentPropValues,C=a(),D="undefined"!=typeof window,L="local"===process.env.NEXT_PUBLIC_ENV,k=C.asPath.split("?")[0].replace("/",""),w=(k="/"===k.charAt(k.length-1)?k.slice(0,-1):k).startsWith("pages/"),O=d.getCurrentRouting(),P=(null==O?void 0:O.path)?"/"+O.path:"",R=L?"http://localhost:3333":"https://"+d.getDomain(),E=null===(s=d.getIndexPageSeoSettings())||void 0===s?void 0:s.find((function(e){return e.locale===d.getCurrentLocale()})),_=E?new n(E):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[l,j]);var I=t.useMemo((function(){if(j&&j.href)return"".concat(R).concat(j.href)}),[j]),V=t.useMemo((function(){if(j&&j.href){var e=j.href;return P?"".concat(R).concat(P).concat(e):"".concat(R).concat(e)}}),[j]),S=t.useMemo((function(){var e,t,o,i=[];if(y){if(i.push({property:"og:type",content:"website"}),i.push({property:"og:site_name",content:(null==_?void 0:_.pageTitle)||"https://"+d.getDomain()}),g&&i.push({property:"og:title",content:g}),f&&i.push({property:"og:description",content:f}),l===r.INDEX){var a=null,n=null;!g&&(null==_?void 0:_.pageTitle)&&(a=_.pageTitle),!f&&(null==_?void 0:_.description)&&(n=_.description),(s=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===l})))&&(a=u(j,l,s.titleTemplate||""),n=u(j,l,s.descriptionTemplate||"")),a&&i.push({property:"og:title",content:a}),n&&i.push({property:"og:description",content:n})}if(l===r.PRODUCT||l===r.CATEGORY||l===r.BRAND){var s,c=null,p=null;(s=null===(t=d.getMetaTemplates())||void 0===t?void 0:t.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===l})))&&(c=u(j,l,s.titleTemplate||""),p=u(j,l,s.descriptionTemplate||"")),c&&!g&&i.push({property:"og:title",content:c}),p&&!f&&i.push({property:"og:description",content:p})}i.push({property:"og:url",content:V||(D?window.location.href:"")||"https://".concat(d.getDomain())});var m=null;if(j&&l===r.PRODUCT){var v=j.selectedVariant.mainImage;(null==v?void 0:v.image)&&(m={property:"og:image",content:v.image.src.replace(".webp",".jpg")})}if(j&&l===r.CATEGORY){var h=j;h.image&&(m={property:"og:image",content:h.image.src.replace(".webp",".jpg")})}if(j&&l===r.BRAND){var b=j;b.image&&(m={property:"og:image",content:b.image.src.replace(".webp",".jpg")})}if(j&&l===r.BLOG_CATEGORY){var T=j;T.image&&(m={property:"og:image",content:T.image.src.replace(".webp",".jpg")})}if(j&&l===r.BLOG){var C=j;C.image&&(m={property:"og:image",content:C.image.src.replace(".webp",".jpg")})}!m&&(null==_?void 0:_.icon)&&(m={property:"og:image",content:null===(o=null==_?void 0:_.icon)||void 0===o?void 0:o.src.replace(".webp",".jpg")}),!m&&(null==x?void 0:x.logo)&&(m={property:"og:image",content:x.logo.src.replace(".webp",".jpg")}),m&&i.push(m)}return i}),[g,j,I,f,x,y,x]),A=t.useMemo((function(){var t=[],o=(null==_?void 0:_.pageTitle)||(null==x?void 0:x.merchantName)||"";if(x){var i={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},a=function(t){var o,i,a,r,n,s,c=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:c,image:c,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(a=null===(i=t.address)||void 0===i?void 0:i.city)||void 0===a?void 0:a.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(x);t.push(i),t.push(a)}if(j&&l===r.PRODUCT){var n=j,s=function(t,o){var i,a,n,s,c,l;try{var p=d.getCurrentRouting(),m=null==p?void 0:p.path,g=function(e){return m?"https://".concat(d.getDomain(),"/").concat(m).concat(e):"https://".concat(d.getDomain()).concat(e)},f=t.selectedVariant,v=null,h=null===(i=d.getMetaTemplates())||void 0===i?void 0:i.find((function(e){return e.locale===d.getCurrentLocale()&&r.PRODUCT}));return h&&(v=u(t,r.PRODUCT,h.descriptionTemplate||"")),e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:(null===(a=t.metaData)||void 0===a?void 0:a.description)||v,image:null===(n=f.images)||void 0===n?void 0:n.map((function(e){return e.image?e.image.src:""})),productId:f.id,sku:f.sku,mpn:(null===(s=f.barcodeList)||void 0===s?void 0:s.length)?f.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(c=t.brand)||void 0===c?void 0:c.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:g(t.href),priceCurrency:f.price.currency||"TRY",price:(null!==(l=f.campaignPrice)&&void 0!==l?l:f.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:f.stock>0||f.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(n,b||null);if(s&&t.push(s),n.categories.length)(g=p(n.categories[0],o,n))&&t.push(g)}if(j&&l===r.CATEGORY){var c=function(e){var t,o;try{var i=d.getCurrentRouting(),a=null==i?void 0:i.path,r=function(e){return a?"https://".concat(d.getDomain(),"/").concat(a).concat(e):"https://".concat(d.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(j),g=p(j,o),f=m(T);c&&t.push(c),g&&t.push(g),f&&t.push(f)}j&&l===r.BRAND&&((f=m(T))&&t.push(f));if(j&&l===r.BLOG){var v=function(t){var o;try{var i="https://".concat(d.getDomain()).concat(t.href),a=function(e){var t=new Date(e),o=t.getFullYear(),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(i,"-").concat(a)},r="".concat(t.writer.firstName," ").concat(t.writer.lastName),n=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:i,datePublished:a(t.createdAt),dateCreated:a(t.createdAt),dateModified:a(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(j);v&&t.push(v)}return t}),[j,x]),M=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===l}));return t?u(j,l,t.titleTemplate||""):null}),[l,j]),N=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===l}));return t?u(j,l,t.descriptionTemplate||""):null}),[l,j]),B=t.useMemo((function(){return!d.getFavicon()&&(null==_?void 0:_.favIcon)?_.favIcon:null}),[]),U=[];d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){U.push({routing:e,hrefLang:e.locale+"-"+t})})):U.push({routing:e,hrefLang:e.locale})}));var G=function(e){var t,o,i,a,r,n=j,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=U.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(a=null===(i=null==n?void 0:n.metaData)||void 0===i?void 0:i.translations)||void 0===a?void 0:a.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""},F=c.getInstance();return t.createElement(i,null,t.createElement("title",null,g||M||(null==_?void 0:_.pageTitle)||""),t.createElement("meta",{name:"description",content:f||N||(null==_?void 0:_.description)||""}),U.length>1&&U.filter((function(e){return!w||e.routing.id===(null==O?void 0:O.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(R+(e.routing.path?"/"+e.routing.path:""),"/").concat(G(e.routing))})})),!!h&&t.createElement("meta",{name:"robots",content:"noindex"}),!!y&&S.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!v&&v.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(R).concat(P).concat(e)})})),B&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(B,"/image_180.webp"),type:"image/webp"}),!v&&F.currentPageType!==r.NOT_FOUND&&t.createElement("link",{rel:"canonical",href:"".concat(R).concat(P,"/").concat(k)}),!!A.length&&A.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function p(e,t,o){try{var i=c.getInstance(),a=d.getCurrentRouting(),n=null==a?void 0:a.path,s=function(e){return n?"https://".concat(d.getDomain(),"/").concat(n).concat(e):"https://".concat(d.getDomain()).concat(e)},l=[{"@type":"ListItem",position:1,name:t,item:"https://".concat(d.getDomain())}];return(l=l.concat(e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+2,name:e.name,item:s(e.href)}})))).push({"@type":"ListItem",position:l.length+1,name:e.name,item:s(e.href)}),i.currentPageType===r.PRODUCT&&o&&l.push({"@type":"ListItem",position:l.length+1,name:o.name,item:s(o.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:l}}catch(e){}}function m(e){try{var t=d.getCurrentRouting(),o=null==t?void 0:t.path;if(e){var i=(e.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[]).find((function(e){return Object.values(e.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}))}));if(i){var a=Object.values(i.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}));if(a)return{"@context":"http://schema.org","@type":"ItemList",itemListElement:(a.data||[]).slice(0,10).map((function(e,t){var i,a,r,n;return{"@type":"ListItem",position:t+1,item:{"@type":"Product",name:e.name,image:(null===(a=null===(i=e.selectedVariant.mainImage)||void 0===i?void 0:i.image)||void 0===a?void 0:a.src)||"",offers:{"@type":"Offer",url:(n=e.href,o?"https://".concat(d.getDomain(),"/").concat(o).concat(n):"https://".concat(d.getDomain()).concat(n)),priceCurrency:e.selectedVariant.price.currency||"TRY",price:(null!==(r=e.selectedVariant.campaignPrice)&&void 0!==r?r:e.selectedVariant.finalPrice).toFixed(2),availability:e.selectedVariant.stock>0||e.selectedVariant.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}}))}}}}catch(e){}}function u(e,t,o){var i,a,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,c=(null===(i=s.brand)||void 0===i?void 0:i.name)||"",l=s.selectedVariant.sku||"",p=(null===(a=s.selectedVariant.barcodeList)||void 0===a?void 0:a.length)?s.selectedVariant.barcodeList[0]:"",m=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=g(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=g(n,"{{brand}}",c)),n.includes("{{sku}}")&&(n=g(n,"{{sku}}",l)),n.includes("{{barcode}}")&&(n=g(n,"{{barcode}}",p)),n.includes("{{price}}")&&(n=g(n,"{{price}}",m.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=g(n,"{{name}}",u));break;case r.BLOG:var f=e.title;n.includes("{{name}}")&&(n=g(n,"{{name}}",f))}}catch(e){}return n.trimEnd()}function g(e,t,o){var i=new RegExp(t,"g");return e.replace(i,o)}export{l as IkasPageHead};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as t,__generator as o}from'./../../ext/tslib/tslib.es6.js';import*as i from"react";import{observer as r}from"mobx-react-lite";import{useRouter as a}from"next/router.js";import s from"next/dynamic";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as d}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as n}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import{IkasThemeJsonCustomData as m}from"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as p}from"@ikas/storefront-config";import{Analytics as l}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasPageHead as c}from"./head.js";import{ThemeComponent as u}from"./ThemeComponent.js";import{IkasBaseStore as f}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{initIkasEvents as j}from"../../analytics/events.js";import{IkasPageDataInit as x}from"../../page-data-init/index.js";import{setAPIClientConfig as g}from"@ikas/storefront-api";var v=s((function(){return import("../popup/index.js").then((function(e){return e.PopupListRendererForPage}))}),{ssr:!1}),y=r((function(r){var s=r.propValues,u=r.themeJsonComponents,y=r.customDataList,w=r.pageType,b=r.pageTitle,S=r.pageDescription,C=r.pageSpecificData,P=r.canonicals,D=r.disableIndex,k=r.settings,T=r.configJson,E=r.reInitOnBrowser,I=r.addOgpMetas,R=r.components,M=r.productReviewSummary,V=a(),O=i.useState(),z=O[0],B=O[1];p.init(e(e({},T),{currentPageComponents:R,loginRequiredCallback:function(){V.push("/account/login")}})),f.getInstance().router=V,g();var A=f.getInstance();A.router=V,A.currentPageType=w;var F=i.useState(!1),H=F[0],L=F[1],U=i.useMemo((function(){return(null==z?void 0:z.id)===(null==C?void 0:C.id)&&x.pageSpecificData&&x.isBrowser?w===d.PRODUCT&&x._initProductOnBrowser(x.pageSpecificData):x.setPageSpecificData(C,w,H),x.initPagePropValues(s,u,y.map((function(e){return new m(e)})),k,H)}),[H,s,w,k,C,u]);i.useEffect((function(){E&&L("undefined"!=typeof window),window.addToCart=A.cartStore._windowAddToCart,A.cartStore.getCart(),A.checkLocalization(),j()}),[]),i.useEffect((function(){C?(null==z?void 0:z.id)!==C.id&&B(C):B(null)}),[C]),i.useEffect((function(){var e=function(){A.customerStore.routeChangeInit()};return V.events.on("routeChangeStart",e),function(){V.events.off("routeChangeStart",e)}}),[]),i.useEffect((function(){!function(e,i){var r,a;t(this,void 0,void 0,(function(){var t,s,n,m,p,c;return o(this,(function(o){switch(o.label){case 0:t=f.getInstance(),l.pageView(e),o.label=
|
|
1
|
+
import{__assign as e,__awaiter as t,__generator as o}from'./../../ext/tslib/tslib.es6.js';import*as i from"react";import{observer as r}from"mobx-react-lite";import{useRouter as a}from"next/router.js";import s from"next/dynamic";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as d}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as n}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import{IkasThemeJsonCustomData as m}from"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as p}from"@ikas/storefront-config";import{Analytics as l}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasPageHead as c}from"./head.js";import{ThemeComponent as u}from"./ThemeComponent.js";import{IkasBaseStore as f}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{initIkasEvents as j}from"../../analytics/events.js";import{IkasPageDataInit as x}from"../../page-data-init/index.js";import{setAPIClientConfig as g}from"@ikas/storefront-api";var v=s((function(){return import("../popup/index.js").then((function(e){return e.PopupListRendererForPage}))}),{ssr:!1}),y=r((function(r){var s=r.propValues,u=r.themeJsonComponents,y=r.customDataList,w=r.pageType,b=r.pageTitle,S=r.pageDescription,C=r.pageSpecificData,P=r.canonicals,D=r.disableIndex,k=r.settings,T=r.configJson,E=r.reInitOnBrowser,I=r.addOgpMetas,R=r.components,M=r.productReviewSummary,V=a(),O=i.useState(),z=O[0],B=O[1];p.init(e(e({},T),{currentPageComponents:R,loginRequiredCallback:function(){V.push("/account/login")}})),f.getInstance().router=V,g();var A=f.getInstance();A.router=V,A.currentPageType=w;var F=i.useState(!1),H=F[0],L=F[1],U=i.useMemo((function(){return(null==z?void 0:z.id)===(null==C?void 0:C.id)&&x.pageSpecificData&&x.isBrowser?w===d.PRODUCT&&x._initProductOnBrowser(x.pageSpecificData):x.setPageSpecificData(C,w,H),x.initPagePropValues(s,u,y.map((function(e){return new m(e)})),k,H)}),[H,s,w,k,C,u]);i.useEffect((function(){E&&L("undefined"!=typeof window),window.addToCart=A.cartStore._windowAddToCart,A.cartStore.getCart(),A.checkLocalization(),j()}),[]),i.useEffect((function(){C?(null==z?void 0:z.id)!==C.id&&B(C):B(null)}),[C]),i.useEffect((function(){var e=function(){A.customerStore.routeChangeInit()};return V.events.on("routeChangeStart",e),function(){V.events.off("routeChangeStart",e)}}),[]),i.useEffect((function(){!function(e,i){var r,a;t(this,void 0,void 0,(function(){var t,s,n,m,p,c;return o(this,(function(o){switch(o.label){case 0:return t=f.getInstance(),[4,l.pageView(e)];case 1:o.sent(),o.label=2;case 2:return o.trys.push([2,7,,8]),e!==d.PRODUCT?[3,4]:(s=i,[4,l.productView(s)]);case 3:o.sent(),t.customerStore.onProductView(s.id,s.selectedVariant.id),o.label=4;case 4:return e===d.CATEGORY&&(m=null===(r=(n=i).categoryPathItems)||void 0===r?void 0:r.map((function(e){return e.name})).join(" > "),m=n.categoryPathItems&&(null===(a=n.categoryPathItems)||void 0===a?void 0:a.length)>0?m+" > "+n.name:n.name,l.viewCategory(m,n)),e===d.BRAND&&(p=i,l.viewBrand(p)),e!==d.CART?[3,6]:[4,t.cartStore.waitUntilInitialized()];case 5:o.sent(),l.viewCart(t.cartStore.cart),o.label=6;case 6:return[3,8];case 7:return c=o.sent(),console.error(c),[3,8];case 8:return[2]}}))}))}(w,x.pageSpecificData)}),[w,C]);var _=i.useMemo((function(){var e=U.find((function(e){return e.component.isHeader})),t=U.find((function(e){return e.component.isFooter})),o=U.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[];return i.createElement("div",{style:{position:"relative",minHeight:"100vh",display:"flex",flexDirection:"column",justifyContent:"space-between"}},i.createElement("div",null,e&&h(e,k,-1),o.map((function(e,t){return h(e,k,t)}))),t&&h(t,k,-1),i.createElement(v,{key:Date.now()}))}),[U,k]),J=i.useMemo((function(){return p.getMerchantSettings()?new n(p.getMerchantSettings()):null}),[p.getMerchantSettings()]);return i.createElement(i.Fragment,null,i.createElement(c,{pageType:w,pageTitle:b,pageDescription:S,pageSpecificData:x.pageSpecificData,canonicals:P&&P.length>0?P:null,disableIndex:D,merchantSettings:J,addOgpMetas:I,productReviewSummary:M,pageComponentPropValues:U}),_)})),h=function(e,t,o){return i.createElement(u,{key:e.pageComponent.id,index:o,pageComponentPropValue:e,settings:t})};export{y as IkasPage,h as renderComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e,__assign as o}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import r from"./error/index.js";import{makeObservable as i,computed as n}from"mobx";import a from"../checkout/index.js";import{Observer as d}from"mobx-react-lite";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as s,IkasOrderLineItemStatus as m,IkasCheckoutRequirement as p,IkasCouponCodeRequirement as l,IkasThemeJsonComponentPropType as u}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import{IkasCheckout as c}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as f}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import{IkasOrderLineItem as j}from"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as v}from"@ikas/storefront-config";import{IkasPageDataInit as g}from"../../page-data-init/index.js";import{IkasBaseStore as x}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";var y=function(y){function h(e){var o=y.call(this,e)||this;return o.state={hasError:!1},o.onMouseEnter=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseOver(r.id)},o.onMouseLeave=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseLeave(r.id)},o.onClick=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onClick(r.id)},o.ref=t.createRef(),i(o,{pageComponentPropValue:n,propValues:n,isSelected:n,isHovered:n,hasNullValue:n,rendered:n,Component:n}),o}return e(h,y),h.prototype.componentDidMount=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},h.prototype.componentDidUpdate=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},h.getDerivedStateFromError=function(e){return console.error(e),{hasError:!0}},Object.defineProperty(h.prototype,"pageComponentPropValue",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.initializedPropValues.find((function(e){return e.pageComponent.id===t.id}))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"propValues",{get:function(){var e,t,r=this.props.vm,i=null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.propValues;(null===(t=r.page)||void 0===t?void 0:t.type)===s.CHECKOUT&&(i={checkout:new c({currencyCode:"TRY",currencySymbol:"₺",orderLineItems:[new j({id:"",createdAt:0,updatedAt:0,currencyCode:"TRY",currencySymbol:"₺",discount:null,discountPrice:null,finalPrice:100,options:null,originalOrderLineItemId:null,price:100,quantity:1,status:m.UNFULFILLED,statusUpdatedAt:null,stockLocationId:null,taxValue:null,unitPrice:null,finalUnitPrice:null,variant:{barcodeList:null,brand:null,categories:null,fileId:null,id:null,mainImageId:null,name:"",prices:null,productId:null,sku:null,slug:null,tagIds:null,taxValue:null,type:null,weight:null,hsCode:null,variantValues:[],baseUnit:null,unit:null,tags:null,bundleProducts:null},orderedAt:0})]}),checkoutSettings:new f({createdAt:0,updatedAt:0,id:"",giftPackagePriceList:null,identityNumberRequirement:p.OPTIONAL,isAccountRequired:!1,isGiftPackageEnabled:!1,isQuickRegistrationEnabled:!1,isShowPostalCode:!0,isTermsAndConditionsDefaultChecked:null,options:null,phoneRequirement:p.OPTIONAL,postalCodeRequirement:p.OPTIONAL,showCheckoutNote:!0,showCompanyInfoInShippingAddress:null,showTermsAndConditionsCheckbox:!0,storefrontId:"",couponCodeRequirement:l.DEFAULT,corporateInvoiceRequirement:null}),customizationProps:o({},i),returnPolicy:"",privacyPolicy:"",termsOfService:"",imprint:"",shippingPolicy:""});return i},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isSelected",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.selectedPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isHovered",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.hoveredPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"hasNullValue",{get:function(){var e,o=this;return!!(null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.props.some((function(e){var t;if(e.isRequired){var r=(o.propValues||{})[e.name],i=null===(t=o.pageComponentPropValue)||void 0===t?void 0:t.component.props.find((function(o){return o.id===e.requiredPropId}));if(i){var n=(o.propValues||{})[i.name];if(i.type===u.BOOLEAN&&!n||i.type===u.CUSTOM&&n!==e.requiredEnumOptionValue)return!1}return null===r||null==r}})))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"rendered",{get:function(){var e,i,n=this.Component,a=this.props.vm;return this.hasNullValue||this.state.hasError?t.createElement(r,{name:null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.displayName}):t.createElement(n,o({},this.propValues,{store:x.getInstance(),settings:null===(i=a.theme)||void 0===i?void 0:i.settings,pageSpecificData:g.pageSpecificData}))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"Component",{get:function(){var e,o=this.props,t=o.vm,r=o.pageComponent,i=v.getCurrentPageComponents();if(!i)return null;var n=i[r.componentId];return(null===(e=t.page)||void 0===e?void 0:e.type)===s.CHECKOUT&&(n=a),n},enumerable:!1,configurable:!0}),h.prototype.render=function(){var e=this;return t.createElement(d,null,(function(){var o;return e.state.hasError?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onClick:e.onClick},t.createElement(r,{name:null===(o=e.pageComponentPropValue)||void 0===o?void 0:o.component.displayName})):v.getCurrentPageComponents()?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave},e.rendered):(console.error("Components for the page not found."),null)}))},h}(t.Component);export{y as ThemeEditorComponent};
|
|
1
|
+
import{__extends as e,__assign as o}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import r from"./error/index.js";import{makeObservable as i,computed as n}from"mobx";import a from"../checkout/index.js";import{Observer as d}from"mobx-react-lite";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as s,IkasOrderLineItemStatus as m,IkasCheckoutRequirement as l,IkasCouponCodeRequirement as p,IkasThemeJsonComponentPropType as u}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import{IkasCheckout as c}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as f}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import{IkasOrderLineItem as j}from"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as v}from"@ikas/storefront-config";import{IkasPageDataInit as g}from"../../page-data-init/index.js";import{IkasBaseStore as x}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";var h=function(h){function y(e){var o=h.call(this,e)||this;return o.state={hasError:!1},o.onMouseEnter=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseOver(r.id)},o.onMouseLeave=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseLeave(r.id)},o.onClick=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onClick(r.id)},o.ref=t.createRef(),i(o,{pageComponentPropValue:n,propValues:n,isSelected:n,isHovered:n,hasNullValue:n,rendered:n,Component:n}),o}return e(y,h),y.prototype.componentDidMount=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},y.prototype.componentDidUpdate=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},y.getDerivedStateFromError=function(e){return console.error(e),{hasError:!0}},Object.defineProperty(y.prototype,"pageComponentPropValue",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.initializedPropValues.find((function(e){return e.pageComponent.id===t.id}))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"propValues",{get:function(){var e,t,r=this.props.vm,i=null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.propValues;(null===(t=r.page)||void 0===t?void 0:t.type)===s.CHECKOUT&&(i={checkout:new c({currencyCode:"TRY",currencySymbol:"₺",orderLineItems:[new j({id:"",createdAt:0,updatedAt:0,bundleProductSettings:null,currencyCode:"TRY",currencySymbol:"₺",discount:null,discountPrice:null,finalPrice:100,options:null,originalOrderLineItemId:null,price:100,quantity:1,status:m.UNFULFILLED,statusUpdatedAt:null,stockLocationId:null,taxValue:null,unitPrice:null,finalUnitPrice:null,variant:{barcodeList:null,brand:null,categories:null,fileId:null,id:null,mainImageId:null,name:"",prices:null,productId:null,sku:null,slug:null,tagIds:null,taxValue:null,type:null,weight:null,hsCode:null,variantValues:[],baseUnit:null,unit:null,tags:null,bundleProducts:null},orderedAt:0})]}),checkoutSettings:new f({createdAt:0,updatedAt:0,id:"",giftPackagePriceList:null,identityNumberRequirement:l.OPTIONAL,isAccountRequired:!1,isGiftPackageEnabled:!1,isQuickRegistrationEnabled:!1,isShowPostalCode:!0,isTermsAndConditionsDefaultChecked:null,options:null,phoneRequirement:l.OPTIONAL,postalCodeRequirement:l.OPTIONAL,showCheckoutNote:!0,showCompanyInfoInShippingAddress:null,showBillingAddressOnShippingStep:null,showTermsAndConditionsCheckbox:!0,storefrontId:"",couponCodeRequirement:p.DEFAULT,corporateInvoiceRequirement:null}),customizationProps:o({},i),returnPolicy:"",privacyPolicy:"",termsOfService:"",imprint:"",shippingPolicy:""});return i},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isSelected",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.selectedPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isHovered",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.hoveredPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasNullValue",{get:function(){var e,o=this;return!!(null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.props.some((function(e){var t;if(e.isRequired){var r=(o.propValues||{})[e.name],i=null===(t=o.pageComponentPropValue)||void 0===t?void 0:t.component.props.find((function(o){return o.id===e.requiredPropId}));if(i){var n=(o.propValues||{})[i.name];if(i.type===u.BOOLEAN&&!n||i.type===u.CUSTOM&&n!==e.requiredEnumOptionValue)return!1}return null===r||null==r}})))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"rendered",{get:function(){var e,i,n=this.Component,a=this.props.vm;return this.hasNullValue||this.state.hasError?t.createElement(r,{name:null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.displayName}):t.createElement(n,o({},this.propValues,{store:x.getInstance(),settings:null===(i=a.theme)||void 0===i?void 0:i.settings,pageSpecificData:g.pageSpecificData}))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"Component",{get:function(){var e,o=this.props,t=o.vm,r=o.pageComponent,i=v.getCurrentPageComponents();if(!i)return null;var n=i[r.componentId];return(null===(e=t.page)||void 0===e?void 0:e.type)===s.CHECKOUT&&(n=a),n},enumerable:!1,configurable:!0}),y.prototype.render=function(){var e=this;return t.createElement(d,null,(function(){var o;return e.state.hasError?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onClick:e.onClick},t.createElement(r,{name:null===(o=e.pageComponentPropValue)||void 0===o?void 0:o.component.displayName})):v.getCurrentPageComponents()?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave},e.rendered):(console.error("Components for the page not found."),null)}))},y}(t.Component);export{h as ThemeEditorComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import{IkasBlogMetaDataTargetType as i}from"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as n}from"@ikas/storefront-models";import{reaction as s,makeAutoObservable as a,runInAction as r}from"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import{IkasHTMLMetaDataTargetType as d}from"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import{IkasThemeJson as p}from"../../models/data/theme-json/index.js";import{IkasStorefront as l}from"../../models/data/storefront/index.js";import{IkasThemeJsonComponent as c}from"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as m}from"../../models/data/theme-json/page/component/index.js";import{IkasThemeJsonSettings as u}from"../../models/data/theme-json/settings/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasPageDataProvider as g}from"@ikas/storefront-providers";import{IkasPageDataInit as h}from"../../page-data-init/index.js";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"../page/index.js";import"../page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"./loader/style.module.scss.js";import"../google-captcha/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import{IkasBaseStore as f}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";import E from"../../store/html-meta-data/index.js";import v from"../../store/blog/index.js";import P from"../../store/raffle/index.js";import O from"../../store/product/index.js";import{setAPIClientConfig as T,listCustomerSettings as C}from"@ikas/storefront-api";var _,j=function(){function j(s){var O=this;this.theme=null,this.page=null,this.selectedPageComponentId=null,this.hoveredPageComponentId=null,this.componentRefs={},this.isLoading=!1,this.updateId="",this.locale="en",this.pageParams={},this.apiKey=null,this.pageDataProvider=null,this.initializedPropValues=[],this.startMessaging=function(){window.addEventListener("message",O.onMessage,!1),O.sendMessage(_.FRAME_DID_LOAD,"5.0.0"),O.createLoadingListener()},this.onMessage=function(o){return e(O,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:switch(e=o.data.type,i=o.data.data,e){case _.UPDATE_FRAME_DATA:return[3,1];case _.UPDATE_THEME_JSON:return[3,3];case _.UPDATE_PROP_VALUE:return[3,5];case _.UPDATE_PAGE_PARAMS:return[3,7];case _.UPDATE_PAGE_COMPONENT_ORDER:return[3,9];case _.ADD_COMPONENT:return[3,11];case _.DELETE_COMPONENT:return[3,12];case _.UPDATE_COMPONENT:return[3,13];case _.ADD_PAGE_COMPONENT:return[3,14];case _.DELETE_PAGE_COMPONENT:return[3,16];case _.SET_SELECTED_COMPONENT:return[3,17];case _.SET_HOVERED_COMPONENT:return[3,18];case _.SCROLL_TO_COMPONENT:return[3,19];case _.EDITOR_RELOAD:return[3,20];case _.UPDATE_THEME_SETTINGS:return[3,21]}return[3,22];case 1:return[4,this.handleUpdateFrameData(i)];case 2:case 4:case 6:case 8:case 10:case 15:return t.sent(),[3,23];case 3:return[4,this.handleUpdateThemeJson(i)];case 5:return[4,this.handleUpdatePropValue(i)];case 7:return[4,this.handleUpdatePageParams(i)];case 9:return[4,this.handleUpdatePageComponentOrder(i)];case 11:return this.handleAddNewComponent(i),[3,23];case 12:return this.handleDeleteComponent(i),[3,23];case 13:return this.handleUpdateComponent(i),[3,23];case 14:return[4,this.handleAddNewPageComponent(i)];case 16:return this.handleDeletePageComponent(i),[3,23];case 17:return this.handleSetSelectedComponent(i),[3,23];case 18:return this.handleSetHoveredComponent(i),[3,23];case 19:return this.handleScrollToComponent(i),[3,23];case 20:return this.handleEditorReload(),[3,23];case 21:return this.updateThemeSettings(i),[3,23];case 22:return[3,23];case 23:return[2]}}))}))},this.onClick=function(e){O.sendMessage(_.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){O.sendMessage(_.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){O.sendMessage(_.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(o){return e(O,void 0,void 0,(function(){var e,s,a,p,l,c,m,u,g,h,O,T,C,j=this;return t(this,(function(t){switch(t.label){case 0:return e=o.slice(1),s=e.split("?"),e=s[0],a=s[1],this.pageParams={},o.startsWith("/account/orders/")?p=n.ORDER_DETAIL:o.startsWith("/account/orders")?p=n.ORDERS:o.startsWith("/account/addresses")?p=n.ADDRESSES:o.startsWith("/account/favorite-products")?p=n.FAVORITE_PRODUCTS:o.startsWith("/account/forgot-password")?p=n.FORGOT_PASSWORD:o.startsWith("/account/login")?p=n.LOGIN:o.startsWith("/account/raffles")?p=n.RAFFLE_ACCOUNT:o.startsWith("/account/recover-password")?p=n.RECOVER_PASSWORD:o.startsWith("/account/activate")?p=n.ACTIVATE_CUSTOMER:o.startsWith("/account/register")?p=n.REGISTER:o.startsWith("/account")?p=n.ACCOUNT:o.startsWith("/blog/")?p=n.BLOG:o.startsWith("/blog")?p=n.BLOG_INDEX:o.startsWith("/pages")?(p=n.CUSTOM,this.pageParams={slug:e.split("/")[1]}):p=o.startsWith("/raffle/")?n.RAFFLE_DETAIL:o.startsWith("/raffle")?n.RAFFLE:o.startsWith("/404")?n.NOT_FOUND:"/cart"===o||"/cart/"===o?n.CART:o.startsWith("/checkout")?n.CHECKOUT:"/"===o?n.INDEX:o.startsWith("/search")?n.SEARCH:n.PRODUCT,p!==n.PRODUCT?[3,6]:[4,E.listHTMLMetaData({slug:{eq:e}})];case 1:return(c=t.sent()).isSuccess&&(null===(g=c.data)||void 0===g?void 0:g.length)?(m=c.data[0]).targetType!==d.PRODUCT?[3,3]:[4,this.getVariantIdFromParams(m.targetId,a)]:[3,5];case 2:return l=t.sent(),this.pageParams={productId:m.targetId,variantId:l,slug:e},[3,4];case 3:if(m.targetType===d.CATEGORY)p=n.CATEGORY,this.pageParams={categoryId:m.targetId,slug:e};else{if(m.targetType!==d.BRAND)return[2];p=n.BRAND,this.pageParams={brandId:m.targetId,slug:e}}t.label=4;case 4:return[3,6];case 5:return[2];case 6:return p!==n.BLOG?[3,8]:[4,v.listBlogMetaData({slug:{eq:e}})];case 7:if(!(c=t.sent()).isSuccess||!(null===(O=null===(h=c.data)||void 0===h?void 0:h.data)||void 0===O?void 0:O.length))return[2];if((m=c.data.data[0]).targetType===i.BLOG)this.pageParams={blogId:m.targetId,slug:e};else{if(m.targetType!==i.BLOG_CATEGORY)return[2];p=n.BLOG_CATEGORY,this.pageParams={blogCategoryId:m.targetId,slug:e}}t.label=8;case 8:return p!==n.RAFFLE_DETAIL?[3,10]:[4,P.listRaffleMetaData({slug:{eq:e}})];case 9:if(!(c=t.sent()).isSuccess||!(null===(T=c.data)||void 0===T?void 0:T.length))return[2];m=c.data[0],this.pageParams={raffleId:m.targetId,slug:e},t.label=10;case 10:return this.isLoading=!0,[4,this.getPagePropValues(this.theme,p,this.pageParams)];case 11:return u=t.sent(),r((function(){var e,t;f.getInstance().currentPageType=p,j.pageDataProvider=u,p===n.CUSTOM?j.page=null===(e=j.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===p&&e.slug===j.pageParams.slug})):j.page=null===(t=j.theme)||void 0===t?void 0:t.pages.find((function(e){return e.type===p})),j.setCurrentPageType(),requestAnimationFrame((function(){document.body.scrollTop=0,document.scrollingElement&&(document.scrollingElement.scrollTop=0)}))})),this.sendMessage(_.EDITOR_PAGE_CHANGE,{pageType:p,pageParams:this.pageParams,pageSpecificData:(null===(C=this.pageDataProvider)||void 0===C?void 0:C.pageSpecificData)||null}),this.isLoading=!1,[2]}}))}))},this.onLoadingChange=function(){O.sendMessage(_.EDITOR_LOADING_CHANGE,{isLoading:O.isLoading})},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(o,i,s){return e(O,void 0,void 0,(function(){var e,a,r;return t(this,(function(t){switch(t.label){case 0:return e=new g(o,s,i),(s.blogId||s.blogCategoryId)&&(e.possiblePageTypes=[n.BLOG,n.BLOG_CATEGORY]),s.raffleId&&(e.possiblePageTypes=[n.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData?(h.setPageSpecificData(e.pageSpecificData,i,!0),i===n.PRODUCT&&h.pageSpecificData&&(a=h.pageSpecificData,(r=a.variants.find((function(e){return e.id===s.variantId})))&&(a.selectedVariantValues=r.variantValues))):h.pageSpecificData=void 0,this.initializedPropValues=h.initPagePropValues(e.$pageComponentPropValues,o.components,o.customData,o.settings,!1),[2,e]}}))}))},this.setComponentRef=function(e,t){O.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),o=t.top,i=t.bottom;return o<window.innerHeight&&i>=0&&i<window.innerHeight&&o>0},this.handleUpdateFrameData=function(i){return e(O,void 0,void 0,(function(){var e,n,s,a,r,d,c=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new p(i.theme),this.page=null===(r=this.theme)||void 0===r?void 0:r.pages.find((function(e){return e.id===i.selectedPage.id})),this.pageParams=i.pageParams,this.apiKey=i.apiKey,this.locale=i.locale||"en",this.translations=i.translations||void 0,this.setCurrentPageType(),this.page?((e=i.storefront?new l(i.storefront):null)&&(n=e.routings.find((function(e){return e.locale===c.locale})),o.init({storefrontId:e.id,storefrontRoutingId:null==n?void 0:n.id,storefrontThemeId:e.mainStorefrontThemeId||void 0,salesChannelId:e.salesChannelId||void 0,priceListId:(null==n?void 0:n.priceListId)||void 0,routings:e.routings,stockPreference:null===(d=this.theme)||void 0===d?void 0:d.settings.stockPreference,translations:this.translations||o.getTranslations(),isEditor:!0,apiKey:i.apiKey,apiUrl:i.apiUrl,cdnUrl:i.cdnUrl,merchantSettings:i.merchantSettings}),T(),this.setCustomerSettings()),s=Date.now()+"",this.updateId=s,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return a=t.sent(),this.updateId===s&&(this.pageDataProvider=a,this.isLoading=!1),[2]}}))}))},this.setCustomerSettings=function(){return e(O,void 0,void 0,(function(){var e,i,n;return t(this,(function(t){switch(t.label){case 0:return o.getCustomerSettings()?[3,2]:[4,C({storefrontId:{eq:o.getStorefrontId()}})];case 1:(e=t.sent()).isSuccess&&(null===(n=e.data)||void 0===n?void 0:n.data.length)&&(i=e.data.data[0],o.init({customerSettings:i})),t.label=2;case 2:return[2]}}))}))},this.handleUpdateThemeJson=function(o){return e(O,void 0,void 0,(function(){return t(this,(function(e){return this.theme=new p(o.theme),[2]}))}))},this.handleUpdatePropValue=function(o){return e(O,void 0,void 0,(function(){var e,i,n,s,a,r,d,p=this;return t(this,(function(t){switch(t.label){case 0:return e=o.propName,i=o.value,(n=null===(d=null===(r=this.selectedComponent)||void 0===r?void 0:r.props)||void 0===d?void 0:d.find((function(t){return t.name===e})))&&this.selectedPageComponent?(s=this.initializedPropValues.find((function(e){return e.pageComponent.id===p.selectedPageComponentId})),this.pageDataProvider&&s?(this.selectedPageComponent.propValues[e]=i,[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,n)]):[2]):[2];case 1:return(a=t.sent())&&JSON.stringify(a).includes("href")?[4,this.pageDataProvider.setLinkSlugs()]:[3,3];case 2:t.sent(),t.label=3;case 3:return s.propValues[e]=h.initPropValue(n,a,this.theme.settings,!0),[2]}}))}))},this.handleUpdatePageParams=function(o){return e(O,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=o.pageParams,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})];case 1:return e=t.sent(),this.pageDataProvider=e,this.isLoading=!1,[2]}}))}))},this.handleUpdatePageComponentOrder=function(o){return e(O,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=o.pageComponents.map((function(e){return new m(e)})):this.page.components=o.pageComponents.map((function(e){return new m(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,o=new c(e.component);null===(t=O.theme)||void 0===t||t.components.push(o)},this.handleDeleteComponent=function(e){var t,o;(null===(t=O.theme)||void 0===t?void 0:t.components)&&(O.theme.components=O.theme.components.filter((function(t){return t.id!==e.componentId})));var i=O.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];O.specification&&O.specification.components&&(O.specification.components=i),!O.specification&&(null===(o=O.page)||void 0===o?void 0:o.components)&&(O.page.components=i)},this.handleUpdateComponent=function(e){var t=O.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(O.theme.components[t]=new c(e.component))},this.handleAddNewPageComponent=function(o){return e(O,void 0,void 0,(function(){var e,i,s,a,r,d,p;return t(this,(function(t){switch(t.label){case 0:return e=new m(o.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return i=t.sent(),s=h.initPageComponentPropValue(i,[i.component],this.theme.settings,!0),this.initializedPropValues.push(s),(null===(d=this.page)||void 0===d?void 0:d.type)===n.CHECKOUT?[2]:(a=null===(p=this.theme)||void 0===p?void 0:p.components.find((function(t){return t.id===e.componentId})),r=this.pageComponents.find((function(e){return e.componentId===(null==a?void 0:a.id)})),(null==a?void 0:a.isCommon)&&r||(o.customIndex?this.pageComponents.splice(o.customIndex,0,e):this.pageComponents.push(e)),[2])}}))}))},this.handleDeletePageComponent=function(e){O.specification?O.specification.components=O.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):O.page.components=O.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){O.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){O.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,o=O.componentRefs[t];o&&(O.isScrolledIntoView(o)||window.scrollTo({top:o.offsetTop,behavior:"smooth"}))},this.handleEditorReload=function(){window.location.reload()},this.updateThemeSettings=function(e){var t=e.settings;O.theme&&(O.theme.settings=new u(t))},this.router=s,a(this),this.startMessaging()}return Object.defineProperty(j.prototype,"specification",{get:function(){var e,t,o,i,s,a,r,d=this,p=this.page;return(null==p?void 0:p.type)===n.PRODUCT&&(r=null===(e=p.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.productId)}))),(null==p?void 0:p.type)===n.CATEGORY&&(r=null===(t=p.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.categoryId)}))),(null==p?void 0:p.type)===n.BRAND&&(r=null===(o=p.specifications)||void 0===o?void 0:o.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.brandId)}))),(null==p?void 0:p.type)===n.BLOG&&(r=null===(i=p.specifications)||void 0===i?void 0:i.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogId)}))),(null==p?void 0:p.type)===n.BLOG_CATEGORY&&(r=null===(s=p.specifications)||void 0===s?void 0:s.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogCategoryId)}))),(null==p?void 0:p.type)===n.RAFFLE_DETAIL&&(r=null===(a=p.specifications)||void 0===a?void 0:a.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.raffleId)}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedComponent",{get:function(){var e,t=this;return null===(e=this.theme)||void 0===e?void 0:e.components.find((function(e){var o;return e.id===(null===(o=t.selectedPageComponent)||void 0===o?void 0:o.componentId)}))},enumerable:!1,configurable:!0}),j.prototype.createLoadingListener=function(){var e=this;s((function(){return e.isLoading}),(function(){e.onLoadingChange()}))},j.prototype.getVariantIdFromParams=function(i,n){var s,a;return e(this,void 0,void 0,(function(){var e,r,d,p,l,c,m;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new URLSearchParams("?"+n),[4,O.searchProducts({input:{productIdList:[i],priceListId:o.getPriceListId(),salesChannelId:o.getSalesChannelId()}})];case 1:return(r=t.sent()).isSuccess&&!(null===(a=null===(s=null==r?void 0:r.data)||void 0===s?void 0:s.data)||void 0===a?void 0:a.length)?[2]:(d=r.data.data[0],p=d.variantTypes.map((function(e){return e.variantType.slug})),l=[],p.forEach((function(t,o){var i=d.variantTypes[o],n=e.get(t);if(n){var s=i.variantType.values.find((function(e){return e.slug===n}));s&&l.push(s)}})),(c=d.variants.find((function(e){return e.variantValues.every((function(e){return l.some((function(t){return t.id===e.id}))}))})))?[2,c.id]:[3,3]);case 2:return m=t.sent(),console.error(m),[3,3];case 3:return[2]}}))}))},j.prototype.setCurrentPageType=function(){this.page&&(f.getInstance().currentPageType=this.page.type)},j}();!function(e){e.FRAME_DID_LOAD="FRAME_DID_LOAD",e.UPDATE_FRAME_DATA="UPDATE_FRAME_DATA",e.UPDATE_THEME_JSON="UPDATE_THEME_JSON",e.UPDATE_PROP_VALUE="UPDATE_PROP_VALUE",e.UPDATE_PAGE_PARAMS="UPDATE_PAGE_PARAMS",e.UPDATE_PAGE_COMPONENT_ORDER="UPDATE_PAGE_COMPONENT_ORDER",e.ADD_COMPONENT="ADD_COMPONENT",e.DELETE_COMPONENT="DELETE_COMPONENT",e.UPDATE_COMPONENT="UPDATE_COMPONENT",e.ADD_PAGE_COMPONENT="ADD_PAGE_COMPONENT",e.DELETE_PAGE_COMPONENT="DELETE_PAGE_COMPONENT",e.COMPONENT_MOUSE_OVER="COMPONENT_MOUSE_OVER",e.COMPONENT_MOUSE_LEAVE="COMPONENT_MOUSE_LEAVE",e.COMPONENT_CLICK="COMPONENT_CLICK",e.SET_SELECTED_COMPONENT="SET_SELECTED_COMPONENT",e.SET_HOVERED_COMPONENT="SET_HOVERED_COMPONENT",e.SCROLL_TO_COMPONENT="SCROLL_TO_COMPONENT",e.UPDATE_THEME_SETTINGS="UPDATE_THEME_SETTINGS",e.EDITOR_PAGE_CHANGE="EDITOR_PAGE_CHANGE",e.EDITOR_LOADING_CHANGE="EDITOR_LOADING_CHANGE",e.EDITOR_RELOAD="EDITOR_RELOAD"}(_||(_={}));export{_ as BridgeMessageType,j as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import{IkasBlogMetaDataTargetType as i}from"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as n}from"@ikas/storefront-models";import{reaction as s,makeAutoObservable as a,runInAction as r}from"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import{IkasHTMLMetaDataTargetType as d}from"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import{IkasThemeJson as p}from"../../models/data/theme-json/index.js";import{IkasStorefront as l}from"../../models/data/storefront/index.js";import{IkasThemeJsonComponent as c}from"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as m}from"../../models/data/theme-json/page/component/index.js";import{IkasThemeJsonSettings as u}from"../../models/data/theme-json/settings/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasPageDataProvider as g}from"@ikas/storefront-providers";import{IkasPageDataInit as h}from"../../page-data-init/index.js";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"../page/index.js";import"../page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"./loader/style.module.scss.js";import"../google-captcha/index.js";import"../paypal-express-checkout/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import{IkasBaseStore as f}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";import E from"../../store/html-meta-data/index.js";import v from"../../store/blog/index.js";import P from"../../store/raffle/index.js";import O from"../../store/product/index.js";import{setAPIClientConfig as T,listCustomerSettings as C}from"@ikas/storefront-api";var _,j=function(){function j(s){var O=this;this.theme=null,this.page=null,this.selectedPageComponentId=null,this.hoveredPageComponentId=null,this.componentRefs={},this.isLoading=!1,this.updateId="",this.locale="en",this.pageParams={},this.apiKey=null,this.pageDataProvider=null,this.initializedPropValues=[],this.startMessaging=function(){window.addEventListener("message",O.onMessage,!1),O.sendMessage(_.FRAME_DID_LOAD,"5.0.0"),O.createLoadingListener()},this.onMessage=function(o){return e(O,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:switch(e=o.data.type,i=o.data.data,e){case _.UPDATE_FRAME_DATA:return[3,1];case _.UPDATE_THEME_JSON:return[3,3];case _.UPDATE_PROP_VALUE:return[3,5];case _.UPDATE_PAGE_PARAMS:return[3,7];case _.UPDATE_PAGE_COMPONENT_ORDER:return[3,9];case _.ADD_COMPONENT:return[3,11];case _.DELETE_COMPONENT:return[3,12];case _.UPDATE_COMPONENT:return[3,13];case _.ADD_PAGE_COMPONENT:return[3,14];case _.DELETE_PAGE_COMPONENT:return[3,16];case _.SET_SELECTED_COMPONENT:return[3,17];case _.SET_HOVERED_COMPONENT:return[3,18];case _.SCROLL_TO_COMPONENT:return[3,19];case _.EDITOR_RELOAD:return[3,20];case _.UPDATE_THEME_SETTINGS:return[3,21]}return[3,22];case 1:return[4,this.handleUpdateFrameData(i)];case 2:case 4:case 6:case 8:case 10:case 15:return t.sent(),[3,23];case 3:return[4,this.handleUpdateThemeJson(i)];case 5:return[4,this.handleUpdatePropValue(i)];case 7:return[4,this.handleUpdatePageParams(i)];case 9:return[4,this.handleUpdatePageComponentOrder(i)];case 11:return this.handleAddNewComponent(i),[3,23];case 12:return this.handleDeleteComponent(i),[3,23];case 13:return this.handleUpdateComponent(i),[3,23];case 14:return[4,this.handleAddNewPageComponent(i)];case 16:return this.handleDeletePageComponent(i),[3,23];case 17:return this.handleSetSelectedComponent(i),[3,23];case 18:return this.handleSetHoveredComponent(i),[3,23];case 19:return this.handleScrollToComponent(i),[3,23];case 20:return this.handleEditorReload(),[3,23];case 21:return this.updateThemeSettings(i),[3,23];case 22:return[3,23];case 23:return[2]}}))}))},this.onClick=function(e){O.sendMessage(_.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){O.sendMessage(_.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){O.sendMessage(_.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(o){return e(O,void 0,void 0,(function(){var e,s,a,p,l,c,m,u,g,h,O,T,C,j=this;return t(this,(function(t){switch(t.label){case 0:return e=o.slice(1),s=e.split("?"),e=s[0],a=s[1],this.pageParams={},o.startsWith("/account/orders/")?p=n.ORDER_DETAIL:o.startsWith("/account/orders")?p=n.ORDERS:o.startsWith("/account/addresses")?p=n.ADDRESSES:o.startsWith("/account/favorite-products")?p=n.FAVORITE_PRODUCTS:o.startsWith("/account/forgot-password")?p=n.FORGOT_PASSWORD:o.startsWith("/account/login")?p=n.LOGIN:o.startsWith("/account/raffles")?p=n.RAFFLE_ACCOUNT:o.startsWith("/account/recover-password")?p=n.RECOVER_PASSWORD:o.startsWith("/account/activate")?p=n.ACTIVATE_CUSTOMER:o.startsWith("/account/register")?p=n.REGISTER:o.startsWith("/account")?p=n.ACCOUNT:o.startsWith("/blog/")?p=n.BLOG:o.startsWith("/blog")?p=n.BLOG_INDEX:o.startsWith("/pages")?(p=n.CUSTOM,this.pageParams={slug:e.split("/")[1]}):p=o.startsWith("/raffle/")?n.RAFFLE_DETAIL:o.startsWith("/raffle")?n.RAFFLE:o.startsWith("/404")?n.NOT_FOUND:"/cart"===o||"/cart/"===o?n.CART:o.startsWith("/checkout")?n.CHECKOUT:"/"===o?n.INDEX:o.startsWith("/search")?n.SEARCH:n.PRODUCT,p!==n.PRODUCT?[3,6]:[4,E.listHTMLMetaData({slug:{eq:e}})];case 1:return(c=t.sent()).isSuccess&&(null===(g=c.data)||void 0===g?void 0:g.length)?(m=c.data[0]).targetType!==d.PRODUCT?[3,3]:[4,this.getVariantIdFromParams(m.targetId,a)]:[3,5];case 2:return l=t.sent(),this.pageParams={productId:m.targetId,variantId:l,slug:e},[3,4];case 3:if(m.targetType===d.CATEGORY)p=n.CATEGORY,this.pageParams={categoryId:m.targetId,slug:e};else{if(m.targetType!==d.BRAND)return[2];p=n.BRAND,this.pageParams={brandId:m.targetId,slug:e}}t.label=4;case 4:return[3,6];case 5:return[2];case 6:return p!==n.BLOG?[3,8]:[4,v.listBlogMetaData({slug:{eq:e}})];case 7:if(!(c=t.sent()).isSuccess||!(null===(O=null===(h=c.data)||void 0===h?void 0:h.data)||void 0===O?void 0:O.length))return[2];if((m=c.data.data[0]).targetType===i.BLOG)this.pageParams={blogId:m.targetId,slug:e};else{if(m.targetType!==i.BLOG_CATEGORY)return[2];p=n.BLOG_CATEGORY,this.pageParams={blogCategoryId:m.targetId,slug:e}}t.label=8;case 8:return p!==n.RAFFLE_DETAIL?[3,10]:[4,P.listRaffleMetaData({slug:{eq:e}})];case 9:if(!(c=t.sent()).isSuccess||!(null===(T=c.data)||void 0===T?void 0:T.length))return[2];m=c.data[0],this.pageParams={raffleId:m.targetId,slug:e},t.label=10;case 10:return this.isLoading=!0,[4,this.getPagePropValues(this.theme,p,this.pageParams)];case 11:return u=t.sent(),r((function(){var e,t;f.getInstance().currentPageType=p,j.pageDataProvider=u,p===n.CUSTOM?j.page=null===(e=j.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===p&&e.slug===j.pageParams.slug})):j.page=null===(t=j.theme)||void 0===t?void 0:t.pages.find((function(e){return e.type===p})),j.setCurrentPageType(),requestAnimationFrame((function(){document.body.scrollTop=0,document.scrollingElement&&(document.scrollingElement.scrollTop=0)}))})),this.sendMessage(_.EDITOR_PAGE_CHANGE,{pageType:p,pageParams:this.pageParams,pageSpecificData:(null===(C=this.pageDataProvider)||void 0===C?void 0:C.pageSpecificData)||null}),this.isLoading=!1,[2]}}))}))},this.onLoadingChange=function(){O.sendMessage(_.EDITOR_LOADING_CHANGE,{isLoading:O.isLoading})},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(o,i,s){return e(O,void 0,void 0,(function(){var e,a,r;return t(this,(function(t){switch(t.label){case 0:return e=new g(o,s,i),(s.blogId||s.blogCategoryId)&&(e.possiblePageTypes=[n.BLOG,n.BLOG_CATEGORY]),s.raffleId&&(e.possiblePageTypes=[n.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData?(h.setPageSpecificData(e.pageSpecificData,i,!0),i===n.PRODUCT&&h.pageSpecificData&&(a=h.pageSpecificData,(r=a.variants.find((function(e){return e.id===s.variantId})))&&(a.selectedVariantValues=r.variantValues))):h.pageSpecificData=void 0,this.initializedPropValues=h.initPagePropValues(e.$pageComponentPropValues,o.components,o.customData,o.settings,!1),[2,e]}}))}))},this.setComponentRef=function(e,t){O.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),o=t.top,i=t.bottom;return o<window.innerHeight&&i>=0&&i<window.innerHeight&&o>0},this.handleUpdateFrameData=function(i){return e(O,void 0,void 0,(function(){var e,n,s,a,r,d,c=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new p(i.theme),this.page=null===(r=this.theme)||void 0===r?void 0:r.pages.find((function(e){return e.id===i.selectedPage.id})),this.pageParams=i.pageParams,this.apiKey=i.apiKey,this.locale=i.locale||"en",this.translations=i.translations||void 0,this.setCurrentPageType(),this.page?((e=i.storefront?new l(i.storefront):null)&&(n=e.routings.find((function(e){return e.locale===c.locale})),o.init({storefrontId:e.id,storefrontRoutingId:null==n?void 0:n.id,storefrontThemeId:e.mainStorefrontThemeId||void 0,salesChannelId:e.salesChannelId||void 0,priceListId:(null==n?void 0:n.priceListId)||void 0,routings:e.routings,stockPreference:null===(d=this.theme)||void 0===d?void 0:d.settings.stockPreference,translations:this.translations||o.getTranslations(),isEditor:!0,apiKey:i.apiKey,apiUrl:i.apiUrl,cdnUrl:i.cdnUrl,merchantSettings:i.merchantSettings}),T(),this.setCustomerSettings()),s=Date.now()+"",this.updateId=s,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return a=t.sent(),this.updateId===s&&(this.pageDataProvider=a,this.isLoading=!1),[2]}}))}))},this.setCustomerSettings=function(){return e(O,void 0,void 0,(function(){var e,i,n;return t(this,(function(t){switch(t.label){case 0:return o.getCustomerSettings()?[3,2]:[4,C({storefrontId:{eq:o.getStorefrontId()}})];case 1:(e=t.sent()).isSuccess&&(null===(n=e.data)||void 0===n?void 0:n.data.length)&&(i=e.data.data[0],o.init({customerSettings:i})),t.label=2;case 2:return[2]}}))}))},this.handleUpdateThemeJson=function(o){return e(O,void 0,void 0,(function(){return t(this,(function(e){return this.theme=new p(o.theme),[2]}))}))},this.handleUpdatePropValue=function(o){return e(O,void 0,void 0,(function(){var e,i,n,s,a,r,d,p=this;return t(this,(function(t){switch(t.label){case 0:return e=o.propName,i=o.value,(n=null===(d=null===(r=this.selectedComponent)||void 0===r?void 0:r.props)||void 0===d?void 0:d.find((function(t){return t.name===e})))&&this.selectedPageComponent?(s=this.initializedPropValues.find((function(e){return e.pageComponent.id===p.selectedPageComponentId})),this.pageDataProvider&&s?(this.selectedPageComponent.propValues[e]=i,[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,n)]):[2]):[2];case 1:return(a=t.sent())&&JSON.stringify(a).includes("href")?[4,this.pageDataProvider.setLinkSlugs()]:[3,3];case 2:t.sent(),t.label=3;case 3:return s.propValues[e]=h.initPropValue(n,a,this.theme.settings,!0),[2]}}))}))},this.handleUpdatePageParams=function(o){return e(O,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=o.pageParams,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})];case 1:return e=t.sent(),this.pageDataProvider=e,this.isLoading=!1,[2]}}))}))},this.handleUpdatePageComponentOrder=function(o){return e(O,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=o.pageComponents.map((function(e){return new m(e)})):this.page.components=o.pageComponents.map((function(e){return new m(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,o=new c(e.component);null===(t=O.theme)||void 0===t||t.components.push(o)},this.handleDeleteComponent=function(e){var t,o;(null===(t=O.theme)||void 0===t?void 0:t.components)&&(O.theme.components=O.theme.components.filter((function(t){return t.id!==e.componentId})));var i=O.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];O.specification&&O.specification.components&&(O.specification.components=i),!O.specification&&(null===(o=O.page)||void 0===o?void 0:o.components)&&(O.page.components=i)},this.handleUpdateComponent=function(e){var t=O.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(O.theme.components[t]=new c(e.component))},this.handleAddNewPageComponent=function(o){return e(O,void 0,void 0,(function(){var e,i,s,a,r,d,p;return t(this,(function(t){switch(t.label){case 0:return e=new m(o.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return i=t.sent(),s=h.initPageComponentPropValue(i,[i.component],this.theme.settings,!0),this.initializedPropValues.push(s),(null===(d=this.page)||void 0===d?void 0:d.type)===n.CHECKOUT?[2]:(a=null===(p=this.theme)||void 0===p?void 0:p.components.find((function(t){return t.id===e.componentId})),r=this.pageComponents.find((function(e){return e.componentId===(null==a?void 0:a.id)})),(null==a?void 0:a.isCommon)&&r||(o.customIndex?this.pageComponents.splice(o.customIndex,0,e):this.pageComponents.push(e)),[2])}}))}))},this.handleDeletePageComponent=function(e){O.specification?O.specification.components=O.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):O.page.components=O.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){O.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){O.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,o=O.componentRefs[t];o&&(O.isScrolledIntoView(o)||window.scrollTo({top:o.offsetTop,behavior:"smooth"}))},this.handleEditorReload=function(){window.location.reload()},this.updateThemeSettings=function(e){var t=e.settings;O.theme&&(O.theme.settings=new u(t))},this.router=s,a(this),this.startMessaging()}return Object.defineProperty(j.prototype,"specification",{get:function(){var e,t,o,i,s,a,r,d=this,p=this.page;return(null==p?void 0:p.type)===n.PRODUCT&&(r=null===(e=p.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.productId)}))),(null==p?void 0:p.type)===n.CATEGORY&&(r=null===(t=p.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.categoryId)}))),(null==p?void 0:p.type)===n.BRAND&&(r=null===(o=p.specifications)||void 0===o?void 0:o.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.brandId)}))),(null==p?void 0:p.type)===n.BLOG&&(r=null===(i=p.specifications)||void 0===i?void 0:i.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogId)}))),(null==p?void 0:p.type)===n.BLOG_CATEGORY&&(r=null===(s=p.specifications)||void 0===s?void 0:s.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogCategoryId)}))),(null==p?void 0:p.type)===n.RAFFLE_DETAIL&&(r=null===(a=p.specifications)||void 0===a?void 0:a.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.raffleId)}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedComponent",{get:function(){var e,t=this;return null===(e=this.theme)||void 0===e?void 0:e.components.find((function(e){var o;return e.id===(null===(o=t.selectedPageComponent)||void 0===o?void 0:o.componentId)}))},enumerable:!1,configurable:!0}),j.prototype.createLoadingListener=function(){var e=this;s((function(){return e.isLoading}),(function(){e.onLoadingChange()}))},j.prototype.getVariantIdFromParams=function(i,n){var s,a;return e(this,void 0,void 0,(function(){var e,r,d,p,l,c,m;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new URLSearchParams("?"+n),[4,O.searchProducts({input:{productIdList:[i],priceListId:o.getPriceListId(),salesChannelId:o.getSalesChannelId()}})];case 1:return(r=t.sent()).isSuccess&&!(null===(a=null===(s=null==r?void 0:r.data)||void 0===s?void 0:s.data)||void 0===a?void 0:a.length)?[2]:(d=r.data.data[0],p=d.variantTypes.map((function(e){return e.variantType.slug})),l=[],p.forEach((function(t,o){var i=d.variantTypes[o],n=e.get(t);if(n){var s=i.variantType.values.find((function(e){return e.slug===n}));s&&l.push(s)}})),(c=d.variants.find((function(e){return e.variantValues.every((function(e){return l.some((function(t){return t.id===e.id}))}))})))?[2,c.id]:[3,3]);case 2:return m=t.sent(),console.error(m),[3,3];case 3:return[2]}}))}))},j.prototype.setCurrentPageType=function(){this.page&&(f.getInstance().currentPageType=this.page.type)},j}();!function(e){e.FRAME_DID_LOAD="FRAME_DID_LOAD",e.UPDATE_FRAME_DATA="UPDATE_FRAME_DATA",e.UPDATE_THEME_JSON="UPDATE_THEME_JSON",e.UPDATE_PROP_VALUE="UPDATE_PROP_VALUE",e.UPDATE_PAGE_PARAMS="UPDATE_PAGE_PARAMS",e.UPDATE_PAGE_COMPONENT_ORDER="UPDATE_PAGE_COMPONENT_ORDER",e.ADD_COMPONENT="ADD_COMPONENT",e.DELETE_COMPONENT="DELETE_COMPONENT",e.UPDATE_COMPONENT="UPDATE_COMPONENT",e.ADD_PAGE_COMPONENT="ADD_PAGE_COMPONENT",e.DELETE_PAGE_COMPONENT="DELETE_PAGE_COMPONENT",e.COMPONENT_MOUSE_OVER="COMPONENT_MOUSE_OVER",e.COMPONENT_MOUSE_LEAVE="COMPONENT_MOUSE_LEAVE",e.COMPONENT_CLICK="COMPONENT_CLICK",e.SET_SELECTED_COMPONENT="SET_SELECTED_COMPONENT",e.SET_HOVERED_COMPONENT="SET_HOVERED_COMPONENT",e.SCROLL_TO_COMPONENT="SCROLL_TO_COMPONENT",e.UPDATE_THEME_SETTINGS="UPDATE_THEME_SETTINGS",e.EDITOR_PAGE_CHANGE="EDITOR_PAGE_CHANGE",e.EDITOR_LOADING_CHANGE="EDITOR_LOADING_CHANGE",e.EDITOR_RELOAD="EDITOR_RELOAD"}(_||(_={}));export{_ as BridgeMessageType,j as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IkasProduct } from "../../models";
|
|
3
|
+
declare type PaypalExpressCheckoutProps = {
|
|
4
|
+
product: IkasProduct;
|
|
5
|
+
errorMessage?: string;
|
|
6
|
+
quantity?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const PaypalExpressCheckout: React.FC<PaypalExpressCheckoutProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as r}from'./../../ext/tslib/tslib.es6.js';import*as n from"react";import{observer as o}from"mobx-react-lite";import{IkasBaseStore as i}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import a from"../../store/checkout/index.js";import{IkasStorefrontConfig as u}from"@ikas/storefront-config";import{getStorefrontSettings as s}from"@ikas/storefront-api";var c=o((function(o){var c=o.product,l=o.errorMessage,d=o.quantity,p=void 0===d?1:d,f=i.getInstance(),v=f.customerStore.customer,h=n.useState(""),m=h[0],g=h[1],y=n.useState(!1),w=y[0],b=y[1],S=n.useState(null),I=S[0],P=S[1],C=n.useRef(null),E=n.useRef(null),U=n.useRef(null),j=n.useRef(null),R=function(t){U.current=t};n.useEffect((function(){t(void 0,void 0,void 0,(function(){var t,r,n;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,a.getPayPalClientId({})];case 1:return t=e.sent(),g((null===(n=t.data)||void 0===n?void 0:n.clientId)||""),[3,3];case 2:return r=e.sent(),console.error("Error fetching Client ID:",r),[3,3];case 3:return[2]}}))}))}),[c]),n.useEffect((function(){t(void 0,void 0,void 0,(function(){var t,r,n,o;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,s()];case 1:return t=e.sent(),(null===(n=t.data)||void 0===n?void 0:n.paypalSettings)&&P(null===(o=t.data)||void 0===o?void 0:o.paypalSettings),[3,3];case 2:return r=e.sent(),console.error("getStorefrontSettings error",r),[3,3];case 3:return[2]}}))}))}),[]);var A=function(n){return t(void 0,void 0,void 0,(function(){var t,o,i;return e(this,(function(e){switch(e.label){case 0:return t=C.current,o=U.current,t&&o?(i=E.current,[4,a.updatePaypalOrder({input:r(r({cartId:o,transactionId:t,customer:v?{email:v.email,firstName:v.firstName,id:v.id,lastName:v.lastName}:null,address:i?{city:i.city,country:i.countryCode,postalCode:i.postalCode,state:i.state}:null},n.shippingSettingsId?{shippingSettingsId:n.shippingSettingsId}:{}),n.shippingZoneRateId?{shippingZoneRateId:n.shippingZoneRateId}:{})})]):[2,!1];case 1:return[2,!!e.sent().data]}}))}))},k=function(t){if(I)return I.find((function(e){return e.label===t}))};return n.useEffect((function(){if(m&&I){var n=k("productPageBuyButton");if(!n||"disabled"!==n.value){var o=document.querySelector("#paypal-button-container");o&&(o.innerHTML="");var i=document.querySelector('script[src^="https://www.paypal.com/sdk/js"]');i&&document.body.removeChild(i);var s=k("productColor"),l=k("productShape"),d=k("productLabel"),v=k("productTagline"),h=document.createElement("script");return h.src="https://www.paypal.com/sdk/js?client-id=".concat(m,"¤cy=").concat(c.selectedVariant.price.currency,"&disable-funding=credit,card"),h.setAttribute("data-page-type","product-details"),h.addEventListener("load",(function(){window.paypal&&window.paypal.Buttons({style:r(r(r(r({layout:"horizontal"},s?{color:null==s?void 0:s.value}:{}),l?{shape:null==l?void 0:l.value}:{}),d?{label:null==d?void 0:d.value}:{}),v?{tagline:"true"===(null==v?void 0:v.value)}:{}),onClick:function(r,n){return t(void 0,void 0,void 0,(function(){return e(this,(function(r){switch(r.label){case 0:return[4,t(void 0,void 0,void 0,(function(){return e(this,(function(t){if(f.cartStore.cart)try{f.cartStore.removeCart()}catch(t){console.error("Error removing items:",t)}return[2]}))}))];case 1:return r.sent(),[2,n.resolve()]}}))}))},createOrder:function(){return t(void 0,void 0,void 0,(function(){var r,n,o,i,s;return e(this,(function(l){switch(l.label){case 0:return[4,t(void 0,void 0,void 0,(function(){var t,r,n,o,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,f.cartStore.addItem(c.selectedVariant,c,p)];case 1:return t=e.sent(),(null===(i=null===(o=t.response)||void 0===o?void 0:o.data)||void 0===i?void 0:i.id)?(r=t.response.data,R(r.id),[2,r.id]):[2,null];case 2:return n=e.sent(),console.log("err",n),[2,null];case 3:return[2]}}))}))];case 1:return l.sent(),[4,t(void 0,void 0,void 0,(function(){var t,r,n,o,i,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=u.getPaymentGateways().map((function(t){return t.id})),(r=U.current)?[4,a.listPaymentGateway({cartId:r,id:{in:t},locale:u.getCurrentLocale(),transactionAmount:c.selectedVariant.finalPrice})]:[2,null];case 1:return n=e.sent(),[2,(null===(s=null===(i=n.data)||void 0===i?void 0:i.find((function(t){return"PAYPAL"===t.code})))||void 0===s?void 0:s.id)||null];case 2:return o=e.sent(),console.error("Error fetching PayPal ID:",o),[2,null];case 3:return[2]}}))}))];case 2:return r=l.sent(),(n=U.current)&&r?[4,a.createPayPalOrder({input:{cartId:n,paymentGatewayId:r},isPayNow:!0})]:[3,4];case 3:return o=l.sent(),b(!1),R(n),(null===(i=o.data)||void 0===i?void 0:i.transactionId)&&(v=o.data.transactionId,C.current=v,d={failUrl:o.data.failUrl,returnUrl:o.data.returnUrl},j.current={failUrl:d.failUrl,returnUrl:d.returnUrl}),[2,null===(s=o.data)||void 0===s?void 0:s.sessionToken];case 4:console.log("err"),l.label=5;case 5:return[2]}var d,v}))}))},onShippingOptionsChange:function(r,n){return t(this,void 0,void 0,(function(){var t,o,i;return e(this,(function(e){switch(e.label){case 0:return console.log("selectedShippingOption",r),t=r.selectedShippingOption.id.split(":"),o=t[0],i=t[1],[4,A({shippingSettingsId:o,shippingZoneRateId:i})];case 1:return e.sent()?[2]:[2,n.reject()]}}))}))},onShippingAddressChange:function(r,n){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return console.log("SHIPPING_ADDRESS",r),function(t){E.current=t}(r.shippingAddress),[4,A({})];case 1:return t.sent()?[2]:[2,n.reject()]}}))}))},onApprove:function(r,n){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,n.order.capture().then((function(t){console.log("data",r),console.log("details",t),console.log("urls",j),j.current&&(console.log("burda"),"COMPLETED"===t.status?window.location.href=j.current.returnUrl:window.location.href=window.location.href=j.current.failUrl)})).catch((function(t){return b(!0)}))]}))}))},onError:function(t){console.error("PayPal button error:",t)}}).render("#paypal-button-container")})),document.body.appendChild(h),function(){document.body.removeChild(h)}}}}),[m,c.id,I]),n.createElement("div",null,n.createElement("div",{id:"paypal-button-container"}),!!w&&!!l&&n.createElement("div",{className:"paypal__error__message"},l))}));export{c as PaypalExpressCheckout};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IkasImage } from "../../models/data/image";
|
|
3
|
+
declare type ImageProps = {
|
|
4
|
+
image: IkasImage;
|
|
5
|
+
alt?: string;
|
|
6
|
+
sizes: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
loading?: "lazy" | "eager";
|
|
10
|
+
decoding?: "async" | "sync" | "auto";
|
|
11
|
+
};
|
|
12
|
+
export declare const PlainImage: React.FC<ImageProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{IkasImageFunctions as t}from"@ikas/storefront-model-functions";var a=[180,360,540,720,900,1080,1296,1512,1728,1950,2560,3840],r=function(a){var r=a.image,o=a.alt,c=void 0===o?"Image":o,i=a.sizes,s=a.className,l=a.style,m=a.loading,d=void 0===m?"lazy":m,g=a.decoding,u=void 0===g?"async":g,f=t.getDefaultSrc;return r?e.createElement("img",{src:f(r),srcSet:n(r),sizes:i,alt:c,className:s,style:l,loading:d,decoding:u}):null},n=function(e){var r=t.getSrc;return a.map((function(t){var a=r(e,t);return"".concat(a," ").concat(t,"w")})).join(", ")};export{r as PlainImage};
|