@ikas/storefront 2.0.71 → 2.0.72
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/__generated__/global-types.d.ts +14 -17
- package/build/__generated__/global-types.js +1 -1
- package/build/_virtual/index.js_commonjs-proxy2.js +1 -1
- package/build/_virtual/index.js_commonjs-proxy3.js +1 -1
- package/build/api/category/__generated__/listCategoryPaths.d.ts +19 -0
- package/build/api/category/index.js +1 -1
- package/build/api/product-search/__generated__/getProductFilterData.d.ts +1 -0
- package/build/api/product-search/index.js +1 -1
- package/build/api/raffle/__generated__/listRaffleParticipants.d.ts +67 -0
- package/build/api/raffle/__generated__/listStorefrontRaffle.d.ts +82 -0
- package/build/api/raffle/__generated__/saveRaffleParticipant.d.ts +46 -6
- package/build/api/raffle/index.d.ts +2 -2
- package/build/api/raffle/index.js +1 -1
- package/build/assets/translations/checkout/de.js +1 -0
- package/build/ikas.js +54 -3
- package/build/index.js +1 -1
- package/build/models/data/category/index.d.ts +2 -0
- package/build/models/data/category/index.js +1 -1
- package/build/models/data/index.d.ts +1 -1
- package/build/models/data/product-filter/index.d.ts +3 -1
- package/build/models/data/product-filter/index.js +1 -1
- package/build/models/data/raffle/index.d.ts +10 -4
- package/build/models/data/raffle/index.js +1 -1
- package/build/models/ui/product-list/index.d.ts +37 -0
- package/build/models/ui/product-list/index.js +1 -1
- package/build/models/ui/raffle-list/index.js +1 -1
- package/build/providers/helpers/raffles.js +1 -1
- package/build/providers/page-data-get.js +1 -1
- package/build/providers/prop-value/raffle.js +1 -1
- package/build/store/customer.d.ts +1 -1
- package/build/store/customer.js +1 -1
- package/build/utils/constants.js +1 -1
- package/build/utils/i18n.js +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Image}from"./components/image/index.js";export{IkasEditorComponentLoader}from"./components/page-editor/loader/index.js";export{IkasBlog,IkasBlogCategory,IkasBlogContent,IkasBlogMetaData,IkasBlogMetadataTargetType,IkasBlogTag,IkasBlogWriter}from"./models/data/blog/index.js";export{IkasBrand}from"./models/data/brand/index.js";export{IkasCategory,IkasCategoryPath,IkasFilterCategory}from"./models/data/category/index.js";export{IkasCheckout,IkasCheckoutCustomer,IkasCheckoutRecoveryEmailStatus,IkasCheckoutRecoveryStatus,IkasCheckoutStatus,IkasPaymentMethod,IkasShippingMethod,IkasShippingMethodEnum}from"./models/data/checkout/index.js";export{IkasCustomerAddress}from"./models/data/customer/address/index.js";export{IkasCustomer}from"./models/data/customer/index.js";export{IkasCustomerReview}from"./models/data/customer-review/index.js";export{IkasCustomerReviewSummary}from"./models/data/customer-review-summary/index.js";export{IkasHTMLMetaData,IkasHTMLMetaDataTargetType}from"./models/data/html-meta-data/index.js";export{IkasImage}from"./models/data/image/index.js";export{IkasCardAssociation,IkasCardType}from"./models/data/installment-info/index.js";export{IkasMerchantSettings}from"./models/data/merchant-settings/index.js";export{IkasAmountTypeEnum,IkasOrder,IkasOrderCancelledReason,IkasOrderPackageFulfillStatus,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus,OrderLineItemStatusEnum}from"./models/data/order/index.js";export{IkasOrderLineItem}from"./models/data/order/line-item/index.js";export{IkasOrderRefundSettings}from"./models/data/order/refund/settings.js";export{IkasOrderLineOptions}from"./models/data/order/line-item/options/index.js";export{IkasOrderLineOptionsValue}from"./models/data/order/line-item/options/options-value/index.js";export{IkasProduct,IkasProductType}from"./models/data/product/index.js";export{IkasProductVariantType}from"./models/data/product/variant-type/index.js";export{IkasProductVariant}from"./models/data/product/variant/index.js";export{IkasProductPrice}from"./models/data/product/variant/price/index.js";export{IkasProductAttribute,IkasProductAttributeType}from"./models/data/product-attribute/index.js";export{IkasProductAttributeValue}from"./models/data/product/attribute-value/index.js";export{IkasApplicableProductFilterValue,IkasProductFilter,IkasProductFilterDisplayType,IkasProductFilterSettings,IkasProductFilterSortType,IkasProductFilterType,IkasProductFilterValue,IkasProductStockFilterValue,RangeValue,parseRangeStr}from"./models/data/product-filter/index.js";export{IkasFavoriteProduct}from"./models/data/favorite-product/index.js";export{IkasContactForm}from"./models/data/contact-form/index.js";export{IkasVariantSelectionType,IkasVariantType}from"./models/data/variant-type/index.js";export{IkasVariantValue}from"./models/data/variant-type/variant-value/index.js";export{IkasOrderTransaction,IkasTransactionStatusEnum,IkasTransactionTypeEnum}from"./models/data/order-transaction/index.js";export{IkasProductOption,IkasProductOptionDateSettings,IkasProductOptionFileSettings,IkasProductOptionSelectSettings,IkasProductOptionSelectType,IkasProductOptionSelectValue,IkasProductOptionSelectValueTranslations,IkasProductOptionSet,IkasProductOptionSetTranslations,IkasProductOptionTextSettings,IkasProductOptionTranslations,IkasProductOptionType}from"./models/data/product-option-set/index.js";export{IkasRaffle,IkasRaffleMetaData,IkasRaffleParticipant}from"./models/data/raffle/index.js";export{IkasSlider}from"./models/data/slider/index.js";export{IkasProductCampaign}from"./models/data/product-campaing/index.js";export{IkasCustomerAttribute}from"./models/data/customer-attribute/index.js";export{IkasCustomerAttributeValue}from"./models/data/customer/attribute-value/index.js";export{IkasCustomerAttributePermissionEnum,IkasCustomerAttributeRegisterPageRequirementEnum,IkasCustomerAttributeSalesChannel}from"./models/data/customer-attribute/customer-attribute-sales-channel/index.js";export{IkasCustomerAttributeOption}from"./models/data/customer-attribute/customer-attribute-option/index.js";export{IkasTheme}from"./models/theme/theme.js";export{IkasThemePage,IkasThemePageType}from"./models/theme/page/index.js";export{IkasThemePageComponent}from"./models/theme/page/component/index.js";export{IkasThemeComponent}from"./models/theme/component/index.js";export{IkasThemeComponentProp,IkasThemeComponentPropType}from"./models/theme/component/prop/index.js";export{IkasLinkPropValue,IkasLinkType}from"./models/theme/page/component/prop-value/link.js";export{IkasBrandPropValue}from"./models/theme/page/component/prop-value/brand.js";export{IkasBrandListPropValue}from"./models/theme/page/component/prop-value/brand-list.js";export{IkasProductListPropValue}from"./models/theme/page/component/prop-value/product-list.js";export{IkasProductDetailPropValue}from"./models/theme/page/component/prop-value/product-detail.js";export{IkasCategoryPropValue}from"./models/theme/page/component/prop-value/category.js";export{IkasCategoryListPropValue}from"./models/theme/page/component/prop-value/category-list.js";export{IkasThemeSettings}from"./models/theme/settings/index.js";export{IkasThemeCustomData}from"./models/theme/custom-data/index.js";export{IkasBlogPropValue}from"./models/theme/page/component/prop-value/blog.js";export{IkasBlogListPropValue}from"./models/theme/page/component/prop-value/blog-list.js";export{IkasBlogCategoryPropValue}from"./models/theme/page/component/prop-value/blog-category.js";export{IkasBlogCategoryListPropValue}from"./models/theme/page/component/prop-value/blog-category-list.js";export{IkasRafflePropValue}from"./models/theme/page/component/prop-value/raffle.js";export{IkasRaffleListPropValue}from"./models/theme/page/component/prop-value/raffle-list.js";export{IkasBlogList,IkasBlogListType}from"./models/ui/blog-list/index.js";export{IkasBlogCategoryList,IkasBlogCategoryListType}from"./models/ui/blog-category-list/index.js";export{IkasBrandList,IkasBrandListSortType,IkasBrandListType}from"./models/ui/brand-list/index.js";export{IkasCategoryList,IkasCategoryListSortType,IkasCategoryListType}from"./models/ui/category-list/index.js";export{IkasNavigationLink}from"./models/ui/navigation-link/index.js";export{IkasProductDetail}from"./models/ui/product-detail/index.js";export{IkasProductList,IkasProductListSortType,IkasProductListType,IkasRelatedProductsType}from"./models/ui/product-list/index.js";export{IkasAttributeDetail}from"./models/ui/product-attribute-detail/index.js";export{IkasAttributeList}from"./models/ui/product-attribute-list/index.js";export{IkasCustomerReviewList}from"./models/ui/customer-review-list/index.js";export{IkasCustomerReviewSummaryList}from"./models/ui/customer-review-summary-list/index.js";export{Validator}from"./models/ui/validator/index.js";export{EmailRule,EqualsRule,IdentityNumberRule,LessThanRule,MaxRule,MinRule,PhoneRule,RequiredRule,ValidationRule,ValidatorErrorType}from"./models/ui/validator/rules/index.js";export{LoginForm}from"./models/ui/validator/form/login.js";export{AddressForm}from"./models/ui/validator/form/address.js";export{RegisterForm}from"./models/ui/validator/form/register.js";export{ContactForm}from"./models/ui/validator/form/contact-form.js";export{ForgotPasswordForm}from"./models/ui/validator/form/forgot-password.js";export{RecoverPasswordForm}from"./models/ui/validator/form/recover-password.js";export{AccountInfoForm}from"./models/ui/validator/form/account-info.js";export{RaffleForm}from"./models/ui/validator/form/raffle-form.js";export{CustomerReviewForm}from"./models/ui/validator/form/customer-review.js";export{IkasComponentRenderer}from"./models/ui/component-renderer/index.js";export{IkasRaffleList}from"./models/ui/raffle-list/index.js";import*as e from"./pages/home.js";export{e as IndexPage};import*as o from"./pages/_slug_/index.js";export{o as SlugPage};import*as t from"./pages/pages/_slug_.js";export{t as CustomPage};import*as r from"./pages/checkout.js";export{r as CheckoutPage};import*as a from"./pages/account/index.js";export{a as AccountPage};import*as s from"./pages/account/addresses.js";export{s as AddressesPage};import*as m from"./pages/account/orders/index.js";export{m as OrdersPage};import*as i from"./pages/account/orders/_id_.js";export{i as OrderDetailPage};import*as d from"./pages/account/login.js";export{d as LoginPage};import*as p from"./pages/account/register.js";export{p as RegisterPage};import*as n from"./pages/account/forgot-password.js";export{n as ForgotPasswordPage};import*as l from"./pages/account/recover-password.js";export{l as RecoverPasswordPage};import*as u from"./pages/cart.js";export{u as CartPage};import*as x from"./pages/editor.js";export{x as EditorPage};import*as c from"./pages/account/favorite-products.js";export{c as FavoriteProductsPage};import*as f from"./pages/search.js";export{f as SearchPage};import*as g from"./pages/404.js";export{g as NotFoundPage};import*as k from"./pages/blog/index.js";export{k as BlogPage};import*as I from"./pages/blog/_slug_.js";export{I as BlogSlugPage};import*as j from"./pages/raffle/_slug_.js";export{j as RafflePage};import*as P from"./pages/raffle/index.js";export{P as RafflesPage};import*as y from"./pages/account/raffles.js";export{y as AccountRafflesPage};export{APIGenerator}from"./scripts/generators/api/index.js";export{ComponentImportsGenerator}from"./scripts/generators/components/index.js";export{ConfigGenerator}from"./scripts/generators/config/index.js";export{PageGenerator}from"./scripts/generators/pages/index.js";export{StoreGenerator}from"./scripts/generators/store/index.js";export{ThemeJsonGenerator}from"./scripts/generators/theme/index.js";export{CustomDataTypesGenerator,PropTypeGenarator}from"./scripts/generators/types/index.js";export{IkasBaseStore}from"./store/base.js";export{IkasStorefrontConfig}from"./storefront/index.js";export{decodeBase64,findAllByKey,findAllIndexes,formatDate,pascalCase,sortObject,stringSorter,stringToSlug,tryForEach,validateEmail,validatePhoneNumber}from"./utils/helper.js";export{formatMoney,getCurrencySymbol}from"./utils/currency.js";export{createTranslationInputData,useTranslation}from"./utils/i18n.js";export{Analytics}from"./analytics/analytics.js";export{AnalyticsBody,AnalyticsHead}from"./analytics/head/index.js";
|
|
1
|
+
export{Image}from"./components/image/index.js";export{IkasEditorComponentLoader}from"./components/page-editor/loader/index.js";export{IkasBlog,IkasBlogCategory,IkasBlogContent,IkasBlogMetaData,IkasBlogMetadataTargetType,IkasBlogTag,IkasBlogWriter}from"./models/data/blog/index.js";export{IkasBrand}from"./models/data/brand/index.js";export{IkasCategory,IkasCategoryPath,IkasFilterCategory}from"./models/data/category/index.js";export{IkasCheckout,IkasCheckoutCustomer,IkasCheckoutRecoveryEmailStatus,IkasCheckoutRecoveryStatus,IkasCheckoutStatus,IkasPaymentMethod,IkasShippingMethod,IkasShippingMethodEnum}from"./models/data/checkout/index.js";export{IkasCustomerAddress}from"./models/data/customer/address/index.js";export{IkasCustomer}from"./models/data/customer/index.js";export{IkasCustomerReview}from"./models/data/customer-review/index.js";export{IkasCustomerReviewSummary}from"./models/data/customer-review-summary/index.js";export{IkasHTMLMetaData,IkasHTMLMetaDataTargetType}from"./models/data/html-meta-data/index.js";export{IkasImage}from"./models/data/image/index.js";export{IkasCardAssociation,IkasCardType}from"./models/data/installment-info/index.js";export{IkasMerchantSettings}from"./models/data/merchant-settings/index.js";export{IkasAmountTypeEnum,IkasOrder,IkasOrderCancelledReason,IkasOrderPackageFulfillStatus,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus,OrderLineItemStatusEnum}from"./models/data/order/index.js";export{IkasOrderLineItem}from"./models/data/order/line-item/index.js";export{IkasOrderRefundSettings}from"./models/data/order/refund/settings.js";export{IkasOrderLineOptions}from"./models/data/order/line-item/options/index.js";export{IkasOrderLineOptionsValue}from"./models/data/order/line-item/options/options-value/index.js";export{IkasProduct,IkasProductType}from"./models/data/product/index.js";export{IkasProductVariantType}from"./models/data/product/variant-type/index.js";export{IkasProductVariant}from"./models/data/product/variant/index.js";export{IkasProductPrice}from"./models/data/product/variant/price/index.js";export{IkasProductAttribute,IkasProductAttributeType}from"./models/data/product-attribute/index.js";export{IkasProductAttributeValue}from"./models/data/product/attribute-value/index.js";export{IkasApplicableProductFilterValue,IkasProductFilter,IkasProductFilterDisplayType,IkasProductFilterSettings,IkasProductFilterSortType,IkasProductFilterType,IkasProductFilterValue,IkasProductStockFilterValue,RangeValue,parseRangeStr}from"./models/data/product-filter/index.js";export{IkasFavoriteProduct}from"./models/data/favorite-product/index.js";export{IkasContactForm}from"./models/data/contact-form/index.js";export{IkasVariantSelectionType,IkasVariantType}from"./models/data/variant-type/index.js";export{IkasVariantValue}from"./models/data/variant-type/variant-value/index.js";export{IkasOrderTransaction,IkasTransactionStatusEnum,IkasTransactionTypeEnum}from"./models/data/order-transaction/index.js";export{IkasProductOption,IkasProductOptionDateSettings,IkasProductOptionFileSettings,IkasProductOptionSelectSettings,IkasProductOptionSelectType,IkasProductOptionSelectValue,IkasProductOptionSelectValueTranslations,IkasProductOptionSet,IkasProductOptionSetTranslations,IkasProductOptionTextSettings,IkasProductOptionTranslations,IkasProductOptionType}from"./models/data/product-option-set/index.js";export{IkasRaffle,IkasRaffleMetaData,IkasRaffleParticipant,RaffleParticipantStatusEnum}from"./models/data/raffle/index.js";export{IkasSlider}from"./models/data/slider/index.js";export{IkasProductCampaign}from"./models/data/product-campaing/index.js";export{IkasCustomerAttribute}from"./models/data/customer-attribute/index.js";export{IkasCustomerAttributeValue}from"./models/data/customer/attribute-value/index.js";export{IkasCustomerAttributePermissionEnum,IkasCustomerAttributeRegisterPageRequirementEnum,IkasCustomerAttributeSalesChannel}from"./models/data/customer-attribute/customer-attribute-sales-channel/index.js";export{IkasCustomerAttributeOption}from"./models/data/customer-attribute/customer-attribute-option/index.js";export{IkasTheme}from"./models/theme/theme.js";export{IkasThemePage,IkasThemePageType}from"./models/theme/page/index.js";export{IkasThemePageComponent}from"./models/theme/page/component/index.js";export{IkasThemeComponent}from"./models/theme/component/index.js";export{IkasThemeComponentProp,IkasThemeComponentPropType}from"./models/theme/component/prop/index.js";export{IkasLinkPropValue,IkasLinkType}from"./models/theme/page/component/prop-value/link.js";export{IkasBrandPropValue}from"./models/theme/page/component/prop-value/brand.js";export{IkasBrandListPropValue}from"./models/theme/page/component/prop-value/brand-list.js";export{IkasProductListPropValue}from"./models/theme/page/component/prop-value/product-list.js";export{IkasProductDetailPropValue}from"./models/theme/page/component/prop-value/product-detail.js";export{IkasCategoryPropValue}from"./models/theme/page/component/prop-value/category.js";export{IkasCategoryListPropValue}from"./models/theme/page/component/prop-value/category-list.js";export{IkasThemeSettings}from"./models/theme/settings/index.js";export{IkasThemeCustomData}from"./models/theme/custom-data/index.js";export{IkasBlogPropValue}from"./models/theme/page/component/prop-value/blog.js";export{IkasBlogListPropValue}from"./models/theme/page/component/prop-value/blog-list.js";export{IkasBlogCategoryPropValue}from"./models/theme/page/component/prop-value/blog-category.js";export{IkasBlogCategoryListPropValue}from"./models/theme/page/component/prop-value/blog-category-list.js";export{IkasRafflePropValue}from"./models/theme/page/component/prop-value/raffle.js";export{IkasRaffleListPropValue}from"./models/theme/page/component/prop-value/raffle-list.js";export{IkasBlogList,IkasBlogListType}from"./models/ui/blog-list/index.js";export{IkasBlogCategoryList,IkasBlogCategoryListType}from"./models/ui/blog-category-list/index.js";export{IkasBrandList,IkasBrandListSortType,IkasBrandListType}from"./models/ui/brand-list/index.js";export{IkasCategoryList,IkasCategoryListSortType,IkasCategoryListType}from"./models/ui/category-list/index.js";export{IkasNavigationLink}from"./models/ui/navigation-link/index.js";export{IkasProductDetail}from"./models/ui/product-detail/index.js";export{IkasProductList,IkasProductListSortType,IkasProductListType,IkasRelatedProductsType}from"./models/ui/product-list/index.js";export{IkasAttributeDetail}from"./models/ui/product-attribute-detail/index.js";export{IkasAttributeList}from"./models/ui/product-attribute-list/index.js";export{IkasCustomerReviewList}from"./models/ui/customer-review-list/index.js";export{IkasCustomerReviewSummaryList}from"./models/ui/customer-review-summary-list/index.js";export{Validator}from"./models/ui/validator/index.js";export{EmailRule,EqualsRule,IdentityNumberRule,LessThanRule,MaxRule,MinRule,PhoneRule,RequiredRule,ValidationRule,ValidatorErrorType}from"./models/ui/validator/rules/index.js";export{LoginForm}from"./models/ui/validator/form/login.js";export{AddressForm}from"./models/ui/validator/form/address.js";export{RegisterForm}from"./models/ui/validator/form/register.js";export{ContactForm}from"./models/ui/validator/form/contact-form.js";export{ForgotPasswordForm}from"./models/ui/validator/form/forgot-password.js";export{RecoverPasswordForm}from"./models/ui/validator/form/recover-password.js";export{AccountInfoForm}from"./models/ui/validator/form/account-info.js";export{RaffleForm}from"./models/ui/validator/form/raffle-form.js";export{CustomerReviewForm}from"./models/ui/validator/form/customer-review.js";export{IkasComponentRenderer}from"./models/ui/component-renderer/index.js";export{IkasRaffleList}from"./models/ui/raffle-list/index.js";import*as e from"./pages/home.js";export{e as IndexPage};import*as o from"./pages/_slug_/index.js";export{o as SlugPage};import*as t from"./pages/pages/_slug_.js";export{t as CustomPage};import*as r from"./pages/checkout.js";export{r as CheckoutPage};import*as a from"./pages/account/index.js";export{a as AccountPage};import*as s from"./pages/account/addresses.js";export{s as AddressesPage};import*as m from"./pages/account/orders/index.js";export{m as OrdersPage};import*as i from"./pages/account/orders/_id_.js";export{i as OrderDetailPage};import*as d from"./pages/account/login.js";export{d as LoginPage};import*as p from"./pages/account/register.js";export{p as RegisterPage};import*as n from"./pages/account/forgot-password.js";export{n as ForgotPasswordPage};import*as l from"./pages/account/recover-password.js";export{l as RecoverPasswordPage};import*as u from"./pages/cart.js";export{u as CartPage};import*as x from"./pages/editor.js";export{x as EditorPage};import*as c from"./pages/account/favorite-products.js";export{c as FavoriteProductsPage};import*as f from"./pages/search.js";export{f as SearchPage};import*as g from"./pages/404.js";export{g as NotFoundPage};import*as k from"./pages/blog/index.js";export{k as BlogPage};import*as I from"./pages/blog/_slug_.js";export{I as BlogSlugPage};import*as j from"./pages/raffle/_slug_.js";export{j as RafflePage};import*as P from"./pages/raffle/index.js";export{P as RafflesPage};import*as y from"./pages/account/raffles.js";export{y as AccountRafflesPage};export{APIGenerator}from"./scripts/generators/api/index.js";export{ComponentImportsGenerator}from"./scripts/generators/components/index.js";export{ConfigGenerator}from"./scripts/generators/config/index.js";export{PageGenerator}from"./scripts/generators/pages/index.js";export{StoreGenerator}from"./scripts/generators/store/index.js";export{ThemeJsonGenerator}from"./scripts/generators/theme/index.js";export{CustomDataTypesGenerator,PropTypeGenarator}from"./scripts/generators/types/index.js";export{IkasBaseStore}from"./store/base.js";export{IkasStorefrontConfig}from"./storefront/index.js";export{decodeBase64,findAllByKey,findAllIndexes,formatDate,pascalCase,sortObject,stringSorter,stringToSlug,tryForEach,validateEmail,validatePhoneNumber}from"./utils/helper.js";export{formatMoney,getCurrencySymbol}from"./utils/currency.js";export{createTranslationInputData,useTranslation}from"./utils/i18n.js";export{Analytics}from"./analytics/analytics.js";export{AnalyticsBody,AnalyticsHead}from"./analytics/head/index.js";
|
|
@@ -18,8 +18,10 @@ export declare class IkasCategoryPath {
|
|
|
18
18
|
id: string;
|
|
19
19
|
name: string;
|
|
20
20
|
slug?: string | null;
|
|
21
|
+
translations: IkasCategoryTranslation[] | null;
|
|
21
22
|
constructor(data: Partial<IkasCategoryPath>);
|
|
22
23
|
get href(): string;
|
|
24
|
+
private setPathTranslations;
|
|
23
25
|
}
|
|
24
26
|
export declare class IkasFilterCategory {
|
|
25
27
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import{IkasImage as
|
|
1
|
+
import{__assign as t}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import{IkasImage as n}from"../image/index.js";import{IkasHTMLMetaData as i}from"../html-meta-data/index.js";import{IkasStorefrontConfig as s}from"../../../storefront/index.js";var r,o=function(){function t(t){void 0===t&&(t={}),this.description=null,this.metaData=null,this.image=null,this.orderType=null,this.translations=null,this.id=t.id||Date.now()+"",this.name=t.name||"",this.description=t.description||null,this.parentId=t.parentId||null,this.metaData=t.metaData?new i(t.metaData):void 0,this.image=t.image?new n(t.image.id):null,this.path=t.path?t.path.map((function(t){return new a(t)})):[],this.orderType=t.orderType||null,this.translations=t.translations||null,this.setTranslations(),e(this)}return Object.defineProperty(t.prototype,"href",{get:function(){var t;return(null===(t=this.metaData)||void 0===t?void 0:t.slug)?"/".concat(this.metaData.slug):""},enumerable:!1,configurable:!0}),t.prototype.setTranslations=function(){if(this.translations&&this.translations.some((function(t){return t.locale===s.getCurrentLocale()}))){var t=this.translations.find((function(t){return t.locale===s.getCurrentLocale()}));(null==t?void 0:t.name)&&(this.name=t.name),(null==t?void 0:t.description)&&(this.description=t.description)}},t}(),a=function(){function t(t){this.translations=null,this.id=t.id||"",this.name=t.name||"",this.slug=t.slug||"",this.translations=t.translations||null,this.setPathTranslations(),e(this)}return Object.defineProperty(t.prototype,"href",{get:function(){return this.slug?"/".concat(this.slug):""},enumerable:!1,configurable:!0}),t.prototype.setPathTranslations=function(){if(this.translations&&this.translations.some((function(t){return t.locale===s.getCurrentLocale()}))){var t=this.translations.find((function(t){return t.locale===s.getCurrentLocale()}));(null==t?void 0:t.name)&&(this.name=t.name)}},t}(),l=function(){function n(t){this._isSelected=!1,this.id=t.id||"",this.name=t.name||"",this.slug=t.slug||"",this.resultCount=void 0!==t.resultCount&&null!==t.resultCount?t.resultCount:null,this._isSelected=t.isSelected||!1,e(this)}return Object.defineProperty(n.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"href",{get:function(){return this.slug?"/".concat(this.slug):""},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return t(t({},this),{isSelected:this._isSelected})},n}();!function(t){t.BEST_SELLER="BEST_SELLER",t.HIGHEST_DISCOUNT_RATIO="HIGHEST_DISCOUNT_RATIO",t.HIGHEST_PRICE="HIGHEST_PRICE",t.LOWEST_DISCOUNT_RATIO="LOWEST_DISCOUNT_RATIO",t.LOWEST_PRICE="LOWEST_PRICE",t.MANUALLY="MANUALLY",t.NEWEST="NEWEST",t.OLDEST="OLDEST"}(r||(r={}));export{o as IkasCategory,a as IkasCategoryPath,l as IkasFilterCategory,r as ModelOrder};
|
|
@@ -35,7 +35,7 @@ export * from "./variant-type";
|
|
|
35
35
|
export { IkasVariantValue } from "./variant-type/variant-value";
|
|
36
36
|
export { IkasOrderTransaction, IkasTransactionStatusEnum, IkasTransactionTypeEnum, } from "./order-transaction";
|
|
37
37
|
export * from "./product-option-set";
|
|
38
|
-
export { IkasRaffle, IkasRaffleParticipant, IkasRaffleMetaData, } from "./raffle";
|
|
38
|
+
export { IkasRaffle, IkasRaffleParticipant, IkasRaffleMetaData, RaffleParticipantStatusEnum, } from "./raffle";
|
|
39
39
|
export { IkasSlider } from "./slider";
|
|
40
40
|
export { IkasProductCampaign } from "./product-campaing";
|
|
41
41
|
export { IkasCustomerAttribute } from "./customer-attribute";
|
|
@@ -60,6 +60,7 @@ export declare class IkasProductFilterSettings {
|
|
|
60
60
|
showCollapsedOnDesktop: boolean;
|
|
61
61
|
showCollapsedOnMobile: boolean;
|
|
62
62
|
sortType: IkasProductFilterSortType;
|
|
63
|
+
customSortedValues: string[] | null;
|
|
63
64
|
constructor(data: Partial<IkasProductFilterSettings>);
|
|
64
65
|
}
|
|
65
66
|
export declare type IkasProductFacetInput = {
|
|
@@ -88,7 +89,8 @@ export declare enum IkasProductFilterSortType {
|
|
|
88
89
|
ALPHABETICAL_ASC = "ALPHABETICAL_ASC",
|
|
89
90
|
ALPHABETICAL_DESC = "ALPHABETICAL_DESC",
|
|
90
91
|
PRODUCT_COUNT_ASC = "PRODUCT_COUNT_ASC",
|
|
91
|
-
PRODUCT_COUNT_DESC = "PRODUCT_COUNT_DESC"
|
|
92
|
+
PRODUCT_COUNT_DESC = "PRODUCT_COUNT_DESC",
|
|
93
|
+
CUSTOM_SORT = "CUSTOM_SORT"
|
|
92
94
|
}
|
|
93
95
|
export declare enum IkasProductStockFilterValue {
|
|
94
96
|
IN_STOCK = "in-stock",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import{IkasImage as i}from"../image/index.js";import n from'../../../ext/lodash/sortBy.js';import s from'../../../ext/lodash/cloneDeep.js';var o,r,
|
|
1
|
+
import{__assign as t}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import{IkasImage as i}from"../image/index.js";import n from'../../../ext/lodash/sortBy.js';import s from'../../../ext/lodash/cloneDeep.js';var o,u,r,l,a=function(){function i(i,n){if(void 0===i&&(i={}),this.values=null,this.customValues=null,this.settings=null,this._numberRange=null,this.numberRangeLimit=null,this.numberRangeListOptions=null,this.productList=null,this.id=i.id||"",this.key=i.key||"",this.name=i.name||"",this.order=i.order||0,this.type=i.type||o.BRAND,this.displayType=i.displayType||u.BOX,this.isMultiSelect=i.isMultiSelect||!1,this.isFacetFilter=i.isFacetFilter||!1,this.values=i.values?i.values.map((function(t){return new c(t)})):null,this.customValues=i.customValues||null,this.settings=i.settings?new d(i.settings):null,this.displayType===u.NUMBER_RANGE_LIST&&this.customValues&&this.customValues.length&&(this.numberRangeListOptions=this.customValues.map((function(e){return new m(t(t({key:e},f(e)),{isSelected:!1}))}))),this.displayType===u.NUMBER_RANGE&&this.customValues&&this.customValues.length){var s=this.customValues[0];this.numberRangeLimit=f(s)}this.productList=n,e(this)}return Object.defineProperty(i.prototype,"isCustomValueFilter",{get:function(){return[u.NUMBER_RANGE_LIST,u.NUMBER_RANGE].includes(this.displayType)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isStockFilter",{get:function(){return this.type===o.STOCK_STATUS},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"valueList",{get:function(){var t,e=this;return this._numberRange?[this.rangeToId(this._numberRange)]:this.numberRangeListOptions?this.numberRangeListOptions.filter((function(t){return t.isSelected})).map((function(t){return e.rangeToId(t)})):(null===(t=this.values)||void 0===t?void 0:t.filter((function(t){return t.isSelected})).map((function(t){return t.id})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"keyList",{get:function(){var t,e=this;return this._numberRange?[this.rangeToId(this._numberRange)]:this.numberRangeListOptions?this.numberRangeListOptions.filter((function(t){return t.isSelected})).map((function(t){return e.rangeToId(t)})):(null===(t=this.values)||void 0===t?void 0:t.filter((function(t){return t.isSelected})).map((function(t){return t.key})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"displayedValues",{get:function(){var t,e,i,s=(null===(t=this.settings)||void 0===t?void 0:t.sortType)||r.ALPHABETICAL_ASC,o=[r.ALPHABETICAL_DESC,r.PRODUCT_COUNT_DESC].includes(s),u=[r.ALPHABETICAL_ASC,r.ALPHABETICAL_DESC].includes(s),l=s===r.CUSTOM_SORT,a=null===(e=this.values)||void 0===e?void 0:e.filter((function(t){return 0!==t.resultCount||t.isSelected}));if(a=n(a,u?"name":"resultCount"),o&&(a=null==a?void 0:a.reverse()),l){var c=(null===(i=this.settings)||void 0===i?void 0:i.customSortedValues)||[];a=a.sort((function(t,e){return c.indexOf(t.id)-c.indexOf(e.id)}))}return a},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"numberRange",{get:function(){return this._numberRange},enumerable:!1,configurable:!0}),i.prototype.onFilterValueClick=function(t){var e,i;if(this.isCustomValueFilter)throw new Error("onFilterValueClick cannot be used with NUMBER_RANGE | NUMBER_RANGE_LIST types!");t._isSelected=!t.isSelected,!this.isMultiSelect&&t.isSelected&&(null===(e=this.values)||void 0===e||e.forEach((function(e){e.id!==t.id&&(e._isSelected=!1)}))),null===(i=this.productList)||void 0===i||i.applyFilters()},i.prototype.onNumberRangeClick=function(t){var e,i;if(this.displayType!==u.NUMBER_RANGE_LIST)throw new Error("onNumberRangeClick can only be used with NUMBER_RANGE filters!");t._isSelected=!t.isSelected,!this.isMultiSelect&&t.isSelected&&(null===(e=this.numberRangeListOptions)||void 0===e||e.forEach((function(e){e.key!==t.key&&(e._isSelected=!1)}))),null===(i=this.productList)||void 0===i||i.applyFilters()},i.prototype.onNumberRangeChange=function(t){var e,i,n;if(this.displayType!==u.NUMBER_RANGE)throw new Error("onNumberRangeChange can only be used with NUMBER_RANGE filters!");if(!t)return this._numberRange=null,void(null===(e=this.productList)||void 0===e||e.applyFilters());var o=new p(s(t));o.from<this.numberRangeLimit.from&&(o.from=this._numberRange.from),o.to&&(null===(i=this.numberRangeLimit)||void 0===i?void 0:i.to)&&o.to>this.numberRangeLimit.to&&(o.to=this.numberRangeLimit.to),this._numberRange=o,null===(n=this.productList)||void 0===n||n.applyFilters()},i.prototype.clear=function(){var t,e;this._numberRange=null,null===(t=this.numberRangeListOptions)||void 0===t||t.forEach((function(t){return t._isSelected=!1})),null===(e=this.values)||void 0===e||e.forEach((function(t){return t._isSelected=!1}))},i.prototype.toInput=function(){var t;return{id:this.key,type:this.type,valueList:this.valueList,useAndFilter:null===(t=this.settings)||void 0===t?void 0:t.useAndFilter}},i.prototype.toJSON=function(){var e=t({},this);return delete e.productList,e},i.prototype.applyQueryParam=function(t){var e,i,n=t.split(",");this.displayType===u.NUMBER_RANGE?this._numberRange=new p(f(t)):this.displayType===u.NUMBER_RANGE_LIST?null===(e=this.numberRangeListOptions)||void 0===e||e.forEach((function(t){n.includes(t.key)&&(t._isSelected=!0)})):null===(i=this.values)||void 0===i||i.forEach((function(t){n.includes(t.key)&&0!==t.resultCount&&(t._isSelected=!0)}))},i.prototype.rangeToId=function(t){return"".concat(t.from,":").concat(t.to||"")},i}(),c=function(){function n(t){void 0===t&&(t={}),this.colorCode=null,this.thumbnailImageId=null,this.thumbnailImage=null,this.resultCount=null,this._isSelected=!1,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 i(this.thumbnailImageId)),this._isSelected=t.isSelected||!1,this.resultCount=void 0!==t.resultCount&&null!==t.resultCount?t.resultCount:null,e(this)}return Object.defineProperty(n.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return t(t({},this),{isSelected:this._isSelected})},n}(),h=function(t){this.id=t.id,this.type=t.type,this.displayType=t.displayType,this.valueList=t.valueList,e(this)},d=function(t){this.useAndFilter=null,this.useAndFilter=t.useAndFilter||!1,this.showCollapsedOnDesktop=t.showCollapsedOnDesktop||!1,this.showCollapsedOnMobile=t.showCollapsedOnMobile||!1,this.sortType=t.sortType||r.ALPHABETICAL_ASC,this.customSortedValues=t.customSortedValues||null,e(this)};!function(t){t.ATTRIBUTE="ATTRIBUTE",t.BRAND="BRAND",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.PRICE="PRICE",t.STOCK_STATUS="STOCK_STATUS",t.TAG="TAG",t.VARIANT_TYPE="VARIANT_TYPE"}(o||(o={})),function(t){t.BOX="BOX",t.DATE_RANGE="DATE_RANGE",t.LIST="LIST",t.NUMBER_RANGE_LIST="NUMBER_RANGE_LIST",t.NUMBER_RANGE="NUMBER_RANGE",t.SWATCH="SWATCH"}(u||(u={})),function(t){t.ALPHABETICAL_ASC="ALPHABETICAL_ASC",t.ALPHABETICAL_DESC="ALPHABETICAL_DESC",t.PRODUCT_COUNT_ASC="PRODUCT_COUNT_ASC",t.PRODUCT_COUNT_DESC="PRODUCT_COUNT_DESC",t.CUSTOM_SORT="CUSTOM_SORT"}(r||(r={})),function(t){t.IN_STOCK="in-stock",t.OUT_OF_STOCK="out-of-stock"}(l||(l={}));var p=function(t){this.from=t.from||0,this.to=t.to||null,e(this)},m=function(){function i(t){this.from=t.from||0,this.to=t.to||null,this.key=t.key||"",this._isSelected=t.isSelected||!1,e(this)}return Object.defineProperty(i.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),i.prototype.toJSON=function(){return t(t({},this),{isSelected:this._isSelected})},i}();function f(t){try{var e=t.split(":").map((function(t){return parseInt(t)}));return new p({from:isNaN(e[0])?0:e[0],to:isNaN(e[1])?void 0:e[1]})}catch(t){return console.log(t),new p({from:0,to:0})}}export{c as IkasApplicableProductFilterValue,a as IkasProductFilter,u as IkasProductFilterDisplayType,d as IkasProductFilterSettings,r as IkasProductFilterSortType,o as IkasProductFilterType,h as IkasProductFilterValue,l as IkasProductStockFilterValue,p as RangeValue,f as parseRangeStr};
|
|
@@ -16,13 +16,11 @@ export declare class IkasRaffle {
|
|
|
16
16
|
dateRange: RaffleDateRangeField | null;
|
|
17
17
|
metadata: IkasRaffleMetaData | null;
|
|
18
18
|
name: string;
|
|
19
|
-
participantCount?: number | null;
|
|
20
19
|
requiredCustomerAccount: boolean;
|
|
21
20
|
status: boolean;
|
|
22
21
|
variants: IkasRaffleAppliedProduct[] | null;
|
|
23
22
|
products: IkasProductDetail[];
|
|
24
23
|
verificationType: IkasRaffleVerificationTypeEnum;
|
|
25
|
-
isCustomerWinner?: boolean;
|
|
26
24
|
constructor(data?: Partial<IkasRaffle>);
|
|
27
25
|
get isRaffleAvailable(): boolean | 0 | null | undefined;
|
|
28
26
|
}
|
|
@@ -43,6 +41,12 @@ export declare class IkasRaffleMetaData {
|
|
|
43
41
|
disableIndex?: boolean | null;
|
|
44
42
|
constructor(data: Partial<IkasRaffleMetaData>);
|
|
45
43
|
}
|
|
44
|
+
export declare enum RaffleParticipantStatusEnum {
|
|
45
|
+
COMPLETED = "COMPLETED",
|
|
46
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
47
|
+
LOSER = "LOSER",
|
|
48
|
+
WINNER = "WINNER"
|
|
49
|
+
}
|
|
46
50
|
export declare class IkasRaffleParticipant {
|
|
47
51
|
id?: string | null;
|
|
48
52
|
createdAt?: number | null;
|
|
@@ -56,13 +60,15 @@ export declare class IkasRaffleParticipant {
|
|
|
56
60
|
email: string;
|
|
57
61
|
applicationDate?: number;
|
|
58
62
|
phone?: string | null;
|
|
59
|
-
|
|
63
|
+
raffle: IkasRaffle;
|
|
64
|
+
status: RaffleParticipantStatusEnum | null;
|
|
65
|
+
isDeliveredCargo: boolean | null;
|
|
60
66
|
extraData?: Record<string, any> | null;
|
|
61
67
|
appliedProduct: IkasRaffleAppliedProduct;
|
|
62
68
|
constructor(data: Partial<IkasRaffleParticipant>);
|
|
63
69
|
}
|
|
64
70
|
export declare class IkasRaffleAppliedProduct {
|
|
65
|
-
productId: string;
|
|
71
|
+
productId: string | null;
|
|
66
72
|
variantId: string;
|
|
67
73
|
constructor(data: Partial<IkasRaffleAppliedProduct>);
|
|
68
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as t}from"mobx";import{IkasProductDetail as e}from"../../ui/product-detail/index.js";var i,a=function(e){this.start=e.start||null,this.end=e.end||null,t(this)};!function(t){t.EMAIL="EMAIL",t.MERSIS="MERSIS"}(i||(i={}));var n,s=function(){function t(t){var n,s;void 0===t&&(t={}),this.id=t.id||Date.now()+"",this.createdAt=t.createdAt||Date.now(),this.updatedAt=t.updatedAt||Date.now(),this.deleted=t.deleted||null,this.name=t.name||"",this.
|
|
1
|
+
import{makeAutoObservable as t}from"mobx";import{IkasProductDetail as e}from"../../ui/product-detail/index.js";var i,a=function(e){this.start=e.start||null,this.end=e.end||null,t(this)};!function(t){t.EMAIL="EMAIL",t.MERSIS="MERSIS"}(i||(i={}));var n,s=function(){function t(t){var n,s;void 0===t&&(t={}),this.id=t.id||Date.now()+"",this.createdAt=t.createdAt||Date.now(),this.updatedAt=t.updatedAt||Date.now(),this.deleted=t.deleted||null,this.name=t.name||"",this.requiredCustomerAccount=t.requiredCustomerAccount||!1,this.status=t.status||!1,this.verificationType=t.verificationType||i.EMAIL,this.dateRange=t.dateRange?new a(t.dateRange):null,this.metadata=t.metadata?new l(t.metadata):null,this.variants=(null===(n=t.variants)||void 0===n?void 0:n.map((function(t){return new u(t)})))||[],this.products=(null===(s=t.products)||void 0===s?void 0:s.map((function(t){return new e(t.product,t.selectedVariantValues)})))||[]}return Object.defineProperty(t.prototype,"isRaffleAvailable",{get:function(){var t;if(!this.status)return!1;var e=Date.now();return(null===(t=this.dateRange)||void 0===t?void 0:t.start)&&e>this.dateRange.start&&this.dateRange.end&&e<this.dateRange.end},enumerable:!1,configurable:!0}),t}();!function(t){t.RAFFLE="RAFFLE"}(n||(n={}));var d,l=function(t){var e,i;this.canonicals=null,this.disableIndex=null,this.id=t.id||Date.now()+"",this.createdAt=t.createdAt||Date.now(),this.updatedAt=t.updatedAt||Date.now(),this.deleted=t.deleted||null,this.description=t.description||"",this.pageTitle=t.pageTitle||"",this.slug=t.slug||"",this.targetId=t.targetId||"",this.targetType=t.targetType||n.RAFFLE,this.canonicals=null!==(e=t.canonicals)&&void 0!==e?e:null,this.disableIndex=null!==(i=t.disableIndex)&&void 0!==i?i:null};!function(t){t.COMPLETED="COMPLETED",t.IN_PROGRESS="IN_PROGRESS",t.LOSER="LOSER",t.WINNER="WINNER"}(d||(d={}));var r=function(e){this.id=e.id||null,this.createdAt=e.createdAt||Date.now(),this.updatedAt=e.updatedAt||Date.now(),this.deleted=e.deleted||!1,this.customerId=e.customerId||null,this.raffleId=e.raffleId||"",this.firstName=e.firstName||"",this.lastName=e.lastName||"",this.fullName=e.fullName||null,this.email=e.email||"",this.applicationDate=e.applicationDate||0,this.phone=e.phone||null,this.extraData=e.extraData||{},this.isDeliveredCargo=e.isDeliveredCargo||null,this.raffle=new s(e.raffle),this.status=e.status||d.IN_PROGRESS,this.appliedProduct=new u(e.appliedProduct||{}),t(this)},u=function(e){this.productId=e.productId||"",this.variantId=e.variantId||"",t(this)};export{s as IkasRaffle,u as IkasRaffleAppliedProduct,l as IkasRaffleMetaData,n as IkasRaffleMetadataTargetType,r as IkasRaffleParticipant,i as IkasRaffleVerificationTypeEnum,a as RaffleDateRangeField,d as RaffleParticipantStatusEnum};
|
|
@@ -58,6 +58,25 @@ export declare class IkasProductList {
|
|
|
58
58
|
private getSortParams;
|
|
59
59
|
private searchProducts;
|
|
60
60
|
private getFilters;
|
|
61
|
+
/**
|
|
62
|
+
* In order to remember the sorting, we convert the sort value
|
|
63
|
+
* to a format and keep it in the queryparam.
|
|
64
|
+
* In this function we are converting queryparam to sortTypeEnum.
|
|
65
|
+
*
|
|
66
|
+
* e.g. sT1 -> IkasProductListSortType.INCREASING_PRICE
|
|
67
|
+
* @param numerableSortTypeQuery {string}
|
|
68
|
+
* @returns IkasProductListSortType | undefined
|
|
69
|
+
*/
|
|
70
|
+
getSortTypeEnumFromNumerableSortTypeString: (numerableSortTypeQuery: string) => IkasProductListSortType | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* In order to remember the sorting, we convert the sort value
|
|
73
|
+
* to a format and keep it in the queryparam.
|
|
74
|
+
*
|
|
75
|
+
* e.g. IkasProductListSortType.INCREASING_PRICE -> sT1
|
|
76
|
+
* @param sortType {IkasProductListSortType}
|
|
77
|
+
* @returns IkasProductListSortTypeNumerable
|
|
78
|
+
*/
|
|
79
|
+
convertSortTypeEnumToStringForQueryParam: (sortType: IkasProductListSortType) => IkasProductListSortTypeNumerable;
|
|
61
80
|
private applyQueryParamFilters;
|
|
62
81
|
private applyFacets;
|
|
63
82
|
private applyFilters;
|
|
@@ -135,6 +154,24 @@ export declare enum IkasProductListSortType {
|
|
|
135
154
|
DECRASING_DISCOUNT = "DECRASING_DISCOUNT",
|
|
136
155
|
FEATURED = "FEATURED"
|
|
137
156
|
}
|
|
157
|
+
export declare enum IkasProductListSortTypeNumerable {
|
|
158
|
+
INCREASING_PRICE = "0",
|
|
159
|
+
DECREASING_PRICE = "1",
|
|
160
|
+
LAST_ADDED = "2",
|
|
161
|
+
FIRST_ADDED = "3",
|
|
162
|
+
INCREASING_DISCOUNT = "4",
|
|
163
|
+
DECRASING_DISCOUNT = "5",
|
|
164
|
+
FEATURED = "6"
|
|
165
|
+
}
|
|
166
|
+
export declare const IkasProductListSortTypeNumerableMapToEnum: {
|
|
167
|
+
0: IkasProductListSortType;
|
|
168
|
+
1: IkasProductListSortType;
|
|
169
|
+
2: IkasProductListSortType;
|
|
170
|
+
3: IkasProductListSortType;
|
|
171
|
+
4: IkasProductListSortType;
|
|
172
|
+
5: IkasProductListSortType;
|
|
173
|
+
6: IkasProductListSortType;
|
|
174
|
+
};
|
|
138
175
|
export declare enum IkasRelatedProductsType {
|
|
139
176
|
CATEGORY = "CATEGORY",
|
|
140
177
|
BRAND = "BRAND"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import"../../theme/theme.js";import{IkasThemePageType as r}from"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import{IkasProductDetail as s}from"../product-detail/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import"../../../api/blog/index.js";import"../../../api/brand/index.js";import"../../../api/cart/index.js";import"../../../api/category/index.js";import"../../../api/checkout/index.js";import"../../../api/city/index.js";import"../../../api/country/index.js";import"../../../api/customer/index.js";import"../../../api/customer-review/index.js";import"../../../api/customer-review-summary/index.js";import"../../../api/district/index.js";import"../../../api/html-meta-data/index.js";import"../../../api/merchant/index.js";import{IkasProductSearchAPI as n}from"../../../api/product-search/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{ModelOrder as a,IkasFilterCategory as o}from"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/merchant-settings/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import"../../../api/product-option-file/index.js";import"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as u,IkasProductFilterValue as c}from"../../data/product-filter/index.js";import"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import"../../data/raffle/index.js";import"../../data/product-campaing/campaign/index.js";import"../../data/customer-attribute/index.js";import"../../data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../../api/apollo.js";import"../../../api/favorite-product/index.js";import"../../../api/contact-form/index.js";import"../../../api/state/index.js";import"../../../api/product-option-set/index.js";import"../../../api/raffle/index.js";import"../../../api/back-in-stock-reminder/index.js";import"../../../api/product-campaign/index.js";import l from'../../../ext/query-string/index.js';import d from'../../../ext/lodash/debounce.js';import{Analytics as p}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import{IkasStorefrontConfig as h}from"../../../storefront/index.js";import{SortByDirectionEnum as f,SortByTypeEnum as m}from"../../../__generated__/global-types.js";var g,_,y,v=function(){function y(n,a){var c=this;if(this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this.applyFilters=function(){return t(c,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[r.CATEGORY,r.BRAND,r.SEARCH].includes(this._pageType)?(t&&this.isBrowser()&&!this.isSearch&&!h.isEditor&&(null===(i=this.router)||void 0===i||i.replace("".concat(location.pathname).concat(this.filterQueryParams?"?"+this.filterQueryParams:""),void 0,{shallow:!0})),[2]):[2]}}))}))},this.getInitial=function(i,r){return t(c,void 0,void 0,(function(){var t,n,a,o,u,c,l,d,p;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,12,13,14]),n=r?this._page:1,a=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(i),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(o=void 0,this.isStatic?(n=void 0,a=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(n=1,a=10,[3,10]):[3,5];case 5:return this.isRecommended?(n=1,a=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,h.store.customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length&&(o=u.map((function(t){return t.productId}))),[3,10];case 9:return[2];case 10:return[4,this.searchProducts(n||1,a||10,o)];case 11:return(c=e.sent())&&this._fetchRequestTime===t?(l=[],this.isStatic||this.isLastViewed?(d=this.isStatic?this._productListPropValue.productIds:h.store.customerStore._lastViewedProducts,l=(null==d?void 0:d.map((function(t){var e=c.data.find((function(e){return e.id===t.productId})),i=null==e?void 0:e.variants.find((function(e){return e.id===t.variantId}));if((null==i?void 0:i.isActive)||(i=null==e?void 0:e.variants.find((function(t){return t.isActive}))),e&&i)return new s(e,i.variantValues)})).filter((function(t){return!!t})))||[]):l=c.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.applyFacets(c.facets),this.data=l,this._count=c.count,this._initialized=!0,this._page=n||1,this._minPage=this.page,r||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 12:return p=e.sent(),console.log(p),[3,14];case 13:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 14:return[2]}}))}))},this.getPrev=function(){return t(c,void 0,void 0,(function(){var t,i,r,n;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(i=e.sent())?(r=i.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r.concat(this.data),this._count=i.count,this._minPage=t,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(c,void 0,void 0,(function(){var t,i,r;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(i=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=this.data.concat(i),this._count=t.count,this._page=this.page+1,[3,5]):[2];case 3:return r=e.sent(),console.log(r),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(i){return t(c,void 0,void 0,(function(){var t,r,n;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(i,this.limit)];case 2:return(t=e.sent())?(r=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r,this._count=t.count,this._page=i,this._minPage=i,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;c._infiniteScrollPage!==t&&(c._infiniteScrollPage=t,h.isEditor||null===(e=c.router)||void 0===e||e.replace("".concat(location.pathname).concat(c.filterQueryParams?"?"+c.filterQueryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=d((function(){c.applyFilters()}),100),this.searchAnalyticsDebouncer=d((function(){p.search(c._searchKeyword)}),1e3),this.data=n.data?n.data.map((function(t){return new s(t.product,t.selectedVariantValues)})):[],this._type=n.type||n.productListPropValue.productListType||g.ALL,this._pageType=n.pageType,this._sort=n.sort||n.productListPropValue.initialSort||_.LAST_ADDED,"A_Z"!==this.initialSort&&"Z_A"!==this.initialSort||(this._sort=_.LAST_ADDED),this._limit=n.limit||n.productListPropValue.initialLimit||20,this._page=n.page||1,this._minPage=n.minPage||null,this._count=n.count||0,this._searchKeyword=n.searchKeyword||"",this._productListPropValue=n.productListPropValue,this._filterBrandId=n.filterBrandId||null,this._filterCategoryId=n.filterCategoryId||null,this._relatedProductData=n.relatedProductData||null,this._recommendFor=n.recommendFor,this.filters=n.filters?n.filters.map((function(t){return new u(t,c)})):null,this._filterCategories=n.filterCategories?n.filterCategories.map((function(t){return new o(t)})):null,this.pageSpecificData=n.pageSpecificData||null,this.router=a,i(this),this.setPageSpecificSort(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===g.SEARCH)){var l=this.getQueryParams();this.getInitial(l,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(y.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFilterable",{get:function(){return this._type===g.ALL||this._type===g.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==r.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isStatic",{get:function(){return this._type===g.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isDiscounted",{get:function(){return this._type===g.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isRecommended",{get:function(){return this._type===g.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLastViewed",{get:function(){return this._type===g.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isRelatedProducts",{get:function(){return this._type===g.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isSearch",{get:function(){return this._type===g.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterQueryParams",{get:function(){var t,e,i,s,n=this,a={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[t.key]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==r.CATEGORY){var o=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==o?void 0:o.length))a.c=null==o?void 0:o.map((function(t){return t.slug}));else if(this._filterCategoryId){var u=null===(s=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===n._filterCategoryId})))||void 0===s?void 0:s.slug;u&&(a.c=u)}}return l.stringify(a,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[g.ALL,g.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),y.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[g.ALL,g.CATEGORY].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=_.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=_.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=_.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=_.INCREASING_PRICE;break;case a.NEWEST:this._sort=_.LAST_ADDED;break;case a.OLDEST:this._sort=_.FIRST_ADDED;break;case a.MANUALLY:this._sort=_.FEATURED}},y.prototype.getSortParams=function(){var t=f.DESC,e=m.CREATED_AT;switch(this._sort){case _.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case _.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case _.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case _.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case _.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case _.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case _.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT}return{direction:t,type:e}},y.prototype.searchProducts=function(i,s,a){var o,u,l;return t(this,void 0,void 0,(function(){var t,d,p,f;return e(this,(function(e){switch(e.label){case 0:return t=[],d=[],null===(o=this.filters)||void 0===o||o.forEach((function(e){e.valueList.length&&t.push(new c({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&d.push({id:e.id,type:e.type,displayType:e.displayType})})),p=null===(u=this._filterCategories)||void 0===u?void 0:u.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,n.getRelatedProducts({priceListId:h.priceListId,salesChannelId:h.salesChannelId,productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds})]:[3,2];case 1:case 3:return[2,e.sent()];case 2:return[4,n.searchProducts({page:i,perPage:s,productIdList:this.isStatic?null===(l=this._productListPropValue.productIds)||void 0===l?void 0:l.map((function(t){return t.productId})):a,filterList:t,facetList:d,brandId:this._pageType===r.BRAND&&this._type!==g.SEARCH?this._filterBrandId:void 0,categoryIdList:p&&p.length?p:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:h.priceListId,salesChannelId:h.salesChannelId,query:this._searchKeyword,order:this._type===g.SEARCH?null:f?[f]:null},!0)]}}))}))},y.prototype.getFilters=function(){var i;return t(this,void 0,void 0,(function(){var t,s,a=this;return e(this,(function(e){switch(e.label){case 0:return[4,n.getProductFilterData(this._filterCategoryId?this._filterCategoryId:void 0)];case 1:return t=e.sent(),this.filters=null==t?void 0:t.filters.map((function(t){return new u(t,a)})),this._filterCategories=null==t?void 0:t.categories,this.pageType!==r.CATEGORY&&this._filterCategoryId&&(s=null===(i=this._filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===a._filterCategoryId})))&&(s._isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},y.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");if(s&&(this._searchKeyword=s),this._pageType!==r.CATEGORY){var n=null==t?void 0:t.get("c"),a=null==n?void 0:n.split(",");a&&a.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t._isSelected=a.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},y.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,n=null==t?void 0:t.find((function(t){return t.id===e.id}));n?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=n.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},y.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==r.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t._isSelected=!1})),this.applyFilters()},y.prototype.setSortType=function(i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this._sort=i,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},y.prototype.onFilterCategoryClick=function(i,r){var s,n;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t._isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:h.isEditor||null===(n=this.router)||void 0===n||n.push(i.href+(this.filterQueryParams?"?"+this.filterQueryParams:"")),t.label=3;case 3:return[2]}}))}))},y.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue,pageSpecificData:this.pageSpecificData}},y.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},y.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},y.prototype.isBrowser=function(){return"undefined"!=typeof window},y.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){h.store.customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},y.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?p.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===g.ALL&&p.viewListing(this.data)},y}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED",t.RELATED_PRODUCTS="RELATED_PRODUCTS"}(g||(g={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED"}(_||(_={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(y||(y={}));export{v as IkasProductList,_ as IkasProductListSortType,g as IkasProductListType,y as IkasRelatedProductsType};
|
|
1
|
+
import{__awaiter as t,__generator as e}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import"../../theme/theme.js";import{IkasThemePageType as r}from"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import{IkasProductDetail as s}from"../product-detail/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import"../../../api/blog/index.js";import"../../../api/brand/index.js";import"../../../api/cart/index.js";import"../../../api/category/index.js";import"../../../api/checkout/index.js";import"../../../api/city/index.js";import"../../../api/country/index.js";import"../../../api/customer/index.js";import"../../../api/customer-review/index.js";import"../../../api/customer-review-summary/index.js";import"../../../api/district/index.js";import"../../../api/html-meta-data/index.js";import"../../../api/merchant/index.js";import{IkasProductSearchAPI as n}from"../../../api/product-search/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{ModelOrder as o,IkasFilterCategory as a}from"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/merchant-settings/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import"../../../api/product-option-file/index.js";import"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as u,IkasProductFilterValue as c}from"../../data/product-filter/index.js";import"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import"../../data/raffle/index.js";import"../../data/product-campaing/campaign/index.js";import"../../data/customer-attribute/index.js";import"../../data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../../api/apollo.js";import"../../../api/favorite-product/index.js";import"../../../api/contact-form/index.js";import"../../../api/state/index.js";import"../../../api/product-option-set/index.js";import"../../../api/raffle/index.js";import"../../../api/back-in-stock-reminder/index.js";import"../../../api/product-campaign/index.js";import l from'../../../ext/query-string/index.js';import d from'../../../ext/lodash/debounce.js';import{Analytics as p}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import{IkasStorefrontConfig as h}from"../../../storefront/index.js";import{SortByDirectionEnum as f,SortByTypeEnum as m}from"../../../__generated__/global-types.js";var g,_,y,v,E=function(){function g(n,o){var c=this;if(this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this.getSortTypeEnumFromNumerableSortTypeString=function(t){if(I.hasOwnProperty(t))return I[t]},this.convertSortTypeEnumToStringForQueryParam=function(t){return v[t]},this.applyFilters=function(){return t(c,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[r.CATEGORY,r.BRAND,r.SEARCH].includes(this._pageType)?(t&&this.isBrowser()&&!this.isSearch&&!h.isEditor&&(null===(i=this.router)||void 0===i||i.replace("".concat(location.pathname).concat(this.filterQueryParams?"?"+this.filterQueryParams:""),void 0,{shallow:!0})),[2]):[2]}}))}))},this.getInitial=function(i,r){return t(c,void 0,void 0,(function(){var t,n,o,a,u,c,l,d,p;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,12,13,14]),n=r?this._page:1,o=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(i),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(a=void 0,this.isStatic?(n=void 0,o=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(n=1,o=10,[3,10]):[3,5];case 5:return this.isRecommended?(n=1,o=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,h.store.customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length&&(a=u.map((function(t){return t.productId}))),[3,10];case 9:return[2];case 10:return[4,this.searchProducts(n||1,o||10,a)];case 11:return(c=e.sent())&&this._fetchRequestTime===t?(l=[],this.isStatic||this.isLastViewed?(d=this.isStatic?this._productListPropValue.productIds:h.store.customerStore._lastViewedProducts,l=(null==d?void 0:d.map((function(t){var e=c.data.find((function(e){return e.id===t.productId})),i=null==e?void 0:e.variants.find((function(e){return e.id===t.variantId}));if((null==i?void 0:i.isActive)||(i=null==e?void 0:e.variants.find((function(t){return t.isActive}))),e&&i)return new s(e,i.variantValues)})).filter((function(t){return!!t})))||[]):l=c.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.applyFacets(c.facets),this.data=l,this._count=c.count,this._initialized=!0,this._page=n||1,this._minPage=this.page,r||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 12:return p=e.sent(),console.log(p),[3,14];case 13:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 14:return[2]}}))}))},this.getPrev=function(){return t(c,void 0,void 0,(function(){var t,i,r,n;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(i=e.sent())?(r=i.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r.concat(this.data),this._count=i.count,this._minPage=t,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(c,void 0,void 0,(function(){var t,i,r;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(i=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=this.data.concat(i),this._count=t.count,this._page=this.page+1,[3,5]):[2];case 3:return r=e.sent(),console.log(r),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(i){return t(c,void 0,void 0,(function(){var t,r,n;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(i,this.limit)];case 2:return(t=e.sent())?(r=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r,this._count=t.count,this._page=i,this._minPage=i,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;c._infiniteScrollPage!==t&&(c._infiniteScrollPage=t,h.isEditor||null===(e=c.router)||void 0===e||e.replace("".concat(location.pathname).concat(c.filterQueryParams?"?"+c.filterQueryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=d((function(){c.applyFilters()}),100),this.searchAnalyticsDebouncer=d((function(){p.search(c._searchKeyword)}),1e3),this.data=n.data?n.data.map((function(t){return new s(t.product,t.selectedVariantValues)})):[],this._type=n.type||n.productListPropValue.productListType||_.ALL,this._pageType=n.pageType,this._sort=n.sort||n.productListPropValue.initialSort||y.LAST_ADDED,"A_Z"!==this.initialSort&&"Z_A"!==this.initialSort||(this._sort=y.LAST_ADDED),this._limit=n.limit||n.productListPropValue.initialLimit||20,this._page=n.page||1,this._minPage=n.minPage||null,this._count=n.count||0,this._searchKeyword=n.searchKeyword||"",this._productListPropValue=n.productListPropValue,this._filterBrandId=n.filterBrandId||null,this._filterCategoryId=n.filterCategoryId||null,this._relatedProductData=n.relatedProductData||null,this._recommendFor=n.recommendFor,this.filters=n.filters?n.filters.map((function(t){return new u(t,c)})):null,this._filterCategories=n.filterCategories?n.filterCategories.map((function(t){return new a(t)})):null,this.pageSpecificData=n.pageSpecificData||null,this.router=o,i(this),this.setPageSpecificSort(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===_.SEARCH)){var l=this.getQueryParams();this.getInitial(l,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(g.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isFilterable",{get:function(){return this._type===_.ALL||this._type===_.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==r.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isStatic",{get:function(){return this._type===_.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isDiscounted",{get:function(){return this._type===_.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isRecommended",{get:function(){return this._type===_.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isLastViewed",{get:function(){return this._type===_.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isRelatedProducts",{get:function(){return this._type===_.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isSearch",{get:function(){return this._type===_.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"filterQueryParams",{get:function(){var t,e,i,s,n=this,o={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(o[t.key]=t.keyList)})),this._sort&&(o.sort=this.convertSortTypeEnumToStringForQueryParam(this._sort)),this._searchKeyword&&(o.s=this._searchKeyword),this._infiniteScrollPage&&(o.page=this._infiniteScrollPage),this._pageType!==r.CATEGORY){var a=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==a?void 0:a.length))o.c=null==a?void 0:a.map((function(t){return t.slug}));else if(this._filterCategoryId){var u=null===(s=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===n._filterCategoryId})))||void 0===s?void 0:s.slug;u&&(o.c=u)}}return l.stringify(o,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===o.MANUALLY&&[_.ALL,_.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),g.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[_.ALL,_.CATEGORY].includes(this._type))switch(this.pageSpecificData.orderType){case o.HIGHEST_DISCOUNT_RATIO:this._sort=y.DECRASING_DISCOUNT;break;case o.LOWEST_DISCOUNT_RATIO:this._sort=y.INCREASING_DISCOUNT;break;case o.HIGHEST_PRICE:this._sort=y.DECREASING_PRICE;break;case o.LOWEST_PRICE:this._sort=y.INCREASING_PRICE;break;case o.NEWEST:this._sort=y.LAST_ADDED;break;case o.OLDEST:this._sort=y.FIRST_ADDED;break;case o.MANUALLY:this._sort=y.FEATURED}},g.prototype.getSortParams=function(){var t=f.DESC,e=m.CREATED_AT;switch(this._sort){case y.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case y.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case y.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case y.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case y.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case y.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case y.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT}return{direction:t,type:e}},g.prototype.searchProducts=function(i,s,o){var a,u,l;return t(this,void 0,void 0,(function(){var t,d,p,f;return e(this,(function(e){switch(e.label){case 0:return t=[],d=[],null===(a=this.filters)||void 0===a||a.forEach((function(e){e.valueList.length&&t.push(new c({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&d.push({id:e.id,type:e.type,displayType:e.displayType})})),p=null===(u=this._filterCategories)||void 0===u?void 0:u.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,n.getRelatedProducts({priceListId:h.priceListId,salesChannelId:h.salesChannelId,productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds})]:[3,2];case 1:case 3:return[2,e.sent()];case 2:return[4,n.searchProducts({page:i,perPage:s,productIdList:this.isStatic?null===(l=this._productListPropValue.productIds)||void 0===l?void 0:l.map((function(t){return t.productId})):o,filterList:t,facetList:d,brandId:this._pageType===r.BRAND&&this._type!==_.SEARCH?this._filterBrandId:void 0,categoryIdList:p&&p.length?p:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:h.priceListId,salesChannelId:h.salesChannelId,query:this._searchKeyword,order:this._type===_.SEARCH?null:f?[f]:null},!0)]}}))}))},g.prototype.getFilters=function(){var i;return t(this,void 0,void 0,(function(){var t,s,o=this;return e(this,(function(e){switch(e.label){case 0:return[4,n.getProductFilterData(this._filterCategoryId?this._filterCategoryId:void 0)];case 1:return t=e.sent(),this.filters=null==t?void 0:t.filters.map((function(t){return new u(t,o)})),this._filterCategories=null==t?void 0:t.categories,this.pageType!==r.CATEGORY&&this._filterCategoryId&&(s=null===(i=this._filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===o._filterCategoryId})))&&(s._isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},g.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");s&&(this._searchKeyword=s);var n=null==t?void 0:t.get("sort");if(n){var o=this.getSortTypeEnumFromNumerableSortTypeString(n);o&&(this._sort=o)}if(this._pageType!==r.CATEGORY){var a=null==t?void 0:t.get("c"),u=null==a?void 0:a.split(",");u&&u.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t._isSelected=u.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},g.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,n=null==t?void 0:t.find((function(t){return t.id===e.id}));n?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=n.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},g.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==r.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t._isSelected=!1})),this.applyFilters()},g.prototype.setSortType=function(i){var r;return t(this,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return this._sort=i,t=new URLSearchParams(window.location.search),s=v[this._sort],t.set("sort",s),h.isEditor||null===(r=this.router)||void 0===r||r.replace("".concat(location.pathname,"?").concat(t.toString()),void 0,{shallow:!0}),[4,this.getInitial(t)];case 1:return e.sent(),[2]}}))}))},g.prototype.onFilterCategoryClick=function(i,r){var s,n;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t._isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:h.isEditor||null===(n=this.router)||void 0===n||n.push(i.href+(this.filterQueryParams?"?"+this.filterQueryParams:"")),t.label=3;case 3:return[2]}}))}))},g.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue,pageSpecificData:this.pageSpecificData}},g.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},g.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},g.prototype.isBrowser=function(){return"undefined"!=typeof window},g.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){h.store.customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},g.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?p.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===_.ALL&&p.viewListing(this.data)},g}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED",t.RELATED_PRODUCTS="RELATED_PRODUCTS"}(_||(_={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED"}(y||(y={})),function(t){t.INCREASING_PRICE="0",t.DECREASING_PRICE="1",t.LAST_ADDED="2",t.FIRST_ADDED="3",t.INCREASING_DISCOUNT="4",t.DECRASING_DISCOUNT="5",t.FEATURED="6"}(v||(v={}));var S,I=((g={})[v.INCREASING_PRICE]=y.INCREASING_PRICE,g[v.DECREASING_PRICE]=y.DECREASING_PRICE,g[v.LAST_ADDED]=y.LAST_ADDED,g[v.FIRST_ADDED]=y.FIRST_ADDED,g[v.INCREASING_DISCOUNT]=y.INCREASING_DISCOUNT,g[v.DECRASING_DISCOUNT]=y.DECRASING_DISCOUNT,g[v.FEATURED]=y.FEATURED,g);!function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(S||(S={}));export{E as IkasProductList,y as IkasProductListSortType,v as IkasProductListSortTypeNumerable,I as IkasProductListSortTypeNumerableMapToEnum,_ as IkasProductListType,S as IkasRelatedProductsType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i}from'../../../ext/tslib/tslib.es6.js';import"../../../api/blog/index.js";import"../../../api/brand/index.js";import"../../../api/cart/index.js";import"../../../api/category/index.js";import"../../../api/checkout/index.js";import"../../../api/city/index.js";import"../../../api/country/index.js";import"../../../api/customer/index.js";import"../../../api/customer-review/index.js";import"../../../api/customer-review-summary/index.js";import"../../../api/district/index.js";import"../../../api/html-meta-data/index.js";import"../../../api/merchant/index.js";import"../../../api/product-search/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import{makeAutoObservable as e,runInAction as r}from"mobx";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/merchant-settings/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import"../../../api/product-option-file/index.js";import"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import"../../data/product-filter/index.js";import"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import{IkasRaffle as n}from"../../data/raffle/index.js";import"../../data/product-campaing/campaign/index.js";import"../../data/customer-attribute/index.js";import"../../data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../theme/theme.js";import"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import"../product-detail/index.js";import"../product-list/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import"../../../api/apollo.js";import"../../../api/favorite-product/index.js";import"../../../api/contact-form/index.js";import"../../../api/state/index.js";import"../../../api/product-option-set/index.js";import{IkasRaffleAPI as a}from"../../../api/raffle/index.js";import"../../../api/back-in-stock-reminder/index.js";import"../../../api/product-campaign/index.js";import{populateRaffleProducts as o}from"../../../providers/helpers/raffles.js";var s=function(){function s(a){var o=this;void 0===a&&(a={}),this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getInitial=function(){return t(o,void 0,void 0,(function(){var t,e,n=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(this.page,this.limit)];case 2:return t=i.sent(),this.data=t.raffles,this._count=t.count,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return r((function(){n._isLoading=!1})),[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(o,void 0,void 0,(function(){var t,e,n,a=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.getRaffleList(t,this.limit)];case 2:return e=i.sent(),r((function(){a.data=e.raffles.concat(a.data),a._count=e.count,a._minPage=t})),[3,5];case 3:return n=i.sent(),console.log(n),[3,5];case 4:return r((function(){a._isLoading=!1})),[7];case 5:return[2]}}))}))},this.getNext=function(){return t(o,void 0,void 0,(function(){var t,e,n=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(this.page+1,this.limit)];case 2:return t=i.sent(),r((function(){n.data=n.data.concat(t.raffles),n._count=t.count,n._page=n.page+1})),[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return r((function(){n._isLoading=!1})),[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(o,void 0,void 0,(function(){var t,n,a=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(e,this.limit)];case 2:return t=i.sent(),r((function(){a.data=t.raffles,a._count=t.count,a._page=e,a._minPage=e})),[3,5];case 3:return n=i.sent(),console.log(n),[3,5];case 4:return r((function(){a._isLoading=!1})),[7];case 5:return[2]}}))}))},this.data=a.data?a.data.map((function(t){return new n(t)})):[],this._limit=a.limit||20,this._page=a.page||1,this._count=a.count||0,this._initialized=a.initialized||!1,this._minPage=a.minPage||null,this._start=a.start||null,this._end=a.end||null,this._includeDeleted=a.includeDeleted||null,this._name=a.name||null,this._search=a.search||null,this._id=a.id||null,e(this)}return Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),s.prototype.getRaffleList=function(e,r){return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,a.
|
|
1
|
+
import{__awaiter as t,__generator as i}from'../../../ext/tslib/tslib.es6.js';import"../../../api/blog/index.js";import"../../../api/brand/index.js";import"../../../api/cart/index.js";import"../../../api/category/index.js";import"../../../api/checkout/index.js";import"../../../api/city/index.js";import"../../../api/country/index.js";import"../../../api/customer/index.js";import"../../../api/customer-review/index.js";import"../../../api/customer-review-summary/index.js";import"../../../api/district/index.js";import"../../../api/html-meta-data/index.js";import"../../../api/merchant/index.js";import"../../../api/product-search/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import{makeAutoObservable as e,runInAction as r}from"mobx";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/merchant-settings/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import"../../../api/product-option-file/index.js";import"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import"../../data/product-filter/index.js";import"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import{IkasRaffle as n}from"../../data/raffle/index.js";import"../../data/product-campaing/campaign/index.js";import"../../data/customer-attribute/index.js";import"../../data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../theme/theme.js";import"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import"../product-detail/index.js";import"../product-list/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import"../../../api/apollo.js";import"../../../api/favorite-product/index.js";import"../../../api/contact-form/index.js";import"../../../api/state/index.js";import"../../../api/product-option-set/index.js";import{IkasRaffleAPI as a}from"../../../api/raffle/index.js";import"../../../api/back-in-stock-reminder/index.js";import"../../../api/product-campaign/index.js";import{populateRaffleProducts as o}from"../../../providers/helpers/raffles.js";var s=function(){function s(a){var o=this;void 0===a&&(a={}),this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getInitial=function(){return t(o,void 0,void 0,(function(){var t,e,n=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(this.page,this.limit)];case 2:return t=i.sent(),this.data=t.raffles,this._count=t.count,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return r((function(){n._isLoading=!1})),[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(o,void 0,void 0,(function(){var t,e,n,a=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.getRaffleList(t,this.limit)];case 2:return e=i.sent(),r((function(){a.data=e.raffles.concat(a.data),a._count=e.count,a._minPage=t})),[3,5];case 3:return n=i.sent(),console.log(n),[3,5];case 4:return r((function(){a._isLoading=!1})),[7];case 5:return[2]}}))}))},this.getNext=function(){return t(o,void 0,void 0,(function(){var t,e,n=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(this.page+1,this.limit)];case 2:return t=i.sent(),r((function(){n.data=n.data.concat(t.raffles),n._count=t.count,n._page=n.page+1})),[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return r((function(){n._isLoading=!1})),[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(o,void 0,void 0,(function(){var t,n,a=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(e,this.limit)];case 2:return t=i.sent(),r((function(){a.data=t.raffles,a._count=t.count,a._page=e,a._minPage=e})),[3,5];case 3:return n=i.sent(),console.log(n),[3,5];case 4:return r((function(){a._isLoading=!1})),[7];case 5:return[2]}}))}))},this.data=a.data?a.data.map((function(t){return new n(t)})):[],this._limit=a.limit||20,this._page=a.page||1,this._count=a.count||0,this._initialized=a.initialized||!1,this._minPage=a.minPage||null,this._start=a.start||null,this._end=a.end||null,this._includeDeleted=a.includeDeleted||null,this._name=a.name||null,this._search=a.search||null,this._id=a.id||null,e(this)}return Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),s.prototype.getRaffleList=function(e,r){return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,a.listStorefrontRaffle({start:this._start,end:this._end,includeDeleted:this._includeDeleted||!1,name:this._name,id:this._id,search:this._search||void 0,pagination:{limit:r,page:e}})];case 1:return t=i.sent(),[4,o(t.raffles)];case 2:return i.sent(),[2,t]}}))}))},s.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage}},s}();export{s as IkasRaffleList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as i,__generator as t}from'../../ext/tslib/tslib.es6.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"mobx";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/merchant-settings/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../api/product-option-file/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/product-campaing/campaign/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductDetail as o}from"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import"../../api/blog/index.js";import"../../api/brand/index.js";import"../../api/cart/index.js";import"../../api/category/index.js";import"../../api/checkout/index.js";import"../../api/city/index.js";import"../../api/country/index.js";import"../../api/customer/index.js";import"../../api/customer-review/index.js";import"../../api/customer-review-summary/index.js";import"../../api/district/index.js";import"../../api/html-meta-data/index.js";import"../../api/merchant/index.js";import{IkasProductSearchAPI as r}from"../../api/product-search/index.js";import"../../api/apollo.js";import"../../api/favorite-product/index.js";import"../../api/contact-form/index.js";import"../../api/state/index.js";import{IkasProductOptionSetAPI as e}from"../../api/product-option-set/index.js";import"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import"../../api/product-campaign/index.js";var d=function(d){return i(void 0,void 0,void 0,(function(){var i,a,s,m,n,p,l,u,c;return t(this,(function(t){switch(t.label){case 0:for(i=[],a=0,s=d;a<s.length;a++)m=s[a],null===(c=m.variants)||void 0===c||c.forEach((function(t){i.find((function(i){return i===t.productId}))||i.push(t.productId)}));return[4,r.searchProducts({productIdList:i})];case 1:return(n=t.sent())&&(p=n.data).length?(l=p.map((function(i){return i.productOptionSetId})).filter((function(i){return!!i})),[4,e.list(l)]):[3,3];case 2:u=t.sent(),d.forEach((function(i){var t;null===(t=i.variants)||void 0===t||t.forEach((function(t){var r=p.find((function(i){return t.productId===i.id}));if(r){r.productOptionSet=null==u?void 0:u.find((function(i){return i.id===r.productOptionSetId}));var e=r.variants.find((function(i){return i.isActive&&t.variantId===i.id}))||r.variants[0];if(!i.products.find((function(i){return i.product.id===r.id}))){var d=new o(r,e.variantValues);d.product.variants=d.product.variants.filter((function(t){var o;return null===(o=i.variants)||void 0===o?void 0:o.find((function(i){return i.variantId===t.id}))})),i.products.push(d)}}}))})),t.label=3;case 3:return[2]}}))}))};export{d as populateRaffleProducts};
|
|
1
|
+
import{__awaiter as i,__generator as t}from'../../ext/tslib/tslib.es6.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"mobx";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/merchant-settings/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../api/product-option-file/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/product-campaing/campaign/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductDetail as o}from"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import"../../api/blog/index.js";import"../../api/brand/index.js";import"../../api/cart/index.js";import"../../api/category/index.js";import"../../api/checkout/index.js";import"../../api/city/index.js";import"../../api/country/index.js";import"../../api/customer/index.js";import"../../api/customer-review/index.js";import"../../api/customer-review-summary/index.js";import"../../api/district/index.js";import"../../api/html-meta-data/index.js";import"../../api/merchant/index.js";import{IkasProductSearchAPI as r}from"../../api/product-search/index.js";import"../../api/apollo.js";import"../../api/favorite-product/index.js";import"../../api/contact-form/index.js";import"../../api/state/index.js";import{IkasProductOptionSetAPI as e}from"../../api/product-option-set/index.js";import"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import"../../api/product-campaign/index.js";var d=function(d){return i(void 0,void 0,void 0,(function(){var i,a,s,m,n,p,l,u,c;return t(this,(function(t){switch(t.label){case 0:for(i=[],a=0,s=d;a<s.length;a++)m=s[a],null===(c=m.variants)||void 0===c||c.forEach((function(t){i.find((function(i){return i===t.productId}))||t.productId&&i.push(t.productId)}));return[4,r.searchProducts({productIdList:i})];case 1:return(n=t.sent())&&(p=n.data).length?(l=p.map((function(i){return i.productOptionSetId})).filter((function(i){return!!i})),[4,e.list(l)]):[3,3];case 2:u=t.sent(),d.forEach((function(i){var t;null===(t=i.variants)||void 0===t||t.forEach((function(t){var r=p.find((function(i){return t.productId===i.id}));if(r){r.productOptionSet=null==u?void 0:u.find((function(i){return i.id===r.productOptionSetId}));var e=r.variants.find((function(i){return i.isActive&&t.variantId===i.id}))||r.variants[0];if(!i.products.find((function(i){return i.product.id===r.id}))){var d=new o(r,e.variantValues);d.product.variants=d.product.variants.filter((function(t){var o;return null===(o=i.variants)||void 0===o?void 0:o.find((function(i){return i.variantId===t.id}))})),i.products.push(d)}}}))})),t.label=3;case 3:return[2]}}))}))};export{d as populateRaffleProducts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import i from'../ext/lodash/uniq.js';import a from'../ext/lzutf8/build/production/lzutf8.js';import{IkasBlogMetadataTargetType as s}from"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import{IkasHTMLMetaDataTargetType as n}from"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/merchant-settings/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"../api/product-option-file/index.js";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import{IkasRaffleMetadataTargetType as o}from"../models/data/raffle/index.js";import"../models/data/product-campaing/campaign/index.js";import"../models/data/customer-attribute/index.js";import"../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import{IkasTheme as p}from"../models/theme/theme.js";import{IkasThemePageType as u}from"../models/theme/page/index.js";import{IkasThemePageComponent as c}from"../models/theme/page/component/index.js";import{IkasThemeComponent as d}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as l}from"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import{IkasProductDetail as m}from"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasBlogAPI as f}from"../api/blog/index.js";import{IkasBrandAPI as g}from"../api/brand/index.js";import"../api/cart/index.js";import{IkasCategoryAPI as h}from"../api/category/index.js";import"../api/checkout/index.js";import"../api/city/index.js";import"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import{IkasCustomerReviewSummaryAPI as v}from"../api/customer-review-summary/index.js";import"../api/district/index.js";import{IkasHTMLMetaDataAPI as j}from"../api/html-meta-data/index.js";import{IkasMerchantAPI as T}from"../api/merchant/index.js";import{IkasProductSearchAPI as y}from"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import{IkasProductOptionSetAPI as x}from"../api/product-option-set/index.js";import{IkasRaffleAPI as b}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{IkasProductListPropValueProvider as S}from"./prop-value/product-list.js";import{IkasProductDetailPropValueProvider as D}from"./prop-value/product-detail.js";import{IkasBrandListPropValueProvider as w}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as L}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as O}from"./prop-value/link.js";import{IkasImageListPropValueProvider as P}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as R}from"./prop-value/text.js";import{IkasColorPropValueProvider as C}from"./prop-value/color.js";import{IkasBooleanPropValueProvider as I}from"./prop-value/boolean.js";import{IkasImagePropValueProvider as E}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as A}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as B}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as M}from"./prop-value/custom.js";import{IkasStorefrontConfig as G}from"../storefront/index.js";import{IkasSliderPropValueProvider as _}from"./prop-value/slider.js";import{IkasRichTextPropValueProvider as V}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as F}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as k}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as U}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as N}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as Y}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as J}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as H}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as q}from"./prop-value/raffle-list.js";import{populateRaffleProducts as z}from"./helpers/raffles.js";var K=function(){function c(e,t,i){this.pageType=null,this.pageParams={},this.pageComponentPropValues=[],this.pageSpecificData=null,this.merchantSettings=null,this.possiblePageTypes=[],this.linkMetaDataTargetIds=[],this.productReviewSummary=null,this.theme=new p(e),this.pageParams=t||{},this.pageType=i,r(this)}return Object.defineProperty(c.prototype,"page",{get:function(){var e=this;if(this.pageType===u.CUSTOM){var t=this.pageParams.slug;return this.theme.pages.find((function(e){return e.type===u.CUSTOM&&e.slug===t}))}return this.theme.pages.find((function(t){return t.type===e.pageType}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"nextPageData",{get:function(){var e,t,r,i,s;return{props:{propValuesStr:a.compress(JSON.stringify(this.pageComponentPropValues),{outputEncoding:"Base64"}),pageSpecificDataStr:this.pageSpecificData?JSON.stringify(this.pageSpecificData||{}):"",pageType:(null===(e=this.page)||void 0===e?void 0:e.type)||u.CUSTOM,pageTitle:(null===(t=this.page)||void 0===t?void 0:t.pageTitle)||null,pageDescription:(null===(r=this.page)||void 0===r?void 0:r.description)||null,canonicals:(null===(i=this.page)||void 0===i?void 0:i.canonicals)||null,disableIndex:(null===(s=this.page)||void 0===s?void 0:s.disableIndex)||null,settingsStr:JSON.stringify(this.theme.settings||{}),merchantSettingsStr:this.merchantSettings?JSON.stringify(this.merchantSettings):null,configJson:G.getJson(),productReviewSummary:JSON.stringify(this.productReviewSummary)}}},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"specification",{get:function(){var e,t,r=this,i=this.page;return(null==i?void 0:i.type)===u.PRODUCT?null===(e=i.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.product.id)})):null===(t=null==i?void 0:i.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),c.prototype.getMerchantSettings=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.listMerchantSettings()];case 1:return(e=t.sent())&&(this.merchantSettings=e),[2]}}))}))},c.prototype.getPageData=function(){return e(this,void 0,void 0,(function(){var e,r=this;return t(this,(function(t){switch(t.label){case 0:return this.pageSpecificData?[3,2]:[4,this.getPageSpecificData()];case 1:t.sent(),t.label=2;case 2:return this.page?[4,this.getMerchantSettings()]:[2];case 3:return t.sent(),e=this,[4,Promise.all(this.pageComponents.map((function(e){return r.getPageComponentPropValues(e)})))];case 4:return e.pageComponentPropValues=t.sent(),[4,this.setLinkSlugs()];case 5:return t.sent(),[4,this.getProductReviewSummary()];case 6:return t.sent(),[2]}}))}))},c.prototype.getProductReviewSummary=function(){var r;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageType!==u.PRODUCT?[3,2]:[4,v.listCustomerReviewSummary({productId:{eq:null===(r=this.pageSpecificData)||void 0===r?void 0:r.product.id}})];case 1:(e=t.sent())&&e.data.length&&(this.productReviewSummary=e.data[0]),t.label=2;case 2:return[2]}}))}))},c.prototype.getPageSpecificData=function(){var r,i,a;return e(this,void 0,void 0,(function(){var p,c,d,l,v,T,S,D,w,L=this;return t(this,(function(O){switch(O.label){case 0:return this.pageType&&![u.BRAND,u.PRODUCT,u.CATEGORY,u.BLOG,u.BLOG_CATEGORY,u.RAFFLE_DETAIL].includes(this.pageType)?[2]:(p=this.pageParams.slug)?(c=[],(null===(r=this.possiblePageTypes)||void 0===r?void 0:r.includes(u.BLOG))||(null===(i=this.possiblePageTypes)||void 0===i?void 0:i.includes(u.BLOG_CATEGORY))?[4,f.listBlogMetaData(p)]:[3,2]):[2];case 1:return(c=O.sent()).length?[3,6]:[2];case 2:return(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(u.RAFFLE_DETAIL))?[4,b.listRaffleMetaData(p)]:[3,4];case 3:return(c=O.sent()).length?[3,6]:[2];case 4:return[4,j.listHTMLMetaData(p)];case 5:if(!(c=O.sent())||!c.length)return[2];O.label=6;case 6:if(!(d=c[0]).targetId)return[2];switch(l=function(){return e(L,void 0,void 0,(function(){var e,r,i,a,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,y.searchProducts({productIdList:[d.targetId],priceListId:G.priceListId,salesChannelId:G.salesChannelId})];case 1:return(null==(e=t.sent())?void 0:e.data.length)?(r=e.data[0]).productOptionSetId?[4,x.list([r.productOptionSetId])]:[3,3]:[2];case 2:(null==(i=t.sent())?void 0:i.length)&&(r.productOptionSet=i[0]),t.label=3;case 3:return(a=r.variants.find((function(e){return e.isActive})))?(this.pageSpecificData=new m(r,a.variantValues),this.pageSpecificData.displayedVariantTypes.length&&(s=this.pageSpecificData.displayedVariantTypes[0]).displayedVariantValues.length&&(n=s.displayedVariantValues.find((function(e){return e.hasStock})))&&(this.pageSpecificData.selectedVariantValues=n.variant.variantValues),this.pageType=u.PRODUCT,this.setPageMetaData(d),[2]):[2]}}))}))},v=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,g.listBrands({idList:[d.targetId]})];case 1:return(e=t.sent()).brands.length?(r=e.brands[0],this.pageSpecificData=r,this.pageType=u.BRAND,this.setPageMetaData(d),[2]):[2]}}))}))},T=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,h.listCategories({idList:[d.targetId]})];case 1:return(e=t.sent()).categories.length?(r=e.categories[0],this.pageSpecificData=r,this.pageType=u.CATEGORY,this.setPageMetaData(d),[2]):[2]}}))}))},S=function(){return e(L,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,f.getBlog({id:d.targetId})];case 1:return(e=t.sent())?(this.pageSpecificData=e,this.pageType=u.BLOG,this.setPageMetaData(d),[2]):[2]}}))}))},D=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,f.listBlogCategory({idList:[d.targetId],page:1,limit:1})];case 1:return(e=t.sent())&&e.blogCategories.length?(r=e.blogCategories[0],this.pageSpecificData=r,this.pageType=u.BLOG_CATEGORY,this.setPageMetaData(d),[2]):[2]}}))}))},w=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,b.listRaffles({id:d.targetId})];case 1:return(e=t.sent())&&e.raffles.length?(r=e.raffles[0],[4,z([r])]):[2];case 2:return t.sent(),this.pageSpecificData=r,this.pageType=u.RAFFLE_DETAIL,this.setPageMetaData(d),[2]}}))}))},d.targetType){case n.BRAND:return[3,7];case n.CATEGORY:return[3,9];case n.PRODUCT:return[3,11];case s.BLOG:return[3,13];case s.BLOG_CATEGORY:return[3,15];case o.RAFFLE:return[3,17]}return[3,19];case 7:return[4,v()];case 8:return[2,O.sent()];case 9:return[4,T()];case 10:return[2,O.sent()];case 11:return[4,l()];case 12:return[2,O.sent()];case 13:return[4,S()];case 14:return[2,O.sent()];case 15:return[4,D()];case 16:return[2,O.sent()];case 17:return[4,w()];case 18:return[2,O.sent()];case 19:return[3,20];case 20:return[2]}}))}))},c.prototype.getPageComponentPropValues=function(r){return e(this,void 0,void 0,(function(){var i,a,s,n=this;return t(this,(function(o){switch(o.label){case 0:return i=this.theme.components.find((function(e){return e.id===r.componentId})),a={pageComponent:r,component:i,propValues:{}},s=function(i){return e(n,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return e=a.propValues,s=i.name,[4,this.getPageComponentPropValue(r,i)];case 1:return e[s]=t.sent(),[2]}}))}))},[4,Promise.all(i.props.map(s))];case 1:return o.sent(),[2,a]}}))}))},c.prototype.getPageComponentPropValue=function(r,i){return e(this,void 0,void 0,(function(){var e,a,s,n,o,p=this;return t(this,(function(t){switch(t.label){case 0:if(a=r.propValues[i.name],s=[l.RAFFLE_LIST],null==a&&!s.includes(i.type))return[2,null];switch(i.type){case l.TEXT:return[3,1];case l.RICH_TEXT:return[3,2];case l.BOOLEAN:return[3,3];case l.IMAGE:return[3,4];case l.IMAGE_LIST:return[3,5];case l.BRAND:return[3,6];case l.BRAND_LIST:return[3,7];case l.PRODUCT_LIST:return[3,8];case l.PRODUCT_DETAIL:return[3,9];case l.PRODUCT_ATTRIBUTE:return[3,10];case l.PRODUCT_ATTRIBUTE_LIST:return[3,11];case l.CATEGORY:return[3,12];case l.CATEGORY_LIST:return[3,13];case l.LINK:case l.LIST_OF_LINK:return[3,14];case l.COLOR:return[3,15];case l.CUSTOM:return[3,16];case l.COMPONENT:case l.COMPONENT_LIST:return[3,17];case l.BLOG:return[3,19];case l.BLOG_LIST:return[3,20];case l.BLOG_CATEGORY:return[3,21];case l.BLOG_CATEGORY_LIST:return[3,22];case l.RAFFLE:return[3,23];case l.RAFFLE_LIST:return[3,24];case l.SLIDER:return[3,25]}return[3,26];case 1:return e=new R(a),[3,27];case 2:return e=new V(a),[3,27];case 3:return e=new I(a),[3,27];case 4:return e=new E(a),[3,27];case 5:return e=new P(a),[3,27];case 6:return e=new L(a),[3,27];case 7:return e=new w(a),[3,27];case 8:return e=new S(this.pageType,a,this.pageSpecificData),[3,27];case 9:return e=new D(a),[3,27];case 10:return e=new U(a),[3,27];case 11:return e=new N(a),[3,27];case 12:return e=new A(a),[3,27];case 13:return e=new B(a),[3,27];case 14:return e=new O(a,this.theme,this.linkMetaDataTargetIds),[3,27];case 15:return e=new C(a),[3,27];case 16:return(n=this.theme.customData.find((function(e){return e.id===i.customDataId})))?(e=new M(a,n,this.theme,this.pageType,this,this.pageSpecificData,this.pageParams),[3,27]):[2];case 17:return o=a,[4,Promise.all(o.map((function(e){return p.getPageComponentPropValues(e)})))];case 18:case 28:return[2,t.sent()];case 19:return e=new F(a),[3,27];case 20:return e=new k(this.pageType,a,this.pageSpecificData),[3,27];case 21:return e=new Y(a),[3,27];case 22:return e=new J(a),[3,27];case 23:return e=new H(a),[3,27];case 24:return e=new q,[3,27];case 25:return e=new _(a),[3,27];case 26:return[3,27];case 27:return[4,null==e?void 0:e.getValue()]}}))}))},c.prototype.setPageMetaData=function(e){this.page&&(this.page.pageTitle=e.pageTitle,this.page.description=e.description,this.page.canonicals=e.canonicals||null,this.page.disableIndex=e.disableIndex||null)},c.prototype.setLinkSlugs=function(){return e(this,void 0,void 0,(function(){var e,r,i;return t(this,(function(t){switch(t.label){case 0:return e=[],r=[],i=[],this.linkMetaDataTargetIds.forEach((function(t){switch(t.type){case"DEFAULT":e.push(t);break;case"BLOG":r.push(t);break;case"RAFFLE":i.push(t)}})),[4,Promise.all([this.getLinkSlugs(e,"DEFAULT"),this.getLinkSlugs(r,"BLOG"),this.getLinkSlugs(i,"RAFFLE")])];case 1:return[2,t.sent()]}}))}))},c.prototype.getLinkSlugs=function(r,a){return e(this,void 0,void 0,(function(){var s,n,o=this;return t(this,(function(p){switch(p.label){case 0:return s=i(r.map((function(e){return e.id}))),n=[],[4,function(){return e(o,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:switch(e=[],a){case"DEFAULT":return[3,1];case"BLOG":return[3,3];case"RAFFLE":return[3,5]}return[3,7];case 1:return[4,j.listHTMLMetaData(void 0,s,void 0)];case 2:case 4:case 6:return e=t.sent(),[3,8];case 3:return[4,f.listBlogMetaData(void 0,s,void 0)];case 5:return[4,b.listRaffleMetaData(void 0,s,void 0)];case 7:return[3,8];case 8:return e.length&&(n=e),[2]}}))}))}()];case 1:return p.sent(),r.forEach((function(e){var t=n.find((function(t){return t.targetId===e.id}));t&&(e.navigationLink.href+=t.slug)})),[2]}}))}))},c}(),X=function(e){this.pageComponent=e.pageComponent?new c(e.pageComponent):new c({}),this.component=e.component?new d(e.component):new d({}),this.propValues=e.propValues||{}};export{X as IkasPageComponentPropValue,K as IkasPageDataProvider};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import i from'../ext/lodash/uniq.js';import a from'../ext/lzutf8/build/production/lzutf8.js';import{IkasBlogMetadataTargetType as s}from"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import{IkasHTMLMetaDataTargetType as n}from"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/merchant-settings/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"../api/product-option-file/index.js";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import{IkasRaffleMetadataTargetType as o}from"../models/data/raffle/index.js";import"../models/data/product-campaing/campaign/index.js";import"../models/data/customer-attribute/index.js";import"../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import{IkasTheme as p}from"../models/theme/theme.js";import{IkasThemePageType as u}from"../models/theme/page/index.js";import{IkasThemePageComponent as c}from"../models/theme/page/component/index.js";import{IkasThemeComponent as d}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as l}from"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import{IkasProductDetail as m}from"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasBlogAPI as f}from"../api/blog/index.js";import{IkasBrandAPI as g}from"../api/brand/index.js";import"../api/cart/index.js";import{IkasCategoryAPI as h}from"../api/category/index.js";import"../api/checkout/index.js";import"../api/city/index.js";import"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import{IkasCustomerReviewSummaryAPI as v}from"../api/customer-review-summary/index.js";import"../api/district/index.js";import{IkasHTMLMetaDataAPI as j}from"../api/html-meta-data/index.js";import{IkasMerchantAPI as T}from"../api/merchant/index.js";import{IkasProductSearchAPI as y}from"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import{IkasProductOptionSetAPI as x}from"../api/product-option-set/index.js";import{IkasRaffleAPI as b}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{IkasProductListPropValueProvider as S}from"./prop-value/product-list.js";import{IkasProductDetailPropValueProvider as D}from"./prop-value/product-detail.js";import{IkasBrandListPropValueProvider as w}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as L}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as O}from"./prop-value/link.js";import{IkasImageListPropValueProvider as P}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as R}from"./prop-value/text.js";import{IkasColorPropValueProvider as C}from"./prop-value/color.js";import{IkasBooleanPropValueProvider as I}from"./prop-value/boolean.js";import{IkasImagePropValueProvider as E}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as A}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as B}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as M}from"./prop-value/custom.js";import{IkasStorefrontConfig as G}from"../storefront/index.js";import{IkasSliderPropValueProvider as _}from"./prop-value/slider.js";import{IkasRichTextPropValueProvider as V}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as F}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as k}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as U}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as N}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as Y}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as J}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as H}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as q}from"./prop-value/raffle-list.js";import{populateRaffleProducts as z}from"./helpers/raffles.js";var K=function(){function c(e,t,i){this.pageType=null,this.pageParams={},this.pageComponentPropValues=[],this.pageSpecificData=null,this.merchantSettings=null,this.possiblePageTypes=[],this.linkMetaDataTargetIds=[],this.productReviewSummary=null,this.theme=new p(e),this.pageParams=t||{},this.pageType=i,r(this)}return Object.defineProperty(c.prototype,"page",{get:function(){var e=this;if(this.pageType===u.CUSTOM){var t=this.pageParams.slug;return this.theme.pages.find((function(e){return e.type===u.CUSTOM&&e.slug===t}))}return this.theme.pages.find((function(t){return t.type===e.pageType}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"nextPageData",{get:function(){var e,t,r,i,s;return{props:{propValuesStr:a.compress(JSON.stringify(this.pageComponentPropValues),{outputEncoding:"Base64"}),pageSpecificDataStr:this.pageSpecificData?JSON.stringify(this.pageSpecificData||{}):"",pageType:(null===(e=this.page)||void 0===e?void 0:e.type)||u.CUSTOM,pageTitle:(null===(t=this.page)||void 0===t?void 0:t.pageTitle)||null,pageDescription:(null===(r=this.page)||void 0===r?void 0:r.description)||null,canonicals:(null===(i=this.page)||void 0===i?void 0:i.canonicals)||null,disableIndex:(null===(s=this.page)||void 0===s?void 0:s.disableIndex)||null,settingsStr:JSON.stringify(this.theme.settings||{}),merchantSettingsStr:this.merchantSettings?JSON.stringify(this.merchantSettings):null,configJson:G.getJson(),productReviewSummary:JSON.stringify(this.productReviewSummary)}}},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"specification",{get:function(){var e,t,r=this,i=this.page;return(null==i?void 0:i.type)===u.PRODUCT?null===(e=i.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.product.id)})):null===(t=null==i?void 0:i.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),c.prototype.getMerchantSettings=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.listMerchantSettings()];case 1:return(e=t.sent())&&(this.merchantSettings=e),[2]}}))}))},c.prototype.getPageData=function(){return e(this,void 0,void 0,(function(){var e,r=this;return t(this,(function(t){switch(t.label){case 0:return this.pageSpecificData?[3,2]:[4,this.getPageSpecificData()];case 1:t.sent(),t.label=2;case 2:return this.page?[4,this.getMerchantSettings()]:[2];case 3:return t.sent(),e=this,[4,Promise.all(this.pageComponents.map((function(e){return r.getPageComponentPropValues(e)})))];case 4:return e.pageComponentPropValues=t.sent(),[4,this.setLinkSlugs()];case 5:return t.sent(),[4,this.getProductReviewSummary()];case 6:return t.sent(),[2]}}))}))},c.prototype.getProductReviewSummary=function(){var r;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageType!==u.PRODUCT?[3,2]:[4,v.listCustomerReviewSummary({productId:{eq:null===(r=this.pageSpecificData)||void 0===r?void 0:r.product.id}})];case 1:(e=t.sent())&&e.data.length&&(this.productReviewSummary=e.data[0]),t.label=2;case 2:return[2]}}))}))},c.prototype.getPageSpecificData=function(){var r,i,a;return e(this,void 0,void 0,(function(){var p,c,d,l,v,T,S,D,w,L=this;return t(this,(function(O){switch(O.label){case 0:return this.pageType&&![u.BRAND,u.PRODUCT,u.CATEGORY,u.BLOG,u.BLOG_CATEGORY,u.RAFFLE_DETAIL].includes(this.pageType)?[2]:(p=this.pageParams.slug)?(c=[],(null===(r=this.possiblePageTypes)||void 0===r?void 0:r.includes(u.BLOG))||(null===(i=this.possiblePageTypes)||void 0===i?void 0:i.includes(u.BLOG_CATEGORY))?[4,f.listBlogMetaData(p)]:[3,2]):[2];case 1:return(c=O.sent()).length?[3,6]:[2];case 2:return(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(u.RAFFLE_DETAIL))?[4,b.listRaffleMetaData(p)]:[3,4];case 3:return(c=O.sent()).length?[3,6]:[2];case 4:return[4,j.listHTMLMetaData(p)];case 5:if(!(c=O.sent())||!c.length)return[2];O.label=6;case 6:if(!(d=c[0]).targetId)return[2];switch(l=function(){return e(L,void 0,void 0,(function(){var e,r,i,a,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,y.searchProducts({productIdList:[d.targetId],priceListId:G.priceListId,salesChannelId:G.salesChannelId})];case 1:return(null==(e=t.sent())?void 0:e.data.length)?(r=e.data[0]).productOptionSetId?[4,x.list([r.productOptionSetId])]:[3,3]:[2];case 2:(null==(i=t.sent())?void 0:i.length)&&(r.productOptionSet=i[0]),t.label=3;case 3:return(a=r.variants.find((function(e){return e.isActive})))?(this.pageSpecificData=new m(r,a.variantValues),this.pageSpecificData.displayedVariantTypes.length&&(s=this.pageSpecificData.displayedVariantTypes[0]).displayedVariantValues.length&&(n=s.displayedVariantValues.find((function(e){return e.hasStock})))&&(this.pageSpecificData.selectedVariantValues=n.variant.variantValues),this.pageType=u.PRODUCT,this.setPageMetaData(d),[2]):[2]}}))}))},v=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,g.listBrands({idList:[d.targetId]})];case 1:return(e=t.sent()).brands.length?(r=e.brands[0],this.pageSpecificData=r,this.pageType=u.BRAND,this.setPageMetaData(d),[2]):[2]}}))}))},T=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,h.listCategories({idList:[d.targetId]})];case 1:return(e=t.sent()).categories.length?(r=e.categories[0],this.pageSpecificData=r,this.pageType=u.CATEGORY,this.setPageMetaData(d),[2]):[2]}}))}))},S=function(){return e(L,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,f.getBlog({id:d.targetId})];case 1:return(e=t.sent())?(this.pageSpecificData=e,this.pageType=u.BLOG,this.setPageMetaData(d),[2]):[2]}}))}))},D=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,f.listBlogCategory({idList:[d.targetId],page:1,limit:1})];case 1:return(e=t.sent())&&e.blogCategories.length?(r=e.blogCategories[0],this.pageSpecificData=r,this.pageType=u.BLOG_CATEGORY,this.setPageMetaData(d),[2]):[2]}}))}))},w=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,b.listStorefrontRaffle({id:d.targetId})];case 1:return(e=t.sent())&&e.raffles.length?(r=e.raffles[0],[4,z([r])]):[2];case 2:return t.sent(),this.pageSpecificData=r,this.pageType=u.RAFFLE_DETAIL,this.setPageMetaData(d),[2]}}))}))},d.targetType){case n.BRAND:return[3,7];case n.CATEGORY:return[3,9];case n.PRODUCT:return[3,11];case s.BLOG:return[3,13];case s.BLOG_CATEGORY:return[3,15];case o.RAFFLE:return[3,17]}return[3,19];case 7:return[4,v()];case 8:return[2,O.sent()];case 9:return[4,T()];case 10:return[2,O.sent()];case 11:return[4,l()];case 12:return[2,O.sent()];case 13:return[4,S()];case 14:return[2,O.sent()];case 15:return[4,D()];case 16:return[2,O.sent()];case 17:return[4,w()];case 18:return[2,O.sent()];case 19:return[3,20];case 20:return[2]}}))}))},c.prototype.getPageComponentPropValues=function(r){return e(this,void 0,void 0,(function(){var i,a,s,n=this;return t(this,(function(o){switch(o.label){case 0:return i=this.theme.components.find((function(e){return e.id===r.componentId})),a={pageComponent:r,component:i,propValues:{}},s=function(i){return e(n,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return e=a.propValues,s=i.name,[4,this.getPageComponentPropValue(r,i)];case 1:return e[s]=t.sent(),[2]}}))}))},[4,Promise.all(i.props.map(s))];case 1:return o.sent(),[2,a]}}))}))},c.prototype.getPageComponentPropValue=function(r,i){return e(this,void 0,void 0,(function(){var e,a,s,n,o,p=this;return t(this,(function(t){switch(t.label){case 0:if(a=r.propValues[i.name],s=[l.RAFFLE_LIST],null==a&&!s.includes(i.type))return[2,null];switch(i.type){case l.TEXT:return[3,1];case l.RICH_TEXT:return[3,2];case l.BOOLEAN:return[3,3];case l.IMAGE:return[3,4];case l.IMAGE_LIST:return[3,5];case l.BRAND:return[3,6];case l.BRAND_LIST:return[3,7];case l.PRODUCT_LIST:return[3,8];case l.PRODUCT_DETAIL:return[3,9];case l.PRODUCT_ATTRIBUTE:return[3,10];case l.PRODUCT_ATTRIBUTE_LIST:return[3,11];case l.CATEGORY:return[3,12];case l.CATEGORY_LIST:return[3,13];case l.LINK:case l.LIST_OF_LINK:return[3,14];case l.COLOR:return[3,15];case l.CUSTOM:return[3,16];case l.COMPONENT:case l.COMPONENT_LIST:return[3,17];case l.BLOG:return[3,19];case l.BLOG_LIST:return[3,20];case l.BLOG_CATEGORY:return[3,21];case l.BLOG_CATEGORY_LIST:return[3,22];case l.RAFFLE:return[3,23];case l.RAFFLE_LIST:return[3,24];case l.SLIDER:return[3,25]}return[3,26];case 1:return e=new R(a),[3,27];case 2:return e=new V(a),[3,27];case 3:return e=new I(a),[3,27];case 4:return e=new E(a),[3,27];case 5:return e=new P(a),[3,27];case 6:return e=new L(a),[3,27];case 7:return e=new w(a),[3,27];case 8:return e=new S(this.pageType,a,this.pageSpecificData),[3,27];case 9:return e=new D(a),[3,27];case 10:return e=new U(a),[3,27];case 11:return e=new N(a),[3,27];case 12:return e=new A(a),[3,27];case 13:return e=new B(a),[3,27];case 14:return e=new O(a,this.theme,this.linkMetaDataTargetIds),[3,27];case 15:return e=new C(a),[3,27];case 16:return(n=this.theme.customData.find((function(e){return e.id===i.customDataId})))?(e=new M(a,n,this.theme,this.pageType,this,this.pageSpecificData,this.pageParams),[3,27]):[2];case 17:return o=a,[4,Promise.all(o.map((function(e){return p.getPageComponentPropValues(e)})))];case 18:case 28:return[2,t.sent()];case 19:return e=new F(a),[3,27];case 20:return e=new k(this.pageType,a,this.pageSpecificData),[3,27];case 21:return e=new Y(a),[3,27];case 22:return e=new J(a),[3,27];case 23:return e=new H(a),[3,27];case 24:return e=new q,[3,27];case 25:return e=new _(a),[3,27];case 26:return[3,27];case 27:return[4,null==e?void 0:e.getValue()]}}))}))},c.prototype.setPageMetaData=function(e){this.page&&(this.page.pageTitle=e.pageTitle,this.page.description=e.description,this.page.canonicals=e.canonicals||null,this.page.disableIndex=e.disableIndex||null)},c.prototype.setLinkSlugs=function(){return e(this,void 0,void 0,(function(){var e,r,i;return t(this,(function(t){switch(t.label){case 0:return e=[],r=[],i=[],this.linkMetaDataTargetIds.forEach((function(t){switch(t.type){case"DEFAULT":e.push(t);break;case"BLOG":r.push(t);break;case"RAFFLE":i.push(t)}})),[4,Promise.all([this.getLinkSlugs(e,"DEFAULT"),this.getLinkSlugs(r,"BLOG"),this.getLinkSlugs(i,"RAFFLE")])];case 1:return[2,t.sent()]}}))}))},c.prototype.getLinkSlugs=function(r,a){return e(this,void 0,void 0,(function(){var s,n,o=this;return t(this,(function(p){switch(p.label){case 0:return s=i(r.map((function(e){return e.id}))),n=[],[4,function(){return e(o,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:switch(e=[],a){case"DEFAULT":return[3,1];case"BLOG":return[3,3];case"RAFFLE":return[3,5]}return[3,7];case 1:return[4,j.listHTMLMetaData(void 0,s,void 0)];case 2:case 4:case 6:return e=t.sent(),[3,8];case 3:return[4,f.listBlogMetaData(void 0,s,void 0)];case 5:return[4,b.listRaffleMetaData(void 0,s,void 0)];case 7:return[3,8];case 8:return e.length&&(n=e),[2]}}))}))}()];case 1:return p.sent(),r.forEach((function(e){var t=n.find((function(t){return t.targetId===e.id}));t&&(e.navigationLink.href+=t.slug)})),[2]}}))}))},c}(),X=function(e){this.pageComponent=e.pageComponent?new c(e.pageComponent):new c({}),this.component=e.component?new d(e.component):new d({}),this.propValues=e.propValues||{}};export{X as IkasPageComponentPropValue,K as IkasPageDataProvider};
|