@ikas/storefront 2.0.70 → 2.0.71-alpha.2
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/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 +7 -3
- package/build/api/raffle/index.js +1 -1
- package/build/ikas.js +2 -2
- package/build/index.js +1 -1
- package/build/models/data/index.d.ts +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/raffle-list/index.js +1 -1
- package/build/models/ui/validator/form/raffle-form.d.ts +2 -0
- package/build/models/ui/validator/form/raffle-form.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/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";
|
|
@@ -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";
|
|
@@ -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};
|
|
@@ -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,4 +1,5 @@
|
|
|
1
1
|
import { IkasRaffle } from "../../../data/raffle";
|
|
2
|
+
import { GraphQLError } from "graphql";
|
|
2
3
|
declare type RaffleFormProps<T> = {
|
|
3
4
|
message: {
|
|
4
5
|
requiredRule: ((model: T) => string) | string;
|
|
@@ -55,6 +56,7 @@ export declare class RaffleForm {
|
|
|
55
56
|
submit(): Promise<{
|
|
56
57
|
isFormError: boolean;
|
|
57
58
|
isSuccess: boolean;
|
|
59
|
+
errors?: readonly GraphQLError[] | undefined;
|
|
58
60
|
}>;
|
|
59
61
|
}
|
|
60
62
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as
|
|
1
|
+
import{__awaiter as e,__generator as r}from'../../../../ext/tslib/tslib.es6.js';import{makeObservable as t,computed as a,observable as i,action as s}from"mobx";import{Validator as o}from"../index.js";import{RequiredRule as n,EmailRule as l,PhoneRule as u,MinRule as m,MaxRule as d,IdentityNumberRule as f}from"../rules/index.js";import{IkasRaffleParticipant as h,IkasRaffleAppliedProduct as c}from"../../../data/raffle/index.js";import{IkasStorefrontConfig as b}from"../../../../storefront/index.js";import{IkasRaffleAPI as p}from"../../../../api/raffle/index.js";var g=function(){function g(e){var r,h,c,p=this;this.model={firstName:(null===(r=b.store.customerStore.customer)||void 0===r?void 0:r.firstName)||"",lastName:(null===(h=b.store.customerStore.customer)||void 0===h?void 0:h.lastName)||"",email:(null===(c=b.store.customerStore.customer)||void 0===c?void 0:c.email)||"",extraData:{birthYear:null,identityNumber:null},phone:""},this.onFirstNameChange=function(e){p.firstName=e},this.onLastNameChange=function(e){p.lastName=e},this.onEmailChange=function(e){p.email=e},this.onBirthYearChange=function(e){p.birthYear=e},this.onIdentityNumberChange=function(e){p.identityNumber=e},this.onPhoneChange=function(e){p.phone=e},t(this,{emailErrorMessage:a,firstNameErrorMessage:a,lastNameErrorMessage:a,birthYearErrorMessage:a,identityNumberErrorMessage:a,hasValidatorError:a,results:a,redirect:a,model:i,validateAll:s}),this.raffle=e.raffle,this.validator=new o(this.model,[new n({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new n({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new n({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new n({fieldKey:"birthYear",valuePath:"extraData.birthYear",message:e.message.requiredRule}),new n({fieldKey:"identityNumber",valuePath:"extraData.identityNumber",message:e.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:e.message.emailRule}),new u({fieldKey:"phone",valuePath:"phone",message:e.message.phoneRule}),new m({fieldKey:"birthYear",valuePath:"extraData.birthYear",message:e.message.birthdayRule,minValue:1e3}),new d({fieldKey:"birthYear",valuePath:"extraData.birthYear",message:e.message.birthdayRule,maxValue:9999}),new f({fieldKey:"identityNumber",valuePath:"extraData.identityNumber",message:e.message.identityNumberRule})])}return Object.defineProperty(g.prototype,"firstName",{get:function(){return this.model.firstName},set:function(e){this.model.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastName",{get:function(){return this.model.lastName},set:function(e){this.model.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"birthYear",{get:function(){return this.model.extraData.birthYear},set:function(e){this.model.extraData.birthYear=e},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"identityNumber",{get:function(){return this.model.extraData.identityNumber},set:function(e){this.model.extraData.identityNumber=e},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phone",{get:function(){return this.model.phone},set:function(e){this.model.phone=e},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"birthYearErrorMessage",{get:function(){return this.validator.results.birthYear.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"identityNumberErrorMessage",{get:function(){return this.validator.results.identityNumber.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phoneErrorMessage",{get:function(){return this.validator.results.phone.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasValidatorError",{get:function(){var e;return this.validator.hasError||!(null===(e=this.raffle.variants)||void 0===e?void 0:e.length)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),g.prototype.validateAll=function(){return this.validator.validateAll()},g.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e,t,a;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,p.saveRaffleParticipant(new h({appliedProduct:new c({productId:this.raffle.products[0].selectedVariant.productId,variantId:this.raffle.products[0].selectedVariant.id}),email:this.email,firstName:this.firstName,lastName:this.lastName,raffleId:this.raffle.id,extraData:{birthYear:this.birthYear,identityNumber:this.identityNumber},phone:this.phone}))];case 3:return(null==(t=r.sent())?void 0:t.errors)&&(e.errors=t.errors,e.isSuccess=!1),(null==t?void 0:t.data)&&(e.isSuccess=!0),[2,e];case 4:return(a=r.sent())&&(e.errors=a),[2,e];case 5:return[2]}}))}))},g}();export{g as RaffleForm};
|
|
@@ -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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as i,__generator as t}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"../../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"../../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/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 e}from"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import"../../api/product-campaign/index.js";import{getPlaceholderRaffle as o}from"../placeholders.js";import{populateRaffleProducts as r}from"../helpers/raffles.js";var s=function(){function s(i){this.rafflePropValue=i}return s.prototype.getValue=function(){var s;return i(this,void 0,void 0,(function(){var i,a;return t(this,(function(t){switch(t.label){case 0:return(null===(s=this.rafflePropValue)||void 0===s?void 0:s.usePageData)?[2,{raffle:null,rafflePropValue:this.rafflePropValue}]:this.rafflePropValue.raffleId?[4,e.
|
|
1
|
+
import{__awaiter as i,__generator as t}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"../../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"../../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/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 e}from"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import"../../api/product-campaign/index.js";import{getPlaceholderRaffle as o}from"../placeholders.js";import{populateRaffleProducts as r}from"../helpers/raffles.js";var s=function(){function s(i){this.rafflePropValue=i}return s.prototype.getValue=function(){var s;return i(this,void 0,void 0,(function(){var i,a;return t(this,(function(t){switch(t.label){case 0:return(null===(s=this.rafflePropValue)||void 0===s?void 0:s.usePageData)?[2,{raffle:null,rafflePropValue:this.rafflePropValue}]:this.rafflePropValue.raffleId?[4,e.listStorefrontRaffle({id:this.rafflePropValue.raffleId})]:[2,null];case 1:return(i=t.sent()).raffles.length?(a=i.raffles[0],[4,r([a])]):[2,null];case 2:return t.sent(),[2,{raffle:a||o(),rafflePropValue:this.rafflePropValue}]}}))}))},s}();export{s as IkasRafflePropValueProvider};
|
|
@@ -59,7 +59,7 @@ export declare class IkasCustomerStore {
|
|
|
59
59
|
sendReview: (input: IkasCustomerReviewForm) => Promise<false | import("../api/customer-review/__generated__/createCustomerReview").createCustomerReview_createCustomerReview | undefined>;
|
|
60
60
|
onCustomerConsentGrant: () => void;
|
|
61
61
|
waitUntilInitialized: () => Promise<unknown>;
|
|
62
|
-
getRaffles: () => Promise<import("../models").
|
|
62
|
+
getRaffles: () => Promise<import("../models").IkasRaffleParticipant[] | undefined>;
|
|
63
63
|
getCustomerAttributes: () => Promise<import("../models").IkasCustomerAttribute[]>;
|
|
64
64
|
getOrderByEmail: (email: string, orderNumber: string) => Promise<import("../models").IkasOrder | undefined>;
|
|
65
65
|
private init;
|
package/build/store/customer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as r}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import{apollo as o}from"../api/apollo.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{IkasCustomer as s,IkasCustomerEmailSubscriptionStatus as n}from"../models/data/customer/index.js";import"../models/data/customer-review/index.js";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"../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{IkasCustomerAPI as a}from"../api/customer/index.js";import{IkasCustomerReviewAPI as u}from"../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 c}from"../api/product-search/index.js";import{IkasFavoriteProductAPI as d}from"../api/favorite-product/index.js";import{IkasContactFormAPI as l}from"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import{IkasRaffleAPI as m}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{Analytics as p}from"../analytics/analytics.js";import"../analytics/head/index.js";import{IkasStorefrontConfig as h}from"../storefront/index.js";import{populateRaffleProducts as f}from"../providers/helpers/raffles.js";import v from'../ext/lodash/uniqBy.js';import{IkasCustomerAttributeAPI as w}from"../api/customer-attribute/index.js";var g="undefined"==typeof localStorage,b=function(){function b(o){var s=this;this.customer=null,this.token=null,this.tokenExpiry=null,this.baseStore=null,this._initialized=!1,this._visitorSubscribedEmail=!1,this._lastViewedProducts=[],this._customerConsentGranted=!1,this._refundSettings=null,this.login=function(r,i){return t(s,void 0,void 0,(function(){var t,o,s;return e(this,(function(e){switch(e.label){case 0:return[4,a.login(r,i)];case 1:return(t=e.sent())?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.customer&&p.customerLogin(),(o=null===(s=this.baseStore)||void 0===s?void 0:s.cartStore.cart)?[4,this.baseStore.cartStore.changeItemQuantity(o.items[0],o.items[0].quantity)]:[3,3]):[3,4];case 2:e.sent(),e.label=3;case 3:return this.saveLocalLastViewedProducts(),[2,!0];case 4:return[2,!1]}}))}))},this.register=function(r,i,o,n,u,c){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.register(o,n,r,i,u,c)];case 1:return(t=e.sent())?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.saveLocalLastViewedProducts(),[2,!0]):[2,!1]}}))}))},this.saveContactForm=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return p.contactForm(r),[4,l.sendContactFormToMerchant(r)];case 1:return[2,t.sent()]}}))}))},this.checkEmail=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.checkEmail(r)];case 1:return[2,t.sent()]}}))}))},this.forgotPassword=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.forgotPassword(r)];case 1:return[2,t.sent()]}}))}))},this.recoverPassword=function(r,i,o){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.recoverPassword(r,i,o)];case 1:return[2,t.sent()]}}))}))},this.logout=function(){var t;s.clearLocalData(),null===(t=s.baseStore)||void 0===t||t.cartStore.removeCart(),p.customerLogout()},this.saveCustomer=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.saveCustomer(r)];case 1:return(t=e.sent())?(this.setCustomer(t),[2,!0]):[2,!1]}}))}))},this.getOrders=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrders()];case 1:return[2,t.sent()]}}))}))},this.getOrder=function(r){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,a.getOrders(r)];case 1:return t=e.sent(),Array.isArray(t)&&t.length?((i=t[0])._refundSettings=this._refundSettings,[2,i]):[2,null]}}))}))},this.getOrderTransactions=function(r){return void 0===r&&(r={}),t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrderTransactions(r)];case 1:return[2,t.sent()]}}))}))},this.getFavoriteProductsIds=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,d.listFavoriteProducts()];case 1:return[2,t.sent()];case 2:return t.sent(),[2,[]];case 3:return[2]}}))}))},this.getFavoriteProducts=function(){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,d.listFavoriteProducts()];case 1:return(t=e.sent()).length?[4,c.searchProducts({productIdList:t.map((function(t){return t.productId})),priceListId:h.priceListId,salesChannelId:h.salesChannelId})]:[2,[]];case 2:return[2,(null==(r=e.sent())?void 0:r.data)||[]];case 3:return e.sent(),[2,[]];case 4:return[2]}}))}))},this.getOrderRefundSettings=function(){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this._refundSettings?[3,2]:(t=this,[4,a.getOrderRefundSettings()]);case 1:t._refundSettings=e.sent(),e.label=2;case 2:return[2]}}))}))},this.addItemToFavorite=function(r){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.saveFavoriteProduct(!0,r)];case 2:return t=e.sent(),p.addToWishlist(r),[2,t];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},this.removeItemFromFavorite=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.saveFavoriteProduct(!1,r)];case 2:return[2,e.sent()];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},this.isProductFavorite=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");return[4,d.isFavoriteProduct(r)];case 1:return[2,e.sent()]}}))}))},this.createEmailSubscription=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.createCustomerEmailSubscription(r)];case 1:return(t=e.sent())&&(window.localStorage.setItem("customerEmailSubscription","true"),this.customer?(this.customer.subscriptionStatus,n.SUBSCRIBED):this._visitorSubscribedEmail=!0,p.createEmailSubscripition(r)),[2,t]}}))}))},this.sendReview=function(i){return t(s,void 0,void 0,(function(){var t,o,s,n,a;return e(this,(function(e){switch(e.label){case 0:if(e.trys.push([0,2,,3]),t=h.customerReviewSettings,o=h.salesChannelId,!t)return[2];if(!(s=null===(a=this.customer)||void 0===a?void 0:a.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,u.createCustomerReview(r(r({},i),{customerId:t.customerLoginRequired?s:void 0,salesChannelId:o||""}))];case 1:return[2,e.sent()];case 2:return n=e.sent(),console.log(n),[3,3];case 3:return[2]}}))}))},this.onCustomerConsentGrant=function(){s.saveCustomerConsent()},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){s.initialized&&(clearInterval(e),t(null))}),100)}))},this.getRaffles=function(){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return[4,m.getRafflesByCustomerId()];case 1:return t=e.sent(),[4,m.getRafflesByCustomerId(!0)];case 2:return r=e.sent(),null==t||t.forEach((function(t){(null==r?void 0:r.find((function(e){return e.id===t.id})))&&(t.isCustomerWinner=!0)})),t?[4,f(t)]:[3,4];case 3:e.sent(),e.label=4;case 4:return[2,t]}}))}))},this.getCustomerAttributes=function(){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,w.listCustomerAttributes()];case 1:return t=e.sent(),this.customer&&this.customer.attributes.forEach((function(e){var r,i;e.customerAttribute=t.find((function(t){return t.id===e.customerAttributeId})),e.customerAttributeOptionId&&(e.customerAttributeOption=null===(i=null===(r=e.customerAttribute)||void 0===r?void 0:r.options)||void 0===i?void 0:i.find((function(t){return t.id===e.customerAttributeOptionId})))})),[2,t]}}))}))},this.getOrderByEmail=function(r,i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrderByEmail(r,i)];case 1:return[2,t.sent()]}}))}))},this.baseStore=o,this.init(),i(this)}return Object.defineProperty(b.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"canCreateEmailSubscription",{get:function(){var t;return!((null===(t=this.customer)||void 0===t?void 0:t.isSubscribed)||g||this._visitorSubscribedEmail)&&!window.localStorage.getItem("customerEmailSubscription")},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"customerConsentGranted",{get:function(){return this._customerConsentGranted},enumerable:!1,configurable:!0}),b.prototype.socialLogin=function(r){return t(this,void 0,void 0,(function(){var t,i,o;return e(this,(function(e){switch(e.label){case 0:return"undefined"==typeof window?[2]:(t=new URLSearchParams(window.location.search).get("redirect")||"",i="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/ms/").concat(r,"/login/authenticate?redirect=").concat(t),[4,fetch(i,{headers:{"x-api-key":h.config.apiKey||"","x-sfid":h.storefrontId||"","x-sfrid":h.storefrontRoutingId||""}})]);case 1:return[4,e.sent().json()];case 2:return o=e.sent(),h.router?h.router.replace(o.redirectUrl):window.location.href=o.redirectUrl,[2]}}))}))},b.prototype.socialLoginToken=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.socialLogin(r)];case 1:return(null==(t=e.sent())?void 0:t.customer)?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.customer&&p.customerLogin(),[2,!0]):[2,!1]}}))}))},b.prototype.init=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.loadToken(),this.loadLastViewedProducts(),this.loadCustomerConsent(),[4,this.refreshToken()];case 1:return t.sent(),[4,this.getCustomer()];case 2:return t.sent(),[4,this.getOrderRefundSettings()];case 3:return t.sent(),this._initialized=!0,this.customer&&p.customerVisit(),[2]}}))}))},b.prototype.routeChangeInit=function(){this.customer||(this.loadToken(),this.getCustomer())},b.prototype.getCustomer=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return g||!this.token?[2]:[4,a.getCustomer()];case 1:return(t=e.sent())&&this.setCustomer(t),[2]}}))}))},b.prototype.refreshToken=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.token?[4,a.refreshToken(this.token)]:[2];case 1:return(null==(t=e.sent())?void 0:t.token)||(null==t?void 0:t.tokenExpiry)?this.setToken(t.token,t.tokenExpiry):(this.token=null,this.tokenExpiry=null,this.clearLocalData()),[2]}}))}))},b.prototype.setCustomer=function(t){this.customer=new s(t)},b.prototype.getLastViewedProducts=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.customer?(t=this,[4,a.getLastViewedProducts(this.customer.id)]):[3,2];case 1:return t._lastViewedProducts=e.sent(),[3,3];case 2:this.loadLastViewedProducts(),e.label=3;case 3:return[2,this._lastViewedProducts]}}))}))},b.prototype.saveLastViewedProducts=function(){g||window.localStorage.setItem("lastViewedProducts",JSON.stringify(this._lastViewedProducts))},b.prototype.loadLastViewedProducts=function(){if(!g)try{var t=window.localStorage.getItem("lastViewedProducts");t&&(this._lastViewedProducts=JSON.parse(t),this._lastViewedProducts=this._lastViewedProducts.reverse(),this._lastViewedProducts=v(this._lastViewedProducts,"variantId"))}catch(t){}},b.prototype.removeLastViewedProducts=function(){g||window.localStorage.removeItem("lastViewedProducts")},b.prototype.onProductView=function(r,i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.customer?this._lastViewedProducts.find((function(t){return t.productId===r}))?[2]:[4,a.saveLastViewedProducts({customerId:this.customer.id,products:[{productId:r,variantId:i}]})]:[3,2];case 1:return t.sent()&&this._lastViewedProducts.push({productId:r,variantId:i}),[3,3];case 2:this._lastViewedProducts.push({productId:r,variantId:i}),this._lastViewedProducts=this._lastViewedProducts.slice(0,20),this._lastViewedProducts=v(this._lastViewedProducts,"variantId"),this.saveLastViewedProducts(),t.label=3;case 3:return[2]}}))}))},b.prototype.saveLocalLastViewedProducts=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:if(g)return[2];t.label=1;case 1:return t.trys.push([1,4,,5]),this.loadLastViewedProducts(),this._lastViewedProducts.length?[4,a.saveLastViewedProducts({customerId:this.customer.id,products:this._lastViewedProducts})]:[3,3];case 2:t.sent()&&this.removeLastViewedProducts(),t.label=3;case 3:return[3,5];case 4:return t.sent(),[3,5];case 5:return[2]}}))}))},b.prototype.saveCustomerConsent=function(){g||(this._customerConsentGranted=!0,window.localStorage.setItem("customerConsent","true"))},b.prototype.loadCustomerConsent=function(){g||(this._customerConsentGranted=!!window.localStorage.getItem("customerConsent"))},b.prototype.removeCustomerConsent=function(){g||window.localStorage.removeItem("customerConsent")},b.prototype.setToken=function(t,e){g||(this.token=t,this.tokenExpiry=e,localStorage.setItem("customerToken",t),localStorage.setItem("customerTokenExpiry",e+""),o.setCustomerToken(t))},b.prototype.loadToken=function(){if(!g){var t=localStorage.getItem("customerToken"),e=localStorage.getItem("customerTokenExpiry");t&&e&&this.setToken(t,parseInt(e))}},b.prototype.clearLocalTokenData=function(){localStorage.removeItem("customerToken"),localStorage.removeItem("customerTokenExpiry"),this.token=void 0,this.tokenExpiry=void 0},b.prototype.clearLocalData=function(){this.clearLocalTokenData(),this.customer=void 0,o.setCustomerToken()},b}();export{b as IkasCustomerStore};
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as r}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import{apollo as o}from"../api/apollo.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{IkasCustomer as s,IkasCustomerEmailSubscriptionStatus as n}from"../models/data/customer/index.js";import"../models/data/customer-review/index.js";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"../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{IkasCustomerAPI as a}from"../api/customer/index.js";import{IkasCustomerReviewAPI as u}from"../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 c}from"../api/product-search/index.js";import{IkasFavoriteProductAPI as d}from"../api/favorite-product/index.js";import{IkasContactFormAPI as l}from"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import{IkasRaffleAPI as m}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{Analytics as p}from"../analytics/analytics.js";import"../analytics/head/index.js";import{IkasStorefrontConfig as h}from"../storefront/index.js";import{populateRaffleProducts as f}from"../providers/helpers/raffles.js";import v from'../ext/lodash/uniqBy.js';import{IkasCustomerAttributeAPI as w}from"../api/customer-attribute/index.js";var g="undefined"==typeof localStorage,b=function(){function b(o){var s=this;this.customer=null,this.token=null,this.tokenExpiry=null,this.baseStore=null,this._initialized=!1,this._visitorSubscribedEmail=!1,this._lastViewedProducts=[],this._customerConsentGranted=!1,this._refundSettings=null,this.login=function(r,i){return t(s,void 0,void 0,(function(){var t,o,s;return e(this,(function(e){switch(e.label){case 0:return[4,a.login(r,i)];case 1:return(t=e.sent())?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.customer&&p.customerLogin(),(o=null===(s=this.baseStore)||void 0===s?void 0:s.cartStore.cart)?[4,this.baseStore.cartStore.changeItemQuantity(o.items[0],o.items[0].quantity)]:[3,3]):[3,4];case 2:e.sent(),e.label=3;case 3:return this.saveLocalLastViewedProducts(),[2,!0];case 4:return[2,!1]}}))}))},this.register=function(r,i,o,n,u,c){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.register(o,n,r,i,u,c)];case 1:return(t=e.sent())?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.saveLocalLastViewedProducts(),[2,!0]):[2,!1]}}))}))},this.saveContactForm=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return p.contactForm(r),[4,l.sendContactFormToMerchant(r)];case 1:return[2,t.sent()]}}))}))},this.checkEmail=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.checkEmail(r)];case 1:return[2,t.sent()]}}))}))},this.forgotPassword=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.forgotPassword(r)];case 1:return[2,t.sent()]}}))}))},this.recoverPassword=function(r,i,o){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.recoverPassword(r,i,o)];case 1:return[2,t.sent()]}}))}))},this.logout=function(){var t;s.clearLocalData(),null===(t=s.baseStore)||void 0===t||t.cartStore.removeCart(),p.customerLogout()},this.saveCustomer=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.saveCustomer(r)];case 1:return(t=e.sent())?(this.setCustomer(t),[2,!0]):[2,!1]}}))}))},this.getOrders=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrders()];case 1:return[2,t.sent()]}}))}))},this.getOrder=function(r){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,a.getOrders(r)];case 1:return t=e.sent(),Array.isArray(t)&&t.length?((i=t[0])._refundSettings=this._refundSettings,[2,i]):[2,null]}}))}))},this.getOrderTransactions=function(r){return void 0===r&&(r={}),t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrderTransactions(r)];case 1:return[2,t.sent()]}}))}))},this.getFavoriteProductsIds=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,d.listFavoriteProducts()];case 1:return[2,t.sent()];case 2:return t.sent(),[2,[]];case 3:return[2]}}))}))},this.getFavoriteProducts=function(){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,d.listFavoriteProducts()];case 1:return(t=e.sent()).length?[4,c.searchProducts({productIdList:t.map((function(t){return t.productId})),priceListId:h.priceListId,salesChannelId:h.salesChannelId})]:[2,[]];case 2:return[2,(null==(r=e.sent())?void 0:r.data)||[]];case 3:return e.sent(),[2,[]];case 4:return[2]}}))}))},this.getOrderRefundSettings=function(){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this._refundSettings?[3,2]:(t=this,[4,a.getOrderRefundSettings()]);case 1:t._refundSettings=e.sent(),e.label=2;case 2:return[2]}}))}))},this.addItemToFavorite=function(r){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.saveFavoriteProduct(!0,r)];case 2:return t=e.sent(),p.addToWishlist(r),[2,t];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},this.removeItemFromFavorite=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.saveFavoriteProduct(!1,r)];case 2:return[2,e.sent()];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},this.isProductFavorite=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");return[4,d.isFavoriteProduct(r)];case 1:return[2,e.sent()]}}))}))},this.createEmailSubscription=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.createCustomerEmailSubscription(r)];case 1:return(t=e.sent())&&(window.localStorage.setItem("customerEmailSubscription","true"),this.customer?(this.customer.subscriptionStatus,n.SUBSCRIBED):this._visitorSubscribedEmail=!0,p.createEmailSubscripition(r)),[2,t]}}))}))},this.sendReview=function(i){return t(s,void 0,void 0,(function(){var t,o,s,n,a;return e(this,(function(e){switch(e.label){case 0:if(e.trys.push([0,2,,3]),t=h.customerReviewSettings,o=h.salesChannelId,!t)return[2];if(!(s=null===(a=this.customer)||void 0===a?void 0:a.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,u.createCustomerReview(r(r({},i),{customerId:t.customerLoginRequired?s:void 0,salesChannelId:o||""}))];case 1:return[2,e.sent()];case 2:return n=e.sent(),console.log(n),[3,3];case 3:return[2]}}))}))},this.onCustomerConsentGrant=function(){s.saveCustomerConsent()},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){s.initialized&&(clearInterval(e),t(null))}),100)}))},this.getRaffles=function(){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,m.listRaffleParticipants()];case 1:return(t=e.sent())?[4,f(t.map((function(t){return t.raffle})))]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2,t]}}))}))},this.getCustomerAttributes=function(){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,w.listCustomerAttributes()];case 1:return t=e.sent(),this.customer&&this.customer.attributes.forEach((function(e){var r,i;e.customerAttribute=t.find((function(t){return t.id===e.customerAttributeId})),e.customerAttributeOptionId&&(e.customerAttributeOption=null===(i=null===(r=e.customerAttribute)||void 0===r?void 0:r.options)||void 0===i?void 0:i.find((function(t){return t.id===e.customerAttributeOptionId})))})),[2,t]}}))}))},this.getOrderByEmail=function(r,i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrderByEmail(r,i)];case 1:return[2,t.sent()]}}))}))},this.baseStore=o,this.init(),i(this)}return Object.defineProperty(b.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"canCreateEmailSubscription",{get:function(){var t;return!((null===(t=this.customer)||void 0===t?void 0:t.isSubscribed)||g||this._visitorSubscribedEmail)&&!window.localStorage.getItem("customerEmailSubscription")},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"customerConsentGranted",{get:function(){return this._customerConsentGranted},enumerable:!1,configurable:!0}),b.prototype.socialLogin=function(r){return t(this,void 0,void 0,(function(){var t,i,o;return e(this,(function(e){switch(e.label){case 0:return"undefined"==typeof window?[2]:(t=new URLSearchParams(window.location.search).get("redirect")||"",i="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/ms/").concat(r,"/login/authenticate?redirect=").concat(t),[4,fetch(i,{headers:{"x-api-key":h.config.apiKey||"","x-sfid":h.storefrontId||"","x-sfrid":h.storefrontRoutingId||""}})]);case 1:return[4,e.sent().json()];case 2:return o=e.sent(),h.router?h.router.replace(o.redirectUrl):window.location.href=o.redirectUrl,[2]}}))}))},b.prototype.socialLoginToken=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.socialLogin(r)];case 1:return(null==(t=e.sent())?void 0:t.customer)?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.customer&&p.customerLogin(),[2,!0]):[2,!1]}}))}))},b.prototype.init=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.loadToken(),this.loadLastViewedProducts(),this.loadCustomerConsent(),[4,this.refreshToken()];case 1:return t.sent(),[4,this.getCustomer()];case 2:return t.sent(),[4,this.getOrderRefundSettings()];case 3:return t.sent(),this._initialized=!0,this.customer&&p.customerVisit(),[2]}}))}))},b.prototype.routeChangeInit=function(){this.customer||(this.loadToken(),this.getCustomer())},b.prototype.getCustomer=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return g||!this.token?[2]:[4,a.getCustomer()];case 1:return(t=e.sent())&&this.setCustomer(t),[2]}}))}))},b.prototype.refreshToken=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.token?[4,a.refreshToken(this.token)]:[2];case 1:return(null==(t=e.sent())?void 0:t.token)||(null==t?void 0:t.tokenExpiry)?this.setToken(t.token,t.tokenExpiry):(this.token=null,this.tokenExpiry=null,this.clearLocalData()),[2]}}))}))},b.prototype.setCustomer=function(t){this.customer=new s(t)},b.prototype.getLastViewedProducts=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.customer?(t=this,[4,a.getLastViewedProducts(this.customer.id)]):[3,2];case 1:return t._lastViewedProducts=e.sent(),[3,3];case 2:this.loadLastViewedProducts(),e.label=3;case 3:return[2,this._lastViewedProducts]}}))}))},b.prototype.saveLastViewedProducts=function(){g||window.localStorage.setItem("lastViewedProducts",JSON.stringify(this._lastViewedProducts))},b.prototype.loadLastViewedProducts=function(){if(!g)try{var t=window.localStorage.getItem("lastViewedProducts");t&&(this._lastViewedProducts=JSON.parse(t),this._lastViewedProducts=this._lastViewedProducts.reverse(),this._lastViewedProducts=v(this._lastViewedProducts,"variantId"))}catch(t){}},b.prototype.removeLastViewedProducts=function(){g||window.localStorage.removeItem("lastViewedProducts")},b.prototype.onProductView=function(r,i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.customer?this._lastViewedProducts.find((function(t){return t.productId===r}))?[2]:[4,a.saveLastViewedProducts({customerId:this.customer.id,products:[{productId:r,variantId:i}]})]:[3,2];case 1:return t.sent()&&this._lastViewedProducts.push({productId:r,variantId:i}),[3,3];case 2:this._lastViewedProducts.push({productId:r,variantId:i}),this._lastViewedProducts=this._lastViewedProducts.slice(0,20),this._lastViewedProducts=v(this._lastViewedProducts,"variantId"),this.saveLastViewedProducts(),t.label=3;case 3:return[2]}}))}))},b.prototype.saveLocalLastViewedProducts=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:if(g)return[2];t.label=1;case 1:return t.trys.push([1,4,,5]),this.loadLastViewedProducts(),this._lastViewedProducts.length?[4,a.saveLastViewedProducts({customerId:this.customer.id,products:this._lastViewedProducts})]:[3,3];case 2:t.sent()&&this.removeLastViewedProducts(),t.label=3;case 3:return[3,5];case 4:return t.sent(),[3,5];case 5:return[2]}}))}))},b.prototype.saveCustomerConsent=function(){g||(this._customerConsentGranted=!0,window.localStorage.setItem("customerConsent","true"))},b.prototype.loadCustomerConsent=function(){g||(this._customerConsentGranted=!!window.localStorage.getItem("customerConsent"))},b.prototype.removeCustomerConsent=function(){g||window.localStorage.removeItem("customerConsent")},b.prototype.setToken=function(t,e){g||(this.token=t,this.tokenExpiry=e,localStorage.setItem("customerToken",t),localStorage.setItem("customerTokenExpiry",e+""),o.setCustomerToken(t))},b.prototype.loadToken=function(){if(!g){var t=localStorage.getItem("customerToken"),e=localStorage.getItem("customerTokenExpiry");t&&e&&this.setToken(t,parseInt(e))}},b.prototype.clearLocalTokenData=function(){localStorage.removeItem("customerToken"),localStorage.removeItem("customerTokenExpiry"),this.token=void 0,this.tokenExpiry=void 0},b.prototype.clearLocalData=function(){this.clearLocalTokenData(),this.customer=void 0,o.setCustomerToken()},b}();export{b as IkasCustomerStore};
|