@ikas/storefront 2.0.49-alpha.1 → 2.0.50
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/_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/api/product-search/index.js +1 -1
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/ikas.js +2 -2
- package/build/models/data/image/index.d.ts +1 -2
- package/build/models/data/image/index.js +1 -1
- package/build/models/data/simple-product/index.d.ts +0 -1
- package/build/utils/helper.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'../ext/
|
|
1
|
+
import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from'../ext/split-on-first/index.js';export{default}from"../node_modules/split-on-first/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as n,__makeTemplateObject as i}from'../../ext/tslib/tslib.es6.js';import r from'../../ext/graphql-tag/src/index.js';import{apollo as o}from"../apollo.js";import"../../models/data/blog/index.js";import{IkasBrand as a}from"../../models/data/brand/index.js";import{IkasCategory as d,IkasCategoryPath as s,IkasFilterCategory as l}from"../../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{IkasHTMLMetaData as u}from"../../models/data/html-meta-data/index.js";import{IkasImage as c}from"../../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"../product-option-file/index.js";import{IkasProduct as m}from"../../models/data/product/index.js";import{IkasProductVariantType as p}from"../../models/data/product/variant-type/index.js";import{IkasProductVariant as v}from"../../models/data/product/variant/index.js";import{IkasProductPrice as g}from"../../models/data/product/variant/price/index.js";import{IkasProductAttribute as y}from"../../models/data/product-attribute/index.js";import{IkasProductAttributeValue as f}from"../../models/data/product/attribute-value/index.js";import{IkasProductFilter as I,IkasApplicableProductFilterValue as b,IkasProductFilterSettings as j}from"../../models/data/product-filter/index.js";import{IkasVariantType as h}from"../../models/data/variant-type/index.js";import{IkasVariantValue as x}from"../../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{IkasThemeStockPreference as $}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasProductTag as C}from"../../models/data/product-tag/index.js";import{IkasStorefrontConfig as w}from"../../storefront/index.js";import{IkasProductAttributeTableTemplate as S}from"../../models/data/product-attribute/product-attribute-table-template/index.js";var T,A,P,D=function(){function a(){}return a.searchProducts=function(a,d){var s;return void 0===d&&(d=!1),t(this,void 0,void 0,(function(){var t,l,u,c,m;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=r(T||(T=i(["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "],["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "]))),[4,o.getClient().query({query:t,variables:{input:n(n({},a),{showStockOption:d?w.stockPreference:$.SHOW_ALL,locale:w.getCurrentLocale(),dynamicCurrencySettings:(null===(s=w.getCurrentRouting())||void 0===s?void 0:s.dynamicCurrencySettings)||null})}})];case 1:return l=e.sent(),u=l.data,(c=l.errors)&&c.length?(console.log(c),[2]):[2,n(n({},u.searchProducts),{data:u.searchProducts.data.map((function(t){return L(t)}))})];case 2:return m=e.sent(),console.log(m),[3,3];case 3:return[2]}}))}))},a.getProductFilterData=function(a){return t(this,void 0,void 0,(function(){var t,d,s,u,c;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=r(A||(A=i(["\n query getProductFilterData($categoryId: String, $locale: String) {\n getProductFilterData(categoryId: $categoryId, locale: $locale) {\n filters {\n customValues\n displayType\n id\n isMultiSelect\n isFacetFilter\n key\n name\n order\n type\n values {\n colorCode\n id\n key\n name\n thumbnailImageId\n }\n settings {\n showCollapsedOnDesktop\n showCollapsedOnMobile\n sortType\n useAndFilter\n }\n }\n categories {\n id\n name\n metaData {\n slug\n }\n }\n }\n }\n "],["\n query getProductFilterData($categoryId: String, $locale: String) {\n getProductFilterData(categoryId: $categoryId, locale: $locale) {\n filters {\n customValues\n displayType\n id\n isMultiSelect\n isFacetFilter\n key\n name\n order\n type\n values {\n colorCode\n id\n key\n name\n thumbnailImageId\n }\n settings {\n showCollapsedOnDesktop\n showCollapsedOnMobile\n sortType\n useAndFilter\n }\n }\n categories {\n id\n name\n metaData {\n slug\n }\n }\n }\n }\n "]))),[4,o.getClient().query({query:t,variables:{categoryId:a||null,locale:w.getCurrentLocale()}})];case 1:return d=e.sent(),s=d.data,(u=d.errors)&&u.length?(console.log(u),[2]):[2,{filters:s.getProductFilterData.filters.map((function(t){var e;return new I(n(n({},t),{displayType:t.displayType,type:t.type,values:null===(e=t.values)||void 0===e?void 0:e.map((function(t){return new b(t)})),settings:t.settings?new j(n(n({},t.settings),{sortType:t.settings.sortType})):null}))})),categories:s.getProductFilterData.categories?s.getProductFilterData.categories.map((function(t){var e;return new l({id:t.id,name:t.name,slug:null===(e=t.metaData)||void 0===e?void 0:e.slug})})):null}];case 2:return c=e.sent(),console.log(c),[3,3];case 3:return[2]}}))}))},a.getRelatedProducts=function(a){var d;return t(this,void 0,void 0,(function(){var t,s,l,u,c;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=r(P||(P=i(["\n query getRelatedProducts(\n $brandIds: [String!]\n $categoryIds: [String!]\n $dynamicCurrencySettings: SearchDynamicCurrencySettings\n $limit: Float\n $priceListId: String\n $productId: String!\n $salesChannelId: String\n $tagIds: [String!]\n ) {\n getRelatedProducts(\n brandIds: $brandIds\n categoryIds: $categoryIds\n dynamicCurrencySettings: $dynamicCurrencySettings\n limit: $limit\n priceListId: $priceListId\n productId: $productId\n salesChannelId: $salesChannelId\n tagIds: $tagIds\n )\n }\n "],["\n query getRelatedProducts(\n $brandIds: [String!]\n $categoryIds: [String!]\n $dynamicCurrencySettings: SearchDynamicCurrencySettings\n $limit: Float\n $priceListId: String\n $productId: String!\n $salesChannelId: String\n $tagIds: [String!]\n ) {\n getRelatedProducts(\n brandIds: $brandIds\n categoryIds: $categoryIds\n dynamicCurrencySettings: $dynamicCurrencySettings\n limit: $limit\n priceListId: $priceListId\n productId: $productId\n salesChannelId: $salesChannelId\n tagIds: $tagIds\n )\n }\n "]))),[4,o.getClient().query({query:t,variables:n(n({},a),{limit:a.limit?a.limit:20,tagIds:a.tagIds?a.tagIds:null,dynamicCurrencySettings:(null===(d=w.getCurrentRouting())||void 0===d?void 0:d.dynamicCurrencySettings)||null})})];case 1:return s=e.sent(),l=s.data,(u=s.errors)&&u.length?(console.log(u),[2]):[2,{data:l.getRelatedProducts.map((function(t){return L(t)})),count:l.getRelatedProducts.length,facets:null,limit:20,page:1,totalCount:l.getRelatedProducts.length}];case 2:return c=e.sent(),console.log(c),[3,3];case 3:return[2]}}))}))},a}();function L(t){var e,n,i,r,o,l,I="local"===process.env.NEXT_PUBLIC_ENV;return new m({id:t.id,attributes:null===(e=t.attributes)||void 0===e?void 0:e.map((function(t){var e,n,i,r,o,a;return new f({value:t.value,productAttributeId:null===(e=t.productAttribute)||void 0===e?void 0:e.id,productAttributeOptionId:null===(n=t.productAttributeOption)||void 0===n?void 0:n.id,productAttribute:new y({id:null===(i=t.productAttribute)||void 0===i?void 0:i.id,name:null===(r=t.productAttribute)||void 0===r?void 0:r.name,type:null===(o=t.productAttribute)||void 0===o?void 0:o.type,tableTemplate:(null===(a=t.productAttribute)||void 0===a?void 0:a.tableTemplate)?new S(t.productAttribute.tableTemplate):null}),productAttributeOption:t.productAttributeOption})})),brand:new a({id:null===(n=t.brand)||void 0===n?void 0:n.id,name:null===(i=t.brand)||void 0===i?void 0:i.name,metaData:new u({slug:(null===(r=t.brand)||void 0===r?void 0:r.slug)||""})}),categories:null===(o=t.categories)||void 0===o?void 0:o.map((function(t){return new d({id:t.id,name:t.name,path:t.path.map((function(t){return new s(t)})),metaData:new u({slug:t.slug||""})})})),tags:null===(l=t.tags)||void 0===l?void 0:l.map((function(t){return new C({id:t.id,name:t.name})})),description:t.description||void 0,metaData:new u(t.metaData||void 0),name:t.name,shortDescription:t.shortDescription||void 0,productOptionSetId:t.productOptionSetId,variantTypes:t.productVariantTypes.map((function(t){return new p({variantType:new h({id:t.variantType.id,name:t.variantType.name,selectionType:t.variantType.selectionType,values:t.variantType.values.map((function(e){return new x({id:e.id,colorCode:e.colorCode,name:e.name,thumbnailImageId:e.thumbnailImageId,variantTypeId:t.variantType.id})})).filter((function(e){return t.variantValueIds.includes(e.id)}))}),variantValueIds:t.variantValueIds})})),variants:t.variants.map((function(e){var n,i,r,o;return new v({id:e.id,productId:t.id,attributes:null===(n=e.attributes)||void 0===n?void 0:n.map((function(t){var e,n,i,r,o,a;return new f({value:t.value,productAttributeId:null===(e=t.productAttribute)||void 0===e?void 0:e.id,productAttributeOptionId:null===(n=t.productAttributeOption)||void 0===n?void 0:n.id,productAttribute:new y({id:null===(i=t.productAttribute)||void 0===i?void 0:i.id,name:null===(r=t.productAttribute)||void 0===r?void 0:r.name,type:null===(o=t.productAttribute)||void 0===o?void 0:o.type,tableTemplate:(null===(a=t.productAttribute)||void 0===a?void 0:a.tableTemplate)?new S(t.productAttribute.tableTemplate):null}),productAttributeOption:t.productAttributeOption})})),sku:e.sku,barcodeList:e.barcodeList||void 0,images:null===(i=e.images)||void 0===i?void 0:i.map((function(t){return new c(t.id,t.isVideo)})),price:new g(null===(r=e.prices)||void 0===r?void 0:r.find((function(t){return w.priceListId?t.priceListId===w.priceListId:null===t.priceListId}))),stock:e.stocks.filter((function(t){var e;return I||w.isEditor||(null===(e=w.stockLocationIds)||void 0===e?void 0:e.includes(t.stockLocationId))})).reduce((function(t,e){return e.stockCount+t}),0)||0,variantValues:null===(o=e.variantValues)||void 0===o?void 0:o.map((function(e){var n=t.productVariantTypes.find((function(t){return t.variantType.id===e.variantTypeId})),i=null==n?void 0:n.variantType.values.find((function(t){return t.id===e.variantValueId}));return new x({id:e.variantValueId,name:null==i?void 0:i.name,colorCode:null==i?void 0:i.colorCode,thumbnailImageId:null==i?void 0:i.thumbnailImageId,variantTypeId:null==n?void 0:n.variantType.id})})),isActive:e.isActive})}))})}export{D as IkasProductSearchAPI};
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as n,__makeTemplateObject as i}from'../../ext/tslib/tslib.es6.js';import r from'../../ext/graphql-tag/src/index.js';import{apollo as o}from"../apollo.js";import"../../models/data/blog/index.js";import{IkasBrand as a}from"../../models/data/brand/index.js";import{IkasCategory as d,IkasCategoryPath as s,IkasFilterCategory as l}from"../../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{IkasHTMLMetaData as u}from"../../models/data/html-meta-data/index.js";import{IkasImage as c}from"../../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"../product-option-file/index.js";import{IkasProduct as m}from"../../models/data/product/index.js";import{IkasProductVariantType as p}from"../../models/data/product/variant-type/index.js";import{IkasProductVariant as v}from"../../models/data/product/variant/index.js";import{IkasProductPrice as g}from"../../models/data/product/variant/price/index.js";import{IkasProductAttribute as y}from"../../models/data/product-attribute/index.js";import{IkasProductAttributeValue as f}from"../../models/data/product/attribute-value/index.js";import{IkasProductFilter as I,IkasApplicableProductFilterValue as b,IkasProductFilterSettings as j}from"../../models/data/product-filter/index.js";import{IkasVariantType as h}from"../../models/data/variant-type/index.js";import{IkasVariantValue as x}from"../../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{IkasThemeStockPreference as $}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasProductTag as C}from"../../models/data/product-tag/index.js";import{IkasStorefrontConfig as w}from"../../storefront/index.js";import{IkasProductAttributeTableTemplate as S}from"../../models/data/product-attribute/product-attribute-table-template/index.js";var T,A,P,D=function(){function a(){}return a.searchProducts=function(a,d){var s;return void 0===d&&(d=!1),t(this,void 0,void 0,(function(){var t,l,u,c,m;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=r(T||(T=i(["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "],["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "]))),[4,o.getClient().query({query:t,variables:{input:n(n({},a),{showStockOption:d?w.stockPreference:$.SHOW_ALL,locale:w.getCurrentLocale(),dynamicCurrencySettings:(null===(s=w.getCurrentRouting())||void 0===s?void 0:s.dynamicCurrencySettings)||null})}})];case 1:return l=e.sent(),u=l.data,(c=l.errors)&&c.length?(console.log(c),[2]):[2,n(n({},u.searchProducts),{data:u.searchProducts.data.map((function(t){return L(t)}))})];case 2:return m=e.sent(),console.log(m),[3,3];case 3:return[2]}}))}))},a.getProductFilterData=function(a){return t(this,void 0,void 0,(function(){var t,d,s,u,c;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=r(A||(A=i(["\n query getProductFilterData($categoryId: String, $locale: String) {\n getProductFilterData(categoryId: $categoryId, locale: $locale) {\n filters {\n customValues\n displayType\n id\n isMultiSelect\n isFacetFilter\n key\n name\n order\n type\n values {\n colorCode\n id\n key\n name\n thumbnailImageId\n }\n settings {\n showCollapsedOnDesktop\n showCollapsedOnMobile\n sortType\n useAndFilter\n }\n }\n categories {\n id\n name\n metaData {\n slug\n }\n }\n }\n }\n "],["\n query getProductFilterData($categoryId: String, $locale: String) {\n getProductFilterData(categoryId: $categoryId, locale: $locale) {\n filters {\n customValues\n displayType\n id\n isMultiSelect\n isFacetFilter\n key\n name\n order\n type\n values {\n colorCode\n id\n key\n name\n thumbnailImageId\n }\n settings {\n showCollapsedOnDesktop\n showCollapsedOnMobile\n sortType\n useAndFilter\n }\n }\n categories {\n id\n name\n metaData {\n slug\n }\n }\n }\n }\n "]))),[4,o.getClient().query({query:t,variables:{categoryId:a||null,locale:w.getCurrentLocale()}})];case 1:return d=e.sent(),s=d.data,(u=d.errors)&&u.length?(console.log(u),[2]):[2,{filters:s.getProductFilterData.filters.map((function(t){var e;return new I(n(n({},t),{displayType:t.displayType,type:t.type,values:null===(e=t.values)||void 0===e?void 0:e.map((function(t){return new b(t)})),settings:t.settings?new j(n(n({},t.settings),{sortType:t.settings.sortType})):null}))})),categories:s.getProductFilterData.categories?s.getProductFilterData.categories.map((function(t){var e;return new l({id:t.id,name:t.name,slug:null===(e=t.metaData)||void 0===e?void 0:e.slug})})):null}];case 2:return c=e.sent(),console.log(c),[3,3];case 3:return[2]}}))}))},a.getRelatedProducts=function(a){var d;return t(this,void 0,void 0,(function(){var t,s,l,u,c;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=r(P||(P=i(["\n query getRelatedProducts(\n $brandIds: [String!]\n $categoryIds: [String!]\n $dynamicCurrencySettings: SearchDynamicCurrencySettings\n $limit: Float\n $priceListId: String\n $productId: String!\n $salesChannelId: String\n $tagIds: [String!]\n ) {\n getRelatedProducts(\n brandIds: $brandIds\n categoryIds: $categoryIds\n dynamicCurrencySettings: $dynamicCurrencySettings\n limit: $limit\n priceListId: $priceListId\n productId: $productId\n salesChannelId: $salesChannelId\n tagIds: $tagIds\n )\n }\n "],["\n query getRelatedProducts(\n $brandIds: [String!]\n $categoryIds: [String!]\n $dynamicCurrencySettings: SearchDynamicCurrencySettings\n $limit: Float\n $priceListId: String\n $productId: String!\n $salesChannelId: String\n $tagIds: [String!]\n ) {\n getRelatedProducts(\n brandIds: $brandIds\n categoryIds: $categoryIds\n dynamicCurrencySettings: $dynamicCurrencySettings\n limit: $limit\n priceListId: $priceListId\n productId: $productId\n salesChannelId: $salesChannelId\n tagIds: $tagIds\n )\n }\n "]))),[4,o.getClient().query({query:t,variables:n(n({},a),{limit:a.limit?a.limit:20,tagIds:a.tagIds?a.tagIds:null,dynamicCurrencySettings:(null===(d=w.getCurrentRouting())||void 0===d?void 0:d.dynamicCurrencySettings)||null})})];case 1:return s=e.sent(),l=s.data,(u=s.errors)&&u.length?(console.log(u),[2]):[2,{data:l.getRelatedProducts.map((function(t){return L(t)})),count:l.getRelatedProducts.length,facets:null,limit:20,page:1,totalCount:l.getRelatedProducts.length}];case 2:return c=e.sent(),console.log(c),[3,3];case 3:return[2]}}))}))},a}();function L(t){var e,n,i,r,o,l,I="local"===process.env.NEXT_PUBLIC_ENV;return new m({id:t.id,attributes:null===(e=t.attributes)||void 0===e?void 0:e.map((function(t){var e,n,i,r,o,a;return new f({value:t.value,productAttributeId:null===(e=t.productAttribute)||void 0===e?void 0:e.id,productAttributeOptionId:null===(n=t.productAttributeOption)||void 0===n?void 0:n.id,productAttribute:new y({id:null===(i=t.productAttribute)||void 0===i?void 0:i.id,name:null===(r=t.productAttribute)||void 0===r?void 0:r.name,type:null===(o=t.productAttribute)||void 0===o?void 0:o.type,tableTemplate:(null===(a=t.productAttribute)||void 0===a?void 0:a.tableTemplate)?new S(t.productAttribute.tableTemplate):null}),productAttributeOption:t.productAttributeOption})})),brand:new a({id:null===(n=t.brand)||void 0===n?void 0:n.id,name:null===(i=t.brand)||void 0===i?void 0:i.name,metaData:new u({slug:(null===(r=t.brand)||void 0===r?void 0:r.slug)||""})}),categories:null===(o=t.categories)||void 0===o?void 0:o.map((function(t){return new d({id:t.id,name:t.name,path:t.path.map((function(t){return new s(t)})),metaData:new u({slug:t.slug||""})})})),tags:null===(l=t.tags)||void 0===l?void 0:l.map((function(t){return new C({id:t.id,name:t.name})})),description:t.description||void 0,metaData:new u(t.metaData||void 0),name:t.name,shortDescription:t.shortDescription||void 0,productOptionSetId:t.productOptionSetId,variantTypes:t.productVariantTypes.map((function(t){return new p({variantType:new h({id:t.variantType.id,name:t.variantType.name,selectionType:t.variantType.selectionType,values:t.variantType.values.map((function(e){return new x({id:e.id,colorCode:e.colorCode,name:e.name,thumbnailImageId:e.thumbnailImageId,variantTypeId:t.variantType.id})})).filter((function(e){return t.variantValueIds.includes(e.id)}))}),variantValueIds:t.variantValueIds})})),variants:t.variants.map((function(e){var n,i,r,o;return new v({id:e.id,productId:t.id,attributes:null===(n=e.attributes)||void 0===n?void 0:n.map((function(t){var e,n,i,r,o,a;return new f({value:t.value,productAttributeId:null===(e=t.productAttribute)||void 0===e?void 0:e.id,productAttributeOptionId:null===(n=t.productAttributeOption)||void 0===n?void 0:n.id,productAttribute:new y({id:null===(i=t.productAttribute)||void 0===i?void 0:i.id,name:null===(r=t.productAttribute)||void 0===r?void 0:r.name,type:null===(o=t.productAttribute)||void 0===o?void 0:o.type,tableTemplate:(null===(a=t.productAttribute)||void 0===a?void 0:a.tableTemplate)?new S(t.productAttribute.tableTemplate):null}),productAttributeOption:t.productAttributeOption})})),sku:e.sku,barcodeList:e.barcodeList||void 0,images:null===(i=e.images)||void 0===i?void 0:i.map((function(t){return new c(t.id)})),price:new g(null===(r=e.prices)||void 0===r?void 0:r.find((function(t){return w.priceListId?t.priceListId===w.priceListId:null===t.priceListId}))),stock:e.stocks.filter((function(t){var e;return I||w.isEditor||(null===(e=w.stockLocationIds)||void 0===e?void 0:e.includes(t.stockLocationId))})).reduce((function(t,e){return e.stockCount+t}),0)||0,variantValues:null===(o=e.variantValues)||void 0===o?void 0:o.map((function(e){var n=t.productVariantTypes.find((function(t){return t.variantType.id===e.variantTypeId})),i=null==n?void 0:n.variantType.values.find((function(t){return t.id===e.variantValueId}));return new x({id:e.variantValueId,name:null==i?void 0:i.name,colorCode:null==i?void 0:i.colorCode,thumbnailImageId:null==i?void 0:i.thumbnailImageId,variantTypeId:null==n?void 0:n.variantType.id})})),isActive:e.isActive})}))})}export{D as IkasProductSearchAPI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i}from'../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";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{IkasCityAPI as s}from"../../../../api/city/index.js";import{IkasCountryAPI as r}from"../../../../api/country/index.js";import"../../../../api/customer/index.js";import"../../../../api/customer-review/index.js";import"../../../../api/customer-review-summary/index.js";import{IkasDistrictAPI as o}from"../../../../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"../../../../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"../../../../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{IkasStateAPI as n}from"../../../../api/state/index.js";import"../../../../api/product-option-set/index.js";import"../../../../api/raffle/index.js";import"../../../../api/back-in-stock-reminder/index.js";import"../../../../api/product-campaign/index.js";import{stringSorter as a}from"../../../../utils/helper.js";import{IkasStorefrontConfig as d}from"../../../../storefront/index.js";import"../../../../utils/i18n.js";import{FREE_TEXT_CITY_COUNTRY_LIST as l}from"../../../../utils/constants.js";var u=function(){function u(a){var l=this;this.isCorporate=!1,this.isErrorsVisible=!1,this.allowedCountryIds=null,this.allowCorporateInfo=!1,this.allowTitleChange=!1,this.firstNameChangeCallback=null,this.lastNameChangeCallback=null,this.countries=[],this.states=[],this.cities=[],this.districts=[],this.myCountryCode=null,this.fillDropdownOptions=function(){return t(l,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.listCountries()];case 1:return t.sent(),[4,this.listStates()];case 2:return t.sent(),[4,this.listCities()];case 3:return t.sent(),[4,this.listDistricts()];case 4:return t.sent(),[2]}}))}))},this.listCountries=function(){return t(l,void 0,void 0,(function(){var t,e,s,o,n,a,l,u=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.myCountryCode?[3,2]:(t=this,[4,r.getMyCountry()]);case 1:t.myCountryCode=i.sent()||void 0,i.label=2;case 2:return[4,r.listCountries(void 0,(null===(a=this.allowedCountryIds)||void 0===a?void 0:a.length)?this.allowedCountryIds:void 0)];case 3:return e=i.sent(),s=d.routings.find((function(t){return t.id===d.storefrontRoutingId})),(null===(l=null==s?void 0:s.countryCodes)||void 0===l?void 0:l.length)?e=e.filter((function(t){var i;return t.iso2&&(null===(i=s.countryCodes)||void 0===i?void 0:i.includes(t.iso2))})):(o=d.routings.filter((function(t){return t.id!==d.storefrontRoutingId})),e=e.filter((function(t){return t.iso2&&!o.some((function(i){var e;return null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2)}))}))),this.countries=e,1!==this.countries.length||this.country?this.myCountryCode&&!this.country&&(n=this.countries.find((function(t){return t.iso2===u.myCountryCode})))&&this.onCountryChange(n.id):this.onCountryChange(this.countries[0].id),[3,5];case 4:return i.sent(),[3,5];case 5:return[2]}}))}))},this.listStates=function(){return t(l,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.listStates(this.country.id)];case 2:return t=i.sent(),this.states=t,this.hasState||this.onStateChange(this.states[0].id),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listCities=function(){return t(l,void 0,void 0,(function(){var t,e,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),t=this,[4,s.listCities(this.state.id,null===(r=this.country)||void 0===r?void 0:r.id)];case 2:return t.cities=i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listDistricts=function(){return t(l,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),t=this,[4,o.listDistricts(this.city.id,null===(s=this.state)||void 0===s?void 0:s.id)];case 2:return t.districts=i.sent(),this.districts.length?this.address.isDistrictRequired=!0:this.address.isDistrictRequired=!1,[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.modelToOption=function(t){return{label:t.name,value:t.id+""}},this.onFirstNameChange=function(t){l.firstNameChangeCallback&&l.firstNameChangeCallback(t),l.address.firstName=t},this.onLastNameChange=function(t){l.lastNameChangeCallback&&l.lastNameChangeCallback(t),l.address.lastName=t},this.onPhoneChange=function(t){l.address.phone=t},this.onIdentityNumberChange=function(t){t?t.length<=11&&(l.address.identityNumber=t):l.address.identityNumber=""},this.onAddressTitleChange=function(t){l.address.title=t},this.onAddressLine1Change=function(t){l.address.addressLine1=t},this.onAddressLine2Change=function(t){l.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){l.address.postalCode=t},this.onCountryChange=function(t){var i;if((null===(i=l.country)||void 0===i?void 0:i.id)!==t){var e=l.countries.find((function(i){return i.id===t}));l.address.country={id:null==e?void 0:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.iso3,iso2:null==e?void 0:e.iso2,iso3:null==e?void 0:e.iso3},l.address.state=void 0,l.address.city=void 0,l.address.district=void 0,l.states=[],l.cities=[],l.districts=[],l.listStates()}},this.onStateChange=function(t){var i;if((null===(i=l.state)||void 0===i?void 0:i.id)!==t){var e=l.states.find((function(i){return i.id===t}));l.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.stateCode},l.address.city=void 0,l.address.district=void 0,l.cities=[],l.districts=[],l.listCities()}},this.onCityChange=function(t){var i;if((null===(i=l.city)||void 0===i?void 0:i.id)!==t){var e=l.cities.find((function(i){return i.id===t}));l.address.city={id:e.id,name:e.name},l.address.district=void 0,l.districts=[],l.listDistricts()}},this.onCityInputChange=function(t){l.districts=[],l.address.city={id:void 0,name:t}},this.onDistrictChange=function(t){var i;if((null===(i=l.district)||void 0===i?void 0:i.id)!==t){var e=l.districts.find((function(i){return i.id===t}));l.address.district={id:e.id,name:e.name}}},this.onDistrictInputChange=function(t){l.address.district={id:void 0,name:t}},this.onCorporateChange=function(t){l.isCorporate=t,t||(l.address.company=null,l.address.taxNumber=null,l.address.taxOffice=null)},this.onCompanyChange=function(t){l.address.company=t},this.onTaxNumberChange=function(t){l.address.taxNumber=t},this.onTaxOfficeChange=function(t){l.address.taxOffice=t},this.address=a.address,this.isCorporate=a.isCorporate||!1,this.isErrorsVisible=a.isErrorsVisible||!1,this.isCustomerAddress=a.isCustomerAddress||!1,this.allowedCountryIds=a.allowedCountryIds,this.allowCorporateInfo=a.allowCorporateInfo||!1,this.allowTitleChange=a.allowTitleChange||!1,this.firstNameChangeCallback=a.firstNameChangeCallback||null,this.lastNameChangeCallback=a.lastNameChangeCallback||null,e(this,{firstNameChangeCallback:!1,lastNameChangeCallback:!1}),this.fillDropdownOptions()}return Object.defineProperty(u.prototype,"firstName",{get:function(){return this.address.firstName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastName",{get:function(){return this.address.lastName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"phone",{get:function(){return this.address.phone},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"identityNumber",{get:function(){return this.address.identityNumber},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"country",{get:function(){return this.address.country},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"state",{get:function(){return this.address.state},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"city",{get:function(){return this.address.city},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"district",{get:function(){return this.address.district},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"countryOptions",{get:function(){var t=this.countries.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"stateOptions",{get:function(){var t=this.states.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"cityOptions",{get:function(){var t=this.cities.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"districtOptions",{get:function(){var t=this.districts.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isFreeTextCity",{get:function(){var t=this;return l.some((function(i){var e,s;return(null===(s=null===(e=t.address.country)||void 0===e?void 0:e.iso2)||void 0===s?void 0:s.toLowerCase())===i.toLowerCase()}))},enumerable:!1,configurable:!0}),u}();export{u as default};
|
|
1
|
+
import{__awaiter as t,__generator as i}from'../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";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{IkasCityAPI as s}from"../../../../api/city/index.js";import{IkasCountryAPI as r}from"../../../../api/country/index.js";import"../../../../api/customer/index.js";import"../../../../api/customer-review/index.js";import"../../../../api/customer-review-summary/index.js";import{IkasDistrictAPI as o}from"../../../../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"../../../../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"../../../../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{IkasStateAPI as n}from"../../../../api/state/index.js";import"../../../../api/product-option-set/index.js";import"../../../../api/raffle/index.js";import"../../../../api/back-in-stock-reminder/index.js";import"../../../../api/product-campaign/index.js";import{stringSorter as a}from"../../../../utils/helper.js";import{IkasStorefrontConfig as d}from"../../../../storefront/index.js";import"../../../../utils/i18n.js";import{FREE_TEXT_CITY_COUNTRY_LIST as l}from"../../../../utils/constants.js";var u=function(){function u(a){var l=this;this.isCorporate=!1,this.isErrorsVisible=!1,this.allowedCountryIds=null,this.allowCorporateInfo=!1,this.allowTitleChange=!1,this.firstNameChangeCallback=null,this.lastNameChangeCallback=null,this.countries=[],this.states=[],this.cities=[],this.districts=[],this.myCountryCode=null,this.fillDropdownOptions=function(){return t(l,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.listCountries()];case 1:return t.sent(),[4,this.listStates()];case 2:return t.sent(),[4,this.listCities()];case 3:return t.sent(),[4,this.listDistricts()];case 4:return t.sent(),[2]}}))}))},this.listCountries=function(){return t(l,void 0,void 0,(function(){var t,e,s,o,n,a,l,u=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.myCountryCode?[3,2]:(t=this,[4,r.getMyCountry()]);case 1:t.myCountryCode=i.sent()||void 0,i.label=2;case 2:return[4,r.listCountries(void 0,(null===(a=this.allowedCountryIds)||void 0===a?void 0:a.length)?this.allowedCountryIds:void 0)];case 3:return e=i.sent(),s=d.routings.find((function(t){return t.id===d.storefrontRoutingId})),(null===(l=null==s?void 0:s.countryCodes)||void 0===l?void 0:l.length)?e=e.filter((function(t){var i;return t.iso2&&(null===(i=s.countryCodes)||void 0===i?void 0:i.includes(t.iso2))})):(o=d.routings.filter((function(t){return t.id!==d.storefrontRoutingId})),e=e.filter((function(t){return t.iso2&&!o.some((function(i){var e;return null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2)}))}))),this.countries=e,1!==this.countries.length||this.country?this.myCountryCode&&!this.country&&(n=this.countries.find((function(t){return t.iso2===u.myCountryCode})))&&this.onCountryChange(n.id):this.onCountryChange(this.countries[0].id),[3,5];case 4:return i.sent(),[3,5];case 5:return[2]}}))}))},this.listStates=function(){return t(l,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.listStates(this.country.id)];case 2:return t=i.sent(),this.states=t,this.hasState||this.onStateChange(this.states[0].id),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listCities=function(){return t(l,void 0,void 0,(function(){var t,e,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),t=this,[4,s.listCities(this.state.id,null===(r=this.country)||void 0===r?void 0:r.id)];case 2:return t.cities=i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listDistricts=function(){return t(l,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),t=this,[4,o.listDistricts(this.city.id,null===(s=this.state)||void 0===s?void 0:s.id)];case 2:return t.districts=i.sent(),this.districts.length?this.address.isDistrictRequired=!0:this.address.isDistrictRequired=!1,[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.modelToOption=function(t){return{label:t.name,value:t.id+""}},this.onFirstNameChange=function(t){l.firstNameChangeCallback&&l.firstNameChangeCallback(t),l.address.firstName=t},this.onLastNameChange=function(t){l.lastNameChangeCallback&&l.lastNameChangeCallback(t),l.address.lastName=t},this.onPhoneChange=function(t){l.address.phone=t},this.onIdentityNumberChange=function(t){t?t.length<=11&&(l.address.identityNumber=t):l.address.identityNumber=""},this.onAddressTitleChange=function(t){l.address.title=t},this.onAddressLine1Change=function(t){l.address.addressLine1=t},this.onAddressLine2Change=function(t){l.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){l.address.postalCode=t},this.onCountryChange=function(t){var i;if((null===(i=l.country)||void 0===i?void 0:i.id)!==t){var e=l.countries.find((function(i){return i.id===t}));l.address.country={id:null==e?void 0:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.iso3,iso2:null==e?void 0:e.iso2,iso3:null==e?void 0:e.iso3},l.address.state=void 0,l.address.city=void 0,l.address.district=void 0,l.states=[],l.cities=[],l.districts=[],l.listStates()}},this.onStateChange=function(t){var i;if((null===(i=l.state)||void 0===i?void 0:i.id)!==t){var e=l.states.find((function(i){return i.id===t}));l.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.stateCode},l.address.city=void 0,l.address.district=void 0,l.cities=[],l.districts=[],l.listCities()}},this.onCityChange=function(t){var i;if((null===(i=l.city)||void 0===i?void 0:i.id)!==t){var e=l.cities.find((function(i){return i.id===t}));l.address.city={id:e.id,name:e.name},l.address.district=void 0,l.districts=[],l.listDistricts()}},this.onCityInputChange=function(t){l.districts=[],l.address.city={id:void 0,name:t}},this.onDistrictChange=function(t){var i;if((null===(i=l.district)||void 0===i?void 0:i.id)!==t){var e=l.districts.find((function(i){return i.id===t}));l.address.district={id:e.id,name:e.name}}},this.onDistrictInputChange=function(t){l.address.district={id:void 0,name:t}},this.onCorporateChange=function(t){l.isCorporate=t,t||(l.address.company=null,l.address.taxNumber=null,l.address.taxOffice=null)},this.onCompanyChange=function(t){l.address.company=t},this.onTaxNumberChange=function(t){l.address.taxNumber=t},this.onTaxOfficeChange=function(t){l.address.taxOffice=t},this.address=a.address,this.isCorporate=a.isCorporate||!1,this.isErrorsVisible=a.isErrorsVisible||!1,this.isCustomerAddress=a.isCustomerAddress||!1,this.allowedCountryIds=a.allowedCountryIds,this.allowCorporateInfo=a.allowCorporateInfo||!1,this.allowTitleChange=a.allowTitleChange||!1,this.firstNameChangeCallback=a.firstNameChangeCallback||null,this.lastNameChangeCallback=a.lastNameChangeCallback||null,e(this,{firstNameChangeCallback:!1,lastNameChangeCallback:!1}),this.fillDropdownOptions()}return Object.defineProperty(u.prototype,"firstName",{get:function(){return this.address.firstName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastName",{get:function(){return this.address.lastName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"phone",{get:function(){return this.address.phone},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"identityNumber",{get:function(){return this.address.identityNumber},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"country",{get:function(){return this.address.country},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"state",{get:function(){return this.address.state},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"city",{get:function(){return this.address.city},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"district",{get:function(){return this.address.district},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"countryOptions",{get:function(){var t=this.countries.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"stateOptions",{get:function(){var t=this.states.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"cityOptions",{get:function(){return this.cities.map(this.modelToOption)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"districtOptions",{get:function(){var t=this.districts.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isFreeTextCity",{get:function(){var t=this;return l.some((function(i){var e,s;return(null===(s=null===(e=t.address.country)||void 0===e?void 0:e.iso2)||void 0===s?void 0:s.toLowerCase())===i.toLowerCase()}))},enumerable:!1,configurable:!0}),u}();export{u as default};
|