@ikas/storefront 2.0.25 → 2.0.26
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 +1 -0
- 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/_virtual/index.js_commonjs-proxy4.js +1 -1
- package/build/analytics/ikas.d.ts +2 -2
- package/build/analytics/ikas.js +1 -1
- package/build/api/product-option-set/__generated__/ListProductOptionSet.d.ts +6 -0
- package/build/api/product-option-set/index.js +1 -1
- package/build/api/storefront/__generated__/getStorefront.d.ts +9 -0
- package/build/ikas.js +2 -2
- package/build/index.js +1 -1
- package/build/models/data/product/index.d.ts +1 -0
- package/build/models/data/product/index.js +1 -1
- package/build/models/data/product-option-set/index.d.ts +6 -0
- package/build/models/data/product-option-set/index.js +1 -1
- package/build/scripts/generators/types/index.d.ts +6 -0
- package/build/scripts/generators/types/index.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{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{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}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{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 p from"./pages/account/orders/index.js";export{p as OrdersPage};import*as i from"./pages/account/orders/_id_.js";export{i as OrderDetailPage};import*as m from"./pages/account/login.js";export{m as LoginPage};import*as d from"./pages/account/register.js";export{d 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}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,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{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{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}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{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 p from"./pages/account/orders/index.js";export{p as OrdersPage};import*as i from"./pages/account/orders/_id_.js";export{i as OrderDetailPage};import*as m from"./pages/account/login.js";export{m as LoginPage};import*as d from"./pages/account/register.js";export{d 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,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 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as t}from"mobx";import{IkasCategory as e}from"../category/index.js";import{IkasProductVariant as
|
|
1
|
+
import{makeAutoObservable as t}from"mobx";import{IkasCategory as e}from"../category/index.js";import{IkasProductVariant as r}from"./variant/index.js";import{IkasProductAttributeValue as i}from"./attribute-value/index.js";import{IkasProductVariantType as n}from"./variant-type/index.js";import{IkasBrand as o}from"../brand/index.js";import{IkasHTMLMetaData as a}from"../html-meta-data/index.js";import{IkasProductTag as s}from"../product-tag/index.js";import{IkasProductOptionSet as p}from"../product-option-set/index.js";var c,u=function(){function u(u){void 0===u&&(u={}),this.id=u.id||Date.now()+"",this.name=u.name||"",this.type=u.type||c.PHYSICAL,this.description=u.description||"",this.shortDescription=u.shortDescription||"",this.metaData=u.metaData?new a(u.metaData):void 0,this.brand=u.brand?new o(u.brand):null,this.categories=u.categories?u.categories.map((function(t){return new e(t)})):[],this.tags=u.tags?u.tags.map((function(t){return new s(t)})):[],this.variants=u.variants?u.variants.map((function(t){return new r(t)})):[],this.attributes=u.attributes?u.attributes.map((function(t){return new i(t)})):[],this.variantTypes=u.variantTypes?u.variantTypes.map((function(t){return new n(t)})):[],this.productOptionSetId=u.productOptionSetId||null,this.productOptionSet=u.productOptionSet?new p(u.productOptionSet):null,this.setOptionPrices(),t(this)}return Object.defineProperty(u.prototype,"hasVariant",{get:function(){return!!this.variantTypes.length},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasStock",{get:function(){return this.variants.some((function(t){return t.stock>0}))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"mainVariantType",{get:function(){if(this.hasVariant)return this.variantTypes[0].variantType},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"href",{get:function(){var t;return(null===(t=this.metaData)||void 0===t?void 0:t.slug)?"/".concat(this.metaData.slug):""},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"canAddToCart",{get:function(){return!this.productOptionSetId||!!this.productOptionSet&&this.productOptionSet.displayedOptions.every((function(t){return t.hasValidValues}))},enumerable:!1,configurable:!0}),u.prototype.setOptionPrices=function(){var t,e=this.variants[0];if(e){var r=e.price.currency;null===(t=this.productOptionSet)||void 0===t||t.options.forEach((function(t){var e;t.selectSettings&&t.selectSettings.values.forEach((function(t){var e;t.otherPrices&&(t.price=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===r})))||void 0===e?void 0:e.price)||t.price)})),t.otherPrices&&(t.price=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===r})))||void 0===e?void 0:e.price)||t.price)}))}},u}();!function(t){t.PHYSICAL="PHYSICAL",t.DIGITAL="DIGITAL",t.MEMBERSHIP="MEMBERSHIP"}(c||(c={}));export{u as IkasProduct,c as IkasProductType};
|
|
@@ -35,6 +35,7 @@ export declare class IkasProductOptionSelectValue {
|
|
|
35
35
|
order: number;
|
|
36
36
|
value: string;
|
|
37
37
|
price: number | null;
|
|
38
|
+
otherPrices: IkasProductOptionOtherPrice[] | null;
|
|
38
39
|
thumbnailImageId: string | null;
|
|
39
40
|
colorCode: string | null;
|
|
40
41
|
thumbnailImage: IkasImage | null;
|
|
@@ -76,6 +77,7 @@ export declare class IkasProductOption {
|
|
|
76
77
|
fileSettings: IkasProductOptionFileSettings | null;
|
|
77
78
|
dateSettings: IkasProductOptionDateSettings | null;
|
|
78
79
|
price: number | null;
|
|
80
|
+
otherPrices: IkasProductOptionOtherPrice[] | null;
|
|
79
81
|
isOptional: boolean;
|
|
80
82
|
optionalText: string | null;
|
|
81
83
|
requiredOptionId: string | null;
|
|
@@ -106,3 +108,7 @@ export declare class IkasProductOptionSet {
|
|
|
106
108
|
private setChildOptions;
|
|
107
109
|
initOptionValues: () => Promise<void>;
|
|
108
110
|
}
|
|
111
|
+
export declare type IkasProductOptionOtherPrice = {
|
|
112
|
+
currencyCode: string;
|
|
113
|
+
price: number;
|
|
114
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as i}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as n}from"mobx";import{IkasImage as l}from"../image/index.js";import{IkasStorefrontConfig as s}from"../../../storefront/index.js";import a from'../../../ext/lodash/sortBy.js';var o,u;!function(t){t.CHOICE="CHOICE",t.TEXT="TEXT",t.TEXT_AREA="TEXT_AREA",t.FILE="FILE",t.COLOR_PICKER="COLOR_PICKER",t.DATE_PICKER="DATE_PICKER",t.CHECKBOX="CHECKBOX"}(o||(o={})),function(t){t.SELECT="SELECT",t.BOX="BOX",t.SWATCH="SWATCH"}(u||(u={}));var r=function(t){this.id=t.id||"",this.value=t.value||null,n(this)},
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as i}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as n}from"mobx";import{IkasImage as l}from"../image/index.js";import{IkasStorefrontConfig as s}from"../../../storefront/index.js";import a from'../../../ext/lodash/sortBy.js';var o,u;!function(t){t.CHOICE="CHOICE",t.TEXT="TEXT",t.TEXT_AREA="TEXT_AREA",t.FILE="FILE",t.COLOR_PICKER="COLOR_PICKER",t.DATE_PICKER="DATE_PICKER",t.CHECKBOX="CHECKBOX"}(o||(o={})),function(t){t.SELECT="SELECT",t.BOX="BOX",t.SWATCH="SWATCH"}(u||(u={}));var r=function(t){this.id=t.id||"",this.value=t.value||null,n(this)},h=function(t){var e;this.id=t.id||"",this.name=t.name||null,this.optionalText=t.optionalText||null,this.values=(null===(e=t.values)||void 0===e?void 0:e.map((function(t){return new r(t)})))||[],n(this)},d=function(t){var e;this.locale=t.locale||"",this.options=(null===(e=t.options)||void 0===e?void 0:e.map((function(t){return new h(t)})))||[],n(this)},c=function(t){void 0===t&&(t={}),this.otherPrices=null,this.thumbnailImage=null,this.id=t.id||"",this.order=t.order||0,this.value=t.value||"",this.price=t.price||null,this.otherPrices=t.otherPrices||null,this.thumbnailImageId=t.thumbnailImageId||null,this.colorCode=t.colorCode||null,this.thumbnailImage=this.thumbnailImageId?new l(this.thumbnailImageId):null,n(this)},p=function(t){var e;void 0===t&&(t={}),this.type=t.type||u.BOX,this.minSelect=null!==t.minSelect&&void 0!==t.minSelect?t.minSelect:null,this.maxSelect=null!==t.maxSelect&&void 0!==t.maxSelect?t.maxSelect:null,this.values=a((null===(e=t.values)||void 0===e?void 0:e.map((function(t){return new c(t)})))||[],"order"),n(this)},f=function(t){this.min=t.min||null,this.max=t.max||null,this.minRelativeNextDate=t.minRelativeNextDate||null,this.maxRelativeNextDate=t.maxRelativeNextDate||null,n(this)},m=function(t){void 0===t&&(t={}),this.min=null!==t.min&&void 0!==t.min?t.min:null,this.max=null!==t.max&&void 0!==t.max?t.max:null,n(this)},v=function(t){this.allowedExtensions=t.allowedExtensions||null,this.minQuantity=null!==t.minQuantity&&void 0!==t.minQuantity?t.minQuantity:null,this.maxQuantity=null!==t.maxQuantity&&void 0!==t.maxQuantity?t.maxQuantity:null,n(this)},g=function(){function i(i){var l=this;this._values=[],this.childOptions=[],this.productOptionFileUpload=function(i){return t(l,void 0,void 0,(function(){var n,l,a=this;return e(this,(function(o){switch(o.label){case 0:return 0===i.length||this.fileSettings&&this.fileSettings.maxQuantity&&this.fileSettings.maxQuantity<i.length?[2,[]]:(n="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/admin/upload-product-option-file"),l=function(i){return t(a,void 0,void 0,(function(){var t,l,a,o,u,r,h;return e(this,(function(e){switch(e.label){case 0:return l=fetch,a=[n],r={method:"POST",headers:{"x-api-key":s.config.apiKey||"","x-sfid":s.storefrontId||"","x-sfrid":s.storefrontRoutingId||"","Content-Type":"application/json",Accept:"application/json"}},u=(o=JSON).stringify,h={productOptionSetId:this.productOptionSetId,productOptionId:this.id},[4,this.getBase64(i)];case 1:return[4,l.apply(void 0,a.concat([(r.body=u.apply(o,[(h.base64=e.sent(),h.fileName=i.name,h)]),r)]))];case 2:return(t=e.sent()).ok?[4,t.text()]:[2,null];case 3:return[2,e.sent()]}}))}))},[4,Promise.all(i.map((function(t){return l(t)})))]);case 1:return[2,o.sent().filter((function(t){return null!==t}))]}}))}))},this.initValues=function(){l.isOptional||(l.values=[],l.childOptions&&l.childOptions.forEach((function(t){return t.initValues()})))},this.isValidTextOptionValue=function(){var t=l.values[0];return t?!!l.textSettings&&(null===l.textSettings.min||t.length>=l.textSettings.min)&&(null===l.textSettings.max||t.length<=l.textSettings.max):!!l.isOptional},this.isValidChoiceOptionValue=function(){return l.values.length?!!l.selectSettings&&(null===l.selectSettings.minSelect||l.values.length>=l.selectSettings.minSelect)&&(null===l.selectSettings.maxSelect||l.values.length<=l.selectSettings.maxSelect):!!l.isOptional},this.isValidFileOptionValue=function(){return l.values.length?!!l.fileSettings&&(null===l.fileSettings.minQuantity||l.values.length>=l.fileSettings.minQuantity)&&(null===l.fileSettings.maxQuantity||l.values.length<=l.fileSettings.maxQuantity):!!l.isOptional},this.isValidDateOptionValue=function(){if(!l.values.length)return!!l.isOptional;if(l.dateSettings){var t=null,e=null;null!==l.dateSettings.minRelativeNextDate&&(t=new Date,t=l.dateSettings.minRelativeNextDate<0?new Date(t.setDate(t.getDate()-Math.abs(l.dateSettings.minRelativeNextDate))):new Date(t.setDate(t.getDate()+Math.abs(l.dateSettings.minRelativeNextDate))),t=new Date(t.setHours(23,59,59))),null!==l.dateSettings.maxRelativeNextDate&&(e=new Date,e=l.dateSettings.maxRelativeNextDate<0?new Date(e.setDate(e.getDate()-Math.abs(l.dateSettings.maxRelativeNextDate))):new Date(e.setDate(e.getDate()+Math.abs(l.dateSettings.maxRelativeNextDate))),e=new Date(e.setHours(23,59,59)));var i=new Date(new Date(l.values[0]).setHours(23,59,59));return(!t||i.getTime()>=t.getTime())&&(!e||i.getTime()<=e.getTime())}return!0},this.id=i.id||"",this.productOptionSetId=i.productOptionSetId||"",this.name=i.name||"",this.order=i.order||0,this.type=i.type||o.CHOICE,this.selectSettings=i.selectSettings?new p(i.selectSettings||{}):null,this.textSettings=i.textSettings?new m(i.textSettings||{}):null,this.fileSettings=i.fileSettings?new v(i.fileSettings||{}):null,this.dateSettings=i.dateSettings?new f(i.dateSettings||{}):null,this.price=i.price||null,this.otherPrices=i.otherPrices||null,this.isOptional=i.isOptional||!1,this.optionalText=i.optionalText||null,this.requiredOptionId=i.requiredOptionId||null,this.requiredOptionValueIds=i.requiredOptionValueIds||null,this.values=i.values||[],this.childOptions=i.childOptions||[],n(this)}return Object.defineProperty(i.prototype,"displayedChildOptions",{get:function(){var t=this;return a(this.childOptions.filter((function(e){var i;return(null===(i=e.requiredOptionValueIds)||void 0===i?void 0:i.length)?e.requiredOptionValueIds.every((function(e){return t.values.some((function(t){return t===e}))})):t.type===o.CHECKBOX?!!t.values.length&&"true"===t.values[0]:!!t.values.length})),"order")},enumerable:!1,configurable:!0}),i.prototype.getBase64=function(t){return new Promise((function(e){var i=new FileReader;i.addEventListener("load",(function(){return e(i.result)})),i.readAsDataURL(t)}))},Object.defineProperty(i.prototype,"hasValidValues",{get:function(){if(!this.values.length&&!this.isOptional)return!1;var t=!1;switch(this.type){case o.TEXT:case o.TEXT_AREA:t=this.isValidTextOptionValue();break;case o.CHECKBOX:case o.COLOR_PICKER:t=!0;break;case o.CHOICE:t=this.isValidChoiceOptionValue();break;case o.DATE_PICKER:t=this.isValidDateOptionValue();break;case o.FILE:t=this.isValidFileOptionValue()}return t&&this.displayedChildOptions.every((function(t){return t.hasValidValues}))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"values",{get:function(){return this._values},set:function(t){this._values=t,t.length||this.childOptions.forEach((function(t){return t.values=[]}))},enumerable:!1,configurable:!0}),i}(),O=function(){function l(l){var s,a,o=this;this.initOptionValues=function(){return t(o,void 0,void 0,(function(){return e(this,(function(t){return this.options.forEach((function(t){return t.initValues()})),[2]}))}))},this.id=l.id||"",this.name=l.name||"",this.options=(null===(s=l.options)||void 0===s?void 0:s.map((function(t){return new g(i(i({},t),{productOptionSetId:o.id}))})))||[],this.translations=l.translations?null===(a=l.translations)||void 0===a?void 0:a.map((function(t){return new d(t)})):null,this.setChildOptions(),this.setTranslations(),this.initOptionValues(),n(this)}return Object.defineProperty(l.prototype,"displayedOptions",{get:function(){return a(this.options.filter((function(t){return!t.requiredOptionId})),"order")},enumerable:!1,configurable:!0}),l.prototype.setTranslations=function(){var t,e=this,i=s.getCurrentLocale();if(this.translations&&this.translations.some((function(t){return t.locale===i}))){var n=this.translations.find((function(t){return t.locale===i}));null===(t=null==n?void 0:n.options)||void 0===t||t.forEach((function(t){var i,n=e.options.find((function(e){return e.id===t.id}));n&&(n.name=t.name||n.name,n.optionalText=t.optionalText||n.optionalText,n.type===o.CHOICE&&(null===(i=t.values)||void 0===i||i.forEach((function(t){var e,i=null===(e=n.selectSettings)||void 0===e?void 0:e.values.find((function(e){return e.id===t.id}));i&&(i.value=t.value||i.value)}))))}))}},l.prototype.setChildOptions=function(){var t=this;this.options.forEach((function(e){var i=t.options.filter((function(t){return t.requiredOptionId===e.id}));i.length&&(e.childOptions=i)}))},l}();export{g as IkasProductOption,f as IkasProductOptionDateSettings,v as IkasProductOptionFileSettings,p as IkasProductOptionSelectSettings,u as IkasProductOptionSelectType,c as IkasProductOptionSelectValue,r as IkasProductOptionSelectValueTranslations,O as IkasProductOptionSet,d as IkasProductOptionSetTranslations,m as IkasProductOptionTextSettings,h as IkasProductOptionTranslations,o as IkasProductOptionType};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IkasTheme } from "../../../models/theme/theme";
|
|
2
|
+
import { IkasThemeComponent, IkasThemeComponentProp } from "../../../models";
|
|
2
3
|
import { IkasThemeCustomData } from "../../../models/theme/custom-data";
|
|
3
4
|
declare type File = {
|
|
4
5
|
content: string;
|
|
@@ -12,4 +13,9 @@ export declare class CustomDataTypesGenerator {
|
|
|
12
13
|
static getType(customData: IkasThemeCustomData, file: File, themeJson: IkasTheme): string;
|
|
13
14
|
static generateTypeName(customData: IkasThemeCustomData): string;
|
|
14
15
|
}
|
|
16
|
+
export declare class PropTypeGenarator {
|
|
17
|
+
static generate(themeJson: IkasTheme, file: File): Promise<void>;
|
|
18
|
+
static getType(prop: IkasThemeComponentProp, themeJson: IkasTheme, file: File): string;
|
|
19
|
+
static generatePropTypeName(component: IkasThemeComponent): string | undefined;
|
|
20
|
+
}
|
|
15
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as s,deleteDirContent as o}from"../../../utils/fs.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"../../../models/data/html-meta-data/index.js";import"../../../models/data/image/index.js";import"../../../models/data/installment-info/index.js";import"../../../models/data/order/index.js";import"../../../models/data/order/line-item/index.js";import"mobx";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/theme/theme.js";import"../../../models/theme/page/index.js";import{IkasThemeComponentPropType as r}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"../../../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/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 i from'../../../ext/lodash/uniq.js';var n=function(){function n(){}return n.generate=function(r){return e(this,void 0,void 0,(function(){var e,m,d,
|
|
1
|
+
import{__awaiter as e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as s,deleteDirContent as o}from"../../../utils/fs.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"../../../models/data/html-meta-data/index.js";import"../../../models/data/image/index.js";import"../../../models/data/installment-info/index.js";import"../../../models/data/order/index.js";import"../../../models/data/order/line-item/index.js";import"mobx";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/theme/theme.js";import"../../../models/theme/page/index.js";import{IkasThemeComponentPropType as r}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"../../../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/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 i from'../../../ext/lodash/uniq.js';var n=function(){function n(){}return n.generate=function(r){return e(this,void 0,void 0,(function(){var e,m,d,c,u,l,k;return t(this,(function(t){switch(t.label){case 0:return[4,o(a.join(process.cwd(),"src","components","__generated__","types"))];case 1:t.sent(),e={content:"",imports:[],internalCustomDatas:[]},t.label=2;case 2:t.trys.push([2,5,,6]),r.customData.forEach((function(t){n.generateAllCustomDataTypes(t,e,r)})),m=0,d=0;do{m=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){n.generateAllCustomDataTypes(t,e,r)})),(d=e.internalCustomDatas.length)!==m&&(e.internalCustomDatas=e.internalCustomDatas.splice(m,d))}while(m!==d);return[4,p.generate(r,e)];case 3:return t.sent(),c=a.join(process.cwd(),"src","components","__generated__"),e.imports=i(e.imports),u="import {\r\n",e.imports.forEach((function(e){u+="\t".concat(e,",\r\n")})),l=(u+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,s(c,"types.ts",l)];case 4:return[2,t.sent()];case 5:return k=t.sent(),console.log(k),[2,!1];case 6:return[2]}}))}))},n.generateAllCustomDataTypes=function(e,t,a){var s=e.type===r.ENUM,o="export ".concat(s?"enum":"type"," ").concat(n.generateTypeName(e)).concat(s?"":" = ","{ \r\n"),i="};\r\n\r\n";e.type!==r.DYNAMIC_LIST&&e.type!==r.STATIC_LIST||!e.nestedData?e.type===r.ENUM&&e.enumOptions?(t.content+=o,e.enumOptions.forEach((function(e){var a=e.value;e.value&&!isNaN(parseInt(e.value))&&(a="_"+e.value),t.content+='\t"'.concat(a,'" = "').concat(null==e?void 0:e.value,'",'),t.content+="\r\n"})),t.content+=i):(t.content+=o,e.nestedData&&e.nestedData.forEach((function(e){n.genenateCustomDataType(e,t,a),t.content+="\r\n"})),t.content+=i):n.generateAllCustomDataTypes(e.nestedData[0],t,a)},n.genenateCustomDataType=function(e,t,a){var s=n.getType(e,t,a);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(s).concat([r.DYNAMIC_LIST,r.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===r.ENUM?",":";")},n.getType=function(e,t,a){var s="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:s="string";break;case r.BOOLEAN:s="boolean";break;case r.IMAGE:s="IkasImage",t.imports.push(s);break;case r.IMAGE_LIST:s="IkasImage[]",t.imports.push("IkasImage");break;case r.LINK:s="IkasNavigationLink",t.imports.push(s);break;case r.LIST_OF_LINK:s="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:s="IkasProductDetail",t.imports.push(s);break;case r.PRODUCT_LIST:s="IkasProductList",t.imports.push("IkasProductList");break;case r.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",t.imports.push(s);break;case r.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",t.imports.push("IkasProductAttribute");break;case r.BRAND:s="IkasBrand",t.imports.push(s);break;case r.BRAND_LIST:s="IkasBrandList",t.imports.push(s);break;case r.CATEGORY:s="IkasCategory",t.imports.push(s);break;case r.CATEGORY_LIST:s="IkasCategoryList",t.imports.push(s);break;case r.CUSTOM:var o=a.customData.find((function(t){return t.id===e.customDataId}));o&&(s=n.generateTypeName(o));break;case r.COMPONENT:s="IkasComponentRenderer",t.imports.push(s);break;case r.COMPONENT_LIST:s="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case r.BLOG:s="IkasBlog",t.imports.push(s);break;case r.BLOG_LIST:s="IkasBlogList",t.imports.push(s);break;case r.BLOG_CATEGORY:s="IkasBlogCategory",t.imports.push(s);break;case r.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",t.imports.push(s);break;case r.RAFFLE:s="IkasRaffle",t.imports.push(s);break;case r.RAFFLE_LIST:s="IkasRaffleList",t.imports.push(s);break;case r.ENUM:s=n.generateTypeName(e),t.content.includes("export enum ".concat(s))||t.internalCustomDatas.push(e);break;case r.DYNAMIC_LIST:case r.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===r.OBJECT||e.nestedData[0].type===r.ENUM?(s=n.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(s))||t.internalCustomDatas.push(e.nestedData[0])):s=n.getType(e.nestedData[0],t,a))}return s},n.generateTypeName=function(e){if(e.typescriptName)return e.typescriptName;var t=e.name||"";return(t=(t=t.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(t="_"+t),e.type===r.ENUM&&(t+="Enum"),t},n}(),p=function(){function a(){}return a.generate=function(s,o){return e(this,void 0,void 0,(function(){return t(this,(function(e){return s.components.forEach((function(e){e.props.length>0&&"checkout"!==e.id&&(o.content+="export type ".concat(a.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){o.content+="\t".concat(e.name,": ").concat(a.getType(e,s,o),";\n")})),o.content+="};\r\n\r\n")})),[2]}))}))},a.getType=function(e,t,a){var s="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:s="string";break;case r.BOOLEAN:s="boolean";break;case r.IMAGE:s="IkasImage",a.imports.push(s);break;case r.IMAGE_LIST:s="IkasImage[]",a.imports.push("IkasImage");break;case r.LINK:s="IkasNavigationLink",a.imports.push(s);break;case r.LIST_OF_LINK:s="IkasNavigationLink[]",a.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:s="IkasProductDetail",a.imports.push(s);break;case r.PRODUCT_LIST:s="IkasProductList",a.imports.push("IkasProductList");break;case r.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",a.imports.push(s);break;case r.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",a.imports.push("IkasProductAttribute");break;case r.BRAND:s="IkasBrand",a.imports.push(s);break;case r.BRAND_LIST:s="IkasBrandList",a.imports.push(s);break;case r.CATEGORY:s="IkasCategory",a.imports.push(s);break;case r.CATEGORY_LIST:s="IkasCategoryList",a.imports.push(s);break;case r.CUSTOM:var o=t.customData.find((function(t){return t.id===e.customDataId}));(null==o?void 0:o.nestedData)&&(o.nestedData[0].type===r.OBJECT||o.nestedData[0].type===r.ENUM?(s=n.generateTypeName(o.nestedData[0]),o.type!==r.DYNAMIC_LIST&&o.type!==r.STATIC_LIST||(s+="[]")):s=n.getType(o.nestedData[0],a,t));break;case r.COMPONENT:s="IkasComponentRenderer",a.imports.push(s);break;case r.COMPONENT_LIST:s="IkasComponentRenderer[]",a.imports.push("IkasComponentRenderer");break;case r.BLOG:s="IkasBlog",a.imports.push(s);break;case r.BLOG_LIST:s="IkasBlogList",a.imports.push(s);break;case r.BLOG_CATEGORY:s="IkasBlogCategory",a.imports.push(s);break;case r.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",a.imports.push(s);break;case r.RAFFLE:s="IkasRaffle",a.imports.push(s);break;case r.RAFFLE_LIST:s="IkasRaffleList",a.imports.push(s);break;case r.SLIDER:s="IkasSlider",a.imports.push(s)}return s},a.generatePropTypeName=function(e){if(""!==e.displayName){var t=(e.dir||"").split("-"),a="";return t.forEach((function(e){return a+=e.charAt(0).toUpperCase()+e.slice(1)})),a}},a}();export{n as CustomDataTypesGenerator,p as PropTypeGenarator};
|