@skyservice-developers/vue-dev-kit 3.0.0 → 3.1.1
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/{money-BCv6JlZu.js → money-DS3eJE0W.js} +154 -142
- package/dist/money-DVXnJ7Ca.cjs +1 -0
- package/dist/sdk/bridge.d.ts +8 -0
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.js +18 -17
- package/dist/style.css +1 -1
- package/dist/vue-dev-kit.cjs +7 -7
- package/dist/vue-dev-kit.js +3244 -3248
- package/package.json +1 -1
- package/dist/money-dyX9wNiC.cjs +0 -1
package/package.json
CHANGED
package/dist/money-dyX9wNiC.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const R=require("ua-parser-js"),v="DASHBOARD",A=5e3;let E=0,f=null;function L(){return`sdk_${Date.now()}_${++E}`}function N(){return"APP_"+Math.random().toString(36).slice(2,10)}function T(t){f=t}function m(){return f||(f=N()),f}function c(t){window.parent.postMessage({...t,sender:m(),target:t.target||v},"*")}function l(t,e,r=A){return y()?new Promise(n=>{const o=L(),i=m(),s=setTimeout(()=>{window.removeEventListener("message",d),n(null)},r);function d(w){const a=w.data;(a==null?void 0:a.type)==="DATA_RESPONSE"&&(a==null?void 0:a.requestId)===o&&(!a.target||a.target===i)&&(clearTimeout(s),window.removeEventListener("message",d),n(a.data??null))}window.addEventListener("message",d),c({type:"DATA_REQUEST",requestId:o,source:t,key:e})}):Promise.resolve(null)}function D(t){c({type:"navigate",path:t})}function C(){c({type:"exit"})}const $=C;function u(t){return l("store",t)}function h(t){return l("localStorage",t)}function U(t){return l("window",t)}function _(){return u("company")}function M(){return u("user")}function O(){return h("token")}function W(){return h("lang")}function B(){return u("productCategories")}function F(t,e){c({type:"setLocalStorage",key:t,value:e})}function G(t){c({type:"setRocketMode",value:t})}function K(t,e){c({type:"trackVisit",name:t,path:e})}function x(t){c({type:"openExternalLink",url:t})}function j(){c({type:"openCrispChat"})}function H(t){c({type:"notification",text:t})}function Y(t){c({type:"notification",text:t,variant:"error"})}function Z(t){c({type:"notification",text:t,variant:"warn"})}function y(){try{return window.self!==window.top}catch{return!0}}const q=y;function V(t){function e(r){var n;((n=r.data)==null?void 0:n.sender)===v&&t(r.data)}return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}function p(){if(typeof window>"u")return"browser";if(window.webkit!=null&&window.webkit.messageHandlers!==void 0)try{if(R(navigator.userAgent).browser.name==="WebKit")return"ios_webview"}catch(t){console.error(t)}return typeof Android<"u"?"android_webview":typeof window.cefQuery<"u"?"cef_webview":"browser"}function Q(){return p()==="ios_webview"}function z(){return p()==="android_webview"}function X(){return p()==="cef_webview"}function J(){return p()!=="browser"}const ee="https://api.cabinet.developer.skyservice.online/index.php";class I{constructor(e){this.permsCache=null,this.token=e.token,this.companyId=e.companyId,this.appId=e.appId,this.developerId=e.developerId,this.deploymentId=e.deploymentId,this.appName=e.appName;const r=e.domain.replace("dashboard","api");this.baseUrl=r.startsWith("http")?r:`https://${r}`}static create(e){return new I(e)}async get(e){const r=new URLSearchParams({token:this.token,companyId:this.companyId,...e}),n=await fetch(`${this.baseUrl}/?${r}`);if(!n.ok)throw new Error(`Skyservice API error: ${n.status}`);const o=await n.json();if(o.status!=="done")throw new Error(`Skyservice API returned status: ${o.status}`);return o.data}async post(e,r,n){const o=new URLSearchParams({token:this.token,...r}),i=await fetch(`${e}?${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new Error(`Skyservice API error: ${i.status}`);const s=await i.json();if(s.status!=="done")throw new Error(`Skyservice API returned status: ${s.status}`);return s.data}async getTradepoints(e){const r=await this.get({section:"tradepoints",action:"getTradepoints"});return e!=null&&e.includeDeleted?r.items:r.items.filter(n=>!n.deleted&&!n.frozen)}async getCategoryTree(e){const r=await this.get({section:"productCategory",action:"getCategories",...e?{tradepointId:String(e)}:{}});return b(r,e)}async getProducts(e){const r=await this.get({section:"products",action:"getProducts",pagelimit:"9999",ot:"desc",of:"nomenclatureId",...e!=null&&e.tradepointId?{tradepointId:String(e.tradepointId)}:{}});return re(r.items,e==null?void 0:e.includeInactive)}async setAppActive({isActive:e,title:r,settings:n}){const o=e?"activateApp":"deactivateApp",i={company_id:this.companyId,app_id:this.appId,...this.developerId!==void 0&&{developer_id:this.developerId},...e&&n!==void 0&&{settings:n}},s=await this.post(ee,{section:"integrations",action:o},i);return this.deploymentId&&this.appName&&typeof window<"u"&&window.self!==window.top&&window.parent.postMessage({type:"sendActiveApp",id:s.id,is_active:e,deploymentId:this.deploymentId,appName:this.appName,title:r},"*"),s}async getPerms(e){const r=await this.loadPerms();return e===void 0?r:!!r[String(e)]}clearPermsCache(){this.permsCache=null}async loadPerms(){var r;if(this.permsCache)return this.permsCache;if(typeof window<"u")try{const n=await u("perms");if(n&&Object.keys(n).length>0)return this.permsCache=S(n),this.permsCache}catch{}const e=await this.get({section:"adminPanel",action:"getStart"});return this.permsCache=S((r=e==null?void 0:e.settings)==null?void 0:r.perms),this.permsCache}}function S(t){const e={};if(!t||typeof t!="object")return e;for(const[r,n]of Object.entries(t))e[r]=!!n;return e}function b(t,e){var n,o;const r=[];for(const i of t){if(e!=null&&!((n=i.tradepointShow)==null?void 0:n[String(e)]))continue;const s={id:i.id,pid:i.pid,name:i.name,active:i.active,background:i.background,show:i.show};i.img&&(s.img=i.img),(o=i.children)!=null&&o.length&&(s.children=b(i.children,e)),r.push(s)}return r}const te=new Set(["product","techcard"]),ne="/img/no.png";function re(t,e){const r=[];for(const n of t)te.has(n.type)&&(!e&&!n.active||r.push({id:n.id,name:n.nomenclatureName,price:n.price,categoryId:n.categoryId,categoryName:n.categoryTitle||"",active:n.active,type:n.type,unit:n.unit,logo:n.logo&&n.logo!==ne?n.logo:""}));return r}const P={UAH:"₴",USD:"$",EUR:"€",KZT:"₸",GEL:"ლ",THB:"฿",AMD:"֏",BYN:"Br",AZN:"₼",GHS:"₵",KGS:"с",PLN:"zł",UZS:"soʻm",PHP:"₱",IDR:"Rp",TJS:"с",DOP:"$",NZD:"$",TRY:"₺",SGD:"$",NGN:"₦",MVR:"Rf",TMT:"m",MDL:"L",VND:"₫",CRC:"₡",INR:"₹",CNY:"¥",AED:".د.إ",LKR:"₨",RON:"L",GBP:"£",PKR:"₨",KRW:"₩",MYR:"RM",ILS:"₪",ZAR:"R",UGX:"USh",KES:"KSh",TZS:"TSh",RSD:"din",MXN:"$",VEF:"BsF",CUP:"$",COP:"$",KWD:".د.ك",CLP:"$",IQD:".د.ع",AOA:"Kz",GTQ:"Q",CZK:"Kč",XAF:"CFA",CHF:"Fr",RUR:"₽",SAR:"SRls"};function k(t){return t?P[t.toUpperCase()]??t:""}function ie(t,e){try{const r=new Intl.NumberFormat(e,{style:"currency",currency:t}).formatToParts(1),n=r.findIndex(i=>i.type==="currency"),o=r.findIndex(i=>i.type==="integer");return n!==-1&&o!==-1&&n<o}catch{return!1}}function oe(t,{currency:e=null,locale:r="uk",decimals:n=2}={}){if(t==null||t==="")return"";const o=typeof t=="number"?t:Number(t);if(!Number.isFinite(o))return String(t);const i=" ",[s,d]=Math.abs(o).toFixed(n).split("."),w=s.replace(/\B(?=(\d{3})+(?!\d))/g,i),a=`${o<0?"-":""}${w}${d?"."+d:""}`,g=k(e);return g?ie(e,r)?`${g}${a}`:`${a}${i}${g}`:a}exports.CURRENCY_ICONS=P;exports.SkyserviceAPI=I;exports.currencyIcon=k;exports.exit=C;exports.formatMoney=oe;exports.getBack=$;exports.getCompany=_;exports.getLang=W;exports.getLocalStorageData=h;exports.getProductCategories=B;exports.getSenderId=m;exports.getStoreData=u;exports.getToken=O;exports.getUser=M;exports.getWindowData=U;exports.isAndroidWebview=z;exports.isCefWebview=X;exports.isInIframe=q;exports.isInsideIframe=y;exports.isIosWebview=Q;exports.isWebview=J;exports.navigate=D;exports.notify=H;exports.notifyError=Y;exports.notifyWarn=Z;exports.onMessage=V;exports.openCrispChat=j;exports.openExternalLink=x;exports.setLocalStorage=F;exports.setRocketMode=G;exports.setSenderId=T;exports.trackVisit=K;exports.webviewCheck=p;
|