@ikas/storefront 6.1.0-beta.31 → 6.1.0-beta.310
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 +6 -3
- package/build/analytics/analytics.js +1 -1
- package/build/analytics/events.d.ts +4 -1
- package/build/analytics/events.js +1 -1
- package/build/analytics/facebookPixel.d.ts +13 -0
- package/build/analytics/facebookPixel.js +1 -1
- package/build/analytics/googleAnalytics.d.ts +3 -2
- 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/head/index.js +1 -1
- package/build/analytics/ikasV3.d.ts +1 -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 +5 -0
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/components/checkout/components/adyen/index.js +1 -1
- package/build/components/checkout/components/button/index.d.ts +1 -0
- package/build/components/checkout/components/button/index.js +1 -1
- package/build/components/checkout/components/button/style.module.scss.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -1
- package/build/components/checkout/components/cart-summary/index.d.ts +9 -1
- 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/checkbox/index.d.ts +1 -0
- package/build/components/checkout/components/checkbox/index.js +1 -1
- package/build/components/checkout/components/credit-card-form/model.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/error/stock-error/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 +5 -3
- 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/iyzico/index.d.ts +8 -0
- package/build/components/checkout/components/iyzico/index.js +1 -0
- 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/offer-product/style.module.scss.js +1 -1
- package/build/components/checkout/components/phone-number-input/index.d.ts +1 -1
- package/build/components/checkout/components/phone-number-input/index.js +1 -1
- package/build/components/checkout/components/quick-registration/completed.js +1 -1
- package/build/components/checkout/components/quick-registration/index.js +1 -1
- package/build/components/checkout/components/step-container/index.d.ts +5 -0
- package/build/components/checkout/components/step-container/index.js +1 -1
- package/build/components/checkout/components/step-container/style.module.scss.js +1 -1
- package/build/components/checkout/components/stripe/checkout-form.js +1 -1
- package/build/components/checkout/components/stripe-express/index.d.ts +7 -0
- package/build/components/checkout/components/stripe-express/index.js +1 -0
- package/build/components/checkout/components/stripe-express/style.module.scss.js +1 -0
- package/build/components/checkout/components/svg/arrow-loyalty.d.ts +6 -0
- package/build/components/checkout/components/svg/arrow-loyalty.js +1 -0
- package/build/components/checkout/components/svg/arrow-right-loyalty.d.ts +6 -0
- package/build/components/checkout/components/svg/arrow-right-loyalty.js +1 -0
- package/build/components/checkout/components/svg/coupon-code-tag.d.ts +6 -0
- package/build/components/checkout/components/svg/coupon-code-tag.js +1 -0
- package/build/components/checkout/components/svg/credit-balance.d.ts +6 -0
- package/build/components/checkout/components/svg/credit-balance.js +1 -0
- package/build/components/checkout/components/svg/gift-cart-tag.d.ts +6 -0
- package/build/components/checkout/components/svg/gift-cart-tag.js +1 -0
- package/build/components/checkout/components/svg/gift-loyalty.d.ts +6 -0
- package/build/components/checkout/components/svg/gift-loyalty.js +1 -0
- package/build/components/checkout/components/svg/info.d.ts +6 -0
- package/build/components/checkout/components/svg/info.js +1 -0
- package/build/components/checkout/components/svg/left-arrow-loyalty.d.ts +6 -0
- package/build/components/checkout/components/svg/left-arrow-loyalty.js +1 -0
- package/build/components/checkout/components/svg/package-loyalty.d.ts +6 -0
- package/build/components/checkout/components/svg/package-loyalty.js +1 -0
- package/build/components/checkout/components/svg/percentage-loyalty.d.ts +6 -0
- package/build/components/checkout/components/svg/percentage-loyalty.js +1 -0
- package/build/components/checkout/components/svg/star-loyalty.d.ts +6 -0
- package/build/components/checkout/components/svg/star-loyalty.js +1 -0
- package/build/components/checkout/components/svg/store-credit-tag.d.ts +6 -0
- package/build/components/checkout/components/svg/store-credit-tag.js +1 -0
- package/build/components/checkout/components/svg/subscription.d.ts +6 -0
- package/build/components/checkout/components/svg/subscription.js +1 -0
- package/build/components/checkout/index.d.ts +1 -0
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.d.ts +58 -7
- 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/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/index.d.ts +7 -0
- package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/index.js +1 -0
- package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/style.module.scss.js +1 -0
- package/build/components/checkout/steps/step-payment/payment-gateways/style.module.scss.js +1 -1
- package/build/components/checkout/steps/step-shipping/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/checkout/style.module.scss.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 +3 -0
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.d.ts +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page/widgets/common.d.ts +2 -0
- package/build/components/page/widgets/common.js +1 -0
- package/build/components/page/widgets/loyaltyWidget.d.ts +8 -0
- package/build/components/page/widgets/loyaltyWidget.js +1 -0
- package/build/components/page/widgets/popupWidget.d.ts +14 -0
- package/build/components/page/widgets/popupWidget.js +1 -0
- package/build/components/page-editor/ThemeComponentEditor.js +1 -1
- package/build/components/page-editor/model.js +1 -1
- package/build/components/pay-with-ikas/index.d.ts +9 -0
- package/build/components/pay-with-ikas/index.js +1 -0
- 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/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/button-element-renderer/index.js +1 -1
- 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/image-column-element-renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/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/image/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js +1 -1
- package/build/hooks/useCustomerReviews.d.ts +2 -0
- package/build/hooks/useCustomerReviews.js +1 -1
- package/build/hooks/useDimension.js +1 -1
- package/build/hooks/useStore.js +1 -1
- package/build/index.js +1 -1
- package/build/models/data/checkout-settings/address-field-restriction/index.d.ts +10 -0
- package/build/models/data/checkout-settings/address-field-restriction/index.js +1 -0
- package/build/models/data/checkout-settings/index.d.ts +3 -0
- package/build/models/data/checkout-settings/index.js +1 -1
- package/build/models/data/customer/address/ikas-localized-customer-address.d.ts +1 -0
- package/build/models/data/customer/address/ikas-localized-customer-address.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/index.d.ts +1 -0
- package/build/models/data/order/address/ikas-localized-order-address.d.ts +1 -0
- package/build/models/data/order/address/ikas-localized-order-address.js +1 -1
- package/build/models/data/order/adjustment/index.d.ts +3 -1
- package/build/models/data/order/adjustment/index.js +1 -1
- package/build/models/data/order/gift-card-line/index.d.ts +2 -1
- package/build/models/data/order/gift-card-line/index.js +1 -1
- package/build/models/data/order/index.d.ts +4 -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 +4 -0
- package/build/models/data/order/line-item/index.js +1 -1
- package/build/models/data/order/line-item/order-line-item-subscription-plan/index.d.ts +8 -0
- package/build/models/data/order/line-item/order-line-item-subscription-plan/index.js +1 -0
- package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-discount/index.d.ts +6 -0
- package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-discount/index.js +1 -0
- package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-period/index.d.ts +14 -0
- package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-period/index.js +1 -0
- package/build/models/data/order/loyalty-line/index.d.ts +9 -0
- package/build/models/data/order/loyalty-line/index.js +1 -0
- package/build/models/data/order/order-transaction-with-prices/index.d.ts +1 -0
- package/build/models/data/order/order-transaction-with-prices/index.js +1 -1
- package/build/models/data/order/refund/settings/index.d.ts +1 -0
- package/build/models/data/order/refund/settings/index.js +1 -1
- package/build/models/data/product/campaign-offer/index.d.ts +2 -0
- package/build/models/data/product/campaign-offer/index.js +1 -1
- package/build/models/data/product/filter/index.d.ts +2 -0
- package/build/models/data/product/filter/index.js +1 -1
- package/build/models/data/product/index.d.ts +10 -0
- package/build/models/data/product/index.js +1 -1
- package/build/models/data/product/translations/index.d.ts +7 -0
- package/build/models/data/product/translations/index.js +1 -0
- package/build/models/data/product/variant/bundle-settings/bundle-product/index.js +1 -1
- package/build/models/data/product/variant/index.d.ts +3 -0
- package/build/models/data/product/variant/index.js +1 -1
- package/build/models/data/product/variant/subscription-plan/index.d.ts +12 -0
- package/build/models/data/product/variant/subscription-plan/index.js +1 -0
- package/build/models/data/product/variant/subscription-plan/product-subscription-plan-discount/index.d.ts +6 -0
- package/build/models/data/product/variant/subscription-plan/product-subscription-plan-period/index.d.ts +23 -0
- package/build/models/data/product/variant/subscription-plan/product-subscription-plan-period/index.js +1 -0
- package/build/models/data/store-credit-balance/index.d.ts +26 -0
- package/build/models/data/store-credit-balance/index.js +1 -0
- package/build/models/data/theme-json/component/prop/index.d.ts +1 -0
- package/build/models/data/theme-json/component/prop/index.js +1 -1
- package/build/models/data/theme-json/custom-data/index.d.ts +1 -0
- package/build/models/data/theme-json/custom-data/index.js +1 -1
- package/build/models/data/theme-json/index.js +1 -1
- package/build/models/ui/customer-review-list/index.d.ts +8 -0
- package/build/models/ui/customer-review-list/index.js +1 -1
- package/build/models/ui/product-list/index.d.ts +25 -2
- package/build/models/ui/product-list/index.js +1 -1
- package/build/models/ui/validator/form/login.d.ts +20 -6
- package/build/models/ui/validator/form/login.js +1 -1
- package/build/models/ui/validator/form/register.d.ts +15 -6
- package/build/models/ui/validator/form/register.js +1 -1
- package/build/page-data-init/index.d.ts +1 -0
- package/build/page-data-init/index.js +1 -1
- package/build/pages/checkout.js +1 -1
- package/build/store/cart/api.d.ts +3 -1
- package/build/store/cart/api.js +1 -1
- package/build/store/cart/index.d.ts +25 -1
- package/build/store/cart/index.js +1 -1
- package/build/store/checkout/index.d.ts +8 -1
- package/build/store/checkout/index.js +1 -1
- package/build/store/customer/api.d.ts +22 -3
- package/build/store/customer/api.js +1 -1
- package/build/store/customer/index.d.ts +49 -7
- package/build/store/customer/index.js +1 -1
- package/build/store/index.d.ts +1 -0
- package/build/store/product/index.d.ts +2 -1
- package/build/store/product/index.js +1 -1
- package/build/utils/helper.d.ts +1 -0
- package/build/utils/helper.js +1 -1
- package/package.json +18 -16
- package/build/components/popup/index.d.ts +0 -2
- package/build/components/popup/index.js +0 -1
- package/build/components/popup/renderer/index.d.ts +0 -8
- package/build/components/popup/renderer/index.js +0 -1
- package/build/components/popup/renderer/model.d.ts +0 -24
- package/build/components/popup/renderer/model.js +0 -1
- package/build/components/popup/utils/index.d.ts +0 -13
- package/build/components/popup/utils/index.js +0 -1
- package/build/store/storefront-popup/index.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IkasCustomerReviewStatus, IkasCustomerReview as ICustomerReview } from "@ikas/storefront-models";
|
|
1
|
+
import { IkasCustomerReviewStatus, IkasCustomerReview as ICustomerReview, IkasCustomerReviewReplyInfo } from "@ikas/storefront-models";
|
|
2
2
|
import { IkasBaseModel } from "../../base";
|
|
3
3
|
import { IkasImage } from "../../image";
|
|
4
4
|
import { IkasProduct } from "../../product";
|
|
@@ -8,11 +8,14 @@ export declare class IkasCustomerReview extends IkasBaseModel implements ICustom
|
|
|
8
8
|
email: string | null;
|
|
9
9
|
firstName: string | null;
|
|
10
10
|
imageIds: string[] | null;
|
|
11
|
+
isPrivateReply: boolean | null;
|
|
11
12
|
lastName: string | null;
|
|
13
|
+
locale: string | null;
|
|
12
14
|
orderId: string | null;
|
|
13
15
|
orderNumber: string | null;
|
|
14
16
|
productId: string;
|
|
15
17
|
reply: string | null;
|
|
18
|
+
replyInfo: IkasCustomerReviewReplyInfo | null;
|
|
16
19
|
salesChannelId: string | null;
|
|
17
20
|
star: number;
|
|
18
21
|
status: IkasCustomerReviewStatus | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as l}from'./../../../../ext/tslib/tslib.es6.js';export{IkasCustomerReviewStatus}from"@ikas/storefront-models";import{makeObservable as e,observable as r}from"mobx";import{IkasBaseModel as t}from"../../base/index.js";import{IkasImage as n}from"../../image/index.js";import{IkasProduct as
|
|
1
|
+
import{__extends as l}from'./../../../../ext/tslib/tslib.es6.js';export{IkasCustomerReviewStatus}from"@ikas/storefront-models";import{makeObservable as e,observable as r}from"mobx";import{IkasBaseModel as t}from"../../base/index.js";import{IkasImage as n}from"../../image/index.js";import{IkasProduct as o}from"../../product/index.js";var u=function(t){function u(l){var u,s=this;return(s=t.call(this,l)||this).comment=null,s.customerId=null,s.email=null,s.firstName=null,s.imageIds=null,s.isPrivateReply=null,s.lastName=null,s.locale=null,s.orderId=null,s.orderNumber=null,s.reply=null,s.replyInfo=null,s.salesChannelId=null,s.status=null,s.storefrontId=null,s.title=null,s.product=null,s.comment=l.comment||null,s.customerId=l.customerId||null,s.email=l.email||null,s.firstName=l.firstName||null,s.imageIds=l.imageIds||null,s.isPrivateReply=l.isPrivateReply||null,s.lastName=l.lastName||null,s.locale=l.locale||null,s.orderId=l.orderId||null,s.orderNumber=l.orderNumber||null,s.productId=l.productId||"",s.reply=l.reply||null,s.replyInfo=l.replyInfo||null,s.salesChannelId=l.salesChannelId||null,s.star=l.star||0,s.status=l.status||null,s.storefrontId=l.storefrontId||null,s.title=l.title||null,s.images=(null===(u=l.images)||void 0===u?void 0:u.map((function(l){return new n(l)})))||null,s.product=l.product?new o(l.product):null,e(s,{comment:r,customerId:r,email:r,firstName:r,imageIds:r,isPrivateReply:r,lastName:r,locale:r,orderId:r,orderNumber:r,productId:r,reply:r,replyInfo:r,salesChannelId:r,star:r,status:r,storefrontId:r,title:r,images:r,product:r}),s}return l(u,t),u}(t);export{u as IkasCustomerReview};
|
|
@@ -130,6 +130,7 @@ export * from "./stock-location/address/state";
|
|
|
130
130
|
export * from "./stock-location/address";
|
|
131
131
|
export * from "./stock-location/available";
|
|
132
132
|
export * from "./stock-location";
|
|
133
|
+
export * from "./store-credit-balance";
|
|
133
134
|
export * from "./storefront-popup/storefront-popup-analytics";
|
|
134
135
|
export * from "./storefront-popup/storefront-popup-date-filter";
|
|
135
136
|
export * from "./storefront-popup/storefront-popup-display-filter";
|
|
@@ -45,6 +45,7 @@ export default class IkasLocalizedOrderAddress extends IkasOrderAddress {
|
|
|
45
45
|
taxOffice: import("@ikas/localized-address").ErrorType;
|
|
46
46
|
taxNumber: import("@ikas/localized-address").ErrorType;
|
|
47
47
|
} | undefined;
|
|
48
|
+
get addressFieldRestrictionErrors(): Record<string, boolean> | null;
|
|
48
49
|
get isValidAddress(): boolean | undefined;
|
|
49
50
|
get fieldLabels(): import("@ikas/localized-address").IkasAddressFormLabels | undefined;
|
|
50
51
|
get isFreeTextCity(): boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as
|
|
1
|
+
import{__extends as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as e,observable as i}from"mobx";import{IkasOrderAddress as n}from"./index.js";import{IkasCheckoutRequirement as r}from"@ikas/storefront-models";import{AddressFormItem as o}from"@ikas/localized-address";var s=function(n){function s(t){void 0===t&&(t={});var r=n.call(this,t)||this;return r.countrySettings=t.countrySettings||null,e(r,{countrySettings:i}),r}return t(s,n),Object.defineProperty(s.prototype,"fieldSettings",{get:function(){if(this.countrySettings)return this.countrySettings.getFieldSettings({country:this.countryCode,invisibleAddressFields:this.invisibleFields,customAddressFormSettings:this.customAddressFormSettings})},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"addressFormat",{get:function(){if(this.countrySettings)return this.countrySettings.getAddressFormat(this.countryCode,this.invisibleFields)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"addressFormatIgnoreCountry",{get:function(){if(this.countrySettings)return this.countrySettings.getAddressFormatIgnoreCountry(this.countryCode,this.invisibleFields)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"billingFormat",{get:function(){if(this.countrySettings)return this.countrySettings.getBillingFormat(this.countryCode)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"countryCode",{get:function(){var t;return(null===(t=this.country)||void 0===t?void 0:t.iso2)||"TR"},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"validationResults",{get:function(){if(this.countrySettings)return this.countrySettings.getValidationResult({address:d(this),country:this.countryCode,invisibleAddressFields:this.invisibleFields,customAddressFormSettings:this.customAddressFormSettings,validateBillingForm:!0})},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"addressFieldRestrictionErrors",{get:function(){return(i=null===(e=(t=this).checkoutSettings)||void 0===e?void 0:e.addressFieldRestrictions)?{firstName:u(t.firstName,i.firstName),lastName:u(t.lastName,i.lastName),companyName:u(t.company,i.companyName),taxOffice:u(t.taxOffice,i.taxOffice),addressLine1:u(t.addressLine1,i.addressLine1),addressLine2:u(t.addressLine2,i.addressLine2)}:null;var t,e,i},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isValidAddress",{get:function(){if(this.countrySettings){var t=this.countrySettings.isValidAddress({address:d(this),country:this.countryCode,invisibleAddressFields:this.invisibleFields,customAddressFormSettings:this.customAddressFormSettings,validateBillingForm:!0}),e=this.addressFieldRestrictionErrors;return(!e||!Object.values(e).some(Boolean))&&t}},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"fieldLabels",{get:function(){if(this.countrySettings)return this.countrySettings.getFieldLabels(this.countryCode)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isFreeTextCity",{get:function(){if(this.countrySettings)return this.countrySettings.isFreeTextCity(this.countryCode)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isFreeTextDistrict",{get:function(){if(this.countrySettings)return this.countrySettings.isFreeTextDistrict(this.countryCode)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"shippingZone",{get:function(){var t,e=this;return null===(t=this.shippingZones)||void 0===t?void 0:t.find((function(t){var i;return t.countryId===(null===(i=e.country)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"shippingZoneState",{get:function(){var t,e,i=this;return null===(e=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===e?void 0:e.find((function(t){var e;return t.id===(null===(e=i.state)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"shippingZoneCity",{get:function(){var t,e,i=this;return null===(e=null===(t=this.shippingZoneState)||void 0===t?void 0:t.cities)||void 0===e?void 0:e.find((function(t){var e;return t.id===(null===(e=i.city)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"shippingZoneDistrict",{get:function(){var t,e,i=this;return null===(e=null===(t=this.shippingZoneCity)||void 0===t?void 0:t.districts)||void 0===e?void 0:e.find((function(t){var e;return t.id===(null===(e=i.district)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"shippingZoneRegion",{get:function(){var t,e,i=this;return null===(e=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===e?void 0:e.find((function(t){var e;return t.id===(null===(e=i.region)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isRequiredRegion",{get:function(){var t,e;return!!this.district&&(null===(e=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===e?void 0:e.length)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"invisibleFields",{get:function(){if(this.checkoutSettings){var t=[];return this.checkoutSettings.identityNumberRequirement===r.INVISIBLE&&t.push(o.IDENTITY_NUMBER),this.checkoutSettings.postalCodeRequirement===r.INVISIBLE&&t.push(o.POSTAL_CODE),this.checkoutSettings.phoneRequirement===r.INVISIBLE&&t.push(o.PHONE),this.isRequiredRegion||t.push(o.REGION),t}},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"customAddressFormSettings",{get:function(){if(this.checkoutSettings){var t={};return this.checkoutSettings.phoneRequirement&&(t.phone={required:this.checkoutSettings.phoneRequirement===r.MANDATORY}),this.checkoutSettings.postalCodeRequirement&&(t.postalCode={required:this.checkoutSettings.postalCodeRequirement===r.MANDATORY}),this.checkoutSettings.identityNumberRequirement&&(t.identityNumber={required:this.checkoutSettings.identityNumberRequirement===r.MANDATORY}),this.isRequiredRegion&&(t.region={required:!0}),t}},enumerable:!1,configurable:!0}),s.prototype.getValidatedCustomerAddress=function(){var t,e,i,n,r,o,s;(null===(t=this.shippingZones)||void 0===t?void 0:t.length)&&(this.shippingZone||(this.country=null,this.state=null,this.city=null,this.district=null,this.region=null),this.shippingZoneState||void 0===(null===(e=this.shippingZone)||void 0===e?void 0:e.showAllStates)||(null===(i=this.shippingZone)||void 0===i?void 0:i.showAllStates)||(this.state=null,this.city=null,this.district=null,this.region=null),this.shippingZoneCity||void 0===(null===(n=this.shippingZoneState)||void 0===n?void 0:n.showAllCities)||(null===(r=this.shippingZoneState)||void 0===r?void 0:r.showAllCities)||(this.city=null,this.district=null,this.region=null),this.shippingZoneDistrict||void 0===(null===(o=this.shippingZoneCity)||void 0===o?void 0:o.showAllDistricts)||(null===(s=this.shippingZoneCity)||void 0===s?void 0:s.showAllDistricts)||(this.district=null,this.region=null),this.shippingZoneRegion||(this.region=null))},s}(n);function u(t,e){if(!e||!t)return!1;try{return!new RegExp(e,"u").test(t)}catch(t){return!1}}var d=function(t){var e,i,n,r,o;return{firstName:t.firstName||"",lastName:t.lastName||"",identityNumber:t.identityNumber||"",addressLine1:t.addressLine1||"",addressLine2:t.addressLine2||"",postalCode:t.postalCode||"",country:(null===(e=t.country)||void 0===e?void 0:e.name)||"",state:(null===(i=t.state)||void 0===i?void 0:i.name)||"",city:(null===(n=t.city)||void 0===n?void 0:n.name)||"",district:(null===(r=t.district)||void 0===r?void 0:r.name)||"",region:(null===(o=t.region)||void 0===o?void 0:o.name)||"",phone:t.phone||"",company:t.company||"",taxOffice:t.taxOffice||"",taxNumber:t.taxNumber||""}};export{s as default};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { IkasOrderAdjustment as IOrderAdjustment, IkasAmountType, IkasAdjustmentType, IkasCampaignType } from "@ikas/storefront-models";
|
|
1
|
+
import { IkasOrderAdjustment as IOrderAdjustment, IkasAmountType, IkasAdjustmentType, IkasCampaignType, IkasCampaignCreatedFor } from "@ikas/storefront-models";
|
|
2
2
|
import { IkasOrderAdjustmentAppliedOrderLine } from "./applied-order-line";
|
|
3
3
|
export declare class IkasOrderAdjustment implements IOrderAdjustment {
|
|
4
4
|
amount: number;
|
|
5
5
|
appliedOrderLines: IkasOrderAdjustmentAppliedOrderLine[] | null;
|
|
6
6
|
campaignId: string | null;
|
|
7
7
|
couponId: string | null;
|
|
8
|
+
createdFor: IkasCampaignCreatedFor | null;
|
|
8
9
|
name: string;
|
|
9
10
|
order: number;
|
|
10
11
|
amountType: IkasAmountType;
|
|
11
12
|
type: IkasAdjustmentType;
|
|
12
13
|
campaignType: IkasCampaignType | null;
|
|
14
|
+
usedLoyaltyPoints: number | null;
|
|
13
15
|
constructor(data: IOrderAdjustment);
|
|
14
16
|
}
|
|
15
17
|
export { IkasAmountType, IkasAdjustmentType, IkasCampaignType };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{IkasAdjustmentType,IkasAmountType,IkasCampaignType}from"@ikas/storefront-models";import{makeAutoObservable as n}from"mobx";import{IkasOrderAdjustmentAppliedOrderLine as
|
|
1
|
+
export{IkasAdjustmentType,IkasAmountType,IkasCampaignType}from"@ikas/storefront-models";import{makeAutoObservable as n}from"mobx";import{IkasOrderAdjustmentAppliedOrderLine as t}from"./applied-order-line/index.js";var i=function(i){var e;this.appliedOrderLines=null,this.campaignId=null,this.couponId=null,this.createdFor=null,this.campaignType=null,this.usedLoyaltyPoints=null,this.amount=i.amount,this.appliedOrderLines=(null===(e=i.appliedOrderLines)||void 0===e?void 0:e.map((function(n){return new t(n)})))||null,this.campaignId=i.campaignId||null,this.couponId=i.couponId||null,this.createdFor=i.createdFor||null,this.name=i.name,this.order=i.order,this.amountType=i.amountType,this.type=i.type,this.campaignType=i.campaignType||null,this.usedLoyaltyPoints=i.usedLoyaltyPoints||null,n(this)};export{i as IkasOrderAdjustment};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IkasOrderGiftCardLine as IOrderGiftCardLine } from "@ikas/storefront-models";
|
|
1
|
+
import { IkasGiftCardType, IkasOrderGiftCardLine as IOrderGiftCardLine } from "@ikas/storefront-models";
|
|
2
2
|
export declare class IkasOrderGiftCardLine implements IOrderGiftCardLine {
|
|
3
3
|
amount: number;
|
|
4
4
|
code: string;
|
|
5
5
|
giftCardId: string;
|
|
6
6
|
id: string;
|
|
7
|
+
type: IkasGiftCardType;
|
|
7
8
|
constructor(data: IOrderGiftCardLine);
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{IkasGiftCardType as t}from"@ikas/storefront-models";import{makeAutoObservable as i}from"mobx";var o=function(o){this.amount=o.amount||0,this.code=o.code||"",this.giftCardId=o.giftCardId||"",this.id=o.id||"",this.type=o.type||t.GIFT_CARD,i(this)};export{o as IkasOrderGiftCardLine};
|
|
@@ -13,6 +13,7 @@ import { IkasBaseModel } from "../base";
|
|
|
13
13
|
import { IkasOrderCancelReason, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus } from "@ikas/storefront-models";
|
|
14
14
|
import { IkasOrder as IOrder } from "@ikas/storefront-models";
|
|
15
15
|
import { IkasOrderGiftCardLine } from "./gift-card-line";
|
|
16
|
+
import { IkasOrderLoyaltyLine } from "./loyalty-line";
|
|
16
17
|
declare type IOrderConstructorData = {
|
|
17
18
|
refundSettings?: IkasOrderRefundSettings | null;
|
|
18
19
|
} & IOrder;
|
|
@@ -24,11 +25,13 @@ export declare class IkasOrder extends IkasBaseModel implements IOrder {
|
|
|
24
25
|
currencySymbol: string | null;
|
|
25
26
|
customer: IkasOrderCustomer | null;
|
|
26
27
|
customerId: string | null;
|
|
28
|
+
edited: boolean | null;
|
|
27
29
|
giftCardLines: IkasOrderGiftCardLine[] | null;
|
|
28
30
|
giftPackageLines: IkasOrderGiftPackageLine[] | null;
|
|
29
31
|
giftPackageNote: string | null;
|
|
30
32
|
invoices: IkasInvoice[] | null;
|
|
31
33
|
isGiftPackage: boolean | null;
|
|
34
|
+
loyaltyLines: IkasOrderLoyaltyLine[] | null;
|
|
32
35
|
note: string | null;
|
|
33
36
|
orderAdjustments: IkasOrderAdjustment[] | null;
|
|
34
37
|
orderLineItems: IkasOrderLineItem[];
|
|
@@ -70,5 +73,6 @@ export declare class IkasOrder extends IkasBaseModel implements IOrder {
|
|
|
70
73
|
get isRefundEnabled(): boolean;
|
|
71
74
|
get displayedOrderAdjustments(): IkasOrderAdjustment[] | undefined;
|
|
72
75
|
get orderProductFileIds(): string[];
|
|
76
|
+
get giftCardTotalPrice(): number;
|
|
73
77
|
}
|
|
74
78
|
export { IkasOrderCancelReason, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasOrderAddress as t}from"./address/index.js";import{IkasOrderShippingLine as n}from"./shipping-line/index.js";import{IkasOrderLineItem as r}from"./line-item/index.js";import{IkasOrderCustomer as
|
|
1
|
+
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasOrderAddress as t}from"./address/index.js";import{IkasOrderShippingLine as n}from"./shipping-line/index.js";import{IkasOrderLineItem as r}from"./line-item/index.js";import{IkasOrderCustomer as i}from"./customer/index.js";import{IkasOrderGiftPackageLine as o}from"./gift-line/index.js";import{IkasInvoice as l}from"./invoice/index.js";import{IkasOrderPaymentMethod as u}from"./payment-method/index.js";import{IkasOrderAdjustment as a}from"./adjustment/index.js";import{IkasOrderPackage as s}from"./package/index.js";import{IkasOrderTaxLine as d}from"./tax-line/index.js";import{IkasBaseModel as c}from"../base/index.js";import{IkasOrderLineItemStatus as m,IkasCampaignType as f,IkasOrderShippingMethod as p,IkasOrderStatus as g}from"@ikas/storefront-models";export{IkasOrderCancelReason,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus}from"@ikas/storefront-models";import{makeObservable as y,observable as b,computed as h}from"mobx";import{IkasOrderFunctions as P}from"@ikas/storefront-model-functions";import{formatCurrency as j}from"../../../utils/currency.js";import{IkasOrderGiftCardLine as v}from"./gift-card-line/index.js";import{IkasOrderLoyaltyLine as A}from"./loyalty-line/index.js";var k=function(c){function k(e,m){var f,P,j,k,I,O,S,C,L,x,T,N,w=this;(w=c.call(this,e)||this).billingAddress=null,w.cancelReason=null,w.cancelledAt=null,w.currencySymbol=null,w.customer=null,w.customerId=null,w.edited=null,w.giftPackageLines=null,w.giftPackageNote=null,w.invoices=null,w.isGiftPackage=null,w.loyaltyLines=null,w.note=null,w.orderAdjustments=null,w.orderNumber=null,w.orderPackageStatus=null,w.orderPackages=null,w.orderPaymentStatus=null,w.orderedAt=null,w.priceListId=null,w.paymentMethods=null,w.shippingAddress=null,w.shippingLines=null,w.taxLines=null,w.billingAddress=e.billingAddress?new t(e.billingAddress):null,w.cancelReason=e.cancelReason||null,w.cancelledAt=e.cancelledAt||null,w.currencyCode=e.currencyCode||"",w.currencySymbol=e.currencySymbol||null,w.customer=e.customer?new i(e.customer):null,w.customerId=e.customerId||null,w.edited=e.edited||null,w.giftCardLines=(null===(f=e.giftCardLines)||void 0===f?void 0:f.map((function(e){return new v(e)})))||null,w.giftPackageLines=(null===(P=e.giftPackageLines)||void 0===P?void 0:P.map((function(e){return new o(e)})))||null,w.giftPackageNote=e.giftPackageNote||null,w.invoices=(null===(j=e.invoices)||void 0===j?void 0:j.map((function(e){return new l(e)})))||null,w.isGiftPackage=e.isGiftPackage||null,w.loyaltyLines=(null===(k=e.loyaltyLines)||void 0===k?void 0:k.map((function(e){return new A(e)})))||null,w.note=e.note||null,w.orderAdjustments=(null===(I=e.orderAdjustments)||void 0===I?void 0:I.map((function(e){return new a(e)})))||null,w.orderLineItems=(null===(O=e.orderLineItems)||void 0===O?void 0:O.map((function(e){return new r(e)})).filter((function(e){return!e.deleted})))||[],w.orderNumber=e.orderNumber||null,w.orderPackageStatus=e.orderPackageStatus||null,w.orderPackages=(null===(S=e.orderPackages)||void 0===S?void 0:S.map((function(e){return new s(e)})))||null,w.orderPaymentStatus=e.orderPaymentStatus||null,w.orderedAt=e.orderedAt||null,w.priceListId=e.priceListId||null,w.paymentMethods=(null===(C=e.paymentMethods)||void 0===C?void 0:C.map((function(e){return new u(e)})))||null,w.shippingAddress=e.shippingAddress?new t(e.shippingAddress):null,w.shippingLines=(null===(L=e.shippingLines)||void 0===L?void 0:L.map((function(e){return new n(e)})))||null,w.shippingMethod=e.shippingMethod||p.SHIPMENT,w.status=e.status||g.CREATED,w.taxLines=(null===(x=e.taxLines)||void 0===x?void 0:x.map((function(e){return new d(e)})))||null,w.totalFinalPrice=null!==(T=e.totalFinalPrice)&&void 0!==T?T:0,w.totalPrice=null!==(N=e.totalPrice)&&void 0!==N?N:0,w.refundSettings=e.refundSettings;var F={billingAddress:b,cancelReason:b,cancelledAt:b,currencyCode:b,currencySymbol:b,customer:b,customerId:b,edited:b,giftCardLines:b,giftPackageLines:b,giftPackageNote:b,invoices:b,isGiftPackage:b,loyaltyLines:b,note:b,orderAdjustments:b,orderLineItems:b,orderNumber:b,orderPackageStatus:b,orderPackages:b,orderPaymentStatus:b,orderedAt:b,paymentMethods:b,shippingAddress:b,shippingLines:b,shippingMethod:b,status:b,taxLines:b,totalFinalPrice:b,totalPrice:b,refundSettings:b,items:h,itemCount:h,refundableItems:h,unfullfilledItems:h,refundedItems:h,totalTax:h,formattedTotalTax:h,shippingTotal:h,formattedShippingTotal:h,formattedTotalFinalPrice:h,formattedTotalPrice:h,hasCustomer:h,hasValidCustomerEmail:h,customerFullName:h,formattedDate:h,couponAdjustment:h,nonCouponAdjustments:h,orderProductFileIds:h};return m&&(delete F.billingAddress,delete F.shippingAddress),y(w,F),w}return e(k,c),Object.defineProperty(k.prototype,"items",{get:function(){return this.orderLineItems.filter((function(e){return e.status!==m.CANCELLED}))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"itemCount",{get:function(){var e;return(null===(e=this.items)||void 0===e?void 0:e.length)||0},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"itemQuantity",{get:function(){return this.items.reduce((function(e,t){return e+t.quantity}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"refundableItems",{get:function(){return this.refundSettings?P.getRefundableItems(this,this.refundSettings):[]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"displayedPackages",{get:function(){return P.getDisplayedPackages(this).map((function(e){return new s(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"unfullfilledItems",{get:function(){return P.getUnfullfilledItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"refundedItems",{get:function(){return P.getRefundedItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"totalTax",{get:function(){return P.getTotalTax(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"formattedTotalTax",{get:function(){return j(this.totalTax,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"shippingTotal",{get:function(){return P.getShippingTotal(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"formattedShippingTotal",{get:function(){return j(this.shippingTotal,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"formattedTotalFinalPrice",{get:function(){return j(this.totalFinalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"formattedTotalPrice",{get:function(){return j(this.totalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasCustomer",{get:function(){return P.hasCustomer(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasValidCustomerEmail",{get:function(){return P.hasValidCustomerEmail(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"customerFullName",{get:function(){return P.getCustomerFullName(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"formattedDate",{get:function(){return P.getFormattedDate(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"couponAdjustment",{get:function(){return P.getCouponAdjustment(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"nonCouponAdjustments",{get:function(){return P.getNonCouponAdjustments(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isRefundEnabled",{get:function(){return this.refundableItems.some((function(e){return null!==e.refundQuantity}))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"displayedOrderAdjustments",{get:function(){var e;return null===(e=this.orderAdjustments)||void 0===e?void 0:e.filter((function(e){return e.campaignType!==f.FREE_SHIPPING}))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"orderProductFileIds",{get:function(){return P.getOrderProductFiles(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"giftCardTotalPrice",{get:function(){var e;return(null===(e=this.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0},enumerable:!1,configurable:!0}),k}(c);export{k as IkasOrder};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IkasOrderLineBundleProductSettings as IOrderLineBundleProductSettings } from "@ikas/storefront-models";
|
|
2
|
+
export declare class IkasOrderLineBundleProductSettings implements IOrderLineBundleProductSettings {
|
|
3
|
+
bundleLineId: string;
|
|
4
|
+
bundleLineQuantity: number;
|
|
5
|
+
name: string | null;
|
|
6
|
+
constructor(data: IOrderLineBundleProductSettings);
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{makeAutoObservable as n}from"mobx";var i=function(i){this.bundleLineId=i.bundleLineId||"",this.bundleLineQuantity=i.bundleLineQuantity||0,this.name=i.name||null,n(this)};export{i as IkasOrderLineBundleProductSettings};
|
|
@@ -2,11 +2,14 @@ import { IkasOrderLineItem as IOrderLineItem, IkasOrderLineItemStatus } from "@i
|
|
|
2
2
|
import { IkasOrderLineDiscount } from "./discount";
|
|
3
3
|
import { IkasOrderLineVariant } from "./variant";
|
|
4
4
|
import { IkasOrderLineItemOption } from "./option";
|
|
5
|
+
import { IkasOrderLineBundleProductSettings } from "./bundle-product-settings";
|
|
5
6
|
import { IkasBaseModel } from "../../base";
|
|
7
|
+
import { IkasOrderLineItemSubscriptionPlan } from "./order-line-item-subscription-plan";
|
|
6
8
|
declare type IOrderLineItemConstructorParams = {
|
|
7
9
|
refundQuantity?: number;
|
|
8
10
|
} & IOrderLineItem;
|
|
9
11
|
export declare class IkasOrderLineItem extends IkasBaseModel implements IOrderLineItem {
|
|
12
|
+
bundleProductSettings: IkasOrderLineBundleProductSettings | null;
|
|
10
13
|
currencyCode: string | null;
|
|
11
14
|
currencySymbol: string | null;
|
|
12
15
|
discount: IkasOrderLineDiscount | null;
|
|
@@ -24,6 +27,7 @@ export declare class IkasOrderLineItem extends IkasBaseModel implements IOrderLi
|
|
|
24
27
|
unitPrice: number | null;
|
|
25
28
|
variant: IkasOrderLineVariant;
|
|
26
29
|
orderedAt: number;
|
|
30
|
+
subscriptionPlan: IkasOrderLineItemSubscriptionPlan | null;
|
|
27
31
|
private _refundQuantity;
|
|
28
32
|
constructor(data: IOrderLineItemConstructorParams);
|
|
29
33
|
get priceWithQuantity(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as t}from'./../../../../ext/tslib/tslib.es6.js';export{IkasOrderLineItemStatus}from"@ikas/storefront-models";import{IkasOrderLineDiscount as e}from"./discount/index.js";import{IkasOrderLineVariant as i}from"./variant/index.js";import{IkasOrderLineItemOption as
|
|
1
|
+
import{__extends as t}from'./../../../../ext/tslib/tslib.es6.js';export{IkasOrderLineItemStatus}from"@ikas/storefront-models";import{IkasOrderLineDiscount as e}from"./discount/index.js";import{IkasOrderLineVariant as i}from"./variant/index.js";import{IkasOrderLineItemOption as n}from"./option/index.js";import{IkasOrderLineBundleProductSettings as r}from"./bundle-product-settings/index.js";import{IkasBaseModel as o}from"../../base/index.js";import{makeObservable as u,observable as c,computed as a,action as l}from"mobx";import{IkasOrderLineItemFunctions as d}from"@ikas/storefront-model-functions";import{formatCurrency as s}from"../../../../utils/currency.js";import{IkasBaseStore as f}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{IkasOrderLineItemSubscriptionPlan as y}from"./order-line-item-subscription-plan/index.js";var p=function(o){function p(t){var d,s,f,p,m,b=this;return(b=o.call(this,t)||this).bundleProductSettings=null,b.currencyCode=null,b.discount=null,b.discountPrice=null,b.finalPrice=null,b.options=null,b.originalOrderLineItemId=null,b.statusUpdatedAt=null,b.stockLocationId=null,b.taxValue=null,b.subscriptionPlan=null,b._refundQuantity=null,b.bundleProductSettings=t.bundleProductSettings?new r(t.bundleProductSettings):null,b.currencyCode=t.currencyCode||null,b.currencySymbol=t.currencySymbol||null,b.discount=t.discount?new e(t.discount):null,b.discountPrice=null!==(d=t.discountPrice)&&void 0!==d?d:null,b.finalPrice=null!==(s=t.finalPrice)&&void 0!==s?s:null,b.finalUnitPrice=null!==(f=t.finalUnitPrice)&&void 0!==f?f:null,b.options=(null===(p=t.options)||void 0===p?void 0:p.map((function(t){return new n(t)})))||null,b.originalOrderLineItemId=t.originalOrderLineItemId||null,b.price=t.price,b.quantity=t.quantity,b.status=t.status,b.statusUpdatedAt=t.statusUpdatedAt,b.stockLocationId=t.stockLocationId,b.taxValue=t.taxValue,b.unitPrice=null!==(m=t.unitPrice)&&void 0!==m?m:null,b.variant=new i(t.variant),b.orderedAt=t.orderedAt,b.subscriptionPlan=t.subscriptionPlan?new y(t.subscriptionPlan):null,b.refundQuantity=t.refundQuantity,u(b,{bundleProductSettings:c,currencyCode:c,currencySymbol:c,discount:c,discountPrice:c,finalPrice:c,finalUnitPrice:c,options:c,originalOrderLineItemId:c,price:c,quantity:c,status:c,statusUpdatedAt:c,stockLocationId:c,taxValue:c,unitPrice:c,variant:c,orderedAt:c,subscriptionPlan:c,_refundQuantity:c,priceWithQuantity:a,formattedPriceWithQuantity:a,overridenPriceWithQuantity:a,formattedOverridenPriceWithQuantity:a,formattedFinalPrice:a,formattedUnitPrice:a,formattedFinalUnitPrice:a,formattedDiscountPrice:a,finalPriceWithQuantity:a,formattedFinalPriceWithQuantity:a,tax:a,formattedTax:a,refundQuantity:a,editLineItem:l.bound}),b}return t(p,o),Object.defineProperty(p.prototype,"priceWithQuantity",{get:function(){return d.getPriceWithQuantity(this)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"formattedPriceWithQuantity",{get:function(){return s(this.priceWithQuantity,this.currencyCode||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"overridenPriceWithQuantity",{get:function(){return d.getOverridenPriceWithQuantity(this)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"formattedOverridenPriceWithQuantity",{get:function(){return s(this.overridenPriceWithQuantity||0,this.currencyCode||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"formattedFinalPrice",{get:function(){return s(this.finalPrice||0,this.currencyCode||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"formattedUnitPrice",{get:function(){return s(this.unitPrice||0,this.currencyCode||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"formattedFinalUnitPrice",{get:function(){return s(this.finalUnitPrice||0,this.currencyCode||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"unitPriceText",{get:function(){var t,e,i,n;if(null!==this.finalUnitPrice){var r=null===(t=this.variant.baseUnit)||void 0===t?void 0:t.baseAmount,o=(null===(i=null===(e=this.variant.baseUnit)||void 0===e?void 0:e.unit)||void 0===i?void 0:i.name)||(null===(n=this.variant.baseUnit)||void 0===n?void 0:n.type);return"".concat(s(this.finalUnitPrice,this.currencyCode||"",this.currencySymbol||"")," / ").concat(r&&1!==r?r:"").concat(o)}},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"formattedDiscountPrice",{get:function(){return s(this.discountPrice||0,this.currencyCode||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"finalPriceWithQuantity",{get:function(){return d.getFinalPriceWithQuantity(this)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"formattedFinalPriceWithQuantity",{get:function(){return s(this.finalPriceWithQuantity||0,this.currencyCode||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"tax",{get:function(){return d.getTax(this)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"formattedTax",{get:function(){return s(this.tax,this.currencyCode||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"hasDiscount",{get:function(){return d.hasDiscount(this)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"refundQuantity",{get:function(){return this._refundQuantity},set:function(t){t?(t>this.quantity&&(t=this.quantity),t<=0&&(t=null),this._refundQuantity=t):this._refundQuantity=null},enumerable:!1,configurable:!0}),p.prototype.editLineItem=function(){var t,e=this.variant.href||"";e=e.includes("?")?e+"&editLineID="+this.id:e+"?editLineID="+this.id,null===(t=f.getInstance().router)||void 0===t||t.push(e)},p}(o);export{p as IkasOrderLineItem};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IkasOrderLineItemSubscriptionPlan as IOrderLineItemSubscriptionPlan } from "@ikas/storefront-models";
|
|
2
|
+
import { IkasOrderLineItemSubscriptionPlanPeriod } from "./order-line-item-subscription-plan-period";
|
|
3
|
+
export declare class IkasOrderLineItemSubscriptionPlan implements IOrderLineItemSubscriptionPlan {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
period: IkasOrderLineItemSubscriptionPlanPeriod;
|
|
7
|
+
constructor(data: IOrderLineItemSubscriptionPlan);
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{makeAutoObservable as i}from"mobx";import{IkasOrderLineItemSubscriptionPlanPeriod as o}from"./order-line-item-subscription-plan-period/index.js";var r=function(r){this.id=r.id,this.name=r.name,this.period=new o(r.period),i(this)};export{r as IkasOrderLineItemSubscriptionPlan};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IkasOrderLineItemSubscriptionPlanDiscountAmountType, IkasOrderLineItemSubscriptionPlanDiscount as IOrderLineItemSubscriptionPlanDiscount } from "@ikas/storefront-models";
|
|
2
|
+
export declare class IkasOrderLineItemSubscriptionPlanDiscount implements IOrderLineItemSubscriptionPlanDiscount {
|
|
3
|
+
amount: number;
|
|
4
|
+
type: IkasOrderLineItemSubscriptionPlanDiscountAmountType;
|
|
5
|
+
constructor(data: IOrderLineItemSubscriptionPlanDiscount);
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=function(t){this.amount=t.amount,this.type=t.type};export{t as IkasOrderLineItemSubscriptionPlanDiscount};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IkasOrderLineItemSubscriptionPlanPeriod as IOrderLineItemSubscriptionPlanPeriod, IkasOrderLineItemSubscriptionPlanDurationUnitType, IkasOrderLineItemSubscriptionPlanPaymentType } from "@ikas/storefront-models";
|
|
2
|
+
import { IkasOrderLineItemSubscriptionPlanDiscount } from "../order-line-item-subscription-plan-discount";
|
|
3
|
+
export declare class IkasOrderLineItemSubscriptionPlanPeriod implements IOrderLineItemSubscriptionPlanPeriod {
|
|
4
|
+
cutOffDay: number | null;
|
|
5
|
+
discount: IkasOrderLineItemSubscriptionPlanDiscount | null;
|
|
6
|
+
durationUnit: IkasOrderLineItemSubscriptionPlanDurationUnitType;
|
|
7
|
+
durationValue: number;
|
|
8
|
+
id: string;
|
|
9
|
+
maxOrders: number | null;
|
|
10
|
+
paymentType: IkasOrderLineItemSubscriptionPlanPaymentType;
|
|
11
|
+
scheduledOrderDay: number | null;
|
|
12
|
+
title: string;
|
|
13
|
+
constructor(data: IOrderLineItemSubscriptionPlanPeriod);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{makeAutoObservable as t}from"mobx";import{IkasOrderLineItemSubscriptionPlanDiscount as i}from"../order-line-item-subscription-plan-discount/index.js";var e=function(e){this.cutOffDay=e.cutOffDay,this.discount=e.discount?new i(e.discount):null,this.durationUnit=e.durationUnit,this.durationValue=e.durationValue,this.id=e.id,this.maxOrders=e.maxOrders,this.paymentType=e.paymentType,this.scheduledOrderDay=e.scheduledOrderDay,this.title=e.title,t(this)};export{e as IkasOrderLineItemSubscriptionPlanPeriod};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IkasOrderLoyaltyLine as IOrderLoyaltyLine } from "@ikas/storefront-models";
|
|
2
|
+
export declare class IkasOrderLoyaltyLine implements IOrderLoyaltyLine {
|
|
3
|
+
amount: number;
|
|
4
|
+
id: string;
|
|
5
|
+
loyaltyProgramCustomerId: string;
|
|
6
|
+
loyaltyProgramId: string;
|
|
7
|
+
loyaltySpendingMethodId: string;
|
|
8
|
+
constructor(data: IOrderLoyaltyLine);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{makeAutoObservable as o}from"mobx";var t=function(t){this.amount=t.amount||0,this.id=t.id||"",this.loyaltyProgramCustomerId=t.loyaltyProgramCustomerId||"",this.loyaltyProgramId=t.loyaltyProgramId||"",this.loyaltySpendingMethodId=t.loyaltySpendingMethodId||"",o(this)};export{t as IkasOrderLoyaltyLine};
|
|
@@ -4,6 +4,7 @@ import { IkasTransactionWithPrices } from "./transaction-with-prices";
|
|
|
4
4
|
export declare class IkasOrderTransactionWithPrices implements IOrderTransactionWithPrices {
|
|
5
5
|
chargedAmount: number | null;
|
|
6
6
|
orderFinalPrice: number | null;
|
|
7
|
+
pendingAmount: number | null;
|
|
7
8
|
refundableTransactions: IkasListOrderTransactionWithPricesRefundableTransaction[];
|
|
8
9
|
refundedAmount: number | null;
|
|
9
10
|
remainingBalance: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{IkasPaymentMethodTypeWithPrices,IkasTransactionSourceWithPrices,IkasTransactionStatusWithPrices,IkasTransactionTypeWithPrices}from"@ikas/storefront-models";import{makeAutoObservable as
|
|
1
|
+
export{IkasPaymentMethodTypeWithPrices,IkasTransactionSourceWithPrices,IkasTransactionStatusWithPrices,IkasTransactionTypeWithPrices}from"@ikas/storefront-models";import{makeAutoObservable as n}from"mobx";import{formatCurrency as r}from"../../../../utils/currency.js";import{IkasListOrderTransactionWithPricesRefundableTransaction as t}from"./list-order-transaction-refundable-transaction/index.js";import{IkasTransactionWithPrices as e}from"./transaction-with-prices/index.js";export{IkasTransactionWithPrices}from"./transaction-with-prices/index.js";var i=function(){function i(r){this.chargedAmount=r.chargedAmount||null,this.orderFinalPrice=r.orderFinalPrice||null,this.pendingAmount=r.pendingAmount||null,this.refundableTransactions=r.refundableTransactions?r.refundableTransactions.map((function(n){return new t(n)})):[],this.refundedAmount=r.refundedAmount||null,this.remainingBalance=r.remainingBalance||null,this.transactions=r.transactions?r.transactions.map((function(n){return new e(n)})):[],n(this)}return Object.defineProperty(i.prototype,"formattedChargedAmount",{get:function(){return r(this.chargedAmount||0,"","")},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"formattedOrderFinalPrice",{get:function(){return r(this.orderFinalPrice||0,"","")},enumerable:!1,configurable:!0}),i}();export{i as IkasOrderTransactionWithPrices};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as i}from"mobx";var
|
|
1
|
+
import{makeAutoObservable as i}from"mobx";var t=function(t){this.orderRefundDayLimit=null,this.isActiveRefundSection=t.isActiveRefundSection,this.orderRefundDayLimit=t.orderRefundDayLimit,this.refundDesc=t.refundDesc,this.storefrontId=t.storefrontId,i(this)};export{t as IkasOrderRefundSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import{IkasCampaignOfferTargetPageType as e,IkasCartCampaignOfferStatus as r}from"@ikas/storefront-models";import{IkasProduct as
|
|
1
|
+
import{__assign as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import{IkasCampaignOfferTargetPageType as e,IkasCartCampaignOfferStatus as r}from"@ikas/storefront-models";import{IkasProduct as n}from"../index.js";import{IkasBaseStore as o}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";var s=function(t){this.id=t.id||"",i(this)},a=function(){function s(e){var r,o,s;void 0===e&&(e={}),this.isSelected=!1,this.quantity=1,this.title=null,this.description=null,this.campaignOfferId=e.campaignOfferId||"",this.campaignOfferProductId=e.campaignOfferProductId||"",this.product=new n(t(t({},e.product),{selectedVariantValues:null===(s=(null===(r=e.product)||void 0===r?void 0:r.variants.find((function(t){return t.isActive})))||(null===(o=e.product)||void 0===o?void 0:o.variants[0]))||void 0===s?void 0:s.variantValues})),this.isSelected=e.isSelected||!1,this.quantity=e.quantity||1,this.title=e.title||null,this.description=e.description||null,i(this)}return Object.defineProperty(s.prototype,"isAccepted",{get:function(){var t,i,n=this;return(null===(i=null===(t=o.getInstance().cartStore.cart)||void 0===t?void 0:t.campaignOffers)||void 0===i?void 0:i.some((function(t){return n.campaignOfferId===t.campaignOfferId&&n.campaignOfferProductId===t.campaignOfferProductId&&t.targetPageTypes.some((function(t){return t===e.PRODUCT}))&&t.status===r.ACCEPTED})))||!1},enumerable:!1,configurable:!0}),s}();export{s as IkasProductCampaignOffer,a as IkasProductOffer};
|
|
@@ -24,6 +24,8 @@ export declare class IkasProductFilter implements IProductFilter {
|
|
|
24
24
|
get valueList(): string[];
|
|
25
25
|
get keyList(): string[];
|
|
26
26
|
get displayedValues(): IkasApplicableProductFilterValue[];
|
|
27
|
+
get discountStatusMapping(): Record<string, string>;
|
|
28
|
+
get isDiscountStatusFilter(): boolean;
|
|
27
29
|
onFilterValueClick: (filterValue: IkasApplicableProductFilterValue) => void;
|
|
28
30
|
onNumberRangeClick: (option: IkasProductFilterNumberRangeListOption) => void;
|
|
29
31
|
onNumberRangeChange: (numberRange: IkasFilterRangeValue | null) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from'./../../../../ext/tslib/tslib.es6.js';import{IkasImage as e}from"../../image/index.js";import{IkasProductFilterType as i,IkasProductFilterDisplayType as s,IkasProductFilterSortType as n}from"@ikas/storefront-models";export{IkasProductFilterDisplayType,IkasProductFilterSortType,IkasProductFilterType,IkasProductStockFilterValue}from"@ikas/storefront-models";import{makeAutoObservable as
|
|
1
|
+
import{__assign as t}from'./../../../../ext/tslib/tslib.es6.js';import{IkasImage as e}from"../../image/index.js";import{IkasProductFilterType as i,IkasProductFilterDisplayType as s,IkasProductFilterSortType as n}from"@ikas/storefront-models";export{IkasProductFilterDisplayType,IkasProductFilterSortType,IkasProductFilterType,IkasProductStockFilterValue}from"@ikas/storefront-models";import{makeAutoObservable as o}from"mobx";import{IkasProductFilterFunctions as u}from"@ikas/storefront-model-functions";var r=function(){function e(e,n){var r=this;if(this.productList=null,this.numberRange=null,this.numberRangeLimit=null,this.numberRangeListOptions=null,this.onFilterValueClick=function(t){var e;u.onFilterValueClick(r,t),null===(e=r.productList)||void 0===e||e.applyFilters()},this.onNumberRangeClick=function(t){var e;u.onNumberRangeClick(r,t),null===(e=r.productList)||void 0===e||e.applyFilters()},this.onNumberRangeChange=function(t){var e;u.onNumberRangeChange(r,t),null===(e=r.productList)||void 0===e||e.applyFilters()},this.clear=function(){u.clear(r)},this.toInput=function(){return u.toInput(r)},this.applyQueryParam=function(t){u.applyQueryParam(r,t)},this.id=e.id||"",this.key=e.key||"",this.name=e.name||"",this.order=e.order||0,this.type=e.type||i.BRAND,this.displayType=e.displayType||s.BOX,this.isMultiSelect=e.isMultiSelect||!1,this.isFacetFilter=e.isFacetFilter||!1,this.values=e.values?e.values.map((function(t){return new l(t)})):null,this.customValues=e.customValues||null,this.settings=e.settings?new h(e.settings):null,this.displayType===s.NUMBER_RANGE_LIST&&this.customValues&&this.customValues.length&&(this.numberRangeListOptions=this.customValues.map((function(e){return new c(t(t({key:e},m(e)),{isSelected:!1}))}))),this.displayType===s.NUMBER_RANGE&&this.customValues&&this.customValues.length){var a=this.customValues[0];this.numberRangeLimit=m(a)}this.productList=n,o(this)}return Object.defineProperty(e.prototype,"isCustomValueFilter",{get:function(){return u.isCustomValueFilter(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStockFilter",{get:function(){return u.isStockFilter(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"valueList",{get:function(){return u.getValueList(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"keyList",{get:function(){return u.getKeyList(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayedValues",{get:function(){return u.getDisplayedValues(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"discountStatusMapping",{get:function(){return u.getDiscountStatusMapping()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDiscountStatusFilter",{get:function(){return u.isDiscountStatusFilter(this)},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var e=t({},this);return delete e.productList,e},e}(),l=function(){function t(t){this.thumbnailImageId=null,this.thumbnailImage=null,this.id=t.id||"",this.key=t.key||"",this.name=t.name||"",this.colorCode=t.colorCode||null,this.thumbnailImageId=t.thumbnailImageId||null,this.thumbnailImageId&&(this.thumbnailImage=new e({id:this.thumbnailImageId,isVideo:!1})),this.isSelected=t.isSelected||!1,this.resultCount=void 0!==t.resultCount&&null!==t.resultCount?t.resultCount:null,this.slug=t.slug||null,o(this)}return Object.defineProperty(t.prototype,"href",{get:function(){return u.getIkasFilterHref(this)},enumerable:!1,configurable:!0}),t}(),a=function(t){this.id=t.id,this.type=t.type,this.displayType=t.displayType,this.valueList=t.valueList,o(this)},h=function(t){this.useAndFilter=t.useAndFilter||!1,this.showCollapsedOnDesktop=t.showCollapsedOnDesktop||!1,this.showCollapsedOnMobile=t.showCollapsedOnMobile||!1,this.sortType=t.sortType||n.ALPHABETICAL_ASC,this.customSortedValues=t.customSortedValues||null,o(this)},p=function(t){this.from=t.from||0,this.to=t.to||null,o(this)},c=function(){function e(t){this.from=t.from||0,this.to=t.to||null,this.key=t.key||"",this.isSelected=t.isSelected||!1,o(this)}return e.prototype.toJSON=function(){return t(t({},this),{isSelected:this.isSelected})},e}();function m(t){return u.parseRangeStr(t)}export{l as IkasApplicableProductFilterValue,p as IkasFilterRangeValue,r as IkasProductFilter,c as IkasProductFilterNumberRangeListOption,h as IkasProductFilterSettings,a as IkasProductFilterValue,m as parseRangeStr};
|
|
@@ -19,6 +19,7 @@ import { IkasProductGroupValue } from "./group/value";
|
|
|
19
19
|
import { IkasProductGroupOrder } from "./group/order";
|
|
20
20
|
import { IkasImage } from "../image";
|
|
21
21
|
import { IkasProductSalesChannel } from "./sales-channel";
|
|
22
|
+
import { IkasProductTranslation } from "./translations";
|
|
22
23
|
export declare class IkasProduct implements IProduct {
|
|
23
24
|
id: string;
|
|
24
25
|
name: string;
|
|
@@ -44,6 +45,7 @@ export declare class IkasProduct implements IProduct {
|
|
|
44
45
|
campaignOffers: IkasProductCampaignOffer[] | null;
|
|
45
46
|
productGroup: IkasProductGroup | null;
|
|
46
47
|
salesChannels: IkasProductSalesChannel[] | null;
|
|
48
|
+
translations?: IkasProductTranslation[] | null;
|
|
47
49
|
productOptionSet?: IkasProductOptionSet | null;
|
|
48
50
|
campaigns?: IkasProductCampaign[] | null;
|
|
49
51
|
selectedVariantValues: IkasVariantValue[];
|
|
@@ -75,15 +77,20 @@ export declare class IkasProduct implements IProduct {
|
|
|
75
77
|
getVariantUnitPriceText: (variant: IkasProductVariant) => string | undefined;
|
|
76
78
|
getCampaigns: () => Promise<IkasProductCampaign[] | undefined>;
|
|
77
79
|
getAvailableStockLocations: () => Promise<import("./stock-location").IkasProductStockLocations[]>;
|
|
80
|
+
updatePrices: () => Promise<void>;
|
|
78
81
|
getCustomerReviews: (params?: {
|
|
79
82
|
limit?: number;
|
|
80
83
|
page?: number;
|
|
81
84
|
hasImage?: boolean;
|
|
85
|
+
locale?: string;
|
|
86
|
+
sortWithImagesFirst?: boolean;
|
|
82
87
|
}) => Promise<IkasCustomerReviewList>;
|
|
83
88
|
getProductOptionSet: () => Promise<boolean>;
|
|
84
89
|
initBundleProducts: () => Promise<void>;
|
|
85
90
|
setShowVariantsInGroup: (value: boolean) => void;
|
|
86
91
|
getBundleProductsOfVariant: (variant: IkasProductVariant) => Promise<void>;
|
|
92
|
+
getSubscriptionPlanOfVariant: (variant: IkasProductVariant) => Promise<void>;
|
|
93
|
+
dispose(): void;
|
|
87
94
|
setOptionRealPrices: () => void;
|
|
88
95
|
private setOptionPrices;
|
|
89
96
|
}
|
|
@@ -104,6 +111,7 @@ export declare type IkasProductGroupItem = {
|
|
|
104
111
|
href: string;
|
|
105
112
|
groupValues: IkasProductGroupValue[];
|
|
106
113
|
order: IkasProductGroupOrder;
|
|
114
|
+
hasStock: boolean;
|
|
107
115
|
};
|
|
108
116
|
export declare type IkasDisplayedProductGroup = {
|
|
109
117
|
name: string;
|
|
@@ -114,4 +122,6 @@ export declare type IkasDisplayedProductGroupItem = {
|
|
|
114
122
|
href: string;
|
|
115
123
|
value: string;
|
|
116
124
|
isSelected: boolean;
|
|
125
|
+
isSelectable: boolean;
|
|
126
|
+
hasStock: boolean;
|
|
117
127
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as t,__assign as e,__awaiter as i,__generator as n}from'./../../../ext/tslib/tslib.es6.js';import r from"lodash/sortBy";import a from"lodash/cloneDeep";import{IkasCategory as o}from"../category/index.js";import{IkasProductVariant as s}from"./variant/index.js";import{IkasProductAttributeValue as u}from"./attribute-value/index.js";import{IkasProductVariantType as c}from"./variant-type/index.js";import{IkasBrand as d}from"../brand/index.js";import{IkasHTMLMetaData as l}from"../html-meta-data/index.js";import{IkasProductTag as p}from"./tag/index.js";import{IkasProductOptionPriceTypeEnum as f,IkasProductType as v}from"@ikas/storefront-models";export{IkasProductType}from"@ikas/storefront-models";import{IkasProductOptionSet as h}from"./option-set/index.js";import{makeObservable as m,observable as g,computed as V}from"mobx";import{IkasProductFunctions as b}from"@ikas/storefront-model-functions";import{IkasProductCampaign as y}from"./campaign/index.js";import{IkasStorefrontConfig as P}from"@ikas/storefront-config";import{IkasBaseStore as I}from"../../../store/base.js";import O from"lodash/groupBy";import{IkasProductBaseUnit as w}from"./base-unit/index.js";import{formatCurrency as S}from"../../../utils/currency.js";import"lodash/get";import T from"../../../store/product/index.js";import{IkasCustomerReviewList as j}from"../../ui/customer-review-list/index.js";import{IkasProductStar as C}from"./star/index.js";import{IkasProductCampaignOffer as x,IkasProductOffer as R}from"./campaign-offer/index.js";import{IkasProductGroup as G}from"./group/index.js";import{IkasImage as E}from"../image/index.js";import{IkasProductSalesChannel as A}from"./sales-channel/index.js";var k=function(){function k(b){void 0===b&&(b={});var O,E,L,D=this;this.metaData=null,this.brand=null,this.tags=null,this.productOptionSetId=null,this.productOptionSet=null,this.campaigns=null,this.selectedVariantValues=[],this.isFiltered=!1,this.isStatic=!1,this.bundleProductCache={},this.productGroupItems=[],this.showVariantsInGroup=!1,this.selectVariantValue=function(i,n){var r,a=D.metaData,o=D.selectedVariantValues.map((function(t){return t.variantTypeId===i.variantTypeId?i:t})),s=D.variants.find((function(t){return t.isActive&&o.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}));if(s)D.selectedVariantValues=o;else{var u=D.variantTypes.findIndex((function(t){return t.variantType.id===i.variantTypeId}));if(u>0){var c=D.variantTypes.slice(0,u),d=D.selectedVariantValues.filter((function(t){return c.some((function(e){return e.variantType.id===t.variantTypeId}))})),l=t(t([],d,!0),[i],!1);s=D.variants.find((function(t){return t.isActive&&l.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}))}else{var p=o.slice(0,o.length-1);(s=D.variants.find((function(t){return t.isActive&&p.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})))||(s=D.variants.find((function(t){return t.isActive&&t.variantValues.some((function(t){return t.id===i.id}))})))}if(!s)return;D.selectedVariantValues=s.variantValues}var f={};new URLSearchParams(window.location.search).forEach((function(t,i){var n;"vid"!==i&&(f=e(e({},f),((n={})[i]=t,n)))})),D.variantTypes.map((function(t){delete f[decodeURIComponent(t.variantType.slug)]}));var v=t(t([],Object.entries(f).map((function(t){var e=t[0],i=t[1];return"".concat(e,"=").concat(i)})),!0),D.variantTypes.map((function(t){var e=t.variantType,i=e.values.find((function(t){return D.selectedVariantValues.some((function(e){return e.id===t.id}))}));if(i)return"".concat(e.slug,"=").concat(i.slug)})),!0).filter((function(t){return!!t})).join("&");if(D.setOptionRealPrices(),!n){var h="/".concat(a.slug);if(v&&(h="/".concat(a.slug,"?").concat(v)),h===window.location.pathname)return;null===(r=I.getInstance().router)||void 0===r||r.replace(h,void 0,{shallow:!1,scroll:!1})}},this.getVariantUnitPriceText=function(t){var e,i,n=t.price;if(n.unitPrice&&D.baseUnit){var r=D.baseUnit.baseAmount,a=(null===(i=null===(e=D.baseUnit)||void 0===e?void 0:e.unit)||void 0===i?void 0:i.name)||"";return"".concat(S(n.unitPrice,n.currency||"",n.currencySymbol||"")," / ").concat(r&&1!==r?r:"").concat(a)}},this.getCampaigns=function(){return i(D,void 0,void 0,(function(){var t,e,i,r,a,o=this;return n(this,(function(n){switch(n.label){case 0:return t=I.getInstance(),e=t.customerStore.customer,i=e?e.customerGroupIds:null,r=this.variants.map((function(t){return t.id})),[4,T.getProductCampaigns({input:{customerGroupIds:i,salesChannelId:P.getSalesChannelId()||"",variantIds:r}})];case 1:return a=n.sent(),this.campaigns=a.data,this.campaigns?(this.campaigns.map((function(t){o.variants.map((function(e){var i;t.variantIds.some((function(t){return t===e.id}))&&(null===(i=e.campaigns)||void 0===i||i.push(t))}))})),[2,this.campaigns]):[2]}}))}))},this.getAvailableStockLocations=function(){return i(D,void 0,void 0,(function(){var t,e;return n(this,(function(i){switch(i.label){case 0:return t=this.variants.map((function(t){return t.id})),e=P.getPickupStockLocationIds(),[4,T.getVariantStockLocations({stockLocationIdList:e,variantIds:t})];case 1:return[2,i.sent().data||[]]}}))}))},this.getCustomerReviews=function(t){return i(D,void 0,void 0,(function(){var i,r,a,o,s;return n(this,(function(n){switch(n.label){case 0:return i=!!(null===(o=this.selectedVariant.bundleSettings)||void 0===o?void 0:o.products.length),r=[this.id],i&&(null===(s=this.selectedVariant.bundleSettings)||void 0===s||s.products.forEach((function(t){r.push(t.productId)}))),[4,(a=new j(e(e(e({},i?{}:{productId:this.id}),{limit:null==t?void 0:t.limit,page:null==t?void 0:t.page,hasImage:null==t?void 0:t.hasImage}),i?{productIds:r}:{}))).getInitial()];case 1:return n.sent(),[2,a]}}))}))},this.getProductOptionSet=function(){return i(D,void 0,void 0,(function(){var t,e;return n(this,(function(i){switch(i.label){case 0:return this.productOptionSet?[2,!0]:this.productOptionSetId?[4,T.listProductOptionSet({id:{eq:this.productOptionSetId}})]:[2,!1];case 1:return(t=i.sent()).isSuccess&&(null===(e=t.data)||void 0===e?void 0:e.length)?(this.productOptionSet=t.data[0],this.setOptionPrices(),this.setOptionRealPrices(),[2,!0]):[2,!1]}}))}))},this.initBundleProducts=function(){return i(D,void 0,void 0,(function(){var t,e,i,r,a,o;return n(this,(function(n){switch(n.label){case 0:return t="","undefined"!=typeof window&&(e=new URLSearchParams(window.location.search),t=e.get("editLineID")||""),t?(i=null===(a=I.getInstance().cartStore.cart)||void 0===a?void 0:a.items.find((function(e){return e.id===t})))&&(r=this.variants.find((function(t){return t.id===i.variant.id})))?(this.selectedVariantValues=r.variantValues,[4,this.getBundleProductsOfVariant(r)]):[3,2]:[3,3];case 1:n.sent(),null===(o=r.bundleSettings)||void 0===o||o.products.forEach((function(t){var e,n,r;try{var a=null===(e=i.variant.bundleProducts)||void 0===e?void 0:e.find((function(e){return e.id===t.id})),o=t.product.variants.find((function(t){return t.id===(null==a?void 0:a.variant.id)}));t.product.selectedVariantValues=o.variantValues,t.quantity=(null===(r=null===(n=i.variant.bundleProducts)||void 0===n?void 0:n.find((function(t){return t.variant.id===o.id})))||void 0===r?void 0:r.quantity)||0}catch(t){console.error(t)}})),n.label=2;case 2:return[3,5];case 3:return[4,this.getBundleProductsOfVariant(this.selectedVariant)];case 4:n.sent(),n.label=5;case 5:return[2]}}))}))},this.setShowVariantsInGroup=function(t){D.showVariantsInGroup=t},this.getBundleProductsOfVariant=function(t){return i(D,void 0,void 0,(function(){var e,i,r,o,s,u,c=this;return n(this,(function(n){switch(n.label){case 0:return(null==(e=null===(r=t.bundleSettings)||void 0===r?void 0:r.products.map((function(t){return t.productId})).filter((function(t){return-1===Object.keys(c.bundleProductCache).indexOf(t)})))?void 0:e.length)?[4,T.searchProducts({input:{productIdList:e,perPage:200,priceListId:P.getPriceListId(),salesChannelId:P.getSalesChannelId()}})]:[3,2];case 1:(i=n.sent()).isSuccess&&(null===(s=null===(o=i.data)||void 0===o?void 0:o.data)||void 0===s||s.forEach((function(t){c.bundleProductCache[t.id]=t}))),n.label=2;case 2:return null===(u=t.bundleSettings)||void 0===u||u.products.forEach((function(t){var e=c.bundleProductCache[t.productId];t.setProduct(new k(a(e)))})),[2]}}))}))},this.setOptionRealPrices=function(){var t,e=D.selectedVariant||D.variants[0];if(e){var i=e.price.currency;i&&(null===(t=D.productOptionSet)||void 0===t||t.options.forEach((function(t){var e;if(t.selectSettings)t.selectSettings.values.forEach((function(t){var e;if(t.priceType===f.RATIO&&t.initPrice)if(t.otherPrices){var n=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===e?void 0:e.price)||t.initPrice||1;t.price=D.selectedVariant.price.finalPrice*n/100}else t.price=D.selectedVariant.price.finalPrice*t.initPrice/100}));else if(t.priceType===f.RATIO&&t.initPrice)if(t.otherPrices){var n=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===e?void 0:e.price)||t.initPrice||1;t.price=D.selectedVariant.price.finalPrice*n/100}else t.price=D.selectedVariant.price.finalPrice*t.initPrice/100})))}},this.setOptionPrices=function(){var t,e=D.variants[0];if(e){var i=e.price.currency;null===(t=D.productOptionSet)||void 0===t||t.options.forEach((function(t){var n,r;if(t.selectSettings&&t.selectSettings.values.forEach((function(t){var n,r;if(t.otherPrices)if(t.priceType===f.RATIO){var a=(null===(n=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===n?void 0:n.price)||t.price||1;t.price=e.price.finalPrice*a}else t.price=(null===(r=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===r?void 0:r.price)||t.price})),t.otherPrices)if(t.priceType===f.RATIO){var a=(null===(n=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===n?void 0:n.price)||t.price||1;t.price=e.price.finalPrice*a}else t.price=(null===(r=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===r?void 0:r.price)||t.price}))}},this.id=b.id||Date.now()+"",this.name=b.name||"",this.type=b.type||v.PHYSICAL,this.description=b.description||"",this.shortDescription=b.shortDescription||"",this.metaData=b.metaData?new l(b.metaData):null,this.brand=b.brand?new d(b.brand):null,this.categories=b.categories?b.categories.map((function(t){return new o(t)})):[],this.deleted=b.deleted||null,this.tags=b.tags?b.tags.map((function(t){return new p(t)})):[],this.variants=b.variants?b.variants.map((function(t){return new s(t)})):[],this.attributes=b.attributes?b.attributes.map((function(t){return new u(t)})):[],this.variantTypes=b.variantTypes?b.variantTypes.map((function(t){return new c(t)})):[],this.productOptionSetId=b.productOptionSetId||null,this.averageRating=null!==(O=b.averageRating)&&void 0!==O?O:null,this.reviewCount=null!==(E=b.reviewCount)&&void 0!==E?E:null,this.stars=b.stars?b.stars.map((function(t){return new C(t)})):null,this.baseUnit=b.baseUnit?new w(b.baseUnit):null,this.campaigns=(null===(L=b.campaigns)||void 0===L?void 0:L.map((function(t){return new y(t)})))||null,this.selectedVariantValues=b.selectedVariantValues||[],this.productOptionSet=b.productOptionSet?new h(b.productOptionSet):null,this.variantTypes=r(this.variantTypes,"order"),this.groupVariantsByVariantTypeId=b.groupVariantsByVariantTypeId||null,this.dynamicPriceListIds=b.dynamicPriceListIds||null,this.productVolumeDiscountId=b.productVolumeDiscountId||null,this.campaignOffers=b.campaignOffers?b.campaignOffers.map((function(t){return new x(t)})):null,this.appliedCampaignOffer=b.appliedCampaignOffer,this.offers=b.offers?b.offers.map((function(t){return new R(t)})):void 0,this.productGroup=b.productGroup?new G(b.productGroup):null,this.salesChannels=b.salesChannels?b.salesChannels.map((function(t){return new A(t)})):null,this.productGroupItems=b.productGroupItems,this.variants.forEach((function(t){return t.product=D})),this.setOptionPrices(),this.setOptionRealPrices(),this.customerReviews=b.customerReviews?new j(b.customerReviews):null,m(this,{selectedVariantValues:g,isFiltered:g,isStatic:g,showVariantsInGroup:g,hasVariant:V,hasStock:V,hasValidProductOptionValues:V,href:V,productHref:V,mainVariantType:V,mainVariantValue:V,selectedVariant:V,displayedVariantTypes:V,isCustomerReviewEnabled:V,isCustomerReviewLoginRequired:V,isAddToCartEnabled:V,groupedAttributeValues:V,selectedVariantUnitPriceText:V,displayedProductGroups:V})}return Object.defineProperty(k.prototype,"hasVariant",{get:function(){return b.hasVariant(this,this.showVariantsInGroup)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasStock",{get:function(){return this.isStatic?this.selectedVariant.hasStock:b.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasValidProductOptionValues",{get:function(){return!this.productOptionSet||this.productOptionSet.hasValidValues},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"href",{get:function(){return b.getSelectedVariantHref(this,this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"productHref",{get:function(){return this.groupVariantsByVariantTypeId||this.isFiltered?this.href:b.getProductHref(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mainVariantType",{get:function(){return b.getMainVariantType(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mainVariantValue",{get:function(){return b.getMainVariantValue(this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"selectedVariant",{get:function(){if(!this.hasVariant)return this.variants[0];var t=this.selectedVariantValues.map((function(t){return t.id}));return this.variants.find((function(e){return e.variantValues.every((function(e){return t.includes(e.id)}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"displayedVariantTypes",{get:function(){return this.hasVariant?b.getDisplayedVariantTypes(this,this.selectedVariantValues):[]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isCustomerReviewEnabled",{get:function(){return P.isCustomerReviewEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isCustomerReviewLoginRequired",{get:function(){return P.isCustomerReviewLoginRequired()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isAddToCartEnabled",{get:function(){var t,e=!0;return null===(t=this.selectedVariant.bundleSettings)||void 0===t||t.products.forEach((function(t){0===t.quantity&&null!==t.minQuantity&&0!==t.minQuantity&&(e=!1)})),e&&this.hasValidProductOptionValues&&(this.selectedVariant.hasStock||this.selectedVariant.sellIfOutOfStock)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"groupedAttributeValues",{get:function(){var t,e=O(this.attributes,"productAttributeId");return(null===(t=this.attributes)||void 0===t?void 0:t.map((function(t){var i=t.productAttributeId;if(i){var n=e[i];return(null==n?void 0:n.length)&&n[0].productAttribute?{attribute:n[0].productAttribute,values:n}:void 0}})).filter((function(t){return!!t})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"selectedVariantUnitPriceText",{get:function(){return this.getVariantUnitPriceText(this.selectedVariant)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"displayedProductGroups",{get:function(){var e,i=this,n=[],a=[];return null===(e=this.productGroupItems)||void 0===e||e.forEach((function(t){t.groupValues.forEach((function(t){n.includes(t.name)||n.push(t.name)}))})),n.forEach((function(e){var n,o={name:e,items:[]};i.productGroupItems=r(i.productGroupItems,(function(t){var e;return parseInt((null===(e=t.order)||void 0===e?void 0:e.value)||"999",10)})),null===(n=i.productGroupItems)||void 0===n||n.forEach((function(n){var r,a,s,u=n.groupValues.find((function(t){return t.name===e}));if(u&&!o.items.some((function(t){return t.value===u.value}))){var c="";if(n.productId===i.id)c=i.href;else{var d=(null===(r=i.productGroup)||void 0===r?void 0:r.values.filter((function(t){return t.name!==e})))||[],l=t(t([],d,!0),[u],!1),p=null===(a=i.productGroupItems)||void 0===a?void 0:a.find((function(t){return l.every((function(e){return t.groupValues.some((function(t){return e.name===t.name&&e.value===t.value}))}))}));c=p?p.href:n.href}o.items.push({image:n.image?new E(n.image):null,href:c,value:u.value,isSelected:(null===(s=i.productGroupItems)||void 0===s?void 0:s.some((function(t){return t.groupValues.some((function(t){return t.value===u.value}))&&t.productId===i.id})))||!1})}})),a.push(o)})),a},enumerable:!1,configurable:!0}),k}();export{k as IkasProduct};
|
|
1
|
+
import{__spreadArray as t,__assign as e,__awaiter as i,__generator as n}from'./../../../ext/tslib/tslib.es6.js';import r from"lodash/sortBy";import a from"lodash/cloneDeep";import{IkasCategory as o}from"../category/index.js";import{IkasProductVariant as s}from"./variant/index.js";import{IkasProductAttributeValue as u}from"./attribute-value/index.js";import{IkasProductVariantType as c}from"./variant-type/index.js";import{IkasBrand as d}from"../brand/index.js";import{IkasHTMLMetaData as l}from"../html-meta-data/index.js";import{IkasProductTag as p}from"./tag/index.js";import{IkasProductOptionPriceTypeEnum as f,IkasProductType as v}from"@ikas/storefront-models";export{IkasProductType}from"@ikas/storefront-models";import{IkasProductOptionSet as h}from"./option-set/index.js";import{makeObservable as m,observable as g,computed as b}from"mobx";import{IkasProductFunctions as V}from"@ikas/storefront-model-functions";import{IkasProductCampaign as y}from"./campaign/index.js";import{IkasStorefrontConfig as P}from"@ikas/storefront-config";import{IkasBaseStore as I}from"../../../store/base.js";import O from"lodash/groupBy";import{IkasProductBaseUnit as S}from"./base-unit/index.js";import{formatCurrency as w}from"../../../utils/currency.js";import"lodash/get";import T from"../../../store/product/index.js";import{IkasCustomerReviewList as j}from"../../ui/customer-review-list/index.js";import{IkasProductStar as C}from"./star/index.js";import{IkasProductCampaignOffer as L,IkasProductOffer as x}from"./campaign-offer/index.js";import{IkasProductGroup as E}from"./group/index.js";import{IkasImage as R}from"../image/index.js";import{IkasProductSalesChannel as G}from"./sales-channel/index.js";import{IkasProductTranslation as k}from"./translations/index.js";var A=function(){function A(V){void 0===V&&(V={});var O,R,D,U=this;this.metaData=null,this.brand=null,this.tags=null,this.productOptionSetId=null,this.translations=null,this.productOptionSet=null,this.campaigns=null,this.selectedVariantValues=[],this.isFiltered=!1,this.isStatic=!1,this.bundleProductCache={},this.productGroupItems=[],this.showVariantsInGroup=!1,this.selectVariantValue=function(i,n){var r,a=U.metaData,o=U.selectedVariantValues.map((function(t){return t.variantTypeId===i.variantTypeId?i:t})),s=U.variants.find((function(t){return t.isActive&&o.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}));if(s)U.selectedVariantValues=o;else{var u=U.variantTypes.findIndex((function(t){return t.variantType.id===i.variantTypeId}));if(u>0){var c=U.variantTypes.slice(0,u),d=U.selectedVariantValues.filter((function(t){return c.some((function(e){return e.variantType.id===t.variantTypeId}))})),l=t(t([],d,!0),[i],!1);s=U.variants.find((function(t){return t.isActive&&l.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}))}else{var p=o.slice(0,o.length-1);(s=U.variants.find((function(t){return t.isActive&&p.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})))||(s=U.variants.find((function(t){return t.isActive&&t.variantValues.some((function(t){return t.id===i.id}))})))}if(!s)return;U.selectedVariantValues=s.variantValues}var f={};new URLSearchParams(window.location.search).forEach((function(t,i){var n;"vid"!==i&&(f=e(e({},f),((n={})[i]=t,n)))})),U.variantTypes.map((function(t){delete f[decodeURIComponent(t.variantType.slug)]}));var v=t(t([],Object.entries(f).map((function(t){var e=t[0],i=t[1];return"".concat(e,"=").concat(i)})),!0),U.variantTypes.map((function(t){var e=t.variantType,i=e.values.find((function(t){return U.selectedVariantValues.some((function(e){return e.id===t.id}))}));if(i)return"".concat(e.slug,"=").concat(i.slug)})),!0).filter((function(t){return!!t})).join("&");if(U.setOptionRealPrices(),!n){var h="/".concat(a.slug);if(v&&(h="/".concat(a.slug,"?").concat(v)),h===window.location.pathname)return;null===(r=I.getInstance().router)||void 0===r||r.replace(h,void 0,{shallow:!1,scroll:!1})}},this.getVariantUnitPriceText=function(t){var e,i,n=t.price;if(n.unitPrice&&U.baseUnit){var r=U.baseUnit.baseAmount,a=(null===(i=null===(e=U.baseUnit)||void 0===e?void 0:e.unit)||void 0===i?void 0:i.name)||"";return"".concat(w(n.unitPrice,n.currency||"",n.currencySymbol||"")," / ").concat(r&&1!==r?r:"").concat(a)}},this.getCampaigns=function(){return i(U,void 0,void 0,(function(){var t,e,i,r,a,o=this;return n(this,(function(n){switch(n.label){case 0:return t=I.getInstance(),e=t.customerStore.customer,i=e?e.customerGroupIds:null,r=this.variants.map((function(t){return t.id})),[4,T.getProductCampaigns({input:{customerGroupIds:i,salesChannelId:P.getSalesChannelId()||"",variantIds:r}})];case 1:return a=n.sent(),this.campaigns=a.data,this.campaigns?(this.campaigns.map((function(t){o.variants.map((function(e){var i;t.variantIds.some((function(t){return t===e.id}))&&(null===(i=e.campaigns)||void 0===i||i.push(t))}))})),[2,this.campaigns]):[2]}}))}))},this.getAvailableStockLocations=function(){return i(U,void 0,void 0,(function(){var t,e;return n(this,(function(i){switch(i.label){case 0:return t=this.variants.map((function(t){return t.id})),e=P.getPickupStockLocationIds(),[4,T.getVariantStockLocations({stockLocationIdList:e,variantIds:t})];case 1:return[2,i.sent().data||[]]}}))}))},this.updatePrices=function(){return i(U,void 0,void 0,(function(){var t,e,i,r,a=this;return n(this,(function(n){switch(n.label){case 0:return[4,T.searchProducts({input:{productIdList:[this.id],perPage:1,priceListId:P.getPriceListId(),salesChannelId:P.getSalesChannelId()}})];case 1:return t=n.sent(),(e=null===(r=null===(i=t.data)||void 0===i?void 0:i.data)||void 0===r?void 0:r.find((function(t){return t.id===a.id})))?(this.variants.forEach((function(t){var i=e.variants.find((function(e){return e.id===t.id}));i&&(t.prices=i.prices,t.baseBundlePrices=i.baseBundlePrices)})),[2]):[2]}}))}))},this.getCustomerReviews=function(t){return i(U,void 0,void 0,(function(){var i,r,a,o,s;return n(this,(function(n){switch(n.label){case 0:return i=!!(null===(o=this.selectedVariant.bundleSettings)||void 0===o?void 0:o.products.length),r=[this.id],i&&(null===(s=this.selectedVariant.bundleSettings)||void 0===s||s.products.forEach((function(t){r.push(t.productId)}))),[4,(a=new j(e(e(e({},i?{}:{productId:this.id}),{locale:null==t?void 0:t.locale,limit:null==t?void 0:t.limit,page:null==t?void 0:t.page,hasImage:null==t?void 0:t.hasImage,sortWithImagesFirst:null==t?void 0:t.sortWithImagesFirst}),i?{productIds:r}:{}))).getInitial()];case 1:return n.sent(),[2,a]}}))}))},this.getProductOptionSet=function(){return i(U,void 0,void 0,(function(){var t,e;return n(this,(function(i){switch(i.label){case 0:return this.productOptionSet?[2,!0]:this.productOptionSetId?[4,T.listProductOptionSet({id:{eq:this.productOptionSetId}})]:[2,!1];case 1:return(t=i.sent()).isSuccess&&(null===(e=t.data)||void 0===e?void 0:e.length)?(this.productOptionSet=t.data[0],this.setOptionPrices(),this.setOptionRealPrices(),[2,!0]):[2,!1]}}))}))},this.initBundleProducts=function(){return i(U,void 0,void 0,(function(){var t,e,i,r,a,o;return n(this,(function(n){switch(n.label){case 0:return t="","undefined"!=typeof window&&(e=new URLSearchParams(window.location.search),t=e.get("editLineID")||""),t?(i=null===(a=I.getInstance().cartStore.cart)||void 0===a?void 0:a.items.find((function(e){return e.id===t})))&&(r=this.variants.find((function(t){return t.id===i.variant.id})))?(this.selectedVariantValues=r.variantValues,[4,this.getBundleProductsOfVariant(r)]):[3,2]:[3,3];case 1:n.sent(),null===(o=r.bundleSettings)||void 0===o||o.products.forEach((function(t){var e,n,r;try{var a=null===(e=i.variant.bundleProducts)||void 0===e?void 0:e.find((function(e){return e.id===t.id})),o=t.product.variants.find((function(t){return t.id===(null==a?void 0:a.variant.id)}));t.product.selectedVariantValues=o.variantValues,t.quantity=(null===(r=null===(n=i.variant.bundleProducts)||void 0===n?void 0:n.find((function(t){return t.variant.id===o.id})))||void 0===r?void 0:r.quantity)||0}catch(t){console.error(t)}})),n.label=2;case 2:return[3,5];case 3:return[4,this.getBundleProductsOfVariant(this.selectedVariant)];case 4:n.sent(),n.label=5;case 5:return[2]}}))}))},this.setShowVariantsInGroup=function(t){U.showVariantsInGroup=t},this.getBundleProductsOfVariant=function(t){return i(U,void 0,void 0,(function(){var e,i,r,o,s,u,c=this;return n(this,(function(n){switch(n.label){case 0:return(null==(e=null===(r=t.bundleSettings)||void 0===r?void 0:r.products.map((function(t){return t.productId})).filter((function(t){return-1===Object.keys(c.bundleProductCache).indexOf(t)})))?void 0:e.length)?[4,T.searchProducts({input:{productIdList:e,perPage:200,priceListId:P.getPriceListId(),salesChannelId:P.getSalesChannelId()}})]:[3,2];case 1:(i=n.sent()).isSuccess&&(null===(s=null===(o=i.data)||void 0===o?void 0:o.data)||void 0===s||s.forEach((function(t){c.bundleProductCache[t.id]=t}))),n.label=2;case 2:return null===(u=t.bundleSettings)||void 0===u||u.products.forEach((function(t){var e=c.bundleProductCache[t.productId];t.setProduct(new A(a(e)))})),[2]}}))}))},this.getSubscriptionPlanOfVariant=function(t){return i(U,void 0,void 0,(function(){var e,i=this;return n(this,(function(n){return null===(e=t.subscriptionPlan)||void 0===e||e.periods.forEach((function(t,e){t.setProduct(i),0===e&&(t.isSelected=!0)})),[2]}))}))},this.setOptionRealPrices=function(){var t,e=U.selectedVariant||U.variants[0];if(e){var i=e.price.priceListId;null===(t=U.productOptionSet)||void 0===t||t.options.forEach((function(t){var e;if(t.selectSettings)t.selectSettings.values.forEach((function(t){var e;if(t.priceType===f.RATIO&&t.initPrice)if(t.otherPrices){var n=(null===(e=t.otherPrices.find((function(t){return t.priceListId===i})))||void 0===e?void 0:e.price)||t.initPrice||1;t.price=U.selectedVariant.price.finalPrice*n/100}else t.price=U.selectedVariant.price.finalPrice*t.initPrice/100}));else if(t.priceType===f.RATIO&&t.initPrice)if(t.otherPrices){var n=(null===(e=t.otherPrices.find((function(t){return t.priceListId===i})))||void 0===e?void 0:e.price)||t.initPrice||1;t.price=U.selectedVariant.price.finalPrice*n/100}else t.price=U.selectedVariant.price.finalPrice*t.initPrice/100}))}},this.setOptionPrices=function(){var t,e=U.variants[0];if(e){var i=e.price.priceListId;null===(t=U.productOptionSet)||void 0===t||t.options.forEach((function(t){var n,r;if(t.selectSettings&&t.selectSettings.values.forEach((function(t){var n,r;if(t.otherPrices)if(t.priceType===f.RATIO){var a=(null===(n=t.otherPrices.find((function(t){return t.priceListId===i})))||void 0===n?void 0:n.price)||t.price||1;t.price=e.price.finalPrice*a/100}else t.price=(null===(r=t.otherPrices.find((function(t){return t.priceListId===i})))||void 0===r?void 0:r.price)||t.price})),t.otherPrices)if(t.priceType===f.RATIO){var a=(null===(n=t.otherPrices.find((function(t){return t.priceListId===i})))||void 0===n?void 0:n.price)||t.price||1;t.price=e.price.finalPrice*a/100}else t.price=(null===(r=t.otherPrices.find((function(t){return t.priceListId===i})))||void 0===r?void 0:r.price)||t.price}))}},this.id=V.id||Date.now()+"",this.name=V.name||"",this.type=V.type||v.PHYSICAL,this.description=V.description||"",this.shortDescription=V.shortDescription||"",this.metaData=V.metaData?new l(V.metaData):null,this.brand=V.brand?new d(V.brand):null,this.categories=V.categories?V.categories.map((function(t){return new o(t)})):[],this.deleted=V.deleted||null,this.tags=V.tags?V.tags.map((function(t){return new p(t)})):[],this.variants=V.variants?V.variants.map((function(t){return new s(t)})):[],this.attributes=V.attributes?V.attributes.map((function(t){return new u(t)})):[],this.variantTypes=V.variantTypes?V.variantTypes.map((function(t){return new c(t)})):[],this.productOptionSetId=V.productOptionSetId||null,this.averageRating=null!==(O=V.averageRating)&&void 0!==O?O:null,this.reviewCount=null!==(R=V.reviewCount)&&void 0!==R?R:null,this.stars=V.stars?V.stars.map((function(t){return new C(t)})):null,this.baseUnit=V.baseUnit?new S(V.baseUnit):null,this.campaigns=(null===(D=V.campaigns)||void 0===D?void 0:D.map((function(t){return new y(t)})))||null,this.selectedVariantValues=V.selectedVariantValues||[],this.productOptionSet=V.productOptionSet?new h(V.productOptionSet):null,this.variantTypes=r(this.variantTypes,"order"),this.groupVariantsByVariantTypeId=V.groupVariantsByVariantTypeId||null,this.dynamicPriceListIds=V.dynamicPriceListIds||null,this.productVolumeDiscountId=V.productVolumeDiscountId||null,this.campaignOffers=V.campaignOffers?V.campaignOffers.map((function(t){return new L(t)})):null,this.appliedCampaignOffer=V.appliedCampaignOffer,this.offers=V.offers?V.offers.map((function(t){return new x(t)})):void 0,this.productGroup=V.productGroup?new E(V.productGroup):null,this.salesChannels=V.salesChannels?V.salesChannels.map((function(t){return new G(t)})):null,this.translations=V.translations?V.translations.map((function(t){return new k(t)})):null,this.productGroupItems=V.productGroupItems,this.variants.forEach((function(t){return t.product=U})),this.setOptionPrices(),this.setOptionRealPrices(),this.customerReviews=V.customerReviews?new j(V.customerReviews):null,m(this,{selectedVariantValues:g,isFiltered:g,isStatic:g,showVariantsInGroup:g,hasVariant:b,hasStock:b,hasValidProductOptionValues:b,href:b,productHref:b,mainVariantType:b,mainVariantValue:b,selectedVariant:b,displayedVariantTypes:b,isCustomerReviewEnabled:b,isCustomerReviewLoginRequired:b,isAddToCartEnabled:b,groupedAttributeValues:b,selectedVariantUnitPriceText:b,displayedProductGroups:b})}return Object.defineProperty(A.prototype,"hasVariant",{get:function(){return V.hasVariant(this,this.showVariantsInGroup)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasStock",{get:function(){return this.isStatic?this.selectedVariant.hasStock:V.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasValidProductOptionValues",{get:function(){return!this.productOptionSet||this.productOptionSet.hasValidValues},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"href",{get:function(){return V.getSelectedVariantHref(this,this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"productHref",{get:function(){return this.groupVariantsByVariantTypeId||this.isFiltered?this.href:V.getProductHref(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"mainVariantType",{get:function(){return V.getMainVariantType(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"mainVariantValue",{get:function(){return V.getMainVariantValue(this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"selectedVariant",{get:function(){if(!this.hasVariant)return this.variants[0];var t=this.selectedVariantValues.map((function(t){return t.id}));return this.variants.find((function(e){return e.variantValues.every((function(e){return t.includes(e.id)}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"displayedVariantTypes",{get:function(){return this.hasVariant?V.getDisplayedVariantTypes(this,this.selectedVariantValues):[]},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"isCustomerReviewEnabled",{get:function(){return P.isCustomerReviewEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"isCustomerReviewLoginRequired",{get:function(){return P.isCustomerReviewLoginRequired()},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"isAddToCartEnabled",{get:function(){var t,e=!0;return null===(t=this.selectedVariant.bundleSettings)||void 0===t||t.products.forEach((function(t){0===t.quantity&&null!==t.minQuantity&&0!==t.minQuantity&&(e=!1)})),e&&this.hasValidProductOptionValues&&(this.selectedVariant.hasStock||this.selectedVariant.sellIfOutOfStock)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"groupedAttributeValues",{get:function(){var t,e=O(this.attributes,"productAttributeId");return(null===(t=this.attributes)||void 0===t?void 0:t.map((function(t){var i=t.productAttributeId;if(i){var n=e[i];return(null==n?void 0:n.length)&&n[0].productAttribute?{attribute:n[0].productAttribute,values:n}:void 0}})).filter((function(t){return!!t})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"selectedVariantUnitPriceText",{get:function(){return this.getVariantUnitPriceText(this.selectedVariant)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"displayedProductGroups",{get:function(){var e,i=this,n=[],a=[];return null===(e=this.productGroupItems)||void 0===e||e.forEach((function(t){t.groupValues.forEach((function(t){n.includes(t.name)||n.push(t.name)}))})),n.forEach((function(e){var n,o={name:e,items:[]};i.productGroupItems=r(i.productGroupItems,(function(t){var e;return parseInt((null===(e=t.order)||void 0===e?void 0:e.value)||"999",10)})),null===(n=i.productGroupItems)||void 0===n||n.forEach((function(n){var r,a,s,u=n.groupValues.find((function(t){return t.name===e}));if(u&&!o.items.some((function(t){return t.value===u.value}))){var c="";if(n.productId===i.id)c=i.href;else{var d=(null===(r=i.productGroup)||void 0===r?void 0:r.values.filter((function(t){return t.name!==e})))||[],l=t(t([],d,!0),[u],!1),p=null===(a=i.productGroupItems)||void 0===a?void 0:a.find((function(t){return l.every((function(e){return t.groupValues.some((function(t){return e.name===t.name&&e.value===t.value}))}))}));c=p?p.href:n.href}o.items.push({image:n.image?new R(n.image):null,href:c,value:u.value,isSelected:(null===(s=i.productGroupItems)||void 0===s?void 0:s.some((function(t){return t.groupValues.some((function(t){return t.value===u.value}))&&t.productId===i.id})))||!1,isSelectable:function(){var n,r,a=(null===(n=i.productGroup)||void 0===n?void 0:n.values.filter((function(t){return t.name!==e})))||[],o=t(t([],a,!0),[u],!1);return!!(null===(r=i.productGroupItems)||void 0===r?void 0:r.find((function(t){return o.every((function(e){return t.groupValues.some((function(t){return e.name===t.name&&e.value===t.value}))}))})))}(),hasStock:n.hasStock})}})),a.push(o)})),a},enumerable:!1,configurable:!0}),A.prototype.dispose=function(){var t,e;console.log("Product disposed 3",this.id),null===(t=this.variants)||void 0===t||t.forEach((function(t){var e,i;t.product=null,t.bundleSettings&&(null===(e=t.bundleSettings.products)||void 0===e||e.forEach((function(t){t.product=null}))),t.subscriptionPlan&&(null===(i=t.subscriptionPlan.periods)||void 0===i||i.forEach((function(t){t.product=null})))})),this.bundleProductCache={},null===(e=this.offers)||void 0===e||e.forEach((function(t){t.product=null}))},A}();export{A as IkasProduct};
|