@snabcentr/common-lib 1.42.1 → 1.43.0
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/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +3 -3
- package/dist/sc-common-lib.js +38 -28
- package/dist/sc-common-lib.js.map +1 -1
- package/dist/sc-common-lib.umd.cjs +1 -1
- package/dist/sc-common-lib.umd.cjs.map +1 -1
- package/dist/src/catalog/interfaces/i-file-upload-data.d.ts +2 -10
- package/dist/src/catalog/interfaces/i-file-upload-data.d.ts.map +1 -1
- package/dist/src/catalog/providers/properties-provider.d.ts +9 -0
- package/dist/src/catalog/providers/properties-provider.d.ts.map +1 -1
- package/dist/src/system/interfaces/i-file.d.ts +14 -0
- package/dist/src/system/interfaces/i-file.d.ts.map +1 -0
- package/dist/src/system/interfaces/index.d.ts +1 -0
- package/dist/src/system/interfaces/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(o,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("lodash-es"),require("date-fns"),require("axios"),require("ts-case-convert"),require("pinia"),require("vue")):typeof define=="function"&&define.amd?define(["exports","lodash-es","date-fns","axios","ts-case-convert","pinia","vue"],h):(o=typeof globalThis<"u"?globalThis:o||self,h(o["SC Common Lib"]={},o["lodash-es"],o["date-fns"],o.axios,o["ts-case-convert"],o.pinia,o.vue))})(this,function(o,h,g,Dr,we,ie,m){"use strict";var Yr=Object.defineProperty;var Xr=(o,h,g)=>h in o?Yr(o,h,{enumerable:!0,configurable:!0,writable:!0,value:g}):o[h]=g;var t=(o,h,g)=>Xr(o,typeof h!="symbol"?h+"":h,g);class G{constructor(r){t(this,"id");t(this,"guid");this.id=(r==null?void 0:r.id)??-1,this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return this.id===-1}}class v extends G{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class Pe extends v{constructor(e){super(e);t(this,"slug");t(this,"code");t(this,"type");this.slug=(e==null?void 0:e.slug)??"",this.code=(e==null?void 0:e.code)??""}}class oe extends Pe{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class ce extends oe{constructor(e){super(e);t(this,"isHidden");t(this,"parentCategoryId");t(this,"properties");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category"}}class w extends v{constructor(e){super(e);t(this,"slug");t(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class Re extends w{}class le{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new Re(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class De{constructor(r){t(this,"lat");t(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class H extends w{}class Y extends w{constructor(e){var s;super(e);t(this,"address");t(this,"isMain");t(this,"deliveryTypes");t(this,"regions");t(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((s=e==null?void 0:e.deliveryTypes)==null?void 0:s.map(n=>new H(n)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new De(e==null?void 0:e.coordinates)}}class He{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new Y(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const K=class K{static init(r){K.config=r}static getConfig(){if(h.isUndefined(K.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return K.config}static loadRemoteConfig(r="/config.json"){const e=fetch(r).then(s=>s.ok?s.json():(console.error(new Error(`Ошибка загрузки ${r}: ${s.statusText}`)),new Promise(n=>{n({})})));return e.catch(s=>{console.error(s)}),e}};t(K,"config");let $=K;class Be extends Pe{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class We{constructor(r,e){t(this,"image");t(this,"preview");t(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class T extends Be{constructor(e){var n,c,u,p;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");t(this,"quantityUnit");t(this,"currency");t(this,"cost");t(this,"costRub");t(this,"costDate");t(this,"onOrder");t(this,"stockCount");t(this,"category");t(this,"categories");t(this,"images");t(this,"properties");t(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=(e==null?void 0:e.unit)??"",this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.quantityUnit=e==null?void 0:e.quantityUnit,this.currency=(e==null?void 0:e.currency)??"",this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((n=e==null?void 0:e.stockCount)==null?void 0:n.map(C=>new He(C)))??[],this.type="product";const s=(e==null?void 0:e.category)??((c=e==null?void 0:e.categories)==null?void 0:c.find(C=>C.isPrimary));s&&(this.category=new oe({...s,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(C=>new oe(C))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(C=>{var P;return new We(C,(P=$.getConfig().urls)==null?void 0:P.mediaServer)}))??[],this.properties=(e==null?void 0:e.properties)??{},this.priceCoefficients=((p=e==null?void 0:e.priceCoefficients)==null?void 0:p.map(C=>new le(C)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){const e=$.getConfig().products.units;return[...e.linear,...e.square].includes(this.unit)}}class ze extends G{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"height");t(this,"length");t(this,"width");t(this,"barcode");t(this,"marker");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");this.product=new T(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new ce,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&h.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class je extends ze{constructor(e){super(e);t(this,"currency");t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");this.currency=e.currency,this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=e.sawing}}class X{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new je(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Ve{constructor(r){t(this,"phone");t(this,"tablet");t(this,"laptop");this.phone=(r==null?void 0:r.phone)??360,this.tablet=(r==null?void 0:r.tablet)??600,this.laptop=(r==null?void 0:r.laptop)??1024}}class xe{constructor(r){t(this,"apiUri");t(this,"responseDataCacheTimeout");this.apiUri=(r==null?void 0:r.apiUri)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class Ke{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,s,n,c;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((s=r==null?void 0:r.trace)==null?void 0:s.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((n=r==null?void 0:r.replay)==null?void 0:n.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((c=r==null?void 0:r.replay)==null?void 0:c.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class Je{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=(r==null?void 0:r.date)??g.format(new Date,"dd.MM.yyyy"),this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}class vr{constructor(r){t(this,"environment");t(this,"currentDomain");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"products");t(this,"sentry");t(this,"urls");t(this,"version");this.environment=(r==null?void 0:r.environment)??"production",this.currentDomain=(r==null?void 0:r.currentDomain)??"",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new xe(r==null?void 0:r.http),this.deviceTypeByResolution=new Ve(r==null?void 0:r.deviceTypeByResolution),this.products={units:{linear:["пог.м.","м."],square:["м2"]},...r==null?void 0:r.products},this.sentry=new Ke({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new Je(r==null?void 0:r.version)}}class ue{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const b=class b{constructor(r,e){t(this,"httpClient");t(this,"defaultInstanceNotificationErrorResponseHandler",h.noop);const s=$.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=b.baseDefaultNotificationErrorResponseHandler,this.httpClient=Dr.create({baseURL:r,headers:{"APP-VERSION":`${s.name} (${s.version}, ${s.date})`,Accept:"application/json","Content-Type":"application/json",...e}}),this.httpClient.interceptors.request.use(n=>(n.method&&(n.method==="get"&&n.params&&(n.params=we.objectToSnake(n.params)),["put","patch","post"].includes(h.toLower(n.method))&&n.data&&(n.data=we.objectToSnake(n.data))),n),n=>Promise.reject(n)),this.httpClient.interceptors.response.use(n=>(n.data&&(n.data=we.objectToCamel(n.data)),n),n=>b.convertHttpErrorResponse(n))}static setBaseDefaultNotificationErrorResponseHandler(r){b.baseDefaultNotificationErrorResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(b.instances,r.name)||(b.instances[r.name]=ue.simpleInstanceInitializer(r)),b.instances[r.name]}static convertHttpErrorResponse(r){var s,n;const e=r==null?void 0:r.response;return Promise.reject({status:(e==null?void 0:e.status)??0,statusText:(e==null?void 0:e.statusText)??"Unknown",message:((s=e==null?void 0:e.data)==null?void 0:s.message)??"Unknown Error. Probably network error.",errors:(n=e==null?void 0:e.data)==null?void 0:n.errors,headers:(e==null?void 0:e.headers)??{},data:e==null?void 0:e.data,rawError:r})}request(r,e=void 0,s={},n=!1){const c=this.httpClient.request(r).then(u=>e?e(u):u.data);return n||c.catch(u=>{this.defaultInstanceNotificationErrorResponseHandler(u,s)}),c}get(r,e={},s=void 0,n=!1){return this.request({method:"GET",url:r,params:e},s,{},n)}patch(r,e={},s=void 0,n={},c=!1){return this.request({method:"PATCH",url:r,data:e},s,n,c)}post(r,e={},s=void 0,n={},c=!1){return this.request({method:"POST",url:r,data:e},s,n,c)}delete(r,e=!1){return this.request({method:"DELETE",url:r},h.noop,{},e)}};t(b,"instances",{}),t(b,"baseDefaultNotificationErrorResponseHandler",h.noop);let pe=b;const J=class J extends pe{constructor(e,s){super(e,s);t(this,"responseDataCacheTimeout");const n=$.getConfig();this.responseDataCacheTimeout=n.http.responseDataCacheTimeout}static getCachedResponse(e){const s=J.responseDataCache.get(e);if(s&&s.validTo>new Date)return s.val}cacheResponse(e,s){J.responseDataCache.set(e,{validTo:g.addSeconds(new Date,this.responseDataCacheTimeout),val:s})}getTypedDataArrayRequester(e,s,n=!1){const c=n?J.getCachedResponse(s):void 0;return c?Promise.resolve(c):this.get(s).then(u=>{const p=u.map(C=>ue.instanceInitializer(e,C));return n&&p&&this.cacheResponse(s,p),p})}};t(J,"responseDataCache",new Map);let he=J;class f extends he{constructor(){var s,n;const r=$.getConfig(),e={};(s=r.devMode)!=null&&s.authBearerToken&&(e.Authorization=`Bearer ${(n=r.devMode)==null?void 0:n.authBearerToken}`),super(`${r.http.apiUri}/api`,e)}}class ar extends f{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new X(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,s={}){return this.patch(`internal/clients/${r.id}/cart`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},n=>new X(n.data),s)}patchCartItem(r,e,s={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},n=>new X(n.data),s)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,{},e=>new X(e.data))}}var ve=(i=>(i.Discount="discount",i.PriceTemplate="price_template",i.ClientPrice="client_price",i.Product="product",i))(ve||{}),Qe=(i=>(i.Unknown="unknown",i.Bool="bool",i.Integer="integer",i.Float="float",i.String="string",i.Range="range",i.Json="json",i.Object="object",i))(Qe||{}),Ye=(i=>(i.K0="k0",i.K1="k1",i.K2="k2",i.K3="k3",i.K4="k4",i))(Ye||{});class N extends ce{constructor(e){var s,n;super(e);t(this,"categories");t(this,"products");this.categories=(s=e==null?void 0:e.categories)==null?void 0:s.map(c=>new N(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new T(c))}}class ae extends v{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=e==null?void 0:e.updatedAt}}class Xe extends ae{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=e!=null&&e.deletedAt?h.isString(e.deletedAt)?g.parseISO(e.deletedAt):e.deletedAt:void 0}}class Sr{static getActualDataFromStorage(r){const e=localStorage.getItem(r);if(e)try{const s=JSON.parse(e);if(g.isAfter(g.parseISO(s.availableFor)||g.startOfToday(),new Date))return s.data||{}}catch{localStorage.removeItem(r)}}static saveActualDataToStorage(r,e,s){localStorage.setItem(r,JSON.stringify({availableFor:s,data:e}))}}class d extends v{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class Ze extends v{constructor(e){super(e);t(this,"costCoefficient");t(this,"isLowPriceAllowed");t(this,"publishedAt");t(this,"description");t(this,"percent");t(this,"owner");t(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=e!=null&&e.publishedAt?h.isString(e.publishedAt)?g.parseISO(e.publishedAt):e.publishedAt:void 0,this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new d(e==null?void 0:e.owner),this.deletedAt=e!=null&&e.deletedAt?h.isString(e.deletedAt)?g.parseISO(e.deletedAt):e.deletedAt:void 0}}class Fe extends ae{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=e!=null&&e.createdAt?h.isString(e.createdAt)?g.parseISO(e.createdAt):e.createdAt:new Date}}class Z extends T{constructor(e){super(e);t(this,"costCoefficient");t(this,"costSource");t(this,"discount");t(this,"priceTemplate");t(this,"isPreviouslyOrdered");t(this,"isRequired");t(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??ve.Product,this.discount=e!=null&&e.discount?new Ze(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new Fe(e.priceTemplate):void 0,this.isPreviouslyOrdered=e==null?void 0:e.isPreviouslyOrdered,this.isRequired=e==null?void 0:e.isRequired,this.isFavorite=e==null?void 0:e.isFavorite}}class Ee{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class A extends w{}class F extends v{constructor(e){super(e);t(this,"salesDirection",new A);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new A(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new Ee(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class E extends F{constructor(e){super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");this.isActive=(e==null?void 0:e.isActive)??!1,this.isSupervisor=(e==null?void 0:e.isSupervisor)??!1,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.createdAt=e==null?void 0:e.createdAt,this.supervisorId=e==null?void 0:e.supervisorId}}class Ar extends ce{constructor(e){super(e);t(this,"isDisabled");t(this,"isRequired");t(this,"isFavorite");t(this,"hidingComment");t(this,"manager");this.isDisabled=(e==null?void 0:e.isDisabled)??!1,this.isRequired=(e==null?void 0:e.isRequired)??!1,this.isFavorite=(e==null?void 0:e.isFavorite)??!1,this.hidingComment=e==null?void 0:e.hidingComment,this.manager=e!=null&&e.manager?new E(e.manager):void 0}}class ee extends Ar{constructor(e){var s,n;super(e);t(this,"categories");t(this,"products");this.categories=(s=e==null?void 0:e.categories)==null?void 0:s.map(c=>new ee(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new Z(c))}}class Se extends w{}class j extends v{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new Se(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class B{constructor(r){t(this,"property");t(this,"value");this.property=new j(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class er extends w{}class Ae extends w{}class Tr extends w{}class W extends w{}class V extends w{constructor(e){super(e);t(this,"country",new W);e&&(this.country=new W(e.country))}}class re extends w{constructor(e){super(e);t(this,"region",new V);e&&(this.region=new V(e.region))}}class rr extends w{}class te extends v{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var a=(i=>(i.Person="individual",i.Ic="entrepreneur",i.UlR="legal",i.UlNr="non_resident_legal",i))(a||{});class U extends w{static generatePersonItem(){return new U({id:1,guid:"",slug:a.Person,name:""})}}class tr extends w{}class sr extends w{}class q extends w{}class nr extends w{}class ir extends w{}class Te extends w{}class be extends w{}class R extends f{getReference(r,e=!1){return this.getTypedDataArrayRequester(er,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Ae,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(rr,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(te,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(q,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(U,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(tr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(sr,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(nr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Te,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(A,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(be,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(re,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(V,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(W,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(H,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(Y,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Se,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(Re,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(ir,"/public/references/product-file-type",!0)}}var or=(i=>(i.Admin="admin",i.Manager="manager",i.Operator="operator",i.Client="client",i.Guest="guest",i))(or||{});class $e extends v{constructor(e){super(e);t(this,"phone");t(this,"email");t(this,"getNews");t(this,"salesDirection");t(this,"createdAt");t(this,"lastLoginAt");t(this,"isActive");this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:(e==null?void 0:e.phone)??"",this.email=(e==null?void 0:e.email)??"",this.getNews=(e==null?void 0:e.getNews)??!1,this.salesDirection=e!=null&&e.salesDirection?new A(e.salesDirection):void 0,this.createdAt=h.isString(e==null?void 0:e.createdAt)?g.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=h.isString(e==null?void 0:e.lastLoginAt)?g.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class cr extends $e{constructor(e){super(e);t(this,"type");t(this,"canDoReclamations");t(this,"photo");this.type=e==null?void 0:e.type,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.photo=e==null?void 0:e.photo}}class lr extends f{getCurrentUser(){return this.get("/internal/users/info",{},r=>new cr(r.data))}}class ur{constructor(r){t(this,"cost");t(this,"costDate");t(this,"isLowCost");t(this,"isRetail");t(this,"discountName");t(this,"priceTemplateName");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost,this.costDate=h.isString(r.costDate)?g.parseISO(r.costDate):r.costDate,this.isLowCost=r.isLowCost,this.isRetail=r.isRetail,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.client=r.client?new d(r.client):void 0,this.executor=r.executor?new d(r.executor):void 0,this.currency=r.currency?new te(r.currency):void 0}}class _e{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new T(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new N(e)))}}class x extends v{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");t(this,"subRoles",[]);t(this,"parentRole");t(this,"level",0);this.description=e==null?void 0:e.description,this.canChangeLowCost=(e==null?void 0:e.canChangeLowCost)??!1,this.parentRoleId=e==null?void 0:e.parentRoleId}}class Ie{constructor(r){t(this,"role");t(this,"category");t(this,"minCoefficient");this.role=new x(r==null?void 0:r.role),this.category=new ce(r==null?void 0:r.category),this.minCoefficient=new Re(r==null?void 0:r.minCoefficient)}}class br extends f{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,s=void 0){let c=`${$.getConfig().http.apiUri}/api/internal/price/export?format=${r}&show_hidden=${e}`;return s&&(c+=`&client_id=${s}`),c}}class $r extends f{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(s=>new N(s)))}getCategoryData(r,e=!1,s=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:s},n=>new N(n.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new N(e.data))}getCategoryProductsList(r,e=!0,s=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:s,withPriceCoefficients:e},n=>h.map(n.data,c=>new T(c)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:s}=e;return h.forEach(s,n=>n.map(c=>new le(c))),s})}publicSimpleSearch(r,e=10){return new Promise((s,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{s(c.categories.map(u=>new N(u)))}).catch(c=>{n(c)})})}}class _r extends f{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},s=>new T(s.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new T(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>h.map(e.data,s=>new le(s)))}getProductPriceHistory(r,e){const s={};return h.isNil(e)||(s.clientId=e),this.get(`/internal/price/products/${r}/history`,s,n=>h.map(n.data,c=>new ur(c)))}publicSimpleSearch(r,e=10){return new Promise((s,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{s(c.products.map(u=>new T(u)))}).catch(c=>{n(c)})})}}class Ir extends f{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},s=>s.data.map(n=>new ee(n)))}getCategoryData(r,e,s=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:s,withNestedCategories:n},c=>new ee(c.data))}getCategoryProductsList(r,e,s=!0,n=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:n,withPriceCoefficients:s},c=>h.map(c.data,u=>new Z(u)))}}class Lr extends f{getProductData(r,e,s=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:s},n=>new Z(n.data))}}class kr extends f{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new x(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new x(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new x(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,s=>new x(s.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.get(`/internal/price/roles/rules/categories/${r}`,{},e=>e.data.map(s=>new Ie(s)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,s=>s.data.map(n=>new Ie(n)))}}class ge extends f{getPaginated(r,e,s,n,c,u){const p={page:(n==null?void 0:n.page)??1,per_page:(n==null?void 0:n.pageSize)??(n==null?void 0:n.perPage)??10};return e&&(p.filters=JSON.stringify(e)),h.isEmpty(s)||(h.isArray(s)?s:[s]).forEach((C,P)=>{p[`sort[${P}][field]`]=C.field,p[`sort[${P}][direction]`]=C.direction}),this.get(r,p,c,u)}}class Or extends ge{getProperties(r,e,s){return this.getPaginated("/internal/catalog/properties",r,e,s,n=>{const c={...n.data};return c.data=c.data.map(u=>new j(u)),c})}createProperty(r){const{typeId:e,...s}=r;return this.post("/internal/catalog/properties",{...s,type:e},n=>new j(n.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new j(e.data))}updateProperty(r,e){const{typeId:s,...n}=e;return this.patch(`/internal/catalog/properties/${r}`,{...n,type:s},c=>new j(c.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.get(`/internal/catalog/products/${r}/properties`,{},e=>e.data.map(s=>new B(s)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},s=>new B(s.data))}updateProductProperty(r,e,s){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:s},n=>new B(n.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,s){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,s)}deleteProductFile(r,e){return this.delete(`/internal/catalog/products/${r}/properties/files/${e}`)}updateProductSlug(r,e){return this.patch(`/internal/catalog/products/${r}/properties/slug`,{slug:e})}getCategoryProperties(r){return this.get(`/internal/catalog/categories/${r}/properties`,{},e=>e.data.map(s=>new B(s)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},s=>new B(s.data))}updateCategoryProperty(r,e,s){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:s},n=>new B(n.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,s){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,s)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}}class Nr extends f{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new _e(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new _e(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(s=>s.id),products:e.products.map(s=>s.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(s=>s.id),products:e.products.map(s=>s.id)})}}var pr=(i=>(i.LastOrder="last_order",i.Contacts="contacts",i.PartnerGroups="partner_groups",i.PreferredDeliveryType="preferred_delivery_type",i))(pr||{});class me extends G{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new te);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new te(e.currency))}}class fe extends v{constructor(e){super(e);t(this,"phone");t(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class M extends fe{constructor(e){super(e);t(this,"isPrimary");t(this,"position");t(this,"notDisturb");t(this,"comment");t(this,"updatedAt");t(this,"deletedAt");this.isPrimary=(e==null?void 0:e.isPrimary)??!1,this.position=e==null?void 0:e.position,this.notDisturb=(e==null?void 0:e.notDisturb)??!1,this.comment=e==null?void 0:e.comment,this.updatedAt=e==null?void 0:e.updatedAt,this.deletedAt=e==null?void 0:e.deletedAt}}class Le extends v{constructor(e){super(e);t(this,"manager",new F);t(this,"opf",U.generatePersonItem());t(this,"salesDirection",new A);t(this,"partnerGroup",new q);t(this,"contacts",[]);t(this,"bankAccounts",[]);t(this,"comment");t(this,"alternativeName");t(this,"createdAt");t(this,"creator");t(this,"updatedAt");t(this,"updater");if(e){if(this.opf=new U(e.opf),this.salesDirection=new A(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=h.isString(e==null?void 0:e.createdAt)?g.parse(e==null?void 0:e.createdAt,"yyyy-MM-dd HH:mm:ss",new Date):e.createdAt,this.creator=e.creator?new d(e.creator):void 0,this.updatedAt=h.isString(e==null?void 0:e.updatedAt)?g.parse(e==null?void 0:e.updatedAt,"yyyy-MM-dd HH:mm:ss",new Date):e.updatedAt,this.updater=e.updater?new d(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new q(e.partnerGroup)),e.manager&&(this.manager=new F(e.manager)),e.contacts){const s=[];e.contacts.forEach(n=>{s.push(new M(n))}),this.contacts=s}if(e.bankAccounts){const s=[];e.bankAccounts.forEach(n=>{s.push(new me(n))}),this.bankAccounts=s}}}}class hr extends Le{constructor(r){super(r)}}class ke extends Le{constructor(e){super(e);t(this,"inn","");t(this,"okpo","");t(this,"directorName","");t(this,"directorPosition","");t(this,"directorActsOn","");t(this,"legalAddress","");t(this,"postalAddress","");t(this,"actualAddress","");e&&(this.inn=e.inn??"",this.okpo=e.okpo??"",this.directorName=e.directorName??"",this.directorPosition=e.directorPosition??"",this.directorActsOn=e.directorActsOn??"",this.legalAddress=e.legalAddress??"",this.postalAddress=e.postalAddress??"",this.actualAddress=e.actualAddress??"")}}class Oe extends ke{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class gr extends Oe{constructor(e){super(e);t(this,"registrationCountry",new W);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new W(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class se{static createInstance(r){switch(r.opf.slug){case a.Ic:return new ke(r);case a.UlR:return new Oe(r);case a.UlNr:return new gr(r);default:return new hr(r)}}}class ye extends $e{constructor(e){var s;super(e);t(this,"salesDirection");t(this,"debt");t(this,"alternativeName");t(this,"city");t(this,"comment");t(this,"isPhoneApproved");t(this,"isEmailApproved");t(this,"managers");this.salesDirection=new A(e==null?void 0:e.salesDirection),this.debt=(e==null?void 0:e.debt)??0,this.alternativeName=(e==null?void 0:e.alternativeName)??"",this.city=new re(e==null?void 0:e.city),this.comment=e==null?void 0:e.comment,this.isPhoneApproved=(e==null?void 0:e.isPhoneApproved)??!1,this.isEmailApproved=(e==null?void 0:e.isEmailApproved)??!1,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(n=>new F(n)))??[]}}class Ce extends G{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class mr extends M{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(s=>new Ce(s))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(s=>new Ce(s))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(s=>new Ce(s))))}}class ne extends Xe{constructor(e){var s;super(e);t(this,"address","");t(this,"coordinates");t(this,"contacts");t(this,"comment");t(this,"operatingHours");t(this,"isOneTime");t(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new De(e==null?void 0:e.coordinates),this.contacts=((s=e==null?void 0:e.contacts)==null?void 0:s.map(n=>new M(n)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class Ne extends ye{constructor(e){var s,n,c,u;super(e);t(this,"contragents");t(this,"partnerGroups");t(this,"contacts");t(this,"deliveryAddresses");t(this,"channelPrimaryInterest");t(this,"sourcePrimaryInterest");t(this,"preferredDeliveryType");t(this,"primaryDemand");t(this,"isExcludedFromMsCallsToClients");t(this,"preferredWarehouse");t(this,"extraData");this.contragents=((s=e==null?void 0:e.contragents)==null?void 0:s.map(p=>se.createInstance(p)))??[],this.partnerGroups=((n=e==null?void 0:e.partnerGroups)==null?void 0:n.map(p=>new q(p)))??[],this.contacts=((c=e==null?void 0:e.contacts)==null?void 0:c.map(p=>new M(p)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(p=>new ne(p)))??[],this.channelPrimaryInterest=new Ae(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new be(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new H(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new Y(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class dr{constructor(r){t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"city");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",{from:null,to:null});t(this,"lastLoginDate",{from:null,to:null});t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"salesDirection");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"hasCostLessThenStop");t(this,"partnerGroup");t(this,"contact");t(this,"lastOrder");var e,s,n,c,u,p,C;this.id=(r==null?void 0:r.id)??"",this.name=(r==null?void 0:r.name)??"",this.alternativeName=(r==null?void 0:r.alternativeName)??"",this.city=new re(r==null?void 0:r.city),this.region=new V(r==null?void 0:r.region),this.country=new W(r==null?void 0:r.country),this.phone=(r==null?void 0:r.phone)??"",this.email=(r==null?void 0:r.email)??"",this.isActive=r&&Object.prototype.hasOwnProperty.call(r,"isActive")?r==null?void 0:r.isActive:!0,this.createdAt={from:((e=r==null?void 0:r.createdAt)==null?void 0:e.from)??null,to:((s=r==null?void 0:r.createdAt)==null?void 0:s.to)??null},this.lastLoginDate={from:((n=r==null?void 0:r.lastLoginDate)==null?void 0:n.from)??null,to:((c=r==null?void 0:r.lastLoginDate)==null?void 0:c.to)??null},this.lastLoginDateHasOrder=(r==null?void 0:r.lastLoginDateHasOrder)??void 0,this.managers=r!=null&&r.managers&&r.managers.length>0?r.managers.map(P=>new E(P)):[],this.salesDirection=new A(r==null?void 0:r.salesDirection),this.contragentInn=(r==null?void 0:r.contragentInn)??"",this.contragentType=new U(r==null?void 0:r.contragentType),this.preferredDeliveryType=new H(r==null?void 0:r.preferredDeliveryType),this.hasCostLessThenStop=r!=null&&r.hasCostLessThenStop?!0:void 0,this.partnerGroup=new q(r==null?void 0:r.partnerGroup),this.contact=new fe(r==null?void 0:r.contact),this.lastOrder={createdAt:(u=r==null?void 0:r.lastOrder)==null?void 0:u.createdAt,creator:(p=r==null?void 0:r.lastOrder)==null?void 0:p.creator,isApproved:(C=r==null?void 0:r.lastOrder)==null?void 0:C.isApproved}}resetFilterValue(r){switch(r){case"id":case"phone":case"email":case"name":case"alternativeName":case"contragentInn":this[r]="";break;case"city":this.city=new re;break;case"region":this.region=new V;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirection":this.salesDirection=new A;break;case"contragentType":this.contragentType=new U;break;case"preferredDeliveryType":this.preferredDeliveryType=new H;break;case"partnerGroup":this.partnerGroup=new q;break;case"hasCostLessThenStop":this.hasCostLessThenStop=void 0;break;case"contact":this.contact=new fe;break}return this}asClearRaw(){var e,s,n,c;const r={};return Object.keys(this).forEach(u=>{const p=this[u];h.isUndefined(p)||h.isString(p)&&p.trim().length===0||h.isFunction(p.isNewRec)&&p.isNewRec()||(r[u]=p)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((s=r==null?void 0:r.createdAt)!=null&&s.to)&&delete r.createdAt,!((n=r==null?void 0:r.lastLoginDate)!=null&&n.from)&&!((c=r==null?void 0:r.lastLoginDate)!=null&&c.to)&&delete r.lastLoginDate,r}}class de extends G{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=h.isString(e==null?void 0:e.createdAt)?g.parse(e.createdAt,"dd.MM.yyyy HH:mm",new Date):(e==null?void 0:e.createdAt)??new Date,this.creator=new d(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Ue extends de{constructor(e){var s,n,c,u,p,C,P,S;super(e);t(this,"client");t(this,"payment");t(this,"delivery");t(this,"attachedUser");t(this,"status");t(this,"salesDirection");t(this,"pendingAt");t(this,"processedAt");t(this,"isOnOrder");t(this,"isNotInStock");this.client=new ye(e==null?void 0:e.client),this.payment={type:((s=e==null?void 0:e.payment)==null?void 0:s.type)??-1,status:((n=e==null?void 0:e.payment)==null?void 0:n.status)??-1,onlinePaymentLink:(c=e==null?void 0:e.payment)==null?void 0:c.onlinePaymentLink},this.delivery={type:((u=e==null?void 0:e.delivery)==null?void 0:u.type)??-1,date:h.isString((p=e==null?void 0:e.delivery)==null?void 0:p.date)?g.parse(e==null?void 0:e.delivery.date,"dd.MM.yyyy",new Date):((C=e==null?void 0:e.delivery)==null?void 0:C.date)??new Date,address:(P=e==null?void 0:e.delivery)!=null&&P.address?new ne(e.delivery.address):void 0,warehouse:(S=e==null?void 0:e.delivery)!=null&&S.warehouse?new Y(e.delivery.warehouse):void 0},this.attachedUser=new d(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new A(e==null?void 0:e.salesDirection),this.pendingAt=h.isString(e==null?void 0:e.pendingAt)?g.parse(e==null?void 0:e.pendingAt,"dd.MM.yyyy HH:mm",new Date):(e==null?void 0:e.pendingAt)??new Date,this.processedAt=h.isString(e==null?void 0:e.processedAt)?g.parse(e==null?void 0:e.processedAt,"dd.MM.yyyy HH:mm",new Date):(e==null?void 0:e.processedAt)??new Date,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1}}class fr extends G{constructor(e){super(e);t(this,"product");t(this,"quantity");t(this,"currency");t(this,"costOne");t(this,"costOneRub");t(this,"cost");t(this,"costRub");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"configurator");t(this,"configuratorParams");t(this,"sawing");this.product=new Z(e.product),this.quantity=e.quantity,this.currency=e.currency,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.cost=e.cost,this.costRub=e.costRub,this.marker=e.marker,this.height=e.height,this.length=e.length,this.width=e.width,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams,this.sawing=e.sawing}}class yr extends Ue{constructor(e){super(e);t(this,"products");t(this,"invoices");t(this,"comment");t(this,"image");t(this,"contragent");t(this,"barcode");t(this,"orderSource");t(this,"isAllowProcessingWithoutPayment");this.products=(e.products??[]).map(s=>new fr(s)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?se.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new w(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class Ur extends ge{getOrders(r,e,s){return this.getPaginated("/internal/orders",r,e?[e]:void 0,s,n=>{const c={...n.data};return c.data=c.data.map(u=>new Ue(u)),c})}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new yr(e.data))}}class Cr extends v{constructor(e){var s,n;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");(s=e.contacts)!=null&&s.length&&(this.contacts=e.contacts.map(c=>new M(c))),e.lastOrder&&(this.lastOrder=new de(e.lastOrder)),(n=e.partnerGroups)!=null&&n.length&&(this.partnerGroups=e.partnerGroups.map(c=>new q(c))),e.preferredDeliveryType&&(this.preferredDeliveryType=new H(e.preferredDeliveryType))}}var qe=(i=>(i.BeginWith="bw",i.Contains="cn",i.Custom="custom",i.EndsWith="ew",i.Equals="eq",i.GreaterOrEqual="ge",i.GreaterThan="gt",i.InList="in",i.LessOrEqual="le",i.LessThan="lt",i.NotBeginWith="bn",i.NotContains="nc",i.NotEndsWith="en",i.NotEqual="ne",i.NotInList="ni",i.NotNull="nn",i.Null="nu",i))(qe||{});class wr{constructor(r){t(this,"page",1);t(this,"pageSize",50);t(this,"perPage",50);this.page=(r==null?void 0:r.page)??1,this.perPage=(r==null?void 0:r.perPage)??50,this.pageSize=(r==null?void 0:r.pageSize)??this.perPage}}class qr extends wr{constructor(e){super(e);t(this,"itemCount",0);t(this,"pageCount",1);t(this,"pageSlot",5);t(this,"pageSizes",[25,50,100]);t(this,"showSizePicker",!0);this.itemCount=(e==null?void 0:e.itemCount)??0,this.pageCount=(e==null?void 0:e.pageCount)??1,this.pageSlot=(e==null?void 0:e.pageSlot)??5,this.pageSizes=(e==null?void 0:e.pageSizes)??[25,50,100],this.showSizePicker=(e==null?void 0:e.showSizePicker)??!0}}class Mr{constructor(r){t(this,"field");t(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class Gr extends ge{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new Ne(e.data))}getClientsList(r,e,s){return this.getPaginated("/internal/clients",r,e,s,n=>{const c={...n.data};return c.data=c.data.map(u=>new ye(u)),c})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:qe.Contains,value:r}]})}getAdditionalClientsData(r,e){return this.post("/internal/clients/additional-data",{clients:r,requested_data_types:e},s=>{let n=[];return(s==null?void 0:s.data.length)>0&&(n=s.data.map(c=>new Cr(c))),n})}getAllClientContacts(r){return this.get(`/internal/clients/${r}/contacts/all`,{},e=>{let s=[];return(e==null?void 0:e.data.length)>0&&(s=e.data.map(n=>new mr(n))),s})}createClientCommonData(r,e={}){var s;return this.post("/internal/clients",{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(s=r.preferredWarehouse)==null?void 0:s.id},n=>new Ne(n.data),e)}updateClientCommonData(r,e={}){var s;return this.patch(`/internal/clients/${r.id}`,{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(s=r.preferredWarehouse)==null?void 0:s.id},void 0,e)}changeClientPassword(r,e,s,n={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:s},void 0,n)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const s=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/attach`,{is_primary:n.isDefault}));await Promise.all(s)}async detachClientFromManagers(r,e){const s=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/detach`));await Promise.all(s)}createContragentClientData(r,e,s={}){var C,P,S,_,I,L,k,O;let n;const c=e,u=e,p=e;switch(e.opf.slug){case a.Ic:n={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(P=c.manager)==null?void 0:P.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case a.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(S=u.partnerGroup)==null?void 0:S.id,manager_id:(_=u.manager)==null?void 0:_.id,comment:u.comment,inn:u.inn,kpp:u.kpp,okpo:u.okpo,director_name:u.directorName,director_position:u.directorPosition,director_acts_on:u.directorActsOn,legal_address:u.legalAddress,postal_address:u.postalAddress,actual_address:u.actualAddress};break;case a.UlNr:n={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(I=p.partnerGroup)==null?void 0:I.id,manager_id:(L=p.manager)==null?void 0:L.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(O=e.manager)==null?void 0:O.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,n,z=>se.createInstance(z.data),s)}updateContragentClientData(r,e,s={}){var C,P,S,_,I,L,k,O;let n;const c=e,u=e,p=e;switch(e.opf.slug){case a.Ic:n={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(P=c.manager)==null?void 0:P.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case a.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(S=u.partnerGroup)==null?void 0:S.id,manager_id:(_=u.manager)==null?void 0:_.id,comment:u.comment,inn:u.inn,kpp:u.kpp,okpo:u.okpo,director_name:u.directorName,director_position:u.directorPosition,director_acts_on:u.directorActsOn,legal_address:u.legalAddress,postal_address:u.postalAddress,actual_address:u.actualAddress};break;case a.UlNr:n={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(I=p.partnerGroup)==null?void 0:I.id,manager_id:(L=p.manager)==null?void 0:L.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(O=e.manager)==null?void 0:O.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,n,z=>se.createInstance(z.data),s)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,s={}){var c,u;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.coordinates&&(n.coordinates={lat:(c=e.coordinates)==null?void 0:c.lat,long:(u=e.coordinates)==null?void 0:u.long}),e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),this.post(`/internal/clients/${r}/delivery-addresses`,n,p=>new ne(p.data),s)}updateClientDeliveryAddress(r,e,s={}){var c,u;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),e.coordinates&&(n.coordinates={lat:(c=e.coordinates)==null?void 0:c.lat,long:(u=e.coordinates)==null?void 0:u.long}),this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,n,p=>new ne(p.data),s)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,s,n={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,{bank_name:s.bankName,bic:s.bic,account_number:s.accountNumber,correspondent_account:s.correspondentAccount,currency_id:s.currency.id},c=>new me(c.data),n)}updateContragentBankAccount(r,e,s,n={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${s.id}`,{bank_name:s.bankName,bic:s.bic,account_number:s.accountNumber,correspondent_account:s.correspondentAccount,currency_id:s.currency.id},c=>new me(c.data),n)}deleteContragentBankAccount(r,e,s){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${s.id}`)}createClientContact(r,e,s={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},s)}updateClientContact(r,e,s={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},n=>new M(n.data),s)}setPrimaryClientContact(r,e){return this.setPrimaryContact(`/internal/clients/${r}/contacts/${e.id}/primary`,e.isPrimary??!1)}detachClientContact(r,e){return this.detachContact(`/internal/clients/${r}/contacts/${e.id}/detach`)}createContragentContact(r,e,s,n={}){return this.createContact(r,s,{contragents:[{id:e,is_primary:s.isPrimary??!1,not_disturb:s.notDisturb??!1}]},n)}setPrimaryContragentContact(r,e,s){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${s.id}/primary`,s.isPrimary??!1)}detachContragentContact(r,e,s){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${s.id}/detach`)}createDeliveryAddressContact(r,e,s,n={}){return this.createContact(r,s,{addresses:[{id:e,is_primary:s.isPrimary??!1,not_disturb:s.notDisturb??!1}]},n)}setPrimaryDeliveryAddressContact(r,e,s){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${s.id}/primary`,s.isPrimary??!1)}detachDeliveryAddressContact(r,e,s){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${s.id}/detach`)}createContact(r,e,s,n={}){var u,p;const c={name:e.name,position:e.position,comment:e.comment,...s};return(u=e.phone)!=null&&u.length&&(c.phone=e.phone),(p=e.email)!=null&&p.length&&(c.email=e.email),this.post(`/internal/clients/${r}/contacts`,c,C=>new M(C.data),n)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class Hr extends f{checkPhoneIsBusy(r){return new Promise((e,s)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(n=>{e(!!n.isBusy)}).catch(s)})}}class Br extends f{getConfiguratorSettings(r){var e;return this.get(`internal/catalog/categories/${r.id}/configurators/${(e=r.properties)==null?void 0:e.editor}/settings`)}searchProduct(r,e,s={}){var c;const n=this.get(`internal/catalog/categories/${r.id}/configurators/${(c=r.properties)==null?void 0:c.editor}/product`,{params:e},u=>new T(u.data));return n.catch(u=>{this.defaultInstanceNotificationErrorResponseHandler(u,s)}),n}createTemplate(r,e,s={}){var n;return this.post(`internal/catalog/categories/${r.id}/configurators/${(n=r.properties)==null?void 0:n.editor}/template`,{...e},()=>{},s)}removeTemplate(r,e){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.editor}/template/${e}`)}}class Wr{static defaultDateRanges(){const r=[0,6].includes(g.getDay(g.startOfTomorrow()))?g.nextMonday(g.startOfToday()):g.startOfTomorrow();return{nextWorkingDay:{label:"Следующий рабочий день",from:g.getUnixTime(g.startOfDay(r)),to:g.getUnixTime(g.endOfDay(r))},today:{label:"Сегодня",from:g.getUnixTime(g.startOfToday()),to:g.getUnixTime(g.endOfToday())},yesterday:{label:"Вчера",from:g.getUnixTime(g.startOfYesterday()),to:g.getUnixTime(g.endOfYesterday())},tomorrow:{label:"Завтра",from:g.getUnixTime(g.startOfTomorrow()),to:g.getUnixTime(g.endOfTomorrow())}}}}const Q=class Q{static setLinearValues(r){Q.linearValues=r}static productIsMeasurable(r){return Q.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,s;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)&&!Q.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,s,n;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((s=r.properties)!=null&&s.ignoreMinCountCheck)&&((n=r.properties)!=null&&n.minCount)?r.properties.minCount:.01}};t(Q,"linearValues",["пог.м.","м.","м2"]);let Me=Q;class zr{static generateUndefinedManagerInstance(){return new E({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Pr extends f{getManagers(){const r="/internal/managers",e=f.getCachedResponse(r);return e?Promise.resolve(e):this.get(r).then(s=>{const n=s.data.map(c=>ue.instanceInitializer(E,c));return n&&this.cacheResponse(r,n),n})}}class Rr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class Ge{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");var e;this.resourceType=new Te(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(s=>new Rr(s)))??[]}}class jr extends f{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},s=>new Ge(s.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,s=>new Ge(s.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const D=ie.defineStore("__references_private",()=>{const i=m.ref({}),r=m.ref(void 0),e=m.ref(void 0),s=m.ref(void 0),n=m.ref(void 0),c=m.ref(void 0),u=m.ref(void 0),p=m.ref(void 0),C=m.ref(void 0),P=m.ref(void 0),S=m.ref(void 0),_=m.ref(void 0),I=m.ref(void 0),L=m.ref(void 0),k=m.ref(void 0),O=m.ref(void 0),z=m.ref(void 0),l=m.ref(void 0);return{dataLoaderList:i,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:s,deliveryTypeReference:n,managersList:c,opfReference:u,orderPaymentStatusReference:p,orderStatusReference:C,paymentTypeReference:P,partnerGroupReference:S,productFileTypeReference:_,resourceTypesReference:I,salesDirectionsReference:L,sourcePrimaryInterestReference:k,warehousesReference:O,propertyTypesReference:z,priceCoefficientsReference:l}}),Vr=ie.defineStore("references",()=>{const i=m.computed(()=>{const l=D();return!l.channelPrimaryInterestReference&&!l.dataLoaderList.channelPrimaryInterestReference&&(l.dataLoaderList.channelPrimaryInterestReference=!0,f.getInstance(R).getChannelPrimaryInterest().then(y=>{l.channelPrimaryInterestReference=y}).catch(h.noop)),l.channelPrimaryInterestReference}),r=m.computed(()=>{const l=D();return!l.contactPositionsReference&&!l.dataLoaderList.contactPositionsReference&&(l.dataLoaderList.contactPositionsReference=!0,f.getInstance(R).getContactPositions().then(y=>{l.contactPositionsReference=y}).catch(h.noop)),l.contactPositionsReference}),e=m.computed(()=>{const l=D();return!l.currencyReference&&!l.dataLoaderList.currencyReference&&(l.dataLoaderList.currencyReference=!0,f.getInstance(R).getCurrency().then(y=>{l.currencyReference=y}).catch(h.noop)),l.currencyReference}),s=m.computed(()=>{const l=D();return!l.opfReference&&!l.dataLoaderList.opfReference&&(l.dataLoaderList.opfReference=!0,f.getInstance(R).getOpf().then(y=>{l.opfReference=y}).catch(h.noop)),l.opfReference}),n=m.computed(()=>{const l=D();return!l.orderPaymentStatusReference&&!l.dataLoaderList.orderPaymentStatusReference&&(l.dataLoaderList.orderPaymentStatusReference=!0,f.getInstance(R).getOrderPaymentStatuses().then(y=>{l.orderPaymentStatusReference=y}).catch(h.noop)),l.orderPaymentStatusReference}),c=m.computed(()=>{const l=D();return!l.orderStatusReference&&!l.dataLoaderList.orderStatusReference&&(l.dataLoaderList.orderStatusReference=!0,f.getInstance(R).getOrderStatuses().then(y=>{l.orderStatusReference=y}).catch(h.noop)),l.orderStatusReference}),u=m.computed(()=>{const l=D();return!l.paymentTypeReference&&!l.dataLoaderList.paymentTypeReference&&(l.dataLoaderList.paymentTypeReference=!0,f.getInstance(R).getPaymentTypes().then(y=>{l.paymentTypeReference=y}).catch(h.noop)),l.paymentTypeReference}),p=m.computed(()=>{const l=D();return!l.partnerGroupReference&&!l.dataLoaderList.partnerGroupReference&&(l.dataLoaderList.partnerGroupReference=!0,f.getInstance(R).getPartnerGroup().then(y=>{l.partnerGroupReference=y}).catch(h.noop)),l.partnerGroupReference}),C=m.computed(()=>{const l=D();return!l.productFileTypeReference&&!l.dataLoaderList.productFileTypeReference&&(l.dataLoaderList.productFileTypeReference=!0,f.getInstance(R).getProductFileType().then(y=>{l.productFileTypeReference=y}).catch(h.noop)),l.productFileTypeReference}),P=m.computed(()=>{const l=D();return!l.resourceTypesReference&&!l.dataLoaderList.resourceTypesReference&&(l.dataLoaderList.resourceTypesReference=!0,f.getInstance(R).getResourceTypes().then(y=>{l.resourceTypesReference=y}).catch(h.noop)),l.resourceTypesReference}),S=m.computed(()=>{const l=D();return!l.salesDirectionsReference&&!l.dataLoaderList.salesDirectionsReference&&(l.dataLoaderList.salesDirectionsReference=!0,f.getInstance(R).getSalesDirections().then(y=>{l.salesDirectionsReference=y}).catch(h.noop)),l.salesDirectionsReference}),_=m.computed(()=>{const l=D();return!l.sourcePrimaryInterestReference&&!l.dataLoaderList.sourcePrimaryInterestReference&&(l.dataLoaderList.sourcePrimaryInterestReference=!0,f.getInstance(R).getSourcePrimaryInterest().then(y=>{l.sourcePrimaryInterestReference=y}).catch(h.noop)),l.sourcePrimaryInterestReference}),I=m.computed(()=>{const l=D();return!l.deliveryTypeReference&&!l.dataLoaderList.deliveryTypeReference&&(l.dataLoaderList.deliveryTypeReference=!0,f.getInstance(R).getDeliveryTypes().then(y=>{l.deliveryTypeReference=y}).catch(h.noop)),l.deliveryTypeReference}),L=m.computed(()=>{const l=D();return!l.managersList&&!l.dataLoaderList.managersList&&(l.dataLoaderList.managersList=!0,f.getInstance(Pr).getManagers().then(y=>{l.managersList=y}).catch(h.noop)),l.managersList}),k=m.computed(()=>{const l=D();return!l.warehousesReference&&!l.dataLoaderList.warehousesReference&&(l.dataLoaderList.warehousesReference=!0,f.getInstance(R).getWarehouses().then(y=>{l.warehousesReference=y}).catch(h.noop)),l.warehousesReference}),O=m.computed(()=>{const l=D();return!l.propertyTypesReference&&!l.dataLoaderList.propertyTypesReference&&(l.dataLoaderList.propertyTypesReference=!0,f.getInstance(R).getPropertyTypes().then(y=>{l.propertyTypesReference=y}).catch(h.noop)),l.propertyTypesReference}),z=m.computed(()=>{const l=D();return!l.priceCoefficientsReference&&!l.dataLoaderList.priceCoefficientsReference&&(l.dataLoaderList.priceCoefficientsReference=!0,f.getInstance(R).getPriceCoefficients().then(y=>{l.priceCoefficientsReference=y}).catch(h.noop)),l.priceCoefficientsReference});return{channelPrimaryInterestsReference:i,contactPositionsReference:r,currencyReference:e,opfReference:s,orderPaymentStatusReference:n,orderStatusReference:c,paymentTypeReference:u,partnerGroupsReference:p,productFilesTypesReference:C,resourceTypesReference:P,salesDirectionsReference:S,sourcePrimaryInterestsReference:_,deliveryTypeReference:I,managersList:L,warehousesReference:k,propertyTypesReference:O,priceCoefficientsReference:z}}),xr=ie.defineStore("__user_state_private",()=>{const i=m.ref({}),r=m.ref(void 0);return{dataLoaderList:i,currentUser:r}}),Kr=ie.defineStore("user_state",()=>({currentUser:m.computed(()=>{const r=xr();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,f.getInstance(lr).getCurrentUser().then(e=>{r.currentUser=e}).catch(h.noop).finally(h.noop)),r.currentUser})}));class Jr extends f{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(s=>{const n=[...s];let c=1;return n.forEach(u=>{u.id=c++}),n})}}class Qr{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}o.AnyReference=er,o.AppBaseConfig=vr,o.AppConfigProvider=$,o.BankAccount=me,o.BasePaginationProvider=ge,o.Cart=X,o.CartItem=je,o.CartItemBase=ze,o.CartProvider=ar,o.CatalogProvider=br,o.CatalogableItem=Pe,o.Category=N,o.CategoryPricingRule=Ie,o.ChannelPrimaryInterest=Ae,o.City=Tr,o.CityWithRegionAndCountry=re,o.Client=Ne,o.ClientAdditionalData=Cr,o.ClientCategory=ee,o.ClientDataProvider=Gr,o.ClientProduct=Z,o.ClientProductCategoryDataProvider=Ir,o.ClientProductDataProvider=Lr,o.ClientShortInfo=ye,o.ClientsAdditionalDataRequestTypeEnum=pr,o.ClientsListFilters=dr,o.ConfiguratorProvider=Br,o.Contact=fe,o.ContactLinks=Ee,o.ContactPerson=M,o.ContactPersonRelated=mr,o.ContactPosition=rr,o.ContactRelation=Ce,o.ContragentBase=Le,o.ContragentFactory=se,o.ContragentIc=ke,o.ContragentPerson=hr,o.ContragentUlNr=gr,o.ContragentUlR=Oe,o.CostSourceEnum=ve,o.Country=W,o.Currency=te,o.DataSuggestionProvider=Jr,o.DataTablePagination=qr,o.DataTablePaginationRequestParams=wr,o.DataTableSortRequestParams=Mr,o.DateTimeProvider=Wr,o.DeletableNamedIdentity=Xe,o.DeliveryAddress=ne,o.DeliveryType=H,o.DeviceTypeResolutionConfig=Ve,o.DiscountShortInfo=Ze,o.FieldValidationResultData=Qr,o.FilterOpEnum=qe,o.GeoCoordinates=De,o.HiddenCatalogableItem=Be,o.HttpBaseCachedRequester=he,o.HttpBaseRequester=pe,o.HttpParamsConfig=xe,o.HttpRequester=f,o.Identity=G,o.Image=We,o.Manager=E,o.ManagerCommon=F,o.ManagerDataFactory=zr,o.ManagerDataProvider=Pr,o.MetaTagItem=Rr,o.NamedIdentity=v,o.Opf=U,o.OpfEnum=a,o.Order=yr,o.OrderInfo=Ue,o.OrderPaymentStatus=tr,o.OrderProduct=fr,o.OrderShortInfo=de,o.OrderStatus=sr,o.OrdersDataProvider=Ur,o.PartnerGroup=q,o.PaymentType=nr,o.PreferencesStorageProvider=Sr,o.PriceCoefficientEnum=Ye,o.PriceTemplate=Fe,o.PricingRole=x,o.PricingRoleProvider=kr,o.PrimaryCatalogableItem=oe,o.Product=T,o.ProductCategoryDataProvider=$r,o.ProductDataProvider=_r,o.ProductFileType=ir,o.ProductPriceCoefficient=le,o.ProductPriceHistory=ur,o.PropertiesProvider=Or,o.Property=j,o.PropertyType=Se,o.PropertyTypeEnum=Qe,o.PropertyValue=B,o.RecommendationsDataProvider=Nr,o.RecommendationsList=_e,o.Reference=w,o.ReferenceDataProvider=R,o.Region=V,o.ResourceType=Te,o.SalesDirection=A,o.SentryConfig=Ke,o.Seo=Ge,o.SeoDataProvider=jr,o.SourcePrimaryInterest=be,o.StockCount=He,o.TypedInstanceFactory=ue,o.UnitsHelper=Me,o.UnknownClientDataProvider=Hr,o.UpdatableNamedIdentity=ae,o.User=cr,o.UserCommonInfo=$e,o.UserDataProvider=lr,o.UserShortInfo=d,o.UserTypeEnum=or,o.VersionConfig=Je,o.Warehouse=Y,o.useReferencesStore=Vr,o.useUserStateStore=Kr,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(o,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("lodash-es"),require("date-fns"),require("axios"),require("ts-case-convert"),require("pinia"),require("vue")):typeof define=="function"&&define.amd?define(["exports","lodash-es","date-fns","axios","ts-case-convert","pinia","vue"],g):(o=typeof globalThis<"u"?globalThis:o||self,g(o["SC Common Lib"]={},o["lodash-es"],o["date-fns"],o.axios,o["ts-case-convert"],o.pinia,o.vue))})(this,function(o,g,h,Dr,we,ie,m){"use strict";var Yr=Object.defineProperty;var Xr=(o,g,h)=>g in o?Yr(o,g,{enumerable:!0,configurable:!0,writable:!0,value:h}):o[g]=h;var t=(o,g,h)=>Xr(o,typeof g!="symbol"?g+"":g,h);class G{constructor(r){t(this,"id");t(this,"guid");this.id=(r==null?void 0:r.id)??-1,this.guid=(r==null?void 0:r.guid)??""}isNewRec(){return this.id===-1}}class v extends G{constructor(e){super(e);t(this,"name","");this.name=(e==null?void 0:e.name)??""}}class Pe extends v{constructor(e){super(e);t(this,"slug");t(this,"code");t(this,"type");this.slug=(e==null?void 0:e.slug)??"",this.code=(e==null?void 0:e.code)??""}}class oe extends Pe{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=(e==null?void 0:e.isPrimary)??!1}}class ce extends oe{constructor(e){super(e);t(this,"isHidden");t(this,"parentCategoryId");t(this,"properties");this.isHidden=(e==null?void 0:e.isHidden)??!1,this.parentCategoryId=e==null?void 0:e.parentCategoryId,this.properties=e==null?void 0:e.properties,this.type="category"}}class w extends v{constructor(e){super(e);t(this,"slug");t(this,"description");this.description=e==null?void 0:e.description,this.slug=e==null?void 0:e.slug}}class Re extends w{}class le{constructor(r){t(this,"coefficient");t(this,"value");t(this,"cost");t(this,"percent");t(this,"readOnly");this.coefficient=new Re(r==null?void 0:r.coefficient),this.value=(r==null?void 0:r.value)??0,this.cost=(r==null?void 0:r.cost)??0,this.percent=(r==null?void 0:r.percent)??0,this.readOnly=(r==null?void 0:r.readOnly)??!0}}class De{constructor(r){t(this,"lat");t(this,"long");this.lat=(r==null?void 0:r.lat)??0,this.long=(r==null?void 0:r.long)??0}}class H extends w{}class Y extends w{constructor(e){var s;super(e);t(this,"address");t(this,"isMain");t(this,"deliveryTypes");t(this,"regions");t(this,"coordinates");this.address=(e==null?void 0:e.address)??"",this.isMain=(e==null?void 0:e.isMain)??!1,this.deliveryTypes=((s=e==null?void 0:e.deliveryTypes)==null?void 0:s.map(n=>new H(n)))??[],this.regions=(e==null?void 0:e.regions)??[],this.coordinates=new De(e==null?void 0:e.coordinates)}}class He{constructor(r){t(this,"warehouse");t(this,"count");this.warehouse=new Y(r==null?void 0:r.warehouse),this.count=(r==null?void 0:r.count)??0}}const K=class K{static init(r){K.config=r}static getConfig(){if(g.isUndefined(K.config))throw new Error("Config is undefined. Please set config by AppConfigProvider.init().");return K.config}static loadRemoteConfig(r="/config.json"){const e=fetch(r).then(s=>s.ok?s.json():(console.error(new Error(`Ошибка загрузки ${r}: ${s.statusText}`)),new Promise(n=>{n({})})));return e.catch(s=>{console.error(s)}),e}};t(K,"config");let $=K;class Be extends Pe{constructor(e){super(e);t(this,"isHidden");this.isHidden=(e==null?void 0:e.isHidden)??!1}}class We{constructor(r,e){t(this,"image");t(this,"preview");t(this,"isDefault");this.image=`${e??""}${r.image}`,this.preview=`${e??""}${r.preview}`,this.isDefault=r.isDefault}}class T extends Be{constructor(e){var n,c,u,p;super(e);t(this,"supplierSku");t(this,"unit");t(this,"pack");t(this,"minCount");t(this,"quantityUnit");t(this,"currency");t(this,"cost");t(this,"costRub");t(this,"costDate");t(this,"onOrder");t(this,"stockCount");t(this,"category");t(this,"categories");t(this,"images");t(this,"properties");t(this,"priceCoefficients");this.supplierSku=e==null?void 0:e.supplierSku,this.unit=(e==null?void 0:e.unit)??"",this.pack=e==null?void 0:e.pack,this.minCount=e==null?void 0:e.minCount,this.quantityUnit=e==null?void 0:e.quantityUnit,this.currency=(e==null?void 0:e.currency)??"",this.cost=(e==null?void 0:e.cost)??0,this.costRub=(e==null?void 0:e.costRub)??0,this.costDate=e==null?void 0:e.costDate,this.onOrder=(e==null?void 0:e.onOrder)??!1,this.stockCount=((n=e==null?void 0:e.stockCount)==null?void 0:n.map(C=>new He(C)))??[],this.type="product";const s=(e==null?void 0:e.category)??((c=e==null?void 0:e.categories)==null?void 0:c.find(C=>C.isPrimary));s&&(this.category=new oe({...s,isPrimary:!0}),this.categories=[this.category]),e!=null&&e.categories&&(this.categories=e.categories.map(C=>new oe(C))),this.images=((u=e==null?void 0:e.images)==null?void 0:u.map(C=>{var P;return new We(C,(P=$.getConfig().urls)==null?void 0:P.mediaServer)}))??[],this.properties=(e==null?void 0:e.properties)??{},this.priceCoefficients=((p=e==null?void 0:e.priceCoefficients)==null?void 0:p.map(C=>new le(C)))??[],e&&"codeNumber"in e&&!e.code&&(this.code=e==null?void 0:e.codeNumber)}getIsMeasurable(){const e=$.getConfig().products.units;return[...e.linear,...e.square].includes(this.unit)}}class ze extends G{constructor(e){super(e);t(this,"category");t(this,"product");t(this,"quantity");t(this,"height");t(this,"length");t(this,"width");t(this,"barcode");t(this,"marker");t(this,"configurator");t(this,"configuratorParams");t(this,"isAdditionalSale");this.product=new T(e==null?void 0:e.product),this.quantity=e.quantity??0,this.marker=e.marker,this.category=e.category??new ce,this.height=e.height,this.length=e.length,this.width=e.width,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams&&g.cloneDeep(e.configuratorParams),this.isAdditionalSale=e.isAdditionalSale}}class je extends ze{constructor(e){super(e);t(this,"currency");t(this,"cost");t(this,"costOne");t(this,"costOneRub");t(this,"costRub");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"sawing");this.currency=e.currency,this.cost=e.cost,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.costRub=e.costRub,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.sawing=e.sawing}}class X{constructor(r){t(this,"items");t(this,"resultSum");t(this,"directionsSum");this.items=r.items.map(e=>new je(e)),this.resultSum=r.resultSum,this.directionsSum=r.directionsSum}}class Ve{constructor(r){t(this,"phone");t(this,"tablet");t(this,"laptop");this.phone=(r==null?void 0:r.phone)??360,this.tablet=(r==null?void 0:r.tablet)??600,this.laptop=(r==null?void 0:r.laptop)??1024}}class xe{constructor(r){t(this,"apiUri");t(this,"responseDataCacheTimeout");this.apiUri=(r==null?void 0:r.apiUri)??"",this.responseDataCacheTimeout=(r==null?void 0:r.responseDataCacheTimeout)??3*60*60}}class Ke{constructor(r){t(this,"dsn");t(this,"environment");t(this,"ignoreErrors");t(this,"trace");t(this,"replay");t(this,"additionalParams");var e,s,n,c;this.dsn=(r==null?void 0:r.dsn)??"",this.environment=(r==null?void 0:r.environment)??"production",this.ignoreErrors=(r==null?void 0:r.ignoreErrors)??[/Network\s{1,3}Error/,/Request\s{1,3}aborted/,/Request\s{1,3}failed\s{1,3}with\s{1,3}status\s{1,3}code\s{1,3}(401|403|422)/],this.trace={allowedTargets:((e=r==null?void 0:r.trace)==null?void 0:e.allowedTargets)??[/^\//],sampleRate:((s=r==null?void 0:r.trace)==null?void 0:s.sampleRate)??0},this.replay={replaysOnErrorSampleRate:((n=r==null?void 0:r.replay)==null?void 0:n.replaysOnErrorSampleRate)??0,replaysSessionSampleRate:((c=r==null?void 0:r.replay)==null?void 0:c.replaysSessionSampleRate)??0},this.additionalParams=(r==null?void 0:r.additionalParams)??{}}}class Je{constructor(r){t(this,"date");t(this,"name");t(this,"version");this.date=(r==null?void 0:r.date)??h.format(new Date,"dd.MM.yyyy"),this.name=(r==null?void 0:r.name)??"",this.version=(r==null?void 0:r.version)??"0.0.0"}}class vr{constructor(r){t(this,"environment");t(this,"currentDomain");t(this,"devMode");t(this,"http");t(this,"deviceTypeByResolution");t(this,"products");t(this,"sentry");t(this,"urls");t(this,"version");this.environment=(r==null?void 0:r.environment)??"production",this.currentDomain=(r==null?void 0:r.currentDomain)??"",this.devMode=(r==null?void 0:r.devMode)??{},this.http=new xe(r==null?void 0:r.http),this.deviceTypeByResolution=new Ve(r==null?void 0:r.deviceTypeByResolution),this.products={units:{linear:["пог.м.","м."],square:["м2"]},...r==null?void 0:r.products},this.sentry=new Ke({environment:this.environment,...r==null?void 0:r.sentry}),this.urls=r==null?void 0:r.urls,this.version=new Je(r==null?void 0:r.version)}}class ue{static simpleInstanceInitializer(r){return new r}static instanceInitializer(r,e){return new r(e)}}const b=class b{constructor(r,e){t(this,"httpClient");t(this,"defaultInstanceNotificationErrorResponseHandler",g.noop);const s=$.getConfig().version;this.defaultInstanceNotificationErrorResponseHandler=b.baseDefaultNotificationErrorResponseHandler,this.httpClient=Dr.create({baseURL:r,headers:{"APP-VERSION":`${s.name} (${s.version}, ${s.date})`,Accept:"application/json","Content-Type":"application/json",...e}}),this.httpClient.interceptors.request.use(n=>(n.method&&(n.method==="get"&&n.params&&(n.params=we.objectToSnake(n.params)),["put","patch","post"].includes(g.toLower(n.method))&&n.data&&(n.data=we.objectToSnake(n.data))),n),n=>Promise.reject(n)),this.httpClient.interceptors.response.use(n=>(n.data&&(n.data=we.objectToCamel(n.data)),n),n=>b.convertHttpErrorResponse(n))}static setBaseDefaultNotificationErrorResponseHandler(r){b.baseDefaultNotificationErrorResponseHandler=r}static getInstance(r){return Object.prototype.hasOwnProperty.call(b.instances,r.name)||(b.instances[r.name]=ue.simpleInstanceInitializer(r)),b.instances[r.name]}static convertHttpErrorResponse(r){var s,n;const e=r==null?void 0:r.response;return Promise.reject({status:(e==null?void 0:e.status)??0,statusText:(e==null?void 0:e.statusText)??"Unknown",message:((s=e==null?void 0:e.data)==null?void 0:s.message)??"Unknown Error. Probably network error.",errors:(n=e==null?void 0:e.data)==null?void 0:n.errors,headers:(e==null?void 0:e.headers)??{},data:e==null?void 0:e.data,rawError:r})}request(r,e=void 0,s={},n=!1){const c=this.httpClient.request(r).then(u=>e?e(u):u.data);return n||c.catch(u=>{this.defaultInstanceNotificationErrorResponseHandler(u,s)}),c}get(r,e={},s=void 0,n=!1){return this.request({method:"GET",url:r,params:e},s,{},n)}patch(r,e={},s=void 0,n={},c=!1){return this.request({method:"PATCH",url:r,data:e},s,n,c)}post(r,e={},s=void 0,n={},c=!1){return this.request({method:"POST",url:r,data:e},s,n,c)}delete(r,e=!1){return this.request({method:"DELETE",url:r},g.noop,{},e)}};t(b,"instances",{}),t(b,"baseDefaultNotificationErrorResponseHandler",g.noop);let pe=b;const J=class J extends pe{constructor(e,s){super(e,s);t(this,"responseDataCacheTimeout");const n=$.getConfig();this.responseDataCacheTimeout=n.http.responseDataCacheTimeout}static getCachedResponse(e){const s=J.responseDataCache.get(e);if(s&&s.validTo>new Date)return s.val}cacheResponse(e,s){J.responseDataCache.set(e,{validTo:h.addSeconds(new Date,this.responseDataCacheTimeout),val:s})}getTypedDataArrayRequester(e,s,n=!1){const c=n?J.getCachedResponse(s):void 0;return c?Promise.resolve(c):this.get(s).then(u=>{const p=u.map(C=>ue.instanceInitializer(e,C));return n&&p&&this.cacheResponse(s,p),p})}};t(J,"responseDataCache",new Map);let ge=J;class f extends ge{constructor(){var s,n;const r=$.getConfig(),e={};(s=r.devMode)!=null&&s.authBearerToken&&(e.Authorization=`Bearer ${(n=r.devMode)==null?void 0:n.authBearerToken}`),super(`${r.http.apiUri}/api`,e)}}class ar extends f{getCart(r){return this.get(`internal/clients/${r.id}/cart`,{},e=>new X(e.data))}deleteCart(r){return this.delete(`internal/clients/${r.id}/cart`)}addCartItem(r,e,s={}){return this.patch(`internal/clients/${r.id}/cart`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},n=>new X(n.data),s)}patchCartItem(r,e,s={}){return this.patch(`internal/clients/${r.id}/cart/${e.id}`,{id:e.configurator&&e.category.id,productId:e.product.id,quantity:e.quantity,height:e.height,length:e.length,width:e.width,configurator:e.configurator,marker:e.marker,isAdditionalSale:e.isAdditionalSale,...e.configuratorParams},n=>new X(n.data),s)}deleteCartItem(r,e){return this.get(`internal/clients/${r.id}/cart/${e.id}`,{})}addCartItemFromCSV(r){return this.post(`internal/clients/${r.id}/cart/add-products-from-csv`,{},e=>new X(e.data))}}var ve=(i=>(i.Discount="discount",i.PriceTemplate="price_template",i.ClientPrice="client_price",i.Product="product",i))(ve||{}),Qe=(i=>(i.Unknown="unknown",i.Bool="bool",i.Integer="integer",i.Float="float",i.String="string",i.Range="range",i.Json="json",i.Object="object",i))(Qe||{}),Ye=(i=>(i.K0="k0",i.K1="k1",i.K2="k2",i.K3="k3",i.K4="k4",i))(Ye||{});class N extends ce{constructor(e){var s,n;super(e);t(this,"categories");t(this,"products");this.categories=(s=e==null?void 0:e.categories)==null?void 0:s.map(c=>new N(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new T(c))}}class ae extends v{constructor(e){super(e);t(this,"updatedAt");this.updatedAt=e==null?void 0:e.updatedAt}}class Xe extends ae{constructor(e){super(e);t(this,"deletedAt");this.deletedAt=e!=null&&e.deletedAt?g.isString(e.deletedAt)?h.parseISO(e.deletedAt):e.deletedAt:void 0}}class Sr{static getActualDataFromStorage(r){const e=localStorage.getItem(r);if(e)try{const s=JSON.parse(e);if(h.isAfter(h.parseISO(s.availableFor)||h.startOfToday(),new Date))return s.data||{}}catch{localStorage.removeItem(r)}}static saveActualDataToStorage(r,e,s){localStorage.setItem(r,JSON.stringify({availableFor:s,data:e}))}}class d extends v{constructor(e){super(e);t(this,"type");this.type=e==null?void 0:e.type}}class Ze extends v{constructor(e){super(e);t(this,"costCoefficient");t(this,"isLowPriceAllowed");t(this,"publishedAt");t(this,"description");t(this,"percent");t(this,"owner");t(this,"deletedAt");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.isLowPriceAllowed=(e==null?void 0:e.isLowPriceAllowed)??!1,this.publishedAt=e!=null&&e.publishedAt?g.isString(e.publishedAt)?h.parseISO(e.publishedAt):e.publishedAt:void 0,this.description=(e==null?void 0:e.description)??void 0,this.percent=(e==null?void 0:e.percent)??0,this.owner=new d(e==null?void 0:e.owner),this.deletedAt=e!=null&&e.deletedAt?g.isString(e.deletedAt)?h.parseISO(e.deletedAt):e.deletedAt:void 0}}class Fe extends ae{constructor(e){super(e);t(this,"description");t(this,"createdAt");this.description=(e==null?void 0:e.description)??"",this.createdAt=e!=null&&e.createdAt?g.isString(e.createdAt)?h.parseISO(e.createdAt):e.createdAt:new Date}}class Z extends T{constructor(e){super(e);t(this,"costCoefficient");t(this,"costSource");t(this,"discount");t(this,"priceTemplate");t(this,"isPreviouslyOrdered");t(this,"isRequired");t(this,"isFavorite");this.costCoefficient=(e==null?void 0:e.costCoefficient)??0,this.costSource=(e==null?void 0:e.costSource)??ve.Product,this.discount=e!=null&&e.discount?new Ze(e.discount):void 0,this.priceTemplate=e!=null&&e.priceTemplate?new Fe(e.priceTemplate):void 0,this.isPreviouslyOrdered=e==null?void 0:e.isPreviouslyOrdered,this.isRequired=e==null?void 0:e.isRequired,this.isFavorite=e==null?void 0:e.isFavorite}}class Ee{constructor(r){t(this,"phone");t(this,"email");this.phone=/^\d+$/.test(r.phone??"")?`+${r.phone}`:r.phone,this.email=r.email}}class A extends w{}class F extends v{constructor(e){super(e);t(this,"salesDirection",new A);t(this,"photo");t(this,"contacts");t(this,"isDefault");e&&(this.salesDirection=new A(e.salesDirection),this.photo=e.photo,e.contacts&&(this.contacts=new Ee(e.contacts)),e.isDefault!==void 0&&(this.isDefault=e.isDefault))}}class E extends F{constructor(e){super(e);t(this,"isActive");t(this,"isSupervisor");t(this,"canDoReclamations");t(this,"createdAt");t(this,"supervisorId");this.isActive=(e==null?void 0:e.isActive)??!1,this.isSupervisor=(e==null?void 0:e.isSupervisor)??!1,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.createdAt=e==null?void 0:e.createdAt,this.supervisorId=e==null?void 0:e.supervisorId}}class Ar extends ce{constructor(e){super(e);t(this,"isDisabled");t(this,"isRequired");t(this,"isFavorite");t(this,"hidingComment");t(this,"manager");this.isDisabled=(e==null?void 0:e.isDisabled)??!1,this.isRequired=(e==null?void 0:e.isRequired)??!1,this.isFavorite=(e==null?void 0:e.isFavorite)??!1,this.hidingComment=e==null?void 0:e.hidingComment,this.manager=e!=null&&e.manager?new E(e.manager):void 0}}class ee extends Ar{constructor(e){var s,n;super(e);t(this,"categories");t(this,"products");this.categories=(s=e==null?void 0:e.categories)==null?void 0:s.map(c=>new ee(c)),this.products=(n=e==null?void 0:e.products)==null?void 0:n.map(c=>new Z(c))}}class Se extends w{}class j extends v{constructor(e){super(e);t(this,"type");t(this,"description");t(this,"metadata");this.type=new Se(e==null?void 0:e.type),this.description=(e==null?void 0:e.description)??"",this.metadata=e==null?void 0:e.metadata}}class B{constructor(r){t(this,"property");t(this,"value");this.property=new j(r==null?void 0:r.property),this.value=(r==null?void 0:r.value)??""}}class er extends w{}class Ae extends w{}class Tr extends w{}class W extends w{}class V extends w{constructor(e){super(e);t(this,"country",new W);e&&(this.country=new W(e.country))}}class re extends w{constructor(e){super(e);t(this,"region",new V);e&&(this.region=new V(e.region))}}class rr extends w{}class te extends v{constructor(e){super(e);t(this,"signature","");t(this,"symbol","");e&&(this.signature=e.signature??"",this.symbol=e.symbol??"")}}var a=(i=>(i.Person="individual",i.Ic="entrepreneur",i.UlR="legal",i.UlNr="non_resident_legal",i))(a||{});class U extends w{static generatePersonItem(){return new U({id:1,guid:"",slug:a.Person,name:""})}}class tr extends w{}class sr extends w{}class q extends w{}class nr extends w{}class ir extends w{}class Te extends w{}class be extends w{}class R extends f{getReference(r,e=!1){return this.getTypedDataArrayRequester(er,`/internal/references/${r}`,e)}getChannelPrimaryInterest(){return this.getTypedDataArrayRequester(Ae,"/internal/references/channel-primary-interest",!0)}getContactPositions(){return this.getTypedDataArrayRequester(rr,"/internal/references/contact-position",!0)}getCurrency(){return this.getTypedDataArrayRequester(te,"/public/references/currency",!0)}getPartnerGroup(){return this.getTypedDataArrayRequester(q,"/internal/references/partner-group",!0)}getOpf(){return this.getTypedDataArrayRequester(U,"/public/references/opf",!0)}getOrderPaymentStatuses(){return this.getTypedDataArrayRequester(tr,"/public/references/order-payment-status",!0)}getOrderStatuses(){return this.getTypedDataArrayRequester(sr,"/public/references/order-status",!0)}getPaymentTypes(){return this.getTypedDataArrayRequester(nr,"/public/references/payment-type",!0)}getResourceTypes(){return this.getTypedDataArrayRequester(Te,"/internal/references/resource-type",!0)}getSalesDirections(){return this.getTypedDataArrayRequester(A,"/public/references/sales-direction",!0)}getSourcePrimaryInterest(){return this.getTypedDataArrayRequester(be,"/internal/references/source-primary-interest",!0)}searchCity(r){return this.getTypedDataArrayRequester(re,`/internal/references/city-with-region-and-country/search?term=${r}`)}searchRegion(r){return this.getTypedDataArrayRequester(V,`/internal/references/region-with-country/search?term=${r}`)}searchCountry(r){return this.getTypedDataArrayRequester(W,`/internal/references/country/search?term=${r}`)}getDeliveryTypes(){return this.getTypedDataArrayRequester(H,"/internal/references/delivery-type",!0)}getWarehouses(){return this.getTypedDataArrayRequester(Y,"/public/references/warehouse",!0)}getPropertyTypes(){return this.getTypedDataArrayRequester(Se,"/internal/references/property-type",!0)}getPriceCoefficients(){return this.getTypedDataArrayRequester(Re,"/internal/references/price-coefficient",!0)}getProductFileType(){return this.getTypedDataArrayRequester(ir,"/public/references/product-file-type",!0)}}var or=(i=>(i.Admin="admin",i.Manager="manager",i.Operator="operator",i.Client="client",i.Guest="guest",i))(or||{});class $e extends v{constructor(e){super(e);t(this,"phone");t(this,"email");t(this,"getNews");t(this,"salesDirection");t(this,"createdAt");t(this,"lastLoginAt");t(this,"isActive");this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:(e==null?void 0:e.phone)??"",this.email=(e==null?void 0:e.email)??"",this.getNews=(e==null?void 0:e.getNews)??!1,this.salesDirection=e!=null&&e.salesDirection?new A(e.salesDirection):void 0,this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parseISO(e.createdAt):e==null?void 0:e.createdAt,this.lastLoginAt=g.isString(e==null?void 0:e.lastLoginAt)?h.parseISO(e.lastLoginAt):e==null?void 0:e.lastLoginAt,this.isActive=(e==null?void 0:e.isActive)??!1}}class cr extends $e{constructor(e){super(e);t(this,"type");t(this,"canDoReclamations");t(this,"photo");this.type=e==null?void 0:e.type,this.canDoReclamations=(e==null?void 0:e.canDoReclamations)??!1,this.photo=e==null?void 0:e.photo}}class lr extends f{getCurrentUser(){return this.get("/internal/users/info",{},r=>new cr(r.data))}}class ur{constructor(r){t(this,"cost");t(this,"costDate");t(this,"isLowCost");t(this,"isRetail");t(this,"discountName");t(this,"priceTemplateName");t(this,"client");t(this,"executor");t(this,"currency");this.cost=r.cost,this.costDate=g.isString(r.costDate)?h.parseISO(r.costDate):r.costDate,this.isLowCost=r.isLowCost,this.isRetail=r.isRetail,this.discountName=r.discountName,this.priceTemplateName=r.priceTemplateName,this.client=r.client?new d(r.client):void 0,this.executor=r.executor?new d(r.executor):void 0,this.currency=r.currency?new te(r.currency):void 0}}class _e{constructor(r){t(this,"products",[]);t(this,"productCategories",[]);r!=null&&r.products&&(this.products=r.products.map(e=>new T(e))),r!=null&&r.productCategories&&(this.productCategories=r.productCategories.map(e=>new N(e)))}}class x extends v{constructor(e){super(e);t(this,"description");t(this,"canChangeLowCost");t(this,"parentRoleId");t(this,"subRoles",[]);t(this,"parentRole");t(this,"level",0);this.description=e==null?void 0:e.description,this.canChangeLowCost=(e==null?void 0:e.canChangeLowCost)??!1,this.parentRoleId=e==null?void 0:e.parentRoleId}}class Ie{constructor(r){t(this,"role");t(this,"category");t(this,"minCoefficient");this.role=new x(r==null?void 0:r.role),this.category=new ce(r==null?void 0:r.category),this.minCoefficient=new Re(r==null?void 0:r.minCoefficient)}}class br extends f{search(r,e=!1){return this.get("/internal/catalog/search",{term:r,show_hidden:e})}getPriceExportLink(r="csv",e=!1,s=void 0){let c=`${$.getConfig().http.apiUri}/api/internal/price/export?format=${r}&show_hidden=${e}`;return s&&(c+=`&client_id=${s}`),c}}class $r extends f{getRootCategoriesList(r=!1){return this.get("/internal/catalog/categories",{showHidden:r},e=>e.data.map(s=>new N(s)))}getCategoryData(r,e=!1,s=!1){return this.get(`/internal/catalog/categories/${r}`,{showHidden:e,withNestedCategories:s},n=>new N(n.data))}getPublicCategoryData(r){return this.get(`/public/catalog/categories/${r}`,{},e=>new N(e.data))}getCategoryProductsList(r,e=!0,s=!1){return this.get(`/internal/catalog/categories/${r}/products`,{showHidden:s,withPriceCoefficients:e},n=>g.map(n.data,c=>new T(c)))}getCategoryProductsCoefficients(r){return this.get(`/internal/catalog/categories/${r}/products/coefficients`,{},e=>{const{data:s}=e;return g.forEach(s,n=>n.map(c=>new le(c))),s})}publicSimpleSearch(r,e=10){return new Promise((s,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{s(c.categories.map(u=>new N(u)))}).catch(c=>{n(c)})})}}class _r extends f{getProductData(r,e=!1){return this.get(`/internal/catalog/products/${r}`,{withPriceCoefficients:e},s=>new T(s.data))}getPublicProductData(r){return this.get(`/public/catalog/products/${r}`,{},e=>new T(e.data))}getProductPriceCoefficients(r){return this.get(`/internal/catalog/products/${r}/coefficients`,{},e=>g.map(e.data,s=>new le(s)))}getProductPriceHistory(r,e){const s={};return g.isNil(e)||(s.clientId=e),this.get(`/internal/price/products/${r}/history`,s,n=>g.map(n.data,c=>new ur(c)))}publicSimpleSearch(r,e=10){return new Promise((s,n)=>{this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then(c=>{s(c.products.map(u=>new T(u)))}).catch(c=>{n(c)})})}}class Ir extends f{getRootCategoriesList(r,e=!1){return this.get("/internal/catalog/categories",{clientId:r,showHidden:e},s=>s.data.map(n=>new ee(n)))}getCategoryData(r,e,s=!1,n=!1){return this.get(`/internal/catalog/categories/${e}`,{clientId:r,showHidden:s,withNestedCategories:n},c=>new ee(c.data))}getCategoryProductsList(r,e,s=!0,n=!1){return this.get(`/internal/catalog/categories/${e}/products`,{client_id:r,showHidden:n,withPriceCoefficients:s},c=>g.map(c.data,u=>new Z(u)))}}class Lr extends f{getProductData(r,e,s=!1){return this.get(`/internal/catalog/products/${r}`,{clientId:e,withPriceCoefficients:s},n=>new Z(n.data))}}class kr extends f{getRoles(){return this.get("/internal/price/roles",{},r=>r.data.map(e=>new x(e)))}createRole(r){return this.post("/internal/price/roles",r,e=>new x(e.data))}getRole(r){return this.get(`/internal/price/roles/${r}`,{},e=>new x(e.data))}updateRole(r,e){return this.patch(`/internal/price/roles/${r}`,e,s=>new x(s.data))}deleteRole(r){return this.delete(`/internal/price/roles/${r}`)}getCategoryRules(r){return this.get(`/internal/price/roles/rules/categories/${r}`,{},e=>e.data.map(s=>new Ie(s)))}updateCategoryRules(r,e){return this.patch(`/internal/price/roles/rules/categories/${r}`,e,s=>s.data.map(n=>new Ie(n)))}}class he extends f{getPaginated(r,e,s,n,c,u){const p={page:(n==null?void 0:n.page)??1,per_page:(n==null?void 0:n.pageSize)??(n==null?void 0:n.perPage)??10};return e&&(p.filters=JSON.stringify(e)),g.isEmpty(s)||(g.isArray(s)?s:[s]).forEach((C,P)=>{p[`sort[${P}][field]`]=C.field,p[`sort[${P}][direction]`]=C.direction}),this.get(r,p,c,u)}}class Or extends he{getProperties(r,e,s){return this.getPaginated("/internal/catalog/properties",r,e,s,n=>{const c={...n.data};return c.data=c.data.map(u=>new j(u)),c})}createProperty(r){const{typeId:e,...s}=r;return this.post("/internal/catalog/properties",{...s,type:e},n=>new j(n.data))}getProperty(r){return this.get(`/internal/catalog/properties/${r}`,{},e=>new j(e.data))}updateProperty(r,e){const{typeId:s,...n}=e;return this.patch(`/internal/catalog/properties/${r}`,{...n,type:s},c=>new j(c.data))}deleteProperty(r){return this.delete(`/internal/catalog/properties/${r}`)}getProductProperties(r){return this.get(`/internal/catalog/products/${r}/properties`,{},e=>e.data.map(s=>new B(s)))}getProductProperty(r,e){return this.get(`/internal/catalog/products/${r}/properties/${e}`,{},s=>new B(s.data))}updateProductProperty(r,e,s){return this.patch(`/internal/catalog/products/${r}/properties/${e}`,{value:s},n=>new B(n.data))}deleteProductProperty(r,e){return this.delete(`/internal/catalog/products/${r}/properties/${e}`)}getProductDescription(r){return this.get(`/internal/catalog/products/${r}/properties/description`)}updateProductDescription(r,e){return this.patch(`/internal/catalog/products/${r}/properties/description`,{text:e})}deleteProductDescription(r){return this.delete(`/internal/catalog/products/${r}/properties/description`)}getProductSpecification(r){return this.get(`/internal/catalog/products/${r}/properties/specification`)}updateProductSpecification(r,e){return this.patch(`/internal/catalog/products/${r}/properties/specification`,{text:e})}deleteProductSpecification(r){return this.delete(`/internal/catalog/products/${r}/properties/specification`)}getProductFiles(r){return this.get(`/internal/catalog/products/${r}/properties/files`)}addProductFile(r,e){return this.post(`/internal/catalog/products/${r}/properties/files`,e)}updateProductFile(r,e,s){return this.patch(`/internal/catalog/products/${r}/properties/files/${e}`,s)}deleteProductFile(r,e){return this.delete(`/internal/catalog/products/${r}/properties/files/${e}`)}updateProductSlug(r,e){return this.patch(`/internal/catalog/products/${r}/properties/slug`,{slug:e})}getCategoryProperties(r){return this.get(`/internal/catalog/categories/${r}/properties`,{},e=>e.data.map(s=>new B(s)))}getCategoryProperty(r,e){return this.get(`/internal/catalog/categories/${r}/properties/${e}`,{},s=>new B(s.data))}updateCategoryProperty(r,e,s){return this.patch(`/internal/catalog/categories/${r}/properties/${e}`,{value:s},n=>new B(n.data))}deleteCategoryProperty(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/${e}`)}getCategoryDescription(r){return this.get(`/internal/catalog/categories/${r}/properties/description`)}updateCategoryDescription(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/description`,{text:e})}deleteCategoryDescription(r){return this.delete(`/internal/catalog/categories/${r}/properties/description`)}getCategorySpecification(r){return this.get(`/internal/catalog/categories/${r}/properties/specification`)}updateCategorySpecification(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/specification`,{text:e})}deleteCategorySpecification(r){return this.delete(`/internal/catalog/categories/${r}/properties/specification`)}getCategoryFiles(r){return this.get(`/internal/catalog/categories/${r}/properties/files`)}addCategoryFile(r,e){return this.post(`/internal/catalog/categories/${r}/properties/files`,e)}updateCategoryFile(r,e,s){return this.patch(`/internal/catalog/categories/${r}/properties/files/${e}`,s)}deleteCategoryFile(r,e){return this.delete(`/internal/catalog/categories/${r}/properties/files/${e}`)}updateCategorySlug(r,e){return this.patch(`/internal/catalog/categories/${r}/properties/slug`,{slug:e})}updateCategoryImage(r,e){return this.post(`/internal/catalog/categories/${r}/image`,e)}}class Nr extends f{getProductCategoryRecommendations(r){return this.get(`/internal/catalog/recommendations/categories/${r.id}`,{},e=>new _e(e.data))}getProductRecommendations(r){return this.get(`/internal/catalog/recommendations/products/${r.id}`,{},e=>new _e(e.data))}saveProductCategoryRecommendations(r,e){return this.post(`/internal/catalog/recommendations/categories/${r.id}`,{product_categories:e.productCategories.map(s=>s.id),products:e.products.map(s=>s.id)})}saveProductRecommendations(r,e){return this.post(`/internal/catalog/recommendations/products/${r.id}`,{product_categories:e.productCategories.map(s=>s.id),products:e.products.map(s=>s.id)})}}var pr=(i=>(i.LastOrder="last_order",i.Contacts="contacts",i.PartnerGroups="partner_groups",i.PreferredDeliveryType="preferred_delivery_type",i))(pr||{});class me extends G{constructor(e){super(e);t(this,"bankName","");t(this,"bic","");t(this,"accountNumber","");t(this,"correspondentAccount","");t(this,"currency",new te);e&&(this.bankName=e.bankName??"",this.bic=e.bic??"",this.accountNumber=e.accountNumber??"",this.correspondentAccount=e.correspondentAccount??"",this.currency=new te(e.currency))}}class fe extends v{constructor(e){super(e);t(this,"phone");t(this,"email");this.email=e==null?void 0:e.email,this.phone=/^\d+$/.test((e==null?void 0:e.phone)??"")?`+${e==null?void 0:e.phone}`:e==null?void 0:e.phone}}class M extends fe{constructor(e){super(e);t(this,"isPrimary");t(this,"position");t(this,"notDisturb");t(this,"comment");t(this,"updatedAt");t(this,"deletedAt");this.isPrimary=(e==null?void 0:e.isPrimary)??!1,this.position=e==null?void 0:e.position,this.notDisturb=(e==null?void 0:e.notDisturb)??!1,this.comment=e==null?void 0:e.comment,this.updatedAt=e==null?void 0:e.updatedAt,this.deletedAt=e==null?void 0:e.deletedAt}}class Le extends v{constructor(e){super(e);t(this,"manager",new F);t(this,"opf",U.generatePersonItem());t(this,"salesDirection",new A);t(this,"partnerGroup",new q);t(this,"contacts",[]);t(this,"bankAccounts",[]);t(this,"comment");t(this,"alternativeName");t(this,"createdAt");t(this,"creator");t(this,"updatedAt");t(this,"updater");if(e){if(this.opf=new U(e.opf),this.salesDirection=new A(e.salesDirection),this.comment=e.comment,this.alternativeName=e.alternativeName,this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parse(e==null?void 0:e.createdAt,"yyyy-MM-dd HH:mm:ss",new Date):e.createdAt,this.creator=e.creator?new d(e.creator):void 0,this.updatedAt=g.isString(e==null?void 0:e.updatedAt)?h.parse(e==null?void 0:e.updatedAt,"yyyy-MM-dd HH:mm:ss",new Date):e.updatedAt,this.updater=e.updater?new d(e.updater):void 0,e.partnerGroup&&(this.partnerGroup=new q(e.partnerGroup)),e.manager&&(this.manager=new F(e.manager)),e.contacts){const s=[];e.contacts.forEach(n=>{s.push(new M(n))}),this.contacts=s}if(e.bankAccounts){const s=[];e.bankAccounts.forEach(n=>{s.push(new me(n))}),this.bankAccounts=s}}}}class gr extends Le{constructor(r){super(r)}}class ke extends Le{constructor(e){super(e);t(this,"inn","");t(this,"okpo","");t(this,"directorName","");t(this,"directorPosition","");t(this,"directorActsOn","");t(this,"legalAddress","");t(this,"postalAddress","");t(this,"actualAddress","");e&&(this.inn=e.inn??"",this.okpo=e.okpo??"",this.directorName=e.directorName??"",this.directorPosition=e.directorPosition??"",this.directorActsOn=e.directorActsOn??"",this.legalAddress=e.legalAddress??"",this.postalAddress=e.postalAddress??"",this.actualAddress=e.actualAddress??"")}}class Oe extends ke{constructor(e){super(e);t(this,"kpp","");e&&(this.kpp=e.kpp??"")}}class hr extends Oe{constructor(e){super(e);t(this,"registrationCountry",new W);t(this,"registrationNumber","");t(this,"taxNumber","");e&&(this.registrationCountry=new W(e.registrationCountry),this.registrationNumber=e.registrationNumber??"",this.taxNumber=e.taxNumber??"")}}class se{static createInstance(r){switch(r.opf.slug){case a.Ic:return new ke(r);case a.UlR:return new Oe(r);case a.UlNr:return new hr(r);default:return new gr(r)}}}class ye extends $e{constructor(e){var s;super(e);t(this,"salesDirection");t(this,"debt");t(this,"alternativeName");t(this,"city");t(this,"comment");t(this,"isPhoneApproved");t(this,"isEmailApproved");t(this,"managers");this.salesDirection=new A(e==null?void 0:e.salesDirection),this.debt=(e==null?void 0:e.debt)??0,this.alternativeName=(e==null?void 0:e.alternativeName)??"",this.city=new re(e==null?void 0:e.city),this.comment=e==null?void 0:e.comment,this.isPhoneApproved=(e==null?void 0:e.isPhoneApproved)??!1,this.isEmailApproved=(e==null?void 0:e.isEmailApproved)??!1,this.managers=((s=e==null?void 0:e.managers)==null?void 0:s.map(n=>new F(n)))??[]}}class Ce extends G{constructor(e){super(e);t(this,"isPrimary");this.isPrimary=e.isPrimary}}class mr extends M{constructor(e){super(e);t(this,"relations",{clients:[],contragents:[],addresses:[]});e.relations&&(e.relations.addresses&&(this.relations.addresses=e.relations.addresses.map(s=>new Ce(s))),e.relations.clients&&(this.relations.clients=e.relations.clients.map(s=>new Ce(s))),e.relations.contragents&&(this.relations.contragents=e.relations.contragents.map(s=>new Ce(s))))}}class ne extends Xe{constructor(e){var s;super(e);t(this,"address","");t(this,"coordinates");t(this,"contacts");t(this,"comment");t(this,"operatingHours");t(this,"isOneTime");t(this,"isTransportCompanyAddress");this.address=(e==null?void 0:e.address)??"",this.coordinates=new De(e==null?void 0:e.coordinates),this.contacts=((s=e==null?void 0:e.contacts)==null?void 0:s.map(n=>new M(n)))??[],this.comment=e==null?void 0:e.comment,this.operatingHours=e==null?void 0:e.operatingHours,this.isOneTime=e==null?void 0:e.isOneTime,this.isTransportCompanyAddress=e==null?void 0:e.isTransportCompanyAddress}}class Ne extends ye{constructor(e){var s,n,c,u;super(e);t(this,"contragents");t(this,"partnerGroups");t(this,"contacts");t(this,"deliveryAddresses");t(this,"channelPrimaryInterest");t(this,"sourcePrimaryInterest");t(this,"preferredDeliveryType");t(this,"primaryDemand");t(this,"isExcludedFromMsCallsToClients");t(this,"preferredWarehouse");t(this,"extraData");this.contragents=((s=e==null?void 0:e.contragents)==null?void 0:s.map(p=>se.createInstance(p)))??[],this.partnerGroups=((n=e==null?void 0:e.partnerGroups)==null?void 0:n.map(p=>new q(p)))??[],this.contacts=((c=e==null?void 0:e.contacts)==null?void 0:c.map(p=>new M(p)))??[],this.deliveryAddresses=((u=e==null?void 0:e.deliveryAddresses)==null?void 0:u.map(p=>new ne(p)))??[],this.channelPrimaryInterest=new Ae(e==null?void 0:e.channelPrimaryInterest),this.sourcePrimaryInterest=new be(e==null?void 0:e.sourcePrimaryInterest),this.preferredDeliveryType=new H(e==null?void 0:e.preferredDeliveryType),this.primaryDemand=e==null?void 0:e.primaryDemand,this.isExcludedFromMsCallsToClients=(e==null?void 0:e.isExcludedFromMsCallsToClients)??!1,this.preferredWarehouse=e!=null&&e.preferredWarehouse?new Y(e.preferredWarehouse):void 0,this.extraData=(e==null?void 0:e.extraData)??{}}}class dr{constructor(r){t(this,"id");t(this,"name");t(this,"alternativeName");t(this,"city");t(this,"region");t(this,"country");t(this,"phone");t(this,"email");t(this,"isActive");t(this,"createdAt",{from:null,to:null});t(this,"lastLoginDate",{from:null,to:null});t(this,"lastLoginDateHasOrder");t(this,"managers");t(this,"salesDirection");t(this,"contragentInn");t(this,"contragentType");t(this,"preferredDeliveryType");t(this,"hasCostLessThenStop");t(this,"partnerGroup");t(this,"contact");t(this,"lastOrder");var e,s,n,c,u,p,C;this.id=(r==null?void 0:r.id)??"",this.name=(r==null?void 0:r.name)??"",this.alternativeName=(r==null?void 0:r.alternativeName)??"",this.city=new re(r==null?void 0:r.city),this.region=new V(r==null?void 0:r.region),this.country=new W(r==null?void 0:r.country),this.phone=(r==null?void 0:r.phone)??"",this.email=(r==null?void 0:r.email)??"",this.isActive=r&&Object.prototype.hasOwnProperty.call(r,"isActive")?r==null?void 0:r.isActive:!0,this.createdAt={from:((e=r==null?void 0:r.createdAt)==null?void 0:e.from)??null,to:((s=r==null?void 0:r.createdAt)==null?void 0:s.to)??null},this.lastLoginDate={from:((n=r==null?void 0:r.lastLoginDate)==null?void 0:n.from)??null,to:((c=r==null?void 0:r.lastLoginDate)==null?void 0:c.to)??null},this.lastLoginDateHasOrder=(r==null?void 0:r.lastLoginDateHasOrder)??void 0,this.managers=r!=null&&r.managers&&r.managers.length>0?r.managers.map(P=>new E(P)):[],this.salesDirection=new A(r==null?void 0:r.salesDirection),this.contragentInn=(r==null?void 0:r.contragentInn)??"",this.contragentType=new U(r==null?void 0:r.contragentType),this.preferredDeliveryType=new H(r==null?void 0:r.preferredDeliveryType),this.hasCostLessThenStop=r!=null&&r.hasCostLessThenStop?!0:void 0,this.partnerGroup=new q(r==null?void 0:r.partnerGroup),this.contact=new fe(r==null?void 0:r.contact),this.lastOrder={createdAt:(u=r==null?void 0:r.lastOrder)==null?void 0:u.createdAt,creator:(p=r==null?void 0:r.lastOrder)==null?void 0:p.creator,isApproved:(C=r==null?void 0:r.lastOrder)==null?void 0:C.isApproved}}resetFilterValue(r){switch(r){case"id":case"phone":case"email":case"name":case"alternativeName":case"contragentInn":this[r]="";break;case"city":this.city=new re;break;case"region":this.region=new V;break;case"isActive":this.isActive=!0;break;case"createdAt":this.createdAt.from=null,this.createdAt.to=null;break;case"lastLoginDate":this.lastLoginDate.from=null,this.lastLoginDate.to=null;break;case"lastLoginDateHasOrder":this.lastLoginDateHasOrder=void 0;break;case"lastOrder":this.lastOrder={};break;case"managers":this.managers=[];break;case"salesDirection":this.salesDirection=new A;break;case"contragentType":this.contragentType=new U;break;case"preferredDeliveryType":this.preferredDeliveryType=new H;break;case"partnerGroup":this.partnerGroup=new q;break;case"hasCostLessThenStop":this.hasCostLessThenStop=void 0;break;case"contact":this.contact=new fe;break}return this}asClearRaw(){var e,s,n,c;const r={};return Object.keys(this).forEach(u=>{const p=this[u];g.isUndefined(p)||g.isString(p)&&p.trim().length===0||g.isFunction(p.isNewRec)&&p.isNewRec()||(r[u]=p)}),!((e=r==null?void 0:r.createdAt)!=null&&e.from)&&!((s=r==null?void 0:r.createdAt)!=null&&s.to)&&delete r.createdAt,!((n=r==null?void 0:r.lastLoginDate)!=null&&n.from)&&!((c=r==null?void 0:r.lastLoginDate)!=null&&c.to)&&delete r.lastLoginDate,r}}class de extends G{constructor(e){super(e);t(this,"createdAt");t(this,"creator");t(this,"isApproved1c");this.createdAt=g.isString(e==null?void 0:e.createdAt)?h.parse(e.createdAt,"dd.MM.yyyy HH:mm",new Date):(e==null?void 0:e.createdAt)??new Date,this.creator=new d(e==null?void 0:e.creator),this.isApproved1c=(e==null?void 0:e.isApproved1c)??!1}}class Ue extends de{constructor(e){var s,n,c,u,p,C,P,S;super(e);t(this,"client");t(this,"payment");t(this,"delivery");t(this,"attachedUser");t(this,"status");t(this,"salesDirection");t(this,"pendingAt");t(this,"processedAt");t(this,"isOnOrder");t(this,"isNotInStock");this.client=new ye(e==null?void 0:e.client),this.payment={type:((s=e==null?void 0:e.payment)==null?void 0:s.type)??-1,status:((n=e==null?void 0:e.payment)==null?void 0:n.status)??-1,onlinePaymentLink:(c=e==null?void 0:e.payment)==null?void 0:c.onlinePaymentLink},this.delivery={type:((u=e==null?void 0:e.delivery)==null?void 0:u.type)??-1,date:g.isString((p=e==null?void 0:e.delivery)==null?void 0:p.date)?h.parse(e==null?void 0:e.delivery.date,"dd.MM.yyyy",new Date):((C=e==null?void 0:e.delivery)==null?void 0:C.date)??new Date,address:(P=e==null?void 0:e.delivery)!=null&&P.address?new ne(e.delivery.address):void 0,warehouse:(S=e==null?void 0:e.delivery)!=null&&S.warehouse?new Y(e.delivery.warehouse):void 0},this.attachedUser=new d(e==null?void 0:e.attachedUser),this.status=(e==null?void 0:e.status)??0,this.salesDirection=new A(e==null?void 0:e.salesDirection),this.pendingAt=g.isString(e==null?void 0:e.pendingAt)?h.parse(e==null?void 0:e.pendingAt,"dd.MM.yyyy HH:mm",new Date):(e==null?void 0:e.pendingAt)??new Date,this.processedAt=g.isString(e==null?void 0:e.processedAt)?h.parse(e==null?void 0:e.processedAt,"dd.MM.yyyy HH:mm",new Date):(e==null?void 0:e.processedAt)??new Date,this.isOnOrder=(e==null?void 0:e.isOnOrder)??!1,this.isNotInStock=(e==null?void 0:e.isNotInStock)??!1}}class fr extends G{constructor(e){super(e);t(this,"product");t(this,"quantity");t(this,"currency");t(this,"costOne");t(this,"costOneRub");t(this,"cost");t(this,"costRub");t(this,"marker");t(this,"height");t(this,"length");t(this,"width");t(this,"logicGroupId");t(this,"salesDirection");t(this,"specificationImgUrl");t(this,"configurator");t(this,"configuratorParams");t(this,"sawing");this.product=new Z(e.product),this.quantity=e.quantity,this.currency=e.currency,this.costOne=e.costOne,this.costOneRub=e.costOneRub,this.cost=e.cost,this.costRub=e.costRub,this.marker=e.marker,this.height=e.height,this.length=e.length,this.width=e.width,this.logicGroupId=e.logicGroupId,this.salesDirection=e.salesDirection,this.specificationImgUrl=e.specificationImgUrl,this.configurator=e.configurator,this.configuratorParams=e.configuratorParams,this.sawing=e.sawing}}class yr extends Ue{constructor(e){super(e);t(this,"products");t(this,"invoices");t(this,"comment");t(this,"image");t(this,"contragent");t(this,"barcode");t(this,"orderSource");t(this,"isAllowProcessingWithoutPayment");this.products=(e.products??[]).map(s=>new fr(s)),this.invoices=e.invoices??[],this.comment=e.comment,this.image=e.image,this.contragent=e.contragent?se.createInstance(e.contragent):void 0,this.barcode=e.barcode,this.orderSource=e.orderSource?new w(e.orderSource):void 0,this.isAllowProcessingWithoutPayment=e.isAllowProcessingWithoutPayment}}class Ur extends he{getOrders(r,e,s){return this.getPaginated("/internal/orders",r,e?[e]:void 0,s,n=>{const c={...n.data};return c.data=c.data.map(u=>new Ue(u)),c})}getClientOrderStatistics(r,e){return this.get(`/internal/clients/${r}/orders/statistics`,e?{period:e}:{})}getOrder(r){return this.get(`/internal/orders/${r}`,{},e=>new yr(e.data))}}class Cr extends v{constructor(e){var s,n;super(e);t(this,"contacts",[]);t(this,"preferredDeliveryType");t(this,"partnerGroups",[]);t(this,"lastOrder");(s=e.contacts)!=null&&s.length&&(this.contacts=e.contacts.map(c=>new M(c))),e.lastOrder&&(this.lastOrder=new de(e.lastOrder)),(n=e.partnerGroups)!=null&&n.length&&(this.partnerGroups=e.partnerGroups.map(c=>new q(c))),e.preferredDeliveryType&&(this.preferredDeliveryType=new H(e.preferredDeliveryType))}}var qe=(i=>(i.BeginWith="bw",i.Contains="cn",i.Custom="custom",i.EndsWith="ew",i.Equals="eq",i.GreaterOrEqual="ge",i.GreaterThan="gt",i.InList="in",i.LessOrEqual="le",i.LessThan="lt",i.NotBeginWith="bn",i.NotContains="nc",i.NotEndsWith="en",i.NotEqual="ne",i.NotInList="ni",i.NotNull="nn",i.Null="nu",i))(qe||{});class wr{constructor(r){t(this,"page",1);t(this,"pageSize",50);t(this,"perPage",50);this.page=(r==null?void 0:r.page)??1,this.perPage=(r==null?void 0:r.perPage)??50,this.pageSize=(r==null?void 0:r.pageSize)??this.perPage}}class qr extends wr{constructor(e){super(e);t(this,"itemCount",0);t(this,"pageCount",1);t(this,"pageSlot",5);t(this,"pageSizes",[25,50,100]);t(this,"showSizePicker",!0);this.itemCount=(e==null?void 0:e.itemCount)??0,this.pageCount=(e==null?void 0:e.pageCount)??1,this.pageSlot=(e==null?void 0:e.pageSlot)??5,this.pageSizes=(e==null?void 0:e.pageSizes)??[25,50,100],this.showSizePicker=(e==null?void 0:e.showSizePicker)??!0}}class Mr{constructor(r){t(this,"field");t(this,"direction");this.field=(r==null?void 0:r.field)??"",this.direction=(r==null?void 0:r.direction)??"asc"}}class Gr extends he{getClient(r){return this.get(`/internal/clients/${r}`,{},e=>new Ne(e.data))}getClientsList(r,e,s){return this.getPaginated("/internal/clients",r,e,s,n=>{const c={...n.data};return c.data=c.data.map(u=>new ye(u)),c})}getClientByPhone(r){return this.getClientsList({groupOp:"and",groups:[],filters:[{field:"phone",op:qe.Contains,value:r}]})}getAdditionalClientsData(r,e){return this.post("/internal/clients/additional-data",{clients:r,requested_data_types:e},s=>{let n=[];return(s==null?void 0:s.data.length)>0&&(n=s.data.map(c=>new Cr(c))),n})}getAllClientContacts(r){return this.get(`/internal/clients/${r}/contacts/all`,{},e=>{let s=[];return(e==null?void 0:e.data.length)>0&&(s=e.data.map(n=>new mr(n))),s})}createClientCommonData(r,e={}){var s;return this.post("/internal/clients",{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(s=r.preferredWarehouse)==null?void 0:s.id},n=>new Ne(n.data),e)}updateClientCommonData(r,e={}){var s;return this.patch(`/internal/clients/${r.id}`,{name:r.name,alternative_name:r.alternativeName,partner_groups:r.partnerGroups.map(n=>n.id),phone:r.phone,email:r.email,city_id:r.city.id,get_news:r.getNews,channel_primary_interest_id:r.channelPrimaryInterest.id,source_primary_interest_id:r.sourcePrimaryInterest.id,primary_demand:r.primaryDemand,is_excluded_from_ms_calls_to_clients:r.isExcludedFromMsCallsToClients,preferred_warehouse_id:(s=r.preferredWarehouse)==null?void 0:s.id},void 0,e)}changeClientPassword(r,e,s,n={}){return this.patch(`/internal/clients/${r}`,{password:e,password_confirmation:s},void 0,n)}updateClientComment(r){return this.patch(`/internal/clients/${r.id}`,{comment:r.comment})}changeClientActivation(r){return this.patch(`/internal/clients/${r.id}`,{is_active:r.isActive})}async attachClientToManagers(r,e){const s=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/attach`,{is_primary:n.isDefault}));await Promise.all(s)}async detachClientFromManagers(r,e){const s=e.map(n=>this.patch(`/internal/clients/${r}/managers/${n.id}/detach`));await Promise.all(s)}createContragentClientData(r,e,s={}){var C,P,S,_,I,L,k,O;let n;const c=e,u=e,p=e;switch(e.opf.slug){case a.Ic:n={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(P=c.manager)==null?void 0:P.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case a.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(S=u.partnerGroup)==null?void 0:S.id,manager_id:(_=u.manager)==null?void 0:_.id,comment:u.comment,inn:u.inn,kpp:u.kpp,okpo:u.okpo,director_name:u.directorName,director_position:u.directorPosition,director_acts_on:u.directorActsOn,legal_address:u.legalAddress,postal_address:u.postalAddress,actual_address:u.actualAddress};break;case a.UlNr:n={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(I=p.partnerGroup)==null?void 0:I.id,manager_id:(L=p.manager)==null?void 0:L.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(O=e.manager)==null?void 0:O.id,comment:e.comment};break}return this.post(`/internal/clients/${r}/contragents`,n,z=>se.createInstance(z.data),s)}updateContragentClientData(r,e,s={}){var C,P,S,_,I,L,k,O;let n;const c=e,u=e,p=e;switch(e.opf.slug){case a.Ic:n={opf:c.opf.slug,name:c.name,alternative_name:c.alternativeName,partner_group_id:(C=c.partnerGroup)==null?void 0:C.id,manager_id:(P=c.manager)==null?void 0:P.id,comment:c.comment,inn:c.inn,okpo:c.okpo,director_name:c.directorName,director_position:c.directorPosition,director_acts_on:c.directorActsOn,legal_address:c.legalAddress,postal_address:c.postalAddress,actual_address:c.actualAddress};break;case a.UlR:n={opf:u.opf.slug,name:u.name,alternative_name:u.alternativeName,partner_group_id:(S=u.partnerGroup)==null?void 0:S.id,manager_id:(_=u.manager)==null?void 0:_.id,comment:u.comment,inn:u.inn,kpp:u.kpp,okpo:u.okpo,director_name:u.directorName,director_position:u.directorPosition,director_acts_on:u.directorActsOn,legal_address:u.legalAddress,postal_address:u.postalAddress,actual_address:u.actualAddress};break;case a.UlNr:n={opf:p.opf.slug,name:p.name,alternative_name:p.alternativeName,partner_group_id:(I=p.partnerGroup)==null?void 0:I.id,manager_id:(L=p.manager)==null?void 0:L.id,comment:p.comment,inn:p.inn,kpp:p.kpp,okpo:p.okpo,director_name:p.directorName,director_position:p.directorPosition,director_acts_on:p.directorActsOn,legal_address:p.legalAddress,postal_address:p.postalAddress,actual_address:p.actualAddress,registration_country_id:p.registrationCountry.id,registration_number:p.registrationNumber,tax_number:p.taxNumber};break;default:n={opf:e.opf.slug,name:e.name,alternative_name:e.alternativeName,partner_group_id:(k=e.partnerGroup)==null?void 0:k.id,manager_id:(O=e.manager)==null?void 0:O.id,comment:e.comment};break}return this.patch(`/internal/clients/${r}/contragents/${e.id}`,n,z=>se.createInstance(z.data),s)}deleteClientContragent(r,e){return this.delete(`/internal/clients/${r}/contragents/${e.id}`)}createClientDeliveryAddress(r,e,s={}){var c,u;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.coordinates&&(n.coordinates={lat:(c=e.coordinates)==null?void 0:c.lat,long:(u=e.coordinates)==null?void 0:u.long}),e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),this.post(`/internal/clients/${r}/delivery-addresses`,n,p=>new ne(p.data),s)}updateClientDeliveryAddress(r,e,s={}){var c,u;const n={address:e.address,is_one_time:e.isOneTime??!1,is_transport_company_address:e.isTransportCompanyAddress??!1,comment:e.comment??""};return e.operatingHours&&(n.operating_hours={from:e.operatingHours.from,to:e.operatingHours.to}),e.coordinates&&(n.coordinates={lat:(c=e.coordinates)==null?void 0:c.lat,long:(u=e.coordinates)==null?void 0:u.long}),this.patch(`/internal/clients/${r}/delivery-addresses/${e.id}`,n,p=>new ne(p.data),s)}deleteClientDeliveryAddress(r,e){return this.delete(`/internal/clients/${r}/delivery-addresses/${e.id}`)}createContragentBankAccount(r,e,s,n={}){return this.post(`/internal/clients/${r}/contragents/${e}/bank-accounts`,{bank_name:s.bankName,bic:s.bic,account_number:s.accountNumber,correspondent_account:s.correspondentAccount,currency_id:s.currency.id},c=>new me(c.data),n)}updateContragentBankAccount(r,e,s,n={}){return this.patch(`/internal/clients/${r}/contragents/${e}/bank-accounts/${s.id}`,{bank_name:s.bankName,bic:s.bic,account_number:s.accountNumber,correspondent_account:s.correspondentAccount,currency_id:s.currency.id},c=>new me(c.data),n)}deleteContragentBankAccount(r,e,s){return this.delete(`/internal/clients/${r}/contragents/${e}/bank-accounts/${s.id}`)}createClientContact(r,e,s={}){return this.createContact(r,e,{client:{id:r,is_primary:e.isPrimary??!1,not_disturb:e.notDisturb??!1}},s)}updateClientContact(r,e,s={}){return this.patch(`/internal/clients/${r}/contacts/${e.id}`,{name:e.name,position:e.position,phone:e.phone,email:e.email,comment:e.comment,not_disturb:e.notDisturb},n=>new M(n.data),s)}setPrimaryClientContact(r,e){return this.setPrimaryContact(`/internal/clients/${r}/contacts/${e.id}/primary`,e.isPrimary??!1)}detachClientContact(r,e){return this.detachContact(`/internal/clients/${r}/contacts/${e.id}/detach`)}createContragentContact(r,e,s,n={}){return this.createContact(r,s,{contragents:[{id:e,is_primary:s.isPrimary??!1,not_disturb:s.notDisturb??!1}]},n)}setPrimaryContragentContact(r,e,s){return this.setPrimaryContact(`/internal/clients/${r}/contragents/${e}/contacts/${s.id}/primary`,s.isPrimary??!1)}detachContragentContact(r,e,s){return this.detachContact(`/internal/clients/${r}/contragents/${e}/contacts/${s.id}/detach`)}createDeliveryAddressContact(r,e,s,n={}){return this.createContact(r,s,{addresses:[{id:e,is_primary:s.isPrimary??!1,not_disturb:s.notDisturb??!1}]},n)}setPrimaryDeliveryAddressContact(r,e,s){return this.setPrimaryContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${s.id}/primary`,s.isPrimary??!1)}detachDeliveryAddressContact(r,e,s){return this.detachContact(`/internal/clients/${r}/delivery-addresses/${e}/contacts/${s.id}/detach`)}createContact(r,e,s,n={}){var u,p;const c={name:e.name,position:e.position,comment:e.comment,...s};return(u=e.phone)!=null&&u.length&&(c.phone=e.phone),(p=e.email)!=null&&p.length&&(c.email=e.email),this.post(`/internal/clients/${r}/contacts`,c,C=>new M(C.data),n)}setPrimaryContact(r,e){return this.patch(r,{is_primary:e})}detachContact(r){return this.patch(r)}sendClientEmailConfirmation(r){return this.get(`/internal/clients/${r.id}/verification/email?email=${r.email}`)}}class Hr extends f{checkPhoneIsBusy(r){return new Promise((e,s)=>{this.request({method:"GET",url:"/public/user/verification/phone/check",params:{phone:r}}).then(n=>{e(!!n.isBusy)}).catch(s)})}}class Br extends f{getConfiguratorSettings(r){var e;return this.get(`internal/catalog/categories/${r.id}/configurators/${(e=r.properties)==null?void 0:e.editor}/settings`)}searchProduct(r,e,s={}){var c;const n=this.get(`internal/catalog/categories/${r.id}/configurators/${(c=r.properties)==null?void 0:c.editor}/product`,{params:e},u=>new T(u.data));return n.catch(u=>{this.defaultInstanceNotificationErrorResponseHandler(u,s)}),n}createTemplate(r,e,s={}){var n;return this.post(`internal/catalog/categories/${r.id}/configurators/${(n=r.properties)==null?void 0:n.editor}/template`,{...e},()=>{},s)}removeTemplate(r,e){var s;return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s=r.properties)==null?void 0:s.editor}/template/${e}`)}}class Wr{static defaultDateRanges(){const r=[0,6].includes(h.getDay(h.startOfTomorrow()))?h.nextMonday(h.startOfToday()):h.startOfTomorrow();return{nextWorkingDay:{label:"Следующий рабочий день",from:h.getUnixTime(h.startOfDay(r)),to:h.getUnixTime(h.endOfDay(r))},today:{label:"Сегодня",from:h.getUnixTime(h.startOfToday()),to:h.getUnixTime(h.endOfToday())},yesterday:{label:"Вчера",from:h.getUnixTime(h.startOfYesterday()),to:h.getUnixTime(h.endOfYesterday())},tomorrow:{label:"Завтра",from:h.getUnixTime(h.startOfTomorrow()),to:h.getUnixTime(h.endOfTomorrow())}}}}const Q=class Q{static setLinearValues(r){Q.linearValues=r}static productIsMeasurable(r){return Q.linearValues.includes(r.unit)}static getProductMultiplicity(r){var e,s;return!((e=r.properties)!=null&&e.ignoreMinCountCheck)&&((s=r.properties)!=null&&s.minCount)&&!Q.productIsMeasurable(r)?r.properties.minCount:1}static getProductLengthMultiplicity(r){var e,s,n;return(e=r.properties)!=null&&e.lengthStep?r.properties.lengthStep:!((s=r.properties)!=null&&s.ignoreMinCountCheck)&&((n=r.properties)!=null&&n.minCount)?r.properties.minCount:.01}};t(Q,"linearValues",["пог.м.","м.","м2"]);let Me=Q;class zr{static generateUndefinedManagerInstance(){return new E({id:0,name:"- Не назначен -",isActive:!0,guid:"-undefined-"})}static isUndefinedManagerInstance(r){return r.id===0&&r.guid==="-undefined-"}}class Pr extends f{getManagers(){const r="/internal/managers",e=f.getCachedResponse(r);return e?Promise.resolve(e):this.get(r).then(s=>{const n=s.data.map(c=>ue.instanceInitializer(E,c));return n&&this.cacheResponse(r,n),n})}}class Rr{constructor(r){t(this,"name");t(this,"content");this.name=r.name,this.content=r.content}}class Ge{constructor(r){t(this,"resourceType");t(this,"resourceId");t(this,"h1");t(this,"title");t(this,"description");t(this,"keywords");t(this,"meta");var e;this.resourceType=new Te(r==null?void 0:r.resourceType),this.resourceId=(r==null?void 0:r.resourceId)??"",this.h1=r==null?void 0:r.h1,this.title=r==null?void 0:r.title,this.description=r==null?void 0:r.description,this.keywords=r==null?void 0:r.keywords,this.meta=((e=r==null?void 0:r.meta)==null?void 0:e.map(s=>new Rr(s)))??[]}}class jr extends f{getResourceSeoData(r,e){return this.get(`/internal/seo/${r.slug}/${e}`,{},s=>new Ge(s.data))}saveResourceSeoData(r,e={}){return this.post(`/internal/seo/${r.resourceType.slug}/${r.resourceId}`,r,s=>new Ge(s.data),e)}deleteResourceSeoData(r,e){return this.delete(`/internal/seo/${r.slug}/${e}`)}}const D=ie.defineStore("__references_private",()=>{const i=m.ref({}),r=m.ref(void 0),e=m.ref(void 0),s=m.ref(void 0),n=m.ref(void 0),c=m.ref(void 0),u=m.ref(void 0),p=m.ref(void 0),C=m.ref(void 0),P=m.ref(void 0),S=m.ref(void 0),_=m.ref(void 0),I=m.ref(void 0),L=m.ref(void 0),k=m.ref(void 0),O=m.ref(void 0),z=m.ref(void 0),l=m.ref(void 0);return{dataLoaderList:i,channelPrimaryInterestReference:r,contactPositionsReference:e,currencyReference:s,deliveryTypeReference:n,managersList:c,opfReference:u,orderPaymentStatusReference:p,orderStatusReference:C,paymentTypeReference:P,partnerGroupReference:S,productFileTypeReference:_,resourceTypesReference:I,salesDirectionsReference:L,sourcePrimaryInterestReference:k,warehousesReference:O,propertyTypesReference:z,priceCoefficientsReference:l}}),Vr=ie.defineStore("references",()=>{const i=m.computed(()=>{const l=D();return!l.channelPrimaryInterestReference&&!l.dataLoaderList.channelPrimaryInterestReference&&(l.dataLoaderList.channelPrimaryInterestReference=!0,f.getInstance(R).getChannelPrimaryInterest().then(y=>{l.channelPrimaryInterestReference=y}).catch(g.noop)),l.channelPrimaryInterestReference}),r=m.computed(()=>{const l=D();return!l.contactPositionsReference&&!l.dataLoaderList.contactPositionsReference&&(l.dataLoaderList.contactPositionsReference=!0,f.getInstance(R).getContactPositions().then(y=>{l.contactPositionsReference=y}).catch(g.noop)),l.contactPositionsReference}),e=m.computed(()=>{const l=D();return!l.currencyReference&&!l.dataLoaderList.currencyReference&&(l.dataLoaderList.currencyReference=!0,f.getInstance(R).getCurrency().then(y=>{l.currencyReference=y}).catch(g.noop)),l.currencyReference}),s=m.computed(()=>{const l=D();return!l.opfReference&&!l.dataLoaderList.opfReference&&(l.dataLoaderList.opfReference=!0,f.getInstance(R).getOpf().then(y=>{l.opfReference=y}).catch(g.noop)),l.opfReference}),n=m.computed(()=>{const l=D();return!l.orderPaymentStatusReference&&!l.dataLoaderList.orderPaymentStatusReference&&(l.dataLoaderList.orderPaymentStatusReference=!0,f.getInstance(R).getOrderPaymentStatuses().then(y=>{l.orderPaymentStatusReference=y}).catch(g.noop)),l.orderPaymentStatusReference}),c=m.computed(()=>{const l=D();return!l.orderStatusReference&&!l.dataLoaderList.orderStatusReference&&(l.dataLoaderList.orderStatusReference=!0,f.getInstance(R).getOrderStatuses().then(y=>{l.orderStatusReference=y}).catch(g.noop)),l.orderStatusReference}),u=m.computed(()=>{const l=D();return!l.paymentTypeReference&&!l.dataLoaderList.paymentTypeReference&&(l.dataLoaderList.paymentTypeReference=!0,f.getInstance(R).getPaymentTypes().then(y=>{l.paymentTypeReference=y}).catch(g.noop)),l.paymentTypeReference}),p=m.computed(()=>{const l=D();return!l.partnerGroupReference&&!l.dataLoaderList.partnerGroupReference&&(l.dataLoaderList.partnerGroupReference=!0,f.getInstance(R).getPartnerGroup().then(y=>{l.partnerGroupReference=y}).catch(g.noop)),l.partnerGroupReference}),C=m.computed(()=>{const l=D();return!l.productFileTypeReference&&!l.dataLoaderList.productFileTypeReference&&(l.dataLoaderList.productFileTypeReference=!0,f.getInstance(R).getProductFileType().then(y=>{l.productFileTypeReference=y}).catch(g.noop)),l.productFileTypeReference}),P=m.computed(()=>{const l=D();return!l.resourceTypesReference&&!l.dataLoaderList.resourceTypesReference&&(l.dataLoaderList.resourceTypesReference=!0,f.getInstance(R).getResourceTypes().then(y=>{l.resourceTypesReference=y}).catch(g.noop)),l.resourceTypesReference}),S=m.computed(()=>{const l=D();return!l.salesDirectionsReference&&!l.dataLoaderList.salesDirectionsReference&&(l.dataLoaderList.salesDirectionsReference=!0,f.getInstance(R).getSalesDirections().then(y=>{l.salesDirectionsReference=y}).catch(g.noop)),l.salesDirectionsReference}),_=m.computed(()=>{const l=D();return!l.sourcePrimaryInterestReference&&!l.dataLoaderList.sourcePrimaryInterestReference&&(l.dataLoaderList.sourcePrimaryInterestReference=!0,f.getInstance(R).getSourcePrimaryInterest().then(y=>{l.sourcePrimaryInterestReference=y}).catch(g.noop)),l.sourcePrimaryInterestReference}),I=m.computed(()=>{const l=D();return!l.deliveryTypeReference&&!l.dataLoaderList.deliveryTypeReference&&(l.dataLoaderList.deliveryTypeReference=!0,f.getInstance(R).getDeliveryTypes().then(y=>{l.deliveryTypeReference=y}).catch(g.noop)),l.deliveryTypeReference}),L=m.computed(()=>{const l=D();return!l.managersList&&!l.dataLoaderList.managersList&&(l.dataLoaderList.managersList=!0,f.getInstance(Pr).getManagers().then(y=>{l.managersList=y}).catch(g.noop)),l.managersList}),k=m.computed(()=>{const l=D();return!l.warehousesReference&&!l.dataLoaderList.warehousesReference&&(l.dataLoaderList.warehousesReference=!0,f.getInstance(R).getWarehouses().then(y=>{l.warehousesReference=y}).catch(g.noop)),l.warehousesReference}),O=m.computed(()=>{const l=D();return!l.propertyTypesReference&&!l.dataLoaderList.propertyTypesReference&&(l.dataLoaderList.propertyTypesReference=!0,f.getInstance(R).getPropertyTypes().then(y=>{l.propertyTypesReference=y}).catch(g.noop)),l.propertyTypesReference}),z=m.computed(()=>{const l=D();return!l.priceCoefficientsReference&&!l.dataLoaderList.priceCoefficientsReference&&(l.dataLoaderList.priceCoefficientsReference=!0,f.getInstance(R).getPriceCoefficients().then(y=>{l.priceCoefficientsReference=y}).catch(g.noop)),l.priceCoefficientsReference});return{channelPrimaryInterestsReference:i,contactPositionsReference:r,currencyReference:e,opfReference:s,orderPaymentStatusReference:n,orderStatusReference:c,paymentTypeReference:u,partnerGroupsReference:p,productFilesTypesReference:C,resourceTypesReference:P,salesDirectionsReference:S,sourcePrimaryInterestsReference:_,deliveryTypeReference:I,managersList:L,warehousesReference:k,propertyTypesReference:O,priceCoefficientsReference:z}}),xr=ie.defineStore("__user_state_private",()=>{const i=m.ref({}),r=m.ref(void 0);return{dataLoaderList:i,currentUser:r}}),Kr=ie.defineStore("user_state",()=>({currentUser:m.computed(()=>{const r=xr();return!r.currentUser&&!r.dataLoaderList.currentUser&&(r.dataLoaderList.currentUser=!0,f.getInstance(lr).getCurrentUser().then(e=>{r.currentUser=e}).catch(g.noop).finally(g.noop)),r.currentUser})}));class Jr extends f{searchAddresses(r){return this.execSuggestionQuery("/public/suggestions/address",r)}searchBank(r){return this.execSuggestionQuery("/public/suggestions/bank",r)}searchOrganization(r){return this.execSuggestionQuery("/public/suggestions/organization",r)}execSuggestionQuery(r,e){return this.get(r,{query:e}).then(s=>{const n=[...s];let c=1;return n.forEach(u=>{u.id=c++}),n})}}class Qr{constructor(r,e){t(this,"showFeedback",!1);t(this,"feedback","");t(this,"validationStatus");this.showFeedback=!!r,this.feedback=r,this.validationStatus=e}}o.AnyReference=er,o.AppBaseConfig=vr,o.AppConfigProvider=$,o.BankAccount=me,o.BasePaginationProvider=he,o.Cart=X,o.CartItem=je,o.CartItemBase=ze,o.CartProvider=ar,o.CatalogProvider=br,o.CatalogableItem=Pe,o.Category=N,o.CategoryPricingRule=Ie,o.ChannelPrimaryInterest=Ae,o.City=Tr,o.CityWithRegionAndCountry=re,o.Client=Ne,o.ClientAdditionalData=Cr,o.ClientCategory=ee,o.ClientDataProvider=Gr,o.ClientProduct=Z,o.ClientProductCategoryDataProvider=Ir,o.ClientProductDataProvider=Lr,o.ClientShortInfo=ye,o.ClientsAdditionalDataRequestTypeEnum=pr,o.ClientsListFilters=dr,o.ConfiguratorProvider=Br,o.Contact=fe,o.ContactLinks=Ee,o.ContactPerson=M,o.ContactPersonRelated=mr,o.ContactPosition=rr,o.ContactRelation=Ce,o.ContragentBase=Le,o.ContragentFactory=se,o.ContragentIc=ke,o.ContragentPerson=gr,o.ContragentUlNr=hr,o.ContragentUlR=Oe,o.CostSourceEnum=ve,o.Country=W,o.Currency=te,o.DataSuggestionProvider=Jr,o.DataTablePagination=qr,o.DataTablePaginationRequestParams=wr,o.DataTableSortRequestParams=Mr,o.DateTimeProvider=Wr,o.DeletableNamedIdentity=Xe,o.DeliveryAddress=ne,o.DeliveryType=H,o.DeviceTypeResolutionConfig=Ve,o.DiscountShortInfo=Ze,o.FieldValidationResultData=Qr,o.FilterOpEnum=qe,o.GeoCoordinates=De,o.HiddenCatalogableItem=Be,o.HttpBaseCachedRequester=ge,o.HttpBaseRequester=pe,o.HttpParamsConfig=xe,o.HttpRequester=f,o.Identity=G,o.Image=We,o.Manager=E,o.ManagerCommon=F,o.ManagerDataFactory=zr,o.ManagerDataProvider=Pr,o.MetaTagItem=Rr,o.NamedIdentity=v,o.Opf=U,o.OpfEnum=a,o.Order=yr,o.OrderInfo=Ue,o.OrderPaymentStatus=tr,o.OrderProduct=fr,o.OrderShortInfo=de,o.OrderStatus=sr,o.OrdersDataProvider=Ur,o.PartnerGroup=q,o.PaymentType=nr,o.PreferencesStorageProvider=Sr,o.PriceCoefficientEnum=Ye,o.PriceTemplate=Fe,o.PricingRole=x,o.PricingRoleProvider=kr,o.PrimaryCatalogableItem=oe,o.Product=T,o.ProductCategoryDataProvider=$r,o.ProductDataProvider=_r,o.ProductFileType=ir,o.ProductPriceCoefficient=le,o.ProductPriceHistory=ur,o.PropertiesProvider=Or,o.Property=j,o.PropertyType=Se,o.PropertyTypeEnum=Qe,o.PropertyValue=B,o.RecommendationsDataProvider=Nr,o.RecommendationsList=_e,o.Reference=w,o.ReferenceDataProvider=R,o.Region=V,o.ResourceType=Te,o.SalesDirection=A,o.SentryConfig=Ke,o.Seo=Ge,o.SeoDataProvider=jr,o.SourcePrimaryInterest=be,o.StockCount=He,o.TypedInstanceFactory=ue,o.UnitsHelper=Me,o.UnknownClientDataProvider=Hr,o.UpdatableNamedIdentity=ae,o.User=cr,o.UserCommonInfo=$e,o.UserDataProvider=lr,o.UserShortInfo=d,o.UserTypeEnum=or,o.VersionConfig=Je,o.Warehouse=Y,o.useReferencesStore=Vr,o.useUserStateStore=Kr,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=sc-common-lib.umd.cjs.map
|