@ikas/storefront 2.0.14-alpha.7 → 2.0.14
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 -46
- package/build/__generated__/global-types.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/analytics.js +1 -1
- package/build/analytics/googleTagManager.js +1 -1
- package/build/analytics/ikas.js +1 -1
- package/build/api/brand/index.js +1 -1
- package/build/api/category/index.js +1 -1
- package/build/api/checkout/index.js +1 -1
- package/build/api/customer/__generated__/customerLogin.d.ts +0 -4
- package/build/api/customer/__generated__/customerSocialLogin.d.ts +0 -4
- package/build/api/customer/__generated__/getMyCustomer.d.ts +0 -4
- package/build/api/customer/__generated__/registerCustomer.d.ts +0 -4
- package/build/api/customer/__generated__/saveMyCustomer.d.ts +0 -4
- package/build/api/customer/index.js +1 -1
- package/build/api/customer-review/__generated__/listCustomerReviews.d.ts +0 -1
- package/build/api/customer-review/index.js +1 -1
- package/build/api/favorite-product/index.js +1 -1
- package/build/api/html-meta-data/index.js +1 -1
- package/build/api/index.d.ts +0 -1
- package/build/api/merchant/index.js +1 -1
- package/build/api/product-option-set/__generated__/ListProductOptionSet.d.ts +0 -2
- package/build/api/product-search/index.js +1 -1
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
- package/build/components/checkout/components/credit-card-form/index.js +1 -1
- package/build/components/checkout/components/customer-addresses/model.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page-editor/ThemeComponentEditor.js +1 -1
- package/build/components/page-editor/model.js +1 -1
- package/build/ikas.js +7 -7
- package/build/index.js +1 -1
- package/build/models/data/customer/index.d.ts +0 -1
- package/build/models/data/customer/index.js +1 -1
- package/build/models/data/customer-review/index.d.ts +0 -3
- package/build/models/data/customer-review/index.js +1 -1
- package/build/models/data/index.d.ts +0 -1
- package/build/models/data/product/variant/index.d.ts +0 -2
- package/build/models/data/product/variant/index.js +1 -1
- package/build/models/data/product-option-set/index.d.ts +0 -4
- package/build/models/data/product-option-set/index.js +1 -1
- package/build/models/ui/blog-category-list/index.js +1 -1
- package/build/models/ui/blog-list/index.js +1 -1
- package/build/models/ui/brand-list/index.js +1 -1
- package/build/models/ui/category-list/index.js +1 -1
- package/build/models/ui/customer-review-list/index.js +1 -1
- package/build/models/ui/product-detail/index.d.ts +2 -4
- package/build/models/ui/product-detail/index.js +1 -1
- package/build/models/ui/product-list/index.js +1 -1
- package/build/models/ui/raffle-list/index.js +1 -1
- package/build/models/ui/validator/form/address.js +1 -1
- package/build/pages/404.js +1 -1
- package/build/pages/_slug_/index.js +1 -1
- package/build/pages/account/addresses.js +1 -1
- package/build/pages/account/favorite-products.js +1 -1
- package/build/pages/account/forgot-password.js +1 -1
- package/build/pages/account/index.js +1 -1
- package/build/pages/account/login.js +1 -1
- package/build/pages/account/orders/_id_.js +1 -1
- package/build/pages/account/orders/index.js +1 -1
- package/build/pages/account/raffles.js +1 -1
- package/build/pages/account/recover-password.js +1 -1
- package/build/pages/account/register.js +1 -1
- package/build/pages/blog/_slug_.js +1 -1
- package/build/pages/blog/index.js +1 -1
- package/build/pages/cart.js +1 -1
- package/build/pages/checkout.js +1 -1
- package/build/pages/home.js +1 -1
- package/build/pages/pages/_slug_.js +1 -1
- package/build/pages/raffle/_slug_.js +1 -1
- package/build/pages/raffle/index.js +1 -1
- package/build/pages/search.js +1 -1
- package/build/providers/helpers/raffles.js +1 -1
- package/build/providers/page-data-get.js +1 -1
- package/build/providers/page-data-init.js +1 -1
- package/build/providers/page-data-next.js +1 -1
- package/build/providers/placeholders.js +1 -1
- package/build/providers/prop-value/attribute-list.js +1 -1
- package/build/providers/prop-value/attribute.js +1 -1
- package/build/providers/prop-value/blog-category-list.js +1 -1
- package/build/providers/prop-value/blog-category.js +1 -1
- package/build/providers/prop-value/blog-list.js +1 -1
- package/build/providers/prop-value/blog.js +1 -1
- package/build/providers/prop-value/brand-list.js +1 -1
- package/build/providers/prop-value/brand.js +1 -1
- package/build/providers/prop-value/category-list.js +1 -1
- package/build/providers/prop-value/category.js +1 -1
- package/build/providers/prop-value/custom.js +1 -1
- package/build/providers/prop-value/image-list.js +1 -1
- package/build/providers/prop-value/image.js +1 -1
- package/build/providers/prop-value/link.js +1 -1
- package/build/providers/prop-value/product-detail.js +1 -1
- package/build/providers/prop-value/product-list.js +1 -1
- package/build/providers/prop-value/raffle-list.js +1 -1
- package/build/providers/prop-value/raffle.js +1 -1
- package/build/scripts/generators/config/content.d.ts +1 -1
- package/build/scripts/generators/config/content.js +1 -1
- package/build/scripts/generators/types/index.js +1 -1
- package/build/store/base.js +1 -1
- package/build/store/cart.js +1 -1
- package/build/store/customer.js +1 -1
- package/package.json +1 -1
- package/build/api/product-campanign/__generated__/getProductCampaigns.d.ts +0 -91
- package/build/api/product-campanign/index.d.ts +0 -10
- package/build/api/product-campanign/index.js +0 -1
- package/build/models/data/product-campaing/campaign/index.d.ts +0 -41
- package/build/models/data/product-campaing/campaign/index.js +0 -1
- package/build/models/data/product-campaing/filter/index.d.ts +0 -13
- package/build/models/data/product-campaing/filter/index.js +0 -1
- package/build/models/data/product-campaing/index.d.ts +0 -6
- package/build/models/data/product-campaing/index.js +0 -1
- package/build/models/data/product-campaing/product-buyx-then-gety/index.d.ts +0 -19
- package/build/models/data/product-campaing/product-buyx-then-gety/index.js +0 -1
- package/build/models/data/product-campaing/product-campaign-date-range-field/index.d.ts +0 -5
- package/build/models/data/product-campaing/product-campaign-date-range-field/index.js +0 -1
- package/build/models/data/product-campaing/product-fixed-discount/index.d.ts +0 -13
- package/build/models/data/product-campaing/product-fixed-discount/index.js +0 -1
|
@@ -146,10 +146,6 @@ export interface saveMyCustomer_saveMyCustomer {
|
|
|
146
146
|
* The customer's first name.
|
|
147
147
|
*/
|
|
148
148
|
firstName: string;
|
|
149
|
-
/**
|
|
150
|
-
* Groups that the store owner attaches to the customer.
|
|
151
|
-
*/
|
|
152
|
-
customerGroupIds: string[] | null;
|
|
153
149
|
}
|
|
154
150
|
export interface saveMyCustomer {
|
|
155
151
|
saveMyCustomer: saveMyCustomer_saveMyCustomer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as n,__generator as e,__assign as t,__makeTemplateObject as r}from'../../ext/tslib/tslib.es6.js';import a from'../../ext/graphql-tag/src/index.js';import{apollo as i}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import{IkasCustomer as s}from"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import{IkasOrder as o}from"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import{IkasOrderRefundSettings as d}from"../../models/data/order/refund/settings.js";import"../../models/data/product/index.js";import"mobx";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{IkasOrderTransaction as c}from"../../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"../../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{IkasStorefrontConfig as u}from"../../storefront/index.js";var m,l,p,g,f,y,h,v,N,I,b,k,x,L,$,S,C=function(){function C(){}return C.login=function(o,d){return n(this,void 0,void 0,(function(){var n,c,u,l,p;return e(this,(function(e){switch(e.label){case 0:n=a(m||(m=r(["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n customerGroupIds\n }\n }\n }\n "],["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n customerGroupIds\n }\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{email:o,password:d}})];case 2:return c=e.sent(),u=c.data,(l=c.errors)&&l.length&&console.log(l),u&&u.customerLogin?[2,t(t({},u.customerLogin),{customer:new s(u.customerLogin.customer)})]:[3,4];case 3:return p=e.sent(),console.log(p),[3,4];case 4:return[2]}}))}))},C.socialLogin=function(t){return n(this,void 0,void 0,(function(){var n,o,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(l||(l=r(["\n query customerSocialLogin($code: String!) {\n customerSocialLogin(code: $code) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n customerGroupIds\n }\n }\n }\n "],["\n query customerSocialLogin($code: String!) {\n customerSocialLogin(code: $code) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n customerGroupIds\n }\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{code:t}})];case 2:return o=e.sent(),d=o.data,(c=o.errors)&&c.length&&console.log(c),d&&d.customerSocialLogin.customer?[2,{customer:new s(d.customerSocialLogin.customer),token:d.customerSocialLogin.token,tokenExpiry:d.customerSocialLogin.tokenExpiry}]:[3,4];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2]}}))}))},C.register=function(o,d,c,m,l){return n(this,void 0,void 0,(function(){var n,g,f,y,h;return e(this,(function(e){switch(e.label){case 0:n=a(p||(p=r(["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n $isAcceptMarketing: Boolean\n $locale: String\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n isAcceptMarketing: $isAcceptMarketing\n locale: $locale\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n customerGroupIds\n }\n }\n }\n "],["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n $isAcceptMarketing: Boolean\n $locale: String\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n isAcceptMarketing: $isAcceptMarketing\n locale: $locale\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n customerGroupIds\n }\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{email:o,password:d,firstName:c,lastName:m,isAcceptMarketing:l,locale:u.getCurrentLocale()}})];case 2:return g=e.sent(),f=g.data,(y=g.errors)&&y.length&&console.log(y),f&&f.registerCustomer?[2,t(t({},f.registerCustomer),{customer:new s(f.registerCustomer.customer)})]:[3,4];case 3:return h=e.sent(),console.log(h),[3,4];case 4:return[2]}}))}))},C.refreshToken=function(t){return n(this,void 0,void 0,(function(){var n,s,o,d,c;return e(this,(function(e){switch(e.label){case 0:n=a(g||(g=r(["\n mutation customerRefreshToken($token: String!) {\n customerRefreshToken(token: $token) {\n token\n tokenExpiry\n }\n }\n "],["\n mutation customerRefreshToken($token: String!) {\n customerRefreshToken(token: $token) {\n token\n tokenExpiry\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{token:t}})];case 2:return s=e.sent(),o=s.data,(d=s.errors)&&d.length&&console.log(d),o?[2,o.customerRefreshToken]:[3,4];case 3:return c=e.sent(),console.log(c),[3,4];case 4:return[2]}}))}))},C.forgotPassword=function(t){return n(this,void 0,void 0,(function(){var n,s,o,d;return e(this,(function(e){switch(e.label){case 0:n=a(f||(f=r(["\n mutation customerForgotPassword($email: String!, $locale: String!) {\n customerForgotPassword(email: $email, locale: $locale)\n }\n "],["\n mutation customerForgotPassword($email: String!, $locale: String!) {\n customerForgotPassword(email: $email, locale: $locale)\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{email:t,locale:u.getCurrentLocale()}})];case 2:return s=e.sent(),(o=s.errors)&&o.length?(console.log(o),[2,!1]):[3,4];case 3:return d=e.sent(),console.log(d),[3,4];case 4:return[2,!0]}}))}))},C.recoverPassword=function(t,s,o){return n(this,void 0,void 0,(function(){var n,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(y||(y=r(["\n mutation customerRecoverPassword(\n $password: String!\n $passwordAgain: String!\n $token: String!\n ) {\n customerRecoverPassword(\n password: $password\n passwordAgain: $passwordAgain\n token: $token\n )\n }\n "],["\n mutation customerRecoverPassword(\n $password: String!\n $passwordAgain: String!\n $token: String!\n ) {\n customerRecoverPassword(\n password: $password\n passwordAgain: $passwordAgain\n token: $token\n )\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{password:t,passwordAgain:s,token:o}})];case 2:return d=e.sent(),(c=d.errors)&&c.length?(console.log(c),[2,!1]):[3,4];case 3:return u=e.sent(),console.log(u),[2,!1];case 4:return[2,!0]}}))}))},C.checkEmail=function(t){return n(this,void 0,void 0,(function(){var n,s,o,d,c;return e(this,(function(e){switch(e.label){case 0:n=a(h||(h=r(["\n query checkCustomerEmail($email: String!) {\n checkCustomerEmail(email: $email) {\n exists\n }\n }\n "],["\n query checkCustomerEmail($email: String!) {\n checkCustomerEmail(email: $email) {\n exists\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{email:t}})];case 2:return s=e.sent(),o=s.data,(d=s.errors)&&d.length&&console.log(d),o&&o.checkCustomerEmail?[2,o.checkCustomerEmail.exists]:[3,4];case 3:return c=e.sent(),console.log(c),[3,4];case 4:return[2,!1]}}))}))},C.getCustomer=function(){return n(this,void 0,void 0,(function(){var n,t,o,d,c;return e(this,(function(e){switch(e.label){case 0:n=a(v||(v=r(["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n customerGroupIds\n }\n }\n "],["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n customerGroupIds\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n})];case 2:return t=e.sent(),o=t.data,(d=t.errors)&&d.length&&console.log(d),o&&o.getMyCustomer?[2,new s(o.getMyCustomer)]:[3,4];case 3:return c=e.sent(),console.log(c),[3,4];case 4:return[2]}}))}))},C.saveCustomer=function(t){return n(this,void 0,void 0,(function(){var n,o,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(N||(N=r(["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n identityNumber\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n customerGroupIds\n }\n }\n "],["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n identityNumber\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n customerGroupIds\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:{firstName:t.firstName,lastName:t.lastName,addresses:t.addresses,phone:t.phone}}})];case 2:return o=e.sent(),d=o.data,(c=o.errors)&&c.length&&console.log(c),d&&d.saveMyCustomer?[2,new s(d.saveMyCustomer)]:[3,4];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2]}}))}))},C.getOrders=function(t){return n(this,void 0,void 0,(function(){var n,s,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(I||(I=r(["\n query getCustomerOrders($orderId: String) {\n getCustomerOrders(orderId: $orderId) {\n billingAddress {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n name\n id\n code\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n cancelledAt\n cancelReason\n createdAt\n currencyCode\n currencyRates {\n rate\n originalRate\n code\n }\n customer {\n lastName\n firstName\n email\n id\n }\n deleted\n id\n merchantId\n note\n orderedAt\n orderAdjustments {\n type\n order\n name\n amountType\n amount\n }\n orderLineItems {\n createdAt\n currencyCode\n deleted\n discount {\n reason\n amountType\n amount\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n variantValueName\n variantValueId\n variantTypeName\n variantTypeId\n order\n }\n }\n options {\n name\n productOptionId\n productOptionsSetId\n type\n values {\n name\n price\n value\n }\n }\n }\n orderNumber\n orderPackages {\n updatedAt\n trackingInfo {\n trackingNumber\n trackingLink\n isSendNotification\n cargoCompany\n }\n stockLocationId\n orderPackageNumber\n orderPackageFulfillStatus\n orderLineItemIds\n id\n deleted\n createdAt\n }\n orderPackageStatus\n orderPaymentStatus\n orderTagIds\n shippingAddress {\n taxOffice\n taxNumber\n state {\n name\n id\n code\n }\n postalCode\n phone\n lastName\n isDefault\n identityNumber\n firstName\n district {\n name\n id\n code\n }\n country {\n name\n id\n code\n }\n company\n city {\n id\n code\n name\n }\n addressLine2\n addressLine1\n }\n shippingLines {\n title\n taxValue\n price\n }\n shippingMethod\n status\n taxLines {\n rate\n price\n }\n totalFinalPrice\n totalPrice\n updatedAt\n }\n }\n "],["\n query getCustomerOrders($orderId: String) {\n getCustomerOrders(orderId: $orderId) {\n billingAddress {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n name\n id\n code\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n cancelledAt\n cancelReason\n createdAt\n currencyCode\n currencyRates {\n rate\n originalRate\n code\n }\n customer {\n lastName\n firstName\n email\n id\n }\n deleted\n id\n merchantId\n note\n orderedAt\n orderAdjustments {\n type\n order\n name\n amountType\n amount\n }\n orderLineItems {\n createdAt\n currencyCode\n deleted\n discount {\n reason\n amountType\n amount\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n variantValueName\n variantValueId\n variantTypeName\n variantTypeId\n order\n }\n }\n options {\n name\n productOptionId\n productOptionsSetId\n type\n values {\n name\n price\n value\n }\n }\n }\n orderNumber\n orderPackages {\n updatedAt\n trackingInfo {\n trackingNumber\n trackingLink\n isSendNotification\n cargoCompany\n }\n stockLocationId\n orderPackageNumber\n orderPackageFulfillStatus\n orderLineItemIds\n id\n deleted\n createdAt\n }\n orderPackageStatus\n orderPaymentStatus\n orderTagIds\n shippingAddress {\n taxOffice\n taxNumber\n state {\n name\n id\n code\n }\n postalCode\n phone\n lastName\n isDefault\n identityNumber\n firstName\n district {\n name\n id\n code\n }\n country {\n name\n id\n code\n }\n company\n city {\n id\n code\n name\n }\n addressLine2\n addressLine1\n }\n shippingLines {\n title\n taxValue\n price\n }\n shippingMethod\n status\n taxLines {\n rate\n price\n }\n totalFinalPrice\n totalPrice\n updatedAt\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:t?{orderId:t}:{}})];case 2:return s=e.sent(),d=s.data,(c=s.errors)&&c.length&&console.log(c),d&&d.getCustomerOrders?[2,d.getCustomerOrders.map((function(n){return new o(n)}))]:[3,4];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2]}}))}))},C.getOrderTransactions=function(t){return n(this,void 0,void 0,(function(){var n,s,o,d,u;return e(this,(function(e){switch(e.label){case 0:n=a(b||(b=r(["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "],["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{checkoutId:(null==t?void 0:t.checkoutId)?{eq:t.checkoutId}:void 0,id:(null==t?void 0:t.id)?{eq:t.id}:void 0,orderId:(null==t?void 0:t.orderId)?{eq:t.orderId}:void 0}})];case 2:return s=e.sent(),o=s.data,d=s.errors,Array.isArray(d)&&d.length?[2,[]]:[2,o.listOrderTransactions.map((function(n){return new c(n)}))];case 3:return u=e.sent(),console.log(u),[2,[]];case 4:return[2]}}))}))},C.saveIkasOrderRefund=function(t){return n(this,void 0,void 0,(function(){var n,s,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(k||(k=r(["\n mutation createOrderRefundRequest($input: OrderRefundRequestInput!) {\n createOrderRefundRequest(input: $input) {\n billingAddress {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n name\n id\n code\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n cancelledAt\n cancelReason\n createdAt\n currencyCode\n currencyRates {\n rate\n originalRate\n code\n }\n customer {\n lastName\n firstName\n email\n id\n }\n deleted\n id\n merchantId\n note\n orderedAt\n orderAdjustments {\n type\n order\n name\n amountType\n amount\n }\n orderLineItems {\n createdAt\n currencyCode\n deleted\n discount {\n reason\n amountType\n amount\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n variantValueName\n variantValueId\n variantTypeName\n variantTypeId\n order\n }\n }\n }\n orderNumber\n orderPackages {\n updatedAt\n trackingInfo {\n trackingNumber\n trackingLink\n isSendNotification\n cargoCompany\n }\n stockLocationId\n orderPackageNumber\n orderPackageFulfillStatus\n orderLineItemIds\n id\n deleted\n createdAt\n }\n orderPackageStatus\n orderPaymentStatus\n orderTagIds\n shippingAddress {\n taxOffice\n taxNumber\n state {\n name\n id\n code\n }\n postalCode\n phone\n lastName\n isDefault\n identityNumber\n firstName\n district {\n name\n id\n code\n }\n country {\n name\n id\n code\n }\n company\n city {\n id\n code\n name\n }\n addressLine2\n addressLine1\n }\n shippingLines {\n title\n taxValue\n price\n }\n shippingMethod\n status\n taxLines {\n rate\n price\n }\n totalFinalPrice\n totalPrice\n updatedAt\n }\n }\n "],["\n mutation createOrderRefundRequest($input: OrderRefundRequestInput!) {\n createOrderRefundRequest(input: $input) {\n billingAddress {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n name\n id\n code\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n cancelledAt\n cancelReason\n createdAt\n currencyCode\n currencyRates {\n rate\n originalRate\n code\n }\n customer {\n lastName\n firstName\n email\n id\n }\n deleted\n id\n merchantId\n note\n orderedAt\n orderAdjustments {\n type\n order\n name\n amountType\n amount\n }\n orderLineItems {\n createdAt\n currencyCode\n deleted\n discount {\n reason\n amountType\n amount\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n variantValueName\n variantValueId\n variantTypeName\n variantTypeId\n order\n }\n }\n }\n orderNumber\n orderPackages {\n updatedAt\n trackingInfo {\n trackingNumber\n trackingLink\n isSendNotification\n cargoCompany\n }\n stockLocationId\n orderPackageNumber\n orderPackageFulfillStatus\n orderLineItemIds\n id\n deleted\n createdAt\n }\n orderPackageStatus\n orderPaymentStatus\n orderTagIds\n shippingAddress {\n taxOffice\n taxNumber\n state {\n name\n id\n code\n }\n postalCode\n phone\n lastName\n isDefault\n identityNumber\n firstName\n district {\n name\n id\n code\n }\n country {\n name\n id\n code\n }\n company\n city {\n id\n code\n name\n }\n addressLine2\n addressLine1\n }\n shippingLines {\n title\n taxValue\n price\n }\n shippingMethod\n status\n taxLines {\n rate\n price\n }\n totalFinalPrice\n totalPrice\n updatedAt\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:t}})];case 2:return s=e.sent(),d=s.data,(c=s.errors)&&c.length?[2]:d&&d.createOrderRefundRequest?[2,new o(null==d?void 0:d.createOrderRefundRequest)]:[3,4];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2]}}))}))},C.createCustomerEmailSubscription=function(t){return n(this,void 0,void 0,(function(){var n,s,o;return e(this,(function(e){switch(e.label){case 0:n=a(x||(x=r(["\n mutation createCustomerEmailSubscription(\n $input: CreateCustomerEmailSubscriptionInput!\n ) {\n createCustomerEmailSubscription(input: $input) {\n id\n }\n }\n "],["\n mutation createCustomerEmailSubscription(\n $input: CreateCustomerEmailSubscriptionInput!\n ) {\n createCustomerEmailSubscription(input: $input) {\n id\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:{email:t}}})];case 2:return(s=e.sent().errors)&&s.length?[2,!1]:[3,4];case 3:return o=e.sent(),console.log(o),[2,!1];case 4:return[2,!0]}}))}))},C.getLastViewedProducts=function(t){var s;return n(this,void 0,void 0,(function(){var n,o,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(L||(L=r(["\n query getLastViewedProducts($customerId: String) {\n getLastViewedProducts(customerId: $customerId) {\n products {\n productId\n variantId\n }\n }\n }\n "],["\n query getLastViewedProducts($customerId: String) {\n getLastViewedProducts(customerId: $customerId) {\n products {\n productId\n variantId\n }\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{customerId:t}})];case 2:return o=e.sent(),d=o.data,(c=o.errors)&&c.length?[2,[]]:[2,(null===(s=d.getLastViewedProducts)||void 0===s?void 0:s.products)||[]];case 3:return u=e.sent(),console.log(u),[2,[]];case 4:return[2]}}))}))},C.saveLastViewedProducts=function(t){return n(this,void 0,void 0,(function(){var n,s,o;return e(this,(function(e){switch(e.label){case 0:n=a($||($=r(["\n mutation saveLastViewedProducts($input: ProductLastViewedInput!) {\n saveLastViewedProducts(input: $input) {\n id\n }\n }\n "],["\n mutation saveLastViewedProducts($input: ProductLastViewedInput!) {\n saveLastViewedProducts(input: $input) {\n id\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:t}})];case 2:return(s=e.sent().errors)&&s.length?[2,!1]:[3,4];case 3:return o=e.sent(),console.log(o),[2,!1];case 4:return[2,!0]}}))}))},C.getOrderRefundSettings=function(){return n(this,void 0,void 0,(function(){var n,t,s,o,c;return e(this,(function(e){switch(e.label){case 0:n=a(S||(S=r(["\n query listOrderRefundSettings($storefrontId: StringFilterInput!) {\n listOrderRefundSettings(storefrontId: $storefrontId) {\n isActiveRefundSection\n orderRefundDayLimit\n refundDesc\n }\n }\n "],["\n query listOrderRefundSettings($storefrontId: StringFilterInput!) {\n listOrderRefundSettings(storefrontId: $storefrontId) {\n isActiveRefundSection\n orderRefundDayLimit\n refundDesc\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{storefrontId:{eq:u.storefrontId}}})];case 2:return t=e.sent(),s=t.data,(o=t.errors)&&o.length&&console.log(o),s&&s.listOrderRefundSettings.length?[2,new d(s.listOrderRefundSettings[0])]:[3,4];case 3:return c=e.sent(),console.log(c),[3,4];case 4:return[2]}}))}))},C}();export{C as IkasCustomerAPI};
|
|
1
|
+
import{__awaiter as n,__generator as e,__assign as t,__makeTemplateObject as r}from'../../ext/tslib/tslib.es6.js';import a from'../../ext/graphql-tag/src/index.js';import{apollo as i}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import{IkasCustomer as s}from"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import{IkasOrder as o}from"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import{IkasOrderRefundSettings as d}from"../../models/data/order/refund/settings.js";import"../../models/data/product/index.js";import"mobx";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{IkasOrderTransaction as c}from"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/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/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{IkasStorefrontConfig as u}from"../../storefront/index.js";var m,l,p,g,f,y,h,v,N,I,b,k,L,x,$,S,C=function(){function C(){}return C.login=function(o,d){return n(this,void 0,void 0,(function(){var n,c,u,l,p;return e(this,(function(e){switch(e.label){case 0:n=a(m||(m=r(["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n }\n }\n }\n "],["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n }\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{email:o,password:d}})];case 2:return c=e.sent(),u=c.data,(l=c.errors)&&l.length&&console.log(l),u&&u.customerLogin?[2,t(t({},u.customerLogin),{customer:new s(u.customerLogin.customer)})]:[3,4];case 3:return p=e.sent(),console.log(p),[3,4];case 4:return[2]}}))}))},C.socialLogin=function(t){return n(this,void 0,void 0,(function(){var n,o,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(l||(l=r(["\n query customerSocialLogin($code: String!) {\n customerSocialLogin(code: $code) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n }\n }\n }\n "],["\n query customerSocialLogin($code: String!) {\n customerSocialLogin(code: $code) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n }\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{code:t}})];case 2:return o=e.sent(),d=o.data,(c=o.errors)&&c.length&&console.log(c),d&&d.customerSocialLogin.customer?[2,{customer:new s(d.customerSocialLogin.customer),token:d.customerSocialLogin.token,tokenExpiry:d.customerSocialLogin.tokenExpiry}]:[3,4];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2]}}))}))},C.register=function(o,d,c,m,l){return n(this,void 0,void 0,(function(){var n,g,f,y,h;return e(this,(function(e){switch(e.label){case 0:n=a(p||(p=r(["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n $isAcceptMarketing: Boolean\n $locale: String\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n isAcceptMarketing: $isAcceptMarketing\n locale: $locale\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "],["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n $isAcceptMarketing: Boolean\n $locale: String\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n isAcceptMarketing: $isAcceptMarketing\n locale: $locale\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{email:o,password:d,firstName:c,lastName:m,isAcceptMarketing:l,locale:u.getCurrentLocale()}})];case 2:return g=e.sent(),f=g.data,(y=g.errors)&&y.length&&console.log(y),f&&f.registerCustomer?[2,t(t({},f.registerCustomer),{customer:new s(f.registerCustomer.customer)})]:[3,4];case 3:return h=e.sent(),console.log(h),[3,4];case 4:return[2]}}))}))},C.refreshToken=function(t){return n(this,void 0,void 0,(function(){var n,s,o,d,c;return e(this,(function(e){switch(e.label){case 0:n=a(g||(g=r(["\n mutation customerRefreshToken($token: String!) {\n customerRefreshToken(token: $token) {\n token\n tokenExpiry\n }\n }\n "],["\n mutation customerRefreshToken($token: String!) {\n customerRefreshToken(token: $token) {\n token\n tokenExpiry\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{token:t}})];case 2:return s=e.sent(),o=s.data,(d=s.errors)&&d.length&&console.log(d),o?[2,o.customerRefreshToken]:[3,4];case 3:return c=e.sent(),console.log(c),[3,4];case 4:return[2]}}))}))},C.forgotPassword=function(t){return n(this,void 0,void 0,(function(){var n,s,o,d;return e(this,(function(e){switch(e.label){case 0:n=a(f||(f=r(["\n mutation customerForgotPassword($email: String!, $locale: String!) {\n customerForgotPassword(email: $email, locale: $locale)\n }\n "],["\n mutation customerForgotPassword($email: String!, $locale: String!) {\n customerForgotPassword(email: $email, locale: $locale)\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{email:t,locale:u.getCurrentLocale()}})];case 2:return s=e.sent(),(o=s.errors)&&o.length?(console.log(o),[2,!1]):[3,4];case 3:return d=e.sent(),console.log(d),[3,4];case 4:return[2,!0]}}))}))},C.recoverPassword=function(t,s,o){return n(this,void 0,void 0,(function(){var n,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(y||(y=r(["\n mutation customerRecoverPassword(\n $password: String!\n $passwordAgain: String!\n $token: String!\n ) {\n customerRecoverPassword(\n password: $password\n passwordAgain: $passwordAgain\n token: $token\n )\n }\n "],["\n mutation customerRecoverPassword(\n $password: String!\n $passwordAgain: String!\n $token: String!\n ) {\n customerRecoverPassword(\n password: $password\n passwordAgain: $passwordAgain\n token: $token\n )\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{password:t,passwordAgain:s,token:o}})];case 2:return d=e.sent(),(c=d.errors)&&c.length?(console.log(c),[2,!1]):[3,4];case 3:return u=e.sent(),console.log(u),[2,!1];case 4:return[2,!0]}}))}))},C.checkEmail=function(t){return n(this,void 0,void 0,(function(){var n,s,o,d,c;return e(this,(function(e){switch(e.label){case 0:n=a(h||(h=r(["\n query checkCustomerEmail($email: String!) {\n checkCustomerEmail(email: $email) {\n exists\n }\n }\n "],["\n query checkCustomerEmail($email: String!) {\n checkCustomerEmail(email: $email) {\n exists\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{email:t}})];case 2:return s=e.sent(),o=s.data,(d=s.errors)&&d.length&&console.log(d),o&&o.checkCustomerEmail?[2,o.checkCustomerEmail.exists]:[3,4];case 3:return c=e.sent(),console.log(c),[3,4];case 4:return[2,!1]}}))}))},C.getCustomer=function(){return n(this,void 0,void 0,(function(){var n,t,o,d,c;return e(this,(function(e){switch(e.label){case 0:n=a(v||(v=r(["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "],["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n})];case 2:return t=e.sent(),o=t.data,(d=t.errors)&&d.length&&console.log(d),o&&o.getMyCustomer?[2,new s(o.getMyCustomer)]:[3,4];case 3:return c=e.sent(),console.log(c),[3,4];case 4:return[2]}}))}))},C.saveCustomer=function(t){return n(this,void 0,void 0,(function(){var n,o,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(N||(N=r(["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n identityNumber\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "],["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n iso2\n iso3\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n identityNumber\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:{firstName:t.firstName,lastName:t.lastName,addresses:t.addresses,phone:t.phone}}})];case 2:return o=e.sent(),d=o.data,(c=o.errors)&&c.length&&console.log(c),d&&d.saveMyCustomer?[2,new s(d.saveMyCustomer)]:[3,4];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2]}}))}))},C.getOrders=function(t){return n(this,void 0,void 0,(function(){var n,s,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(I||(I=r(["\n query getCustomerOrders($orderId: String) {\n getCustomerOrders(orderId: $orderId) {\n billingAddress {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n name\n id\n code\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n cancelledAt\n cancelReason\n createdAt\n currencyCode\n currencyRates {\n rate\n originalRate\n code\n }\n customer {\n lastName\n firstName\n email\n id\n }\n deleted\n id\n merchantId\n note\n orderedAt\n orderAdjustments {\n type\n order\n name\n amountType\n amount\n }\n orderLineItems {\n createdAt\n currencyCode\n deleted\n discount {\n reason\n amountType\n amount\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n variantValueName\n variantValueId\n variantTypeName\n variantTypeId\n order\n }\n }\n options {\n name\n productOptionId\n productOptionsSetId\n type\n values {\n name\n price\n value\n }\n }\n }\n orderNumber\n orderPackages {\n updatedAt\n trackingInfo {\n trackingNumber\n trackingLink\n isSendNotification\n cargoCompany\n }\n stockLocationId\n orderPackageNumber\n orderPackageFulfillStatus\n orderLineItemIds\n id\n deleted\n createdAt\n }\n orderPackageStatus\n orderPaymentStatus\n orderTagIds\n shippingAddress {\n taxOffice\n taxNumber\n state {\n name\n id\n code\n }\n postalCode\n phone\n lastName\n isDefault\n identityNumber\n firstName\n district {\n name\n id\n code\n }\n country {\n name\n id\n code\n }\n company\n city {\n id\n code\n name\n }\n addressLine2\n addressLine1\n }\n shippingLines {\n title\n taxValue\n price\n }\n shippingMethod\n status\n taxLines {\n rate\n price\n }\n totalFinalPrice\n totalPrice\n updatedAt\n }\n }\n "],["\n query getCustomerOrders($orderId: String) {\n getCustomerOrders(orderId: $orderId) {\n billingAddress {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n name\n id\n code\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n cancelledAt\n cancelReason\n createdAt\n currencyCode\n currencyRates {\n rate\n originalRate\n code\n }\n customer {\n lastName\n firstName\n email\n id\n }\n deleted\n id\n merchantId\n note\n orderedAt\n orderAdjustments {\n type\n order\n name\n amountType\n amount\n }\n orderLineItems {\n createdAt\n currencyCode\n deleted\n discount {\n reason\n amountType\n amount\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n variantValueName\n variantValueId\n variantTypeName\n variantTypeId\n order\n }\n }\n options {\n name\n productOptionId\n productOptionsSetId\n type\n values {\n name\n price\n value\n }\n }\n }\n orderNumber\n orderPackages {\n updatedAt\n trackingInfo {\n trackingNumber\n trackingLink\n isSendNotification\n cargoCompany\n }\n stockLocationId\n orderPackageNumber\n orderPackageFulfillStatus\n orderLineItemIds\n id\n deleted\n createdAt\n }\n orderPackageStatus\n orderPaymentStatus\n orderTagIds\n shippingAddress {\n taxOffice\n taxNumber\n state {\n name\n id\n code\n }\n postalCode\n phone\n lastName\n isDefault\n identityNumber\n firstName\n district {\n name\n id\n code\n }\n country {\n name\n id\n code\n }\n company\n city {\n id\n code\n name\n }\n addressLine2\n addressLine1\n }\n shippingLines {\n title\n taxValue\n price\n }\n shippingMethod\n status\n taxLines {\n rate\n price\n }\n totalFinalPrice\n totalPrice\n updatedAt\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:t?{orderId:t}:{}})];case 2:return s=e.sent(),d=s.data,(c=s.errors)&&c.length&&console.log(c),d&&d.getCustomerOrders?[2,d.getCustomerOrders.map((function(n){return new o(n)}))]:[3,4];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2]}}))}))},C.getOrderTransactions=function(t){return n(this,void 0,void 0,(function(){var n,s,o,d,u;return e(this,(function(e){switch(e.label){case 0:n=a(b||(b=r(["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "],["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{checkoutId:(null==t?void 0:t.checkoutId)?{eq:t.checkoutId}:void 0,id:(null==t?void 0:t.id)?{eq:t.id}:void 0,orderId:(null==t?void 0:t.orderId)?{eq:t.orderId}:void 0}})];case 2:return s=e.sent(),o=s.data,d=s.errors,Array.isArray(d)&&d.length?[2,[]]:[2,o.listOrderTransactions.map((function(n){return new c(n)}))];case 3:return u=e.sent(),console.log(u),[2,[]];case 4:return[2]}}))}))},C.saveIkasOrderRefund=function(t){return n(this,void 0,void 0,(function(){var n,s,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(k||(k=r(["\n mutation createOrderRefundRequest($input: OrderRefundRequestInput!) {\n createOrderRefundRequest(input: $input) {\n billingAddress {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n name\n id\n code\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n cancelledAt\n cancelReason\n createdAt\n currencyCode\n currencyRates {\n rate\n originalRate\n code\n }\n customer {\n lastName\n firstName\n email\n id\n }\n deleted\n id\n merchantId\n note\n orderedAt\n orderAdjustments {\n type\n order\n name\n amountType\n amount\n }\n orderLineItems {\n createdAt\n currencyCode\n deleted\n discount {\n reason\n amountType\n amount\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n variantValueName\n variantValueId\n variantTypeName\n variantTypeId\n order\n }\n }\n }\n orderNumber\n orderPackages {\n updatedAt\n trackingInfo {\n trackingNumber\n trackingLink\n isSendNotification\n cargoCompany\n }\n stockLocationId\n orderPackageNumber\n orderPackageFulfillStatus\n orderLineItemIds\n id\n deleted\n createdAt\n }\n orderPackageStatus\n orderPaymentStatus\n orderTagIds\n shippingAddress {\n taxOffice\n taxNumber\n state {\n name\n id\n code\n }\n postalCode\n phone\n lastName\n isDefault\n identityNumber\n firstName\n district {\n name\n id\n code\n }\n country {\n name\n id\n code\n }\n company\n city {\n id\n code\n name\n }\n addressLine2\n addressLine1\n }\n shippingLines {\n title\n taxValue\n price\n }\n shippingMethod\n status\n taxLines {\n rate\n price\n }\n totalFinalPrice\n totalPrice\n updatedAt\n }\n }\n "],["\n mutation createOrderRefundRequest($input: OrderRefundRequestInput!) {\n createOrderRefundRequest(input: $input) {\n billingAddress {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n name\n id\n code\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n cancelledAt\n cancelReason\n createdAt\n currencyCode\n currencyRates {\n rate\n originalRate\n code\n }\n customer {\n lastName\n firstName\n email\n id\n }\n deleted\n id\n merchantId\n note\n orderedAt\n orderAdjustments {\n type\n order\n name\n amountType\n amount\n }\n orderLineItems {\n createdAt\n currencyCode\n deleted\n discount {\n reason\n amountType\n amount\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n variantValueName\n variantValueId\n variantTypeName\n variantTypeId\n order\n }\n }\n }\n orderNumber\n orderPackages {\n updatedAt\n trackingInfo {\n trackingNumber\n trackingLink\n isSendNotification\n cargoCompany\n }\n stockLocationId\n orderPackageNumber\n orderPackageFulfillStatus\n orderLineItemIds\n id\n deleted\n createdAt\n }\n orderPackageStatus\n orderPaymentStatus\n orderTagIds\n shippingAddress {\n taxOffice\n taxNumber\n state {\n name\n id\n code\n }\n postalCode\n phone\n lastName\n isDefault\n identityNumber\n firstName\n district {\n name\n id\n code\n }\n country {\n name\n id\n code\n }\n company\n city {\n id\n code\n name\n }\n addressLine2\n addressLine1\n }\n shippingLines {\n title\n taxValue\n price\n }\n shippingMethod\n status\n taxLines {\n rate\n price\n }\n totalFinalPrice\n totalPrice\n updatedAt\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:t}})];case 2:return s=e.sent(),d=s.data,(c=s.errors)&&c.length?[2]:d&&d.createOrderRefundRequest?[2,new o(null==d?void 0:d.createOrderRefundRequest)]:[3,4];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2]}}))}))},C.createCustomerEmailSubscription=function(t){return n(this,void 0,void 0,(function(){var n,s,o;return e(this,(function(e){switch(e.label){case 0:n=a(L||(L=r(["\n mutation createCustomerEmailSubscription(\n $input: CreateCustomerEmailSubscriptionInput!\n ) {\n createCustomerEmailSubscription(input: $input) {\n id\n }\n }\n "],["\n mutation createCustomerEmailSubscription(\n $input: CreateCustomerEmailSubscriptionInput!\n ) {\n createCustomerEmailSubscription(input: $input) {\n id\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:{email:t}}})];case 2:return(s=e.sent().errors)&&s.length?[2,!1]:[3,4];case 3:return o=e.sent(),console.log(o),[2,!1];case 4:return[2,!0]}}))}))},C.getLastViewedProducts=function(t){var s;return n(this,void 0,void 0,(function(){var n,o,d,c,u;return e(this,(function(e){switch(e.label){case 0:n=a(x||(x=r(["\n query getLastViewedProducts($customerId: String) {\n getLastViewedProducts(customerId: $customerId) {\n products {\n productId\n variantId\n }\n }\n }\n "],["\n query getLastViewedProducts($customerId: String) {\n getLastViewedProducts(customerId: $customerId) {\n products {\n productId\n variantId\n }\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{customerId:t}})];case 2:return o=e.sent(),d=o.data,(c=o.errors)&&c.length?[2,[]]:[2,(null===(s=d.getLastViewedProducts)||void 0===s?void 0:s.products)||[]];case 3:return u=e.sent(),console.log(u),[2,[]];case 4:return[2]}}))}))},C.saveLastViewedProducts=function(t){return n(this,void 0,void 0,(function(){var n,s,o;return e(this,(function(e){switch(e.label){case 0:n=a($||($=r(["\n mutation saveLastViewedProducts($input: ProductLastViewedInput!) {\n saveLastViewedProducts(input: $input) {\n id\n }\n }\n "],["\n mutation saveLastViewedProducts($input: ProductLastViewedInput!) {\n saveLastViewedProducts(input: $input) {\n id\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:t}})];case 2:return(s=e.sent().errors)&&s.length?[2,!1]:[3,4];case 3:return o=e.sent(),console.log(o),[2,!1];case 4:return[2,!0]}}))}))},C.getOrderRefundSettings=function(){return n(this,void 0,void 0,(function(){var n,t,s,o,c;return e(this,(function(e){switch(e.label){case 0:n=a(S||(S=r(["\n query listOrderRefundSettings($storefrontId: StringFilterInput!) {\n listOrderRefundSettings(storefrontId: $storefrontId) {\n isActiveRefundSection\n orderRefundDayLimit\n refundDesc\n }\n }\n "],["\n query listOrderRefundSettings($storefrontId: StringFilterInput!) {\n listOrderRefundSettings(storefrontId: $storefrontId) {\n isActiveRefundSection\n orderRefundDayLimit\n refundDesc\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{storefrontId:{eq:u.storefrontId}}})];case 2:return t=e.sent(),s=t.data,(o=t.errors)&&o.length&&console.log(o),s&&s.listOrderRefundSettings.length?[2,new d(s.listOrderRefundSettings[0])]:[3,4];case 3:return c=e.sent(),console.log(c),[3,4];case 4:return[2]}}))}))},C}();export{C as IkasCustomerAPI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__makeTemplateObject as i,__assign as o}from'../../ext/tslib/tslib.es6.js';import n from'../../ext/graphql-tag/src/index.js';import{apollo as r}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import{IkasCustomerReview as s}from"../../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"../../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/
|
|
1
|
+
import{__awaiter as t,__generator as e,__makeTemplateObject as i,__assign as o}from'../../ext/tslib/tslib.es6.js';import n from'../../ext/graphql-tag/src/index.js';import{apollo as r}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import{IkasCustomerReview as s}from"../../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"../../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/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/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";var a,d,m=function(){function m(){}return m.listCustomerReviews=function(o){return t(this,void 0,void 0,(function(){var t,d,m,u,l;return e(this,(function(e){switch(e.label){case 0:t=n(a||(a=i(["\n query listCustomerReviews(\n $input: ListCustomerReviewInput!\n $productId: String\n $pagination: PaginationInput\n ) {\n listCustomerReviews(\n input: $input\n productId: $productId\n pagination: $pagination\n ) {\n count\n data {\n comment\n createdAt\n id\n star\n title\n }\n hasNext\n limit\n page\n }\n }\n "],["\n query listCustomerReviews(\n $input: ListCustomerReviewInput!\n $productId: String\n $pagination: PaginationInput\n ) {\n listCustomerReviews(\n input: $input\n productId: $productId\n pagination: $pagination\n ) {\n count\n data {\n comment\n createdAt\n id\n star\n title\n }\n hasNext\n limit\n page\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,r.getClient().query({query:t,variables:{input:{salesChannelId:o.salesChannelId},productId:o.productId,pagination:{page:o.page,limit:o.limit}}})];case 2:return d=e.sent(),m=d.data,(u=d.errors)&&u.length?[2,{data:[],count:0}]:[2,{data:m.listCustomerReviews.data.map((function(t){return new s(t)})),count:m.listCustomerReviews.count}];case 3:return l=e.sent(),console.log(l),[2,{data:[],count:0}];case 4:return[2]}}))}))},m.createCustomerReview=function(s){return t(this,void 0,void 0,(function(){var t,a,m,u,l;return e(this,(function(e){switch(e.label){case 0:t=n(d||(d=i(["\n mutation createCustomerReview($input: CreateCustomerReviewInput!) {\n createCustomerReview(input: $input) {\n id\n }\n }\n "],["\n mutation createCustomerReview($input: CreateCustomerReviewInput!) {\n createCustomerReview(input: $input) {\n id\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,r.getClient().mutate({mutation:t,variables:{input:o({},s)}})];case 2:return a=e.sent(),m=a.data,(u=a.errors)&&u.length?[2,!1]:[2,null==m?void 0:m.createCustomerReview];case 3:return l=e.sent(),console.log(l),[3,4];case 4:return[2]}}))}))},m}();export{m as IkasCustomerReviewAPI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as o,__makeTemplateObject as e}from'../../ext/tslib/tslib.es6.js';import r from'../../ext/graphql-tag/src/index.js';import{apollo as i}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../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"../../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{IkasFavoriteProduct as d}from"../../models/data/favorite-product/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/
|
|
1
|
+
import{__awaiter as t,__generator as o,__makeTemplateObject as e}from'../../ext/tslib/tslib.es6.js';import r from'../../ext/graphql-tag/src/index.js';import{apollo as i}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../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"../../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{IkasFavoriteProduct as d}from"../../models/data/favorite-product/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/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/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";var s,a,n,m=function(){function m(){}return m.listFavoriteProducts=function(){return t(this,void 0,void 0,(function(){var t,a,n,m,u;return o(this,(function(o){switch(o.label){case 0:t=r(s||(s=e(["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "],["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "]))),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.getClient().query({query:t})];case 2:return a=o.sent(),n=a.data,(m=a.errors)&&m.length?[2,[]]:[2,n.listFavoriteProducts.map((function(t){return new d(t)}))];case 3:return u=o.sent(),console.log(u),[3,4];case 4:return[2,[]]}}))}))},m.isFavoriteProduct=function(d){return t(this,void 0,void 0,(function(){var t,s,n,m,u;return o(this,(function(o){switch(o.label){case 0:t=r(a||(a=e(["\n query isFavoriteProduct($productId: String!) {\n isFavoriteProduct(productId: $productId)\n }\n "],["\n query isFavoriteProduct($productId: String!) {\n isFavoriteProduct(productId: $productId)\n }\n "]))),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.getClient().query({query:t,variables:{productId:d}})];case 2:return s=o.sent(),n=s.data,(m=s.errors)&&m.length?[2,!1]:[2,n.isFavoriteProduct];case 3:return u=o.sent(),console.log(u),[3,4];case 4:return[2,!1]}}))}))},m.saveFavoriteProduct=function(d,s){return t(this,void 0,void 0,(function(){var t,a,m,u,l;return o(this,(function(o){switch(o.label){case 0:t=r(n||(n=e(["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "],["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "]))),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:t,variables:{isFavorite:d,productId:s}})];case 2:return a=o.sent(),m=a.data,(u=a.errors)&&u.length?[2,!1]:[2,(null==m?void 0:m.saveFavoriteProduct)||!0];case 3:return l=o.sent(),console.log(l),[3,4];case 4:return[2,!1]}}))}))},m}();export{m as IkasFavoriteProductAPI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__makeTemplateObject as i}from'../../ext/tslib/tslib.es6.js';import o from'../../ext/graphql-tag/src/index.js';import{apollo as r}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import{IkasHTMLMetaData as a}from"../../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"../../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/
|
|
1
|
+
import{__awaiter as t,__generator as e,__makeTemplateObject as i}from'../../ext/tslib/tslib.es6.js';import o from'../../ext/graphql-tag/src/index.js';import{apollo as r}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import{IkasHTMLMetaData as a}from"../../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"../../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/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/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";var d,s=function(){function s(){}return s.listHTMLMetaData=function(s,n,m,l,p){return void 0===l&&(l=1),void 0===p&&(p=200),t(this,void 0,void 0,(function(){var t,u,g,j,c;return e(this,(function(e){switch(e.label){case 0:t=o(d||(d=i(["\n query listHTMLMetaData(\n $slug: StringFilterInput\n $targetId: StringFilterInput\n $targetType: HTMLMetaDataTargetTypeEnumFilter\n $pagination: PaginationInput\n ) {\n listHTMLMetaData(\n slug: $slug\n targetId: $targetId\n targetType: $targetType\n pagination: $pagination\n ) {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n "],["\n query listHTMLMetaData(\n $slug: StringFilterInput\n $targetId: StringFilterInput\n $targetType: HTMLMetaDataTargetTypeEnumFilter\n $pagination: PaginationInput\n ) {\n listHTMLMetaData(\n slug: $slug\n targetId: $targetId\n targetType: $targetType\n pagination: $pagination\n ) {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,r.getClient().query({query:t,variables:{slug:s?{eq:s}:void 0,targetId:n?{in:n}:void 0,targetType:m?{in:m}:void 0,pagination:{page:l,limit:p}}})];case 2:return u=e.sent(),g=u.data,(j=u.errors)&&j.length?[2,[]]:[2,g.listHTMLMetaData.map((function(t){return new a(t)}))];case 3:return c=e.sent(),console.log(c),[2,[]];case 4:return[2]}}))}))},s}();export{s as IkasHTMLMetaDataAPI};
|
package/build/api/index.d.ts
CHANGED
|
@@ -20,5 +20,4 @@ export { IkasProductOptionSetAPI } from "./product-option-set";
|
|
|
20
20
|
export { IkasRaffleAPI } from "./raffle";
|
|
21
21
|
export type { IkasListRaffleParams } from "./raffle";
|
|
22
22
|
export { IkasProductBackInStockReminderAPI } from "./back-in-stock-reminder";
|
|
23
|
-
export { IkasProductCampaignAPI } from "./product-campanign";
|
|
24
23
|
export { apollo } from "./apollo";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__makeTemplateObject as o}from'../../ext/tslib/tslib.es6.js';import i from'../../ext/graphql-tag/src/index.js';import{apollo as r}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../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{IkasMerchantSettings as s}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"mobx";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/
|
|
1
|
+
import{__awaiter as t,__generator as e,__makeTemplateObject as o}from'../../ext/tslib/tslib.es6.js';import i from'../../ext/graphql-tag/src/index.js';import{apollo as r}from"../apollo.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../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{IkasMerchantSettings as s}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"mobx";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/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/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";var d,m=function(){function m(){}return m.listMerchantSettings=function(){return t(this,void 0,void 0,(function(){var t,m,a,n;return e(this,(function(e){switch(e.label){case 0:t=i(d||(d=o(["\n query listMerchantSettings {\n listMerchantSettings {\n id\n logoId\n merchantName\n }\n }\n "],["\n query listMerchantSettings {\n listMerchantSettings {\n id\n logoId\n merchantName\n }\n }\n "]))),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,r.getClient().query({query:t})];case 2:return m=e.sent(),a=m.data,(n=m.errors)&&n.length||!a||!a.listMerchantSettings.length?[2]:[2,new s(a.listMerchantSettings[0])];case 3:return e.sent(),[3,4];case 4:return[2]}}))}))},m}();export{m as IkasMerchantAPI};
|
|
@@ -3,8 +3,6 @@ export interface ListProductOptionSet_listProductOptionSet_options_dateSettings
|
|
|
3
3
|
__typename: "ProductOptionDateSettings";
|
|
4
4
|
max: any | null;
|
|
5
5
|
min: any | null;
|
|
6
|
-
minRelativeNextDate: number | null;
|
|
7
|
-
maxRelativeNextDate: number | null;
|
|
8
6
|
}
|
|
9
7
|
export interface ListProductOptionSet_listProductOptionSet_options_fileSettings {
|
|
10
8
|
__typename: "ProductOptionFileSettings";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as i,__makeTemplateObject as o}from'../../ext/tslib/tslib.es6.js';import n from'../../ext/graphql-tag/src/index.js';import{apollo as r}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{IkasHTMLMetaData as u}from"../../models/data/html-meta-data/index.js";import{IkasImage as m}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"mobx";import{IkasProduct as p}from"../../models/data/product/index.js";import{IkasProductVariantType as c}from"../../models/data/product/variant-type/index.js";import{IkasProductVariant as v}from"../../models/data/product/variant/index.js";import{IkasProductPrice as f}from"../../models/data/product/variant/price/index.js";import{IkasProductAttribute as g}from"../../models/data/product-attribute/index.js";import{IkasProductAttributeValue as b}from"../../models/data/product/attribute-value/index.js";import{IkasProductFilter as y,IkasApplicableProductFilterValue as j,IkasProductFilterSettings as x}from"../../models/data/product-filter/index.js";import{IkasVariantType as h}from"../../models/data/variant-type/index.js";import{IkasVariantValue as I}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/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/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 w}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasProductTag as T}from"../../models/data/product-tag/index.js";import{IkasStorefrontConfig as A}from"../../storefront/index.js";import{IkasProductAttributeTableTemplate as D}from"../../models/data/product-attribute/product-attribute-table-template/index.js";var C,k,P=function(){function P(){}return P.searchProducts=function(l,y){return void 0===y&&(y=!1),t(this,void 0,void 0,(function(){var t,j,x,k,P;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=n(C||(C=o(["\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,r.getClient().query({query:t,variables:{input:i(i({},l),{showStockOption:y?A.stockPreference:w.SHOW_ALL,locale:A.getCurrentLocale()})}})];case 1:return j=e.sent(),x=j.data,(k=j.errors)&&k.length?(console.log(k),[2]):[2,i(i({},x.searchProducts),{data:x.searchProducts.data.map((function(t){return function(t){var e,i,o,n,r,l,y="local"===process.env.NEXT_PUBLIC_ENV;return new p({id:t.id,attributes:null===(e=t.attributes)||void 0===e?void 0:e.map((function(t){var e,i,o,n,r,a;return new b({value:t.value,productAttributeId:null===(e=t.productAttribute)||void 0===e?void 0:e.id,productAttributeOptionId:null===(i=t.productAttributeOption)||void 0===i?void 0:i.id,productAttribute:new g({id:null===(o=t.productAttribute)||void 0===o?void 0:o.id,name:null===(n=t.productAttribute)||void 0===n?void 0:n.name,type:null===(r=t.productAttribute)||void 0===r?void 0:r.type,tableTemplate:(null===(a=t.productAttribute)||void 0===a?void 0:a.tableTemplate)?new D(t.productAttribute.tableTemplate):null}),productAttributeOption:t.productAttributeOption})})),brand:new a({id:null===(i=t.brand)||void 0===i?void 0:i.id,name:null===(o=t.brand)||void 0===o?void 0:o.name,metaData:new u({slug:(null===(n=t.brand)||void 0===n?void 0:n.slug)||""})}),categories:null===(r=t.categories)||void 0===r?void 0:r.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 T({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 c({variantType:new h({id:t.variantType.id,name:t.variantType.name,selectionType:t.variantType.selectionType,values:t.variantType.values.map((function(e){return new I({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 i,o,n,r;return new v({id:e.id,productId:t.id,attributes:null===(i=e.attributes)||void 0===i?void 0:i.map((function(t){var e,i,o,n,r,a;return new b({value:t.value,productAttributeId:null===(e=t.productAttribute)||void 0===e?void 0:e.id,productAttributeOptionId:null===(i=t.productAttributeOption)||void 0===i?void 0:i.id,productAttribute:new g({id:null===(o=t.productAttribute)||void 0===o?void 0:o.id,name:null===(n=t.productAttribute)||void 0===n?void 0:n.name,type:null===(r=t.productAttribute)||void 0===r?void 0:r.type,tableTemplate:(null===(a=t.productAttribute)||void 0===a?void 0:a.tableTemplate)?new D(t.productAttribute.tableTemplate):null}),productAttributeOption:t.productAttributeOption})})),sku:e.sku,barcodeList:e.barcodeList||void 0,images:null===(o=e.images)||void 0===o?void 0:o.map((function(t){return new m(t.id)})),price:new f(null===(n=e.prices)||void 0===n?void 0:n.find((function(t){return A.priceListId?t.priceListId===A.priceListId:null===t.priceListId}))),stock:e.stocks.filter((function(t){var e;return y||A.isEditor||(null===(e=A.stockLocationIds)||void 0===e?void 0:e.includes(t.stockLocationId))})).reduce((function(t,e){return e.stockCount+t}),0)||0,variantValues:null===(r=e.variantValues)||void 0===r?void 0:r.map((function(e){var i=t.productVariantTypes.find((function(t){return t.variantType.id===e.variantTypeId})),o=null==i?void 0:i.variantType.values.find((function(t){return t.id===e.variantValueId}));return new I({id:e.variantValueId,name:null==o?void 0:o.name,colorCode:null==o?void 0:o.colorCode,thumbnailImageId:null==o?void 0:o.thumbnailImageId,variantTypeId:null==i?void 0:i.variantType.id})})),isActive:e.isActive})}))})}(t)}))})];case 2:return P=e.sent(),console.log(P),[3,3];case 3:return[2]}}))}))},P.getProductFilterData=function(a){return t(this,void 0,void 0,(function(){var t,d,s,u,m;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=n(k||(k=o(["\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,r.getClient().query({query:t,variables:{categoryId:a||null,locale:A.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 y(i(i({},t),{displayType:t.displayType,type:t.type,values:null===(e=t.values)||void 0===e?void 0:e.map((function(t){return new j(t)})),settings:t.settings?new x(i(i({},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 m=e.sent(),console.log(m),[3,3];case 3:return[2]}}))}))},P}();export{P as IkasProductSearchAPI};
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as i,__makeTemplateObject as o}from'../../ext/tslib/tslib.es6.js';import n from'../../ext/graphql-tag/src/index.js';import{apollo as r}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{IkasHTMLMetaData as u}from"../../models/data/html-meta-data/index.js";import{IkasImage as m}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"mobx";import{IkasProduct as p}from"../../models/data/product/index.js";import{IkasProductVariantType as c}from"../../models/data/product/variant-type/index.js";import{IkasProductVariant as v}from"../../models/data/product/variant/index.js";import{IkasProductPrice as f}from"../../models/data/product/variant/price/index.js";import{IkasProductAttribute as g}from"../../models/data/product-attribute/index.js";import{IkasProductAttributeValue as b}from"../../models/data/product/attribute-value/index.js";import{IkasProductFilter as y,IkasApplicableProductFilterValue as j,IkasProductFilterSettings as x}from"../../models/data/product-filter/index.js";import{IkasVariantType as h}from"../../models/data/variant-type/index.js";import{IkasVariantValue as I}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/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/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 w}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasProductTag as T}from"../../models/data/product-tag/index.js";import{IkasStorefrontConfig as A}from"../../storefront/index.js";import{IkasProductAttributeTableTemplate as D}from"../../models/data/product-attribute/product-attribute-table-template/index.js";var C,k,P=function(){function P(){}return P.searchProducts=function(l,y){return void 0===y&&(y=!1),t(this,void 0,void 0,(function(){var t,j,x,k,P;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=n(C||(C=o(["\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,r.getClient().query({query:t,variables:{input:i(i({},l),{showStockOption:y?A.stockPreference:w.SHOW_ALL,locale:A.getCurrentLocale()})}})];case 1:return j=e.sent(),x=j.data,(k=j.errors)&&k.length?(console.log(k),[2]):[2,i(i({},x.searchProducts),{data:x.searchProducts.data.map((function(t){return function(t){var e,i,o,n,r,l,y="local"===process.env.NEXT_PUBLIC_ENV;return new p({id:t.id,attributes:null===(e=t.attributes)||void 0===e?void 0:e.map((function(t){var e,i,o,n,r,a;return new b({value:t.value,productAttributeId:null===(e=t.productAttribute)||void 0===e?void 0:e.id,productAttributeOptionId:null===(i=t.productAttributeOption)||void 0===i?void 0:i.id,productAttribute:new g({id:null===(o=t.productAttribute)||void 0===o?void 0:o.id,name:null===(n=t.productAttribute)||void 0===n?void 0:n.name,type:null===(r=t.productAttribute)||void 0===r?void 0:r.type,tableTemplate:(null===(a=t.productAttribute)||void 0===a?void 0:a.tableTemplate)?new D(t.productAttribute.tableTemplate):null}),productAttributeOption:t.productAttributeOption})})),brand:new a({id:null===(i=t.brand)||void 0===i?void 0:i.id,name:null===(o=t.brand)||void 0===o?void 0:o.name,metaData:new u({slug:(null===(n=t.brand)||void 0===n?void 0:n.slug)||""})}),categories:null===(r=t.categories)||void 0===r?void 0:r.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 T({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 c({variantType:new h({id:t.variantType.id,name:t.variantType.name,selectionType:t.variantType.selectionType,values:t.variantType.values.map((function(e){return new I({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 i,o,n,r;return new v({id:e.id,productId:t.id,attributes:null===(i=e.attributes)||void 0===i?void 0:i.map((function(t){var e,i,o,n,r,a;return new b({value:t.value,productAttributeId:null===(e=t.productAttribute)||void 0===e?void 0:e.id,productAttributeOptionId:null===(i=t.productAttributeOption)||void 0===i?void 0:i.id,productAttribute:new g({id:null===(o=t.productAttribute)||void 0===o?void 0:o.id,name:null===(n=t.productAttribute)||void 0===n?void 0:n.name,type:null===(r=t.productAttribute)||void 0===r?void 0:r.type,tableTemplate:(null===(a=t.productAttribute)||void 0===a?void 0:a.tableTemplate)?new D(t.productAttribute.tableTemplate):null}),productAttributeOption:t.productAttributeOption})})),sku:e.sku,barcodeList:e.barcodeList||void 0,images:null===(o=e.images)||void 0===o?void 0:o.map((function(t){return new m(t.id)})),price:new f(null===(n=e.prices)||void 0===n?void 0:n.find((function(t){return A.priceListId?t.priceListId===A.priceListId:null===t.priceListId}))),stock:e.stocks.filter((function(t){var e;return y||A.isEditor||(null===(e=A.stockLocationIds)||void 0===e?void 0:e.includes(t.stockLocationId))})).reduce((function(t,e){return e.stockCount+t}),0)||0,variantValues:null===(r=e.variantValues)||void 0===r?void 0:r.map((function(e){var i=t.productVariantTypes.find((function(t){return t.variantType.id===e.variantTypeId})),o=null==i?void 0:i.variantType.values.find((function(t){return t.id===e.variantValueId}));return new I({id:e.variantValueId,name:null==o?void 0:o.name,colorCode:null==o?void 0:o.colorCode,thumbnailImageId:null==o?void 0:o.thumbnailImageId,variantTypeId:null==i?void 0:i.variantType.id})})),isActive:e.isActive})}))})}(t)}))})];case 2:return P=e.sent(),console.log(P),[3,3];case 3:return[2]}}))}))},P.getProductFilterData=function(a){return t(this,void 0,void 0,(function(){var t,d,s,u,m;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=n(k||(k=o(["\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,r.getClient().query({query:t,variables:{categoryId:a||null,locale:A.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 y(i(i({},t),{displayType:t.displayType,type:t.type,values:null===(e=t.values)||void 0===e?void 0:e.map((function(t){return new j(t)})),settings:t.settings?new x(i(i({},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 m=e.sent(),console.log(m),[3,3];case 3:return[2]}}))}))},P}();export{P 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{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"../../../../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"../../../../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"../../../../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-campanign/index.js";import{stringSorter as a}from"../../../../utils/helper.js";import{IkasStorefrontConfig as d}from"../../../../storefront/index.js";import"../../../../utils/i18n.js";var l=function(){function l(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.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(l.prototype,"firstName",{get:function(){return this.address.firstName},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"lastName",{get:function(){return this.address.lastName},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"phone",{get:function(){return this.address.phone},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"identityNumber",{get:function(){return this.address.identityNumber},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"country",{get:function(){return this.address.country},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"state",{get:function(){return this.address.state},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"city",{get:function(){return this.address.city},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"district",{get:function(){return this.address.district},enumerable:!1,configurable:!0}),Object.defineProperty(l.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(l.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(l.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(l.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(l.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),l}();export{l 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{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"../../../../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/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/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{stringSorter as a}from"../../../../utils/helper.js";import{IkasStorefrontConfig as d}from"../../../../storefront/index.js";import"../../../../utils/i18n.js";var l=function(){function l(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.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(l.prototype,"firstName",{get:function(){return this.address.firstName},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"lastName",{get:function(){return this.address.lastName},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"phone",{get:function(){return this.address.phone},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"identityNumber",{get:function(){return this.address.identityNumber},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"country",{get:function(){return this.address.country},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"state",{get:function(){return this.address.state},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"city",{get:function(){return this.address.city},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"district",{get:function(){return this.address.district},enumerable:!1,configurable:!0}),Object.defineProperty(l.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(l.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(l.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(l.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(l.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),l}();export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";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"../../../../../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{IkasProductOptionType as i}from"../../../../../models/data/product-option-set/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";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"../../../../../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{IkasProductOptionType as i}from"../../../../../models/data/product-option-set/index.js";import"../../../../../models/data/raffle/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/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{formatDate as a}from"../../../../../utils/helper.js";import{formatMoney as o}from"../../../../../utils/currency.js";import{useTranslation as r}from"../../../../../utils/i18n.js";import{Modal as m}from"../../modal/index.js";import s from"./style.module.scss.js";var n=t((function(t){var n,d,l,c=t.vm,u=t.currencyCode,p=t.cartItem,v=r().t,j=e.useState(!1),f=j[0],x=j[1],E=null===(n=c.checkout.adjustments)||void 0===n?void 0:n.map((function(e){var t;return(null===(t=e.appliedOrderLines)||void 0===t?void 0:t.filter((function(e){return e.orderLineId===p.id})).reduce((function(e,t){return e+(t.amount||0)}),0))||0})),N=null==E?void 0:E.reduce((function(e,t){return e+t}),0),h=e.useMemo((function(){var t;return e.createElement("div",null,null===(t=p.options)||void 0===t?void 0:t.map((function(t){switch(t.type){case i.TEXT:case i.TEXT_AREA:case i.CHOICE:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.map((function(e){return e.name||e.value})).join(", ")));case i.DATE_PICKER:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.map((function(e){return t=e.value,(i=a(new Date(t)).split(" ")).splice(-1),i.join(" ");var t,i})).join(", ")));case i.CHECKBOX:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.length&&"true"===t.values[0].value?v("checkout-page:yes"):v("checkout-page:no")));case i.COLOR_PICKER:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionsHorContainer},t.values.map((function(t,i){return e.createElement("div",{key:i,className:s.OptionColorValue,style:{backgroundColor:t.value}})}))))}})))}),[]);return e.createElement("div",{className:s.CheckoutItem},e.createElement("div",{className:s.ImageContainer},e.createElement("img",{className:s.Image,src:null===(d=p.variant.mainImage)||void 0===d?void 0:d.thumbnailSrc})),e.createElement("div",{className:s.Right},e.createElement("div",{className:s.Name},p.variant.name),e.createElement("div",{className:s.LightText},"".concat(v("checkout-page:quantity"),": ")+p.quantity),e.createElement("div",{className:s.LightText},p.variant.variantValues.map((function(e){return e.variantValueName})).join(" / ")),!!(null===(l=p.options)||void 0===l?void 0:l.length)&&e.createElement("div",{className:s.OptionsText,onClick:function(){return x(!0)}},v("checkout-page:customizedProduct")),!!f&&e.createElement(m,{title:p.variant.name,modalContent:h,onClose:function(){return x(!1)}}),e.createElement("div",{className:s.Price},!!p.overridenPriceWithQuantity&&e.createElement("span",{className:s.GrayPrice},o(N?p.finalPriceWithQuantity:p.overridenPriceWithQuantity,u)),o(N?p.finalPriceWithQuantity-N:p.finalPriceWithQuantity,u))))}));export{n as CartItem};
|