@ozdao/prometheus-framework 0.1.67 → 0.1.69
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/BackofficeGallery-59a591ab.js +1 -0
- package/dist/BackofficeGallery-be6f69a9.mjs +307 -0
- package/dist/BackofficeReports-06166952.js +1 -0
- package/dist/BackofficeReports-50fd799c.mjs +44 -0
- package/dist/BlockTags-00325fa0.mjs +853 -0
- package/dist/BlockTags-58f95c8a.js +1 -0
- package/dist/ButtonToggleMembership-84d0e018.mjs +90 -0
- package/dist/ButtonToggleMembership-b905812f.js +1 -0
- package/dist/CardBlogpost-1b81b54e.mjs +246 -0
- package/dist/CardBlogpost-7107e04a.js +1 -0
- package/dist/CardOrganization-49ab5190.mjs +234 -0
- package/dist/CardOrganization-e6ac27f1.js +1 -0
- package/dist/CardProduct-4c0cb9a1.js +1 -0
- package/dist/CardProduct-ea0e1f84.mjs +192 -0
- package/dist/Chips-817cf959.js +1 -0
- package/dist/Chips-8c836ba6.mjs +213 -0
- package/dist/Community-8c4e011b.js +1 -0
- package/dist/Community-bd6f0cbb.mjs +131 -0
- package/dist/Dashboard-73b50724.js +1 -0
- package/dist/Dashboard-bc81b5f6.mjs +151 -0
- package/dist/Dropdown-60e3dc6c.js +1 -0
- package/dist/Dropdown-d1c81d45.mjs +169 -0
- package/dist/EditOrder-2b746caf.mjs +221 -0
- package/dist/EditOrder-e632f0cc.js +1 -0
- package/dist/Events-999cc8ed.js +1 -0
- package/dist/Events-ad8bbf27.mjs +134 -0
- package/dist/Feed-35e13c22.mjs +156 -0
- package/dist/Feed-53d96b18.mjs +361 -0
- package/dist/Feed-694a2fad.js +1 -0
- package/dist/Feed-ac4bb6ea.js +1 -0
- package/dist/Feed-d1d01771.js +1 -0
- package/dist/Feed-f7c04014.mjs +124 -0
- package/dist/Image-61cfd52d.js +9 -0
- package/dist/Image-e8be4acc.mjs +480 -0
- package/dist/LeftoverAdd-a268a95c.js +1 -0
- package/dist/LeftoverAdd-e4d93760.mjs +229 -0
- package/dist/Leftovers-6976802d.mjs +135 -0
- package/dist/Leftovers-d8f1d152.js +1 -0
- package/dist/Members-aeb2bca1.mjs +109 -0
- package/dist/Members-b9664e83.js +1 -0
- package/dist/Menu-93d34d9f.js +1 -0
- package/dist/Menu-eaf6b44c.mjs +13 -0
- package/dist/MenuItem-4a5881bd.mjs +85 -0
- package/dist/MenuItem-f35cad93.js +1 -0
- package/dist/Orders-8bc8963c.js +1 -0
- package/dist/Orders-eb262d8c.mjs +75 -0
- package/dist/Organizations-9926aa51.mjs +72 -0
- package/dist/Organizations-c653d814.js +1 -0
- package/dist/Payments-98328000.js +1 -0
- package/dist/Payments-a9066cdf.mjs +11 -0
- package/dist/Popup-0d8e1392.mjs +96 -0
- package/dist/Popup-eb11fa82.js +1 -0
- package/dist/Product-15043af7.mjs +651 -0
- package/dist/Product-82c022a4.js +7 -0
- package/dist/ProductEdit-05da9866.mjs +258 -0
- package/dist/ProductEdit-2f075296.js +1 -0
- package/dist/ProductsBackoffice-8462f626.js +1 -0
- package/dist/ProductsBackoffice-8d0f0ee8.mjs +85 -0
- package/dist/ProfileBlogposts-43855cb9.js +1 -0
- package/dist/ProfileBlogposts-f32170a3.mjs +78 -0
- package/dist/ProfileEvents-54be2d43.mjs +69 -0
- package/dist/ProfileEvents-ab69e27e.js +1 -0
- package/dist/ProfileOrganizations-0787cf34.mjs +72 -0
- package/dist/ProfileOrganizations-eb62dde4.js +1 -0
- package/dist/Publics-8e726d20.mjs +45 -0
- package/dist/Publics-ae589bf1.js +1 -0
- package/dist/Select-95f4701a.js +1 -0
- package/dist/Select-dab17282.mjs +80 -0
- package/dist/Select.vue_vue_type_style_index_0_scoped_dfe03dc2_lang-0ea8fbf8.js +1 -0
- package/dist/Select.vue_vue_type_style_index_0_scoped_dfe03dc2_lang-4ed993c7.mjs +1 -0
- package/dist/Socials-43293869.js +1 -0
- package/dist/Socials-8193477c.mjs +189 -0
- package/dist/UploadImage-0e8e4278.mjs +83 -0
- package/dist/UploadImage-8c71bda6.js +1 -0
- package/dist/UploadImageMultiple-c34a6c6f.mjs +58 -0
- package/dist/UploadImageMultiple-d1316df5.js +1 -0
- package/dist/Wallet-727195d9.mjs +21700 -0
- package/dist/Wallet-f4dda407.js +10 -0
- package/dist/auth-04684a60.js +7 -0
- package/dist/auth-7e39361f.mjs +633 -0
- package/dist/auth.client.cjs +1 -1
- package/dist/auth.client.js +5 -5
- package/dist/auth.server.js +1 -1
- package/dist/auth.server.mjs +1 -1
- package/dist/auth.validation-d614130d.js +1 -0
- package/dist/auth.validation-f4bf1deb.mjs +24 -0
- package/dist/axios-33aeb810.mjs +1435 -0
- package/dist/axios-ceccf20e.js +5 -0
- package/dist/backoffice.client.cjs +1 -1
- package/dist/backoffice.client.js +20 -20
- package/dist/categories-7e17a7eb.js +1 -0
- package/dist/categories-b7f9e8c0.mjs +122 -0
- package/dist/community.client.cjs +1 -1
- package/dist/community.client.js +209 -202
- package/dist/components/Upload/Upload.vue.d.ts.map +1 -1
- package/dist/events.client.cjs +2 -2
- package/dist/events.client.js +24 -27
- package/dist/landing.client.cjs +1 -1
- package/dist/landing.client.js +64 -40
- package/dist/leftovers-86e7d438.mjs +67 -0
- package/dist/leftovers-c9f70579.js +1 -0
- package/dist/legal.client.cjs +1 -1
- package/dist/legal.client.js +6 -7
- package/dist/main.css +1 -1
- package/dist/memberships-559590ad.mjs +68 -0
- package/dist/memberships-58af22e0.js +1 -0
- package/dist/modules/constructor/components/elements/H2.vue.d.ts +1 -1
- package/dist/modules/constructor/components/elements/Textarea.vue.d.ts +1 -1
- package/dist/modules/products/components/sections/EditProductInfo.vue.d.ts +1 -5
- package/dist/orders-1325c51b.js +1 -0
- package/dist/orders-c7cbe706.mjs +85 -0
- package/dist/organizations-71777b32.js +1 -0
- package/dist/organizations-93f7b610.mjs +122 -0
- package/dist/organizations.client-6ca27fb3.js +3 -0
- package/dist/organizations.client-bd63a7b2.mjs +2997 -0
- package/dist/organizations.client.cjs +1 -1
- package/dist/organizations.client.js +56 -61
- package/dist/products-61d83d74.js +1 -0
- package/dist/products-7f1e5a75.mjs +108 -0
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +67 -65
- package/dist/prometheus-framework.cjs.js +21 -21
- package/dist/prometheus-framework.es.js +682 -690
- package/dist/reports-a67b4fb4.js +1 -0
- package/dist/reports-c579b02a.mjs +91 -0
- package/dist/reports.client.cjs +1 -1
- package/dist/reports.client.js +2 -2
- package/dist/states.validation-3b4604bc.mjs +13 -0
- package/dist/states.validation-9b43a097.js +1 -0
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +279 -208
- package/package.json +30 -35
- package/src/components/Button/Button.vue +1 -1
- package/src/components/Sidebar/Sidebar.vue +10 -8
- package/src/components/Upload/Upload.vue +8 -28
- package/src/modules/auth/components/pages/SignIn.vue +2 -2
- package/src/modules/auth/controllers/auth.controller.js +1 -1
- package/src/modules/auth/store/auth.js +21 -24
- package/src/modules/backoffice/components/admin/ProductEdit.vue +2 -0
- package/src/modules/constructor/components/sections/Constructor.vue +7 -54
- package/src/modules/gallery/components/pages/Gallery.vue +7 -1
- package/src/modules/gallery/components/sections/GalleryWithCategories.vue +24 -8
- package/src/modules/gallery/gallery.client.js +5 -1
- package/src/modules/marketplace/components/layouts/Marketplace.vue +1 -0
- package/src/modules/organizations/components/pages/Organization.vue +2 -2
- package/src/modules/payments/components/pages/Payments.vue +4 -3
- package/src/modules/products/components/blocks/CardLeftover.vue +0 -1
- package/src/modules/products/components/blocks/CardProduct.vue +15 -1
- package/src/modules/products/components/sections/EditProductInfo.vue +16 -14
- package/src/modules/products/components/sections/FilterProducts.vue +0 -2
- package/src/modules/products/components/sections/SectionProduct.vue +1 -0
- package/src/modules/products/components/sections/SortProducts.vue +2 -0
- package/src/modules/products/store/categories.js +9 -9
- package/src/modules/products/store/leftovers.js +6 -9
- package/src/modules/products/store/products.js +2 -0
- package/src/modules/users/components/pages/Profile.vue +3 -5
- package/src/modules/wallet/components/pages/Wallet.vue +1 -1
- package/src/styles/components/button.scss +253 -0
- package/src/styles/theme.scss +1 -0
- package/src/modules/constructor/components/elements/Audio.vue +0 -82
- package/src/modules/constructor/components/elements/Embed.vue +0 -85
- package/src/modules/globals/mixins/mixins.js +0 -52
- package/src/modules/globals/router/routerGuards.js +0 -28
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";const Z=require("./axios-ceccf20e.js"),M=require("vue"),E=require("./globals-928eb13c.js");var ue=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Q(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var X={exports:{}};/*!
|
2
|
+
* JavaScript Cookie v2.2.1
|
3
|
+
* https://github.com/js-cookie/js-cookie
|
4
|
+
*
|
5
|
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
6
|
+
* Released under the MIT license
|
7
|
+
*/(function(t,e){(function(r){var o;if(t.exports=r(),o=!0,!o){var n=window.Cookies,s=window.Cookies=r();s.noConflict=function(){return window.Cookies=n,s}}})(function(){function r(){for(var s=0,i={};s<arguments.length;s++){var a=arguments[s];for(var d in a)i[d]=a[d]}return i}function o(s){return s.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function n(s){function i(){}function a(c,p,l){if(!(typeof document>"u")){l=r({path:"/"},i.defaults,l),typeof l.expires=="number"&&(l.expires=new Date(new Date*1+l.expires*864e5)),l.expires=l.expires?l.expires.toUTCString():"";try{var b=JSON.stringify(p);/^[\{\[]/.test(b)&&(p=b)}catch{}p=s.write?s.write(p,c):encodeURIComponent(String(p)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),c=encodeURIComponent(String(c)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var y="";for(var C in l)l[C]&&(y+="; "+C,l[C]!==!0&&(y+="="+l[C].split(";")[0]));return document.cookie=c+"="+p+y}}function d(c,p){if(!(typeof document>"u")){for(var l={},b=document.cookie?document.cookie.split("; "):[],y=0;y<b.length;y++){var C=b[y].split("="),h=C.slice(1).join("=");!p&&h.charAt(0)==='"'&&(h=h.slice(1,-1));try{var A=o(C[0]);if(h=(s.read||s)(h,A)||o(h),p)try{h=JSON.parse(h)}catch{}if(l[A]=h,c===A)break}catch{}}return c?l[c]:l}}return i.set=a,i.get=function(c){return d(c,!1)},i.getJSON=function(c){return d(c,!0)},i.remove=function(c,p){a(c,"",r(p,{expires:-1}))},i.defaults={},i.withConverter=n,i}return n(function(){})})})(X);var fe=X.exports;const H=Q(fe);/*! Capacitor: https://capacitorjs.com/ - MIT License */const pe=t=>{const e=new Map;e.set("web",{name:"web"});const r=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e},o=(s,i)=>{r.platforms.set(s,i)},n=s=>{r.platforms.has(s)&&(r.currentPlatform=r.platforms.get(s))};return r.addPlatform=o,r.setPlatform=n,r},ge=t=>t.CapacitorPlatforms=pe(t),Y=ge(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});Y.addPlatform;Y.setPlatform;var S;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(S||(S={}));class F extends Error{constructor(e,r,o){super(e),this.message=e,this.code=r,this.data=o}}const me=t=>{var e,r;return t!=null&&t.androidBridge?"android":!((r=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},we=t=>{var e,r,o,n,s;const i=t.CapacitorCustomPlatform||null,a=t.Capacitor||{},d=a.Plugins=a.Plugins||{},c=t.CapacitorPlatforms,p=()=>i!==null?i.name:me(t),l=((e=c==null?void 0:c.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||p,b=()=>l()!=="web",y=((r=c==null?void 0:c.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||b,C=u=>{const f=B.get(u);return!!(f!=null&&f.platforms.has(l())||R(u))},h=((o=c==null?void 0:c.currentPlatform)===null||o===void 0?void 0:o.isPluginAvailable)||C,A=u=>{var f;return(f=a.PluginHeaders)===null||f===void 0?void 0:f.find(_=>_.name===u)},R=((n=c==null?void 0:c.currentPlatform)===null||n===void 0?void 0:n.getPluginHeader)||A,ne=u=>t.console.error(u),oe=(u,f,_)=>Promise.reject(`${_} does not have an implementation of "${f}".`),B=new Map,ae=(u,f={})=>{const _=B.get(u);if(_)return console.warn(`Capacitor plugin "${u}" already registered. Cannot register plugins twice.`),_.proxy;const j=l(),x=R(u);let O;const ce=async()=>(!O&&j in f?O=typeof f[j]=="function"?O=await f[j]():O=f[j]:i!==null&&!O&&"web"in f&&(O=typeof f.web=="function"?O=await f.web():O=f.web),O),le=(g,w)=>{var P,L;if(x){const k=x==null?void 0:x.methods.find(v=>w===v.name);if(k)return k.rtype==="promise"?v=>a.nativePromise(u,w.toString(),v):(v,T)=>a.nativeCallback(u,w.toString(),v,T);if(g)return(P=g[w])===null||P===void 0?void 0:P.bind(g)}else{if(g)return(L=g[w])===null||L===void 0?void 0:L.bind(g);throw new F(`"${u}" plugin is not implemented on ${j}`,S.Unimplemented)}},q=g=>{let w;const P=(...L)=>{const k=ce().then(v=>{const T=le(v,g);if(T){const I=T(...L);return w=I==null?void 0:I.remove,I}else throw new F(`"${u}.${g}()" is not implemented on ${j}`,S.Unimplemented)});return g==="addListener"&&(k.remove=async()=>w()),k};return P.toString=()=>`${g.toString()}() { [capacitor code] }`,Object.defineProperty(P,"name",{value:g,writable:!1,configurable:!1}),P},z=q("addListener"),K=q("removeListener"),de=(g,w)=>{const P=z({eventName:g},w),L=async()=>{const v=await P;K({eventName:g,callbackId:v},w)},k=new Promise(v=>P.then(()=>v({remove:L})));return k.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await L()},k},W=new Proxy({},{get(g,w){switch(w){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return x?de:z;case"removeListener":return K;default:return q(w)}}});return d[u]=W,B.set(u,{name:u,proxy:W,platforms:new Set([...Object.keys(f),...x?[j]:[]])}),W},ie=((s=c==null?void 0:c.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||ae;return a.convertFileSrc||(a.convertFileSrc=u=>u),a.getPlatform=l,a.handleError=ne,a.isNativePlatform=y,a.isPluginAvailable=h,a.pluginMethodNoop=oe,a.registerPlugin=ie,a.Exception=F,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a.platform=a.getPlatform(),a.isNative=a.isNativePlatform(),a},he=t=>t.Capacitor=we(t),D=he(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ee=D.registerPlugin;D.Plugins;class te{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const s=async()=>this.removeListener(e,r),i=Promise.resolve({remove:s});return Object.defineProperty(i,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()}}),i}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,r){const o=this.listeners[e];o&&o.forEach(n=>n(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:o=>{this.notifyListeners(r,o)}}}unimplemented(e="not implemented"){return new D.Exception(e,S.Unimplemented)}unavailable(e="not available"){return new D.Exception(e,S.Unavailable)}async removeListener(e,r){const o=this.listeners[e];if(!o)return;const n=o.indexOf(r);this.listeners[e].splice(n,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const N=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),V=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ve extends te{async getCookies(){const e=document.cookie,r={};return e.split(";").forEach(o=>{if(o.length<=0)return;let[n,s]=o.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");n=V(n).trim(),s=V(s).trim(),r[n]=s}),r}async setCookie(e){try{const r=N(e.key),o=N(e.value),n=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),i=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${o||""}${n}; path=${s}; ${i};`}catch(r){return Promise.reject(r)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}const J=ee("CapacitorCookies",{web:()=>new ve}),Pe=async t=>new Promise((e,r)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n.indexOf(",")>=0?n.split(",")[1]:n)},o.onerror=n=>r(n),o.readAsDataURL(t)}),be=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(n=>n.toLocaleLowerCase()).reduce((n,s,i)=>(n[s]=t[e[i]],n),{})},ye=(t,e=!0)=>t?Object.entries(t).reduce((o,n)=>{const[s,i]=n;let a,d;return Array.isArray(i)?(d="",i.forEach(c=>{a=e?encodeURIComponent(c):c,d+=`${s}=${a}&`}),d.slice(0,-1)):(a=e?encodeURIComponent(i):i,d=`${s}=${a}`),`${o}&${d}`},"").substr(1):null,Ce=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=be(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const s=new URLSearchParams;for(const[i,a]of Object.entries(t.data||{}))s.set(i,a);r.body=s.toString()}else if(n.includes("multipart/form-data")){const s=new FormData;if(t.data instanceof FormData)t.data.forEach((a,d)=>{s.append(d,a)});else for(const a of Object.keys(t.data))s.append(a,t.data[a]);r.body=s;const i=new Headers(r.headers);i.delete("content-type"),r.headers=i}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class Oe extends te{async request(e){const r=Ce(e,e.webFetchExtra),o=ye(e.params,e.shouldEncodeUrlParams),n=o?`${e.url}?${o}`:e.url,s=await fetch(n,r),i=s.headers.get("content-type")||"";let{responseType:a="text"}=s.ok?e:{};i.includes("application/json")&&(a="json");let d,c;switch(a){case"arraybuffer":case"blob":c=await s.blob(),d=await Pe(c);break;case"json":d=await s.json();break;case"document":case"text":default:d=await s.text()}const p={};return s.headers.forEach((l,b)=>{p[b]=l}),{data:d,headers:p,status:s.status,url:s.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}ee("CapacitorHttp",{web:()=>new Oe});const Le=Z.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),U=M.reactive({code:{value:"",type:"",method:"",isSended:!1,isValid:!1}});async function re(t,e,r){return await Le.post("/api/twofa/sendcode",{phone:t.phone.number,email:t.email,method:e,type:r}).then(o=>(U.code=o.data,U.code.isSended=!0,Promise.resolve(o.data)),o=>(console.log(o),E.setError(o),Promise.reject(o)))}M.watch(U,(t,e)=>{});const ke=Object.freeze(Object.defineProperty({__proto__:null,sendCode:re,state:U},Symbol.toStringTag,{value:"Module"})),$=Z.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),m=M.reactive({user:{_id:void 0,username:"",email:"",phone:"",password:"",passwordRepeat:""},access:{roles:null,token:null,status:!1}});async function je(){const t=await _e("user");if(t){const{_id:e,email:r,phone:o,roles:n,accessToken:s}=t;Object.assign(m.user,{_id:e,email:r,phone:o}),Object.assign(m.access,{token:s,roles:n,status:!!s}),$.interceptors.request.use(i=>(s&&(i.headers["x-access-token"]=s),i),i=>Promise.reject(i))}}je();const se={async login(t,e){try{const r=await $.post("/api/auth/signin",{...t,type:e});return G("user",r.data),Object.assign(m.user,{...r.data}),Object.assign(m.access,{token:r.data.accessToken,status:!0,roles:r.data.roles}),r.data}catch(r){return Object.assign(m.access,{token:null,status:!1,roles:null}),E.setError(r),Promise.reject(r)}},async signup(t,e,r){const{password:o,passwordRepeat:n}=m.user;if(o!==n){const s={response:{data:{errorCode:"PASSWORDS_DO_NOT_MATCH"}}};throw E.setError(s),new Error(s.response.status)}try{t.phone=t.phone.number;const s=await $.post("/api/auth/signup",{...t,type:e,inviteCode:r});return s.data.accessToken&&G("user",s.data),Object.assign(m.user,{...s.data}),Object.assign(m.access,{token:s.data.accessToken,status:!0,roles:s.data.roles}),s.data}catch(s){throw E.setError(s),console.log("Sign up falied"),s}},logout(){xe("user"),Object.assign(m.user,{email:"",phone:"",password:"",passwordRepeat:""}),Object.assign(m.access,{token:null,status:!1})},async resetPassword(t,e){try{const r=await $.post("/api/auth/reset-password",{email:t.email,phone:t.phone.number,type:e});return Object.assign(U.code,{...r.data,isSended:!0}),r.data}catch(r){return E.setError(r),Promise.reject(r)}},async updatePassword(t,e){const{password:r,passwordRepeat:o}=m.user;if(r!==o){const n={response:{data:{errorCode:"PASSWORDS_DO_NOT_MATCH"}}};throw E.setError(n),new Error(n.response.status)}try{const n=await $.post("/api/auth/update-password",{email:t.email,phone:t.phone.number,password:t.password,passwordRepeat:t.passwordRepeat,type:e});return n.data.accessToken&&G("user",n.data),Object.assign(m.user,{...n.data}),Object.assign(m.access,{token:n.data.accessToken,status:!0}),n.data}catch(n){return E.setError(n),Promise.reject(n)}}},Ee={development:{secure:!1,expires:1},production:{expires:1,domain:process.env.API_URL,sameSite:"none",secure:!0}};function _e(t){if(process.env.MOBILE_APP)return J.getCookie({url:process.env.API_URL,key:t}).then(e=>JSON.parse(e.value));{const e=H.get(t);return e?JSON.parse(e):null}}function G(t,e,r=process.env.NODE_ENV){process.env.MOBILE_APP?J.setCookie({url:process.env.API_URL,key:t,value:JSON.stringify(e)}):H.set(t,JSON.stringify(e),Ee[r])}function xe(t,e=process.env.NODE_ENV){if(process.env.MOBILE_APP)J.deleteCookie({url:process.env.API_URL,key:t});else{const r=e==="production"?{domain:process.env.API_URL}:{};H.remove(t,r)}}M.watch(m,(t,e)=>{});const Se=Object.freeze(Object.defineProperty({__proto__:null,actions:se,state:m},Symbol.toStringTag,{value:"Module"}));exports.Cookies=H;exports.actions=se;exports.auth=Se;exports.commonjsGlobal=ue;exports.getDefaultExportFromCjs=Q;exports.sendCode=re;exports.state=m;exports.state$1=U;exports.twofa=ke;
|
@@ -0,0 +1,633 @@
|
|
1
|
+
import { a as V } from "./axios-33aeb810.mjs";
|
2
|
+
import { reactive as Z, watch as Q } from "vue";
|
3
|
+
import { s as E } from "./globals-96ba60e4.mjs";
|
4
|
+
var Ae = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
5
|
+
function le(t) {
|
6
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
7
|
+
}
|
8
|
+
var X = { exports: {} };
|
9
|
+
/*!
|
10
|
+
* JavaScript Cookie v2.2.1
|
11
|
+
* https://github.com/js-cookie/js-cookie
|
12
|
+
*
|
13
|
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
14
|
+
* Released under the MIT license
|
15
|
+
*/
|
16
|
+
(function(t, e) {
|
17
|
+
(function(r) {
|
18
|
+
var o;
|
19
|
+
if (t.exports = r(), o = !0, !o) {
|
20
|
+
var n = window.Cookies, s = window.Cookies = r();
|
21
|
+
s.noConflict = function() {
|
22
|
+
return window.Cookies = n, s;
|
23
|
+
};
|
24
|
+
}
|
25
|
+
})(function() {
|
26
|
+
function r() {
|
27
|
+
for (var s = 0, i = {}; s < arguments.length; s++) {
|
28
|
+
var a = arguments[s];
|
29
|
+
for (var d in a)
|
30
|
+
i[d] = a[d];
|
31
|
+
}
|
32
|
+
return i;
|
33
|
+
}
|
34
|
+
function o(s) {
|
35
|
+
return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
|
36
|
+
}
|
37
|
+
function n(s) {
|
38
|
+
function i() {
|
39
|
+
}
|
40
|
+
function a(c, p, l) {
|
41
|
+
if (!(typeof document > "u")) {
|
42
|
+
l = r({
|
43
|
+
path: "/"
|
44
|
+
}, i.defaults, l), typeof l.expires == "number" && (l.expires = new Date(/* @__PURE__ */ new Date() * 1 + l.expires * 864e5)), l.expires = l.expires ? l.expires.toUTCString() : "";
|
45
|
+
try {
|
46
|
+
var b = JSON.stringify(p);
|
47
|
+
/^[\{\[]/.test(b) && (p = b);
|
48
|
+
} catch {
|
49
|
+
}
|
50
|
+
p = s.write ? s.write(p, c) : encodeURIComponent(String(p)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), c = encodeURIComponent(String(c)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape);
|
51
|
+
var y = "";
|
52
|
+
for (var C in l)
|
53
|
+
l[C] && (y += "; " + C, l[C] !== !0 && (y += "=" + l[C].split(";")[0]));
|
54
|
+
return document.cookie = c + "=" + p + y;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
function d(c, p) {
|
58
|
+
if (!(typeof document > "u")) {
|
59
|
+
for (var l = {}, b = document.cookie ? document.cookie.split("; ") : [], y = 0; y < b.length; y++) {
|
60
|
+
var C = b[y].split("="), h = C.slice(1).join("=");
|
61
|
+
!p && h.charAt(0) === '"' && (h = h.slice(1, -1));
|
62
|
+
try {
|
63
|
+
var U = o(C[0]);
|
64
|
+
if (h = (s.read || s)(h, U) || o(h), p)
|
65
|
+
try {
|
66
|
+
h = JSON.parse(h);
|
67
|
+
} catch {
|
68
|
+
}
|
69
|
+
if (l[U] = h, c === U)
|
70
|
+
break;
|
71
|
+
} catch {
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return c ? l[c] : l;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
return i.set = a, i.get = function(c) {
|
78
|
+
return d(
|
79
|
+
c,
|
80
|
+
!1
|
81
|
+
/* read as raw */
|
82
|
+
);
|
83
|
+
}, i.getJSON = function(c) {
|
84
|
+
return d(
|
85
|
+
c,
|
86
|
+
!0
|
87
|
+
/* read as json */
|
88
|
+
);
|
89
|
+
}, i.remove = function(c, p) {
|
90
|
+
a(c, "", r(p, {
|
91
|
+
expires: -1
|
92
|
+
}));
|
93
|
+
}, i.defaults = {}, i.withConverter = n, i;
|
94
|
+
}
|
95
|
+
return n(function() {
|
96
|
+
});
|
97
|
+
});
|
98
|
+
})(X);
|
99
|
+
var de = X.exports;
|
100
|
+
const F = /* @__PURE__ */ le(de);
|
101
|
+
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
102
|
+
const ue = (t) => {
|
103
|
+
const e = /* @__PURE__ */ new Map();
|
104
|
+
e.set("web", { name: "web" });
|
105
|
+
const r = t.CapacitorPlatforms || {
|
106
|
+
currentPlatform: { name: "web" },
|
107
|
+
platforms: e
|
108
|
+
}, o = (s, i) => {
|
109
|
+
r.platforms.set(s, i);
|
110
|
+
}, n = (s) => {
|
111
|
+
r.platforms.has(s) && (r.currentPlatform = r.platforms.get(s));
|
112
|
+
};
|
113
|
+
return r.addPlatform = o, r.setPlatform = n, r;
|
114
|
+
}, fe = (t) => t.CapacitorPlatforms = ue(t), Y = /* @__PURE__ */ fe(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
|
115
|
+
Y.addPlatform;
|
116
|
+
Y.setPlatform;
|
117
|
+
var x;
|
118
|
+
(function(t) {
|
119
|
+
t.Unimplemented = "UNIMPLEMENTED", t.Unavailable = "UNAVAILABLE";
|
120
|
+
})(x || (x = {}));
|
121
|
+
class W extends Error {
|
122
|
+
constructor(e, r, o) {
|
123
|
+
super(e), this.message = e, this.code = r, this.data = o;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
const pe = (t) => {
|
127
|
+
var e, r;
|
128
|
+
return t != null && t.androidBridge ? "android" : !((r = (e = t == null ? void 0 : t.webkit) === null || e === void 0 ? void 0 : e.messageHandlers) === null || r === void 0) && r.bridge ? "ios" : "web";
|
129
|
+
}, ge = (t) => {
|
130
|
+
var e, r, o, n, s;
|
131
|
+
const i = t.CapacitorCustomPlatform || null, a = t.Capacitor || {}, d = a.Plugins = a.Plugins || {}, c = t.CapacitorPlatforms, p = () => i !== null ? i.name : pe(t), l = ((e = c == null ? void 0 : c.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || p, b = () => l() !== "web", y = ((r = c == null ? void 0 : c.currentPlatform) === null || r === void 0 ? void 0 : r.isNativePlatform) || b, C = (u) => {
|
132
|
+
const f = M.get(u);
|
133
|
+
return !!(f != null && f.platforms.has(l()) || R(u));
|
134
|
+
}, h = ((o = c == null ? void 0 : c.currentPlatform) === null || o === void 0 ? void 0 : o.isPluginAvailable) || C, U = (u) => {
|
135
|
+
var f;
|
136
|
+
return (f = a.PluginHeaders) === null || f === void 0 ? void 0 : f.find((_) => _.name === u);
|
137
|
+
}, R = ((n = c == null ? void 0 : c.currentPlatform) === null || n === void 0 ? void 0 : n.getPluginHeader) || U, re = (u) => t.console.error(u), se = (u, f, _) => Promise.reject(`${_} does not have an implementation of "${f}".`), M = /* @__PURE__ */ new Map(), ne = (u, f = {}) => {
|
138
|
+
const _ = M.get(u);
|
139
|
+
if (_)
|
140
|
+
return console.warn(`Capacitor plugin "${u}" already registered. Cannot register plugins twice.`), _.proxy;
|
141
|
+
const j = l(), S = R(u);
|
142
|
+
let O;
|
143
|
+
const ae = async () => (!O && j in f ? O = typeof f[j] == "function" ? O = await f[j]() : O = f[j] : i !== null && !O && "web" in f && (O = typeof f.web == "function" ? O = await f.web() : O = f.web), O), ie = (g, w) => {
|
144
|
+
var P, L;
|
145
|
+
if (S) {
|
146
|
+
const k = S == null ? void 0 : S.methods.find((v) => w === v.name);
|
147
|
+
if (k)
|
148
|
+
return k.rtype === "promise" ? (v) => a.nativePromise(u, w.toString(), v) : (v, T) => a.nativeCallback(u, w.toString(), v, T);
|
149
|
+
if (g)
|
150
|
+
return (P = g[w]) === null || P === void 0 ? void 0 : P.bind(g);
|
151
|
+
} else {
|
152
|
+
if (g)
|
153
|
+
return (L = g[w]) === null || L === void 0 ? void 0 : L.bind(g);
|
154
|
+
throw new W(`"${u}" plugin is not implemented on ${j}`, x.Unimplemented);
|
155
|
+
}
|
156
|
+
}, H = (g) => {
|
157
|
+
let w;
|
158
|
+
const P = (...L) => {
|
159
|
+
const k = ae().then((v) => {
|
160
|
+
const T = ie(v, g);
|
161
|
+
if (T) {
|
162
|
+
const I = T(...L);
|
163
|
+
return w = I == null ? void 0 : I.remove, I;
|
164
|
+
} else
|
165
|
+
throw new W(`"${u}.${g}()" is not implemented on ${j}`, x.Unimplemented);
|
166
|
+
});
|
167
|
+
return g === "addListener" && (k.remove = async () => w()), k;
|
168
|
+
};
|
169
|
+
return P.toString = () => `${g.toString()}() { [capacitor code] }`, Object.defineProperty(P, "name", {
|
170
|
+
value: g,
|
171
|
+
writable: !1,
|
172
|
+
configurable: !1
|
173
|
+
}), P;
|
174
|
+
}, G = H("addListener"), z = H("removeListener"), ce = (g, w) => {
|
175
|
+
const P = G({ eventName: g }, w), L = async () => {
|
176
|
+
const v = await P;
|
177
|
+
z({
|
178
|
+
eventName: g,
|
179
|
+
callbackId: v
|
180
|
+
}, w);
|
181
|
+
}, k = new Promise((v) => P.then(() => v({ remove: L })));
|
182
|
+
return k.remove = async () => {
|
183
|
+
console.warn("Using addListener() without 'await' is deprecated."), await L();
|
184
|
+
}, k;
|
185
|
+
}, B = new Proxy({}, {
|
186
|
+
get(g, w) {
|
187
|
+
switch (w) {
|
188
|
+
case "$$typeof":
|
189
|
+
return;
|
190
|
+
case "toJSON":
|
191
|
+
return () => ({});
|
192
|
+
case "addListener":
|
193
|
+
return S ? ce : G;
|
194
|
+
case "removeListener":
|
195
|
+
return z;
|
196
|
+
default:
|
197
|
+
return H(w);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
});
|
201
|
+
return d[u] = B, M.set(u, {
|
202
|
+
name: u,
|
203
|
+
proxy: B,
|
204
|
+
platforms: /* @__PURE__ */ new Set([
|
205
|
+
...Object.keys(f),
|
206
|
+
...S ? [j] : []
|
207
|
+
])
|
208
|
+
}), B;
|
209
|
+
}, oe = ((s = c == null ? void 0 : c.currentPlatform) === null || s === void 0 ? void 0 : s.registerPlugin) || ne;
|
210
|
+
return a.convertFileSrc || (a.convertFileSrc = (u) => u), a.getPlatform = l, a.handleError = re, a.isNativePlatform = y, a.isPluginAvailable = h, a.pluginMethodNoop = se, a.registerPlugin = oe, a.Exception = W, a.DEBUG = !!a.DEBUG, a.isLoggingEnabled = !!a.isLoggingEnabled, a.platform = a.getPlatform(), a.isNative = a.isNativePlatform(), a;
|
211
|
+
}, me = (t) => t.Capacitor = ge(t), D = /* @__PURE__ */ me(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {}), ee = D.registerPlugin;
|
212
|
+
D.Plugins;
|
213
|
+
class te {
|
214
|
+
constructor(e) {
|
215
|
+
this.listeners = {}, this.windowListeners = {}, e && (console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`), this.config = e);
|
216
|
+
}
|
217
|
+
addListener(e, r) {
|
218
|
+
this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(r);
|
219
|
+
const n = this.windowListeners[e];
|
220
|
+
n && !n.registered && this.addWindowListener(n);
|
221
|
+
const s = async () => this.removeListener(e, r), i = Promise.resolve({ remove: s });
|
222
|
+
return Object.defineProperty(i, "remove", {
|
223
|
+
value: async () => {
|
224
|
+
console.warn("Using addListener() without 'await' is deprecated."), await s();
|
225
|
+
}
|
226
|
+
}), i;
|
227
|
+
}
|
228
|
+
async removeAllListeners() {
|
229
|
+
this.listeners = {};
|
230
|
+
for (const e in this.windowListeners)
|
231
|
+
this.removeWindowListener(this.windowListeners[e]);
|
232
|
+
this.windowListeners = {};
|
233
|
+
}
|
234
|
+
notifyListeners(e, r) {
|
235
|
+
const o = this.listeners[e];
|
236
|
+
o && o.forEach((n) => n(r));
|
237
|
+
}
|
238
|
+
hasListeners(e) {
|
239
|
+
return !!this.listeners[e].length;
|
240
|
+
}
|
241
|
+
registerWindowListener(e, r) {
|
242
|
+
this.windowListeners[r] = {
|
243
|
+
registered: !1,
|
244
|
+
windowEventName: e,
|
245
|
+
pluginEventName: r,
|
246
|
+
handler: (o) => {
|
247
|
+
this.notifyListeners(r, o);
|
248
|
+
}
|
249
|
+
};
|
250
|
+
}
|
251
|
+
unimplemented(e = "not implemented") {
|
252
|
+
return new D.Exception(e, x.Unimplemented);
|
253
|
+
}
|
254
|
+
unavailable(e = "not available") {
|
255
|
+
return new D.Exception(e, x.Unavailable);
|
256
|
+
}
|
257
|
+
async removeListener(e, r) {
|
258
|
+
const o = this.listeners[e];
|
259
|
+
if (!o)
|
260
|
+
return;
|
261
|
+
const n = o.indexOf(r);
|
262
|
+
this.listeners[e].splice(n, 1), this.listeners[e].length || this.removeWindowListener(this.windowListeners[e]);
|
263
|
+
}
|
264
|
+
addWindowListener(e) {
|
265
|
+
window.addEventListener(e.windowEventName, e.handler), e.registered = !0;
|
266
|
+
}
|
267
|
+
removeWindowListener(e) {
|
268
|
+
e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
|
269
|
+
}
|
270
|
+
}
|
271
|
+
const K = (t) => encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), N = (t) => t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
272
|
+
class we extends te {
|
273
|
+
async getCookies() {
|
274
|
+
const e = document.cookie, r = {};
|
275
|
+
return e.split(";").forEach((o) => {
|
276
|
+
if (o.length <= 0)
|
277
|
+
return;
|
278
|
+
let [n, s] = o.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
279
|
+
n = N(n).trim(), s = N(s).trim(), r[n] = s;
|
280
|
+
}), r;
|
281
|
+
}
|
282
|
+
async setCookie(e) {
|
283
|
+
try {
|
284
|
+
const r = K(e.key), o = K(e.value), n = `; expires=${(e.expires || "").replace("expires=", "")}`, s = (e.path || "/").replace("path=", ""), i = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
|
285
|
+
document.cookie = `${r}=${o || ""}${n}; path=${s}; ${i};`;
|
286
|
+
} catch (r) {
|
287
|
+
return Promise.reject(r);
|
288
|
+
}
|
289
|
+
}
|
290
|
+
async deleteCookie(e) {
|
291
|
+
try {
|
292
|
+
document.cookie = `${e.key}=; Max-Age=0`;
|
293
|
+
} catch (r) {
|
294
|
+
return Promise.reject(r);
|
295
|
+
}
|
296
|
+
}
|
297
|
+
async clearCookies() {
|
298
|
+
try {
|
299
|
+
const e = document.cookie.split(";") || [];
|
300
|
+
for (const r of e)
|
301
|
+
document.cookie = r.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`);
|
302
|
+
} catch (e) {
|
303
|
+
return Promise.reject(e);
|
304
|
+
}
|
305
|
+
}
|
306
|
+
async clearAllCookies() {
|
307
|
+
try {
|
308
|
+
await this.clearCookies();
|
309
|
+
} catch (e) {
|
310
|
+
return Promise.reject(e);
|
311
|
+
}
|
312
|
+
}
|
313
|
+
}
|
314
|
+
const J = ee("CapacitorCookies", {
|
315
|
+
web: () => new we()
|
316
|
+
}), he = async (t) => new Promise((e, r) => {
|
317
|
+
const o = new FileReader();
|
318
|
+
o.onload = () => {
|
319
|
+
const n = o.result;
|
320
|
+
e(n.indexOf(",") >= 0 ? n.split(",")[1] : n);
|
321
|
+
}, o.onerror = (n) => r(n), o.readAsDataURL(t);
|
322
|
+
}), ve = (t = {}) => {
|
323
|
+
const e = Object.keys(t);
|
324
|
+
return Object.keys(t).map((n) => n.toLocaleLowerCase()).reduce((n, s, i) => (n[s] = t[e[i]], n), {});
|
325
|
+
}, Pe = (t, e = !0) => t ? Object.entries(t).reduce((o, n) => {
|
326
|
+
const [s, i] = n;
|
327
|
+
let a, d;
|
328
|
+
return Array.isArray(i) ? (d = "", i.forEach((c) => {
|
329
|
+
a = e ? encodeURIComponent(c) : c, d += `${s}=${a}&`;
|
330
|
+
}), d.slice(0, -1)) : (a = e ? encodeURIComponent(i) : i, d = `${s}=${a}`), `${o}&${d}`;
|
331
|
+
}, "").substr(1) : null, be = (t, e = {}) => {
|
332
|
+
const r = Object.assign({ method: t.method || "GET", headers: t.headers }, e), n = ve(t.headers)["content-type"] || "";
|
333
|
+
if (typeof t.data == "string")
|
334
|
+
r.body = t.data;
|
335
|
+
else if (n.includes("application/x-www-form-urlencoded")) {
|
336
|
+
const s = new URLSearchParams();
|
337
|
+
for (const [i, a] of Object.entries(t.data || {}))
|
338
|
+
s.set(i, a);
|
339
|
+
r.body = s.toString();
|
340
|
+
} else if (n.includes("multipart/form-data")) {
|
341
|
+
const s = new FormData();
|
342
|
+
if (t.data instanceof FormData)
|
343
|
+
t.data.forEach((a, d) => {
|
344
|
+
s.append(d, a);
|
345
|
+
});
|
346
|
+
else
|
347
|
+
for (const a of Object.keys(t.data))
|
348
|
+
s.append(a, t.data[a]);
|
349
|
+
r.body = s;
|
350
|
+
const i = new Headers(r.headers);
|
351
|
+
i.delete("content-type"), r.headers = i;
|
352
|
+
} else
|
353
|
+
(n.includes("application/json") || typeof t.data == "object") && (r.body = JSON.stringify(t.data));
|
354
|
+
return r;
|
355
|
+
};
|
356
|
+
class ye extends te {
|
357
|
+
/**
|
358
|
+
* Perform an Http request given a set of options
|
359
|
+
* @param options Options to build the HTTP request
|
360
|
+
*/
|
361
|
+
async request(e) {
|
362
|
+
const r = be(e, e.webFetchExtra), o = Pe(e.params, e.shouldEncodeUrlParams), n = o ? `${e.url}?${o}` : e.url, s = await fetch(n, r), i = s.headers.get("content-type") || "";
|
363
|
+
let { responseType: a = "text" } = s.ok ? e : {};
|
364
|
+
i.includes("application/json") && (a = "json");
|
365
|
+
let d, c;
|
366
|
+
switch (a) {
|
367
|
+
case "arraybuffer":
|
368
|
+
case "blob":
|
369
|
+
c = await s.blob(), d = await he(c);
|
370
|
+
break;
|
371
|
+
case "json":
|
372
|
+
d = await s.json();
|
373
|
+
break;
|
374
|
+
case "document":
|
375
|
+
case "text":
|
376
|
+
default:
|
377
|
+
d = await s.text();
|
378
|
+
}
|
379
|
+
const p = {};
|
380
|
+
return s.headers.forEach((l, b) => {
|
381
|
+
p[b] = l;
|
382
|
+
}), {
|
383
|
+
data: d,
|
384
|
+
headers: p,
|
385
|
+
status: s.status,
|
386
|
+
url: s.url
|
387
|
+
};
|
388
|
+
}
|
389
|
+
/**
|
390
|
+
* Perform an Http GET request given a set of options
|
391
|
+
* @param options Options to build the HTTP request
|
392
|
+
*/
|
393
|
+
async get(e) {
|
394
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "GET" }));
|
395
|
+
}
|
396
|
+
/**
|
397
|
+
* Perform an Http POST request given a set of options
|
398
|
+
* @param options Options to build the HTTP request
|
399
|
+
*/
|
400
|
+
async post(e) {
|
401
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "POST" }));
|
402
|
+
}
|
403
|
+
/**
|
404
|
+
* Perform an Http PUT request given a set of options
|
405
|
+
* @param options Options to build the HTTP request
|
406
|
+
*/
|
407
|
+
async put(e) {
|
408
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "PUT" }));
|
409
|
+
}
|
410
|
+
/**
|
411
|
+
* Perform an Http PATCH request given a set of options
|
412
|
+
* @param options Options to build the HTTP request
|
413
|
+
*/
|
414
|
+
async patch(e) {
|
415
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "PATCH" }));
|
416
|
+
}
|
417
|
+
/**
|
418
|
+
* Perform an Http DELETE request given a set of options
|
419
|
+
* @param options Options to build the HTTP request
|
420
|
+
*/
|
421
|
+
async delete(e) {
|
422
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "DELETE" }));
|
423
|
+
}
|
424
|
+
}
|
425
|
+
ee("CapacitorHttp", {
|
426
|
+
web: () => new ye()
|
427
|
+
});
|
428
|
+
const Ce = V.create({ baseURL: process.env.API_URL, withCredentials: !0 }), $ = Z({
|
429
|
+
code: {
|
430
|
+
value: "",
|
431
|
+
type: "",
|
432
|
+
method: "",
|
433
|
+
isSended: !1,
|
434
|
+
isValid: !1
|
435
|
+
}
|
436
|
+
});
|
437
|
+
async function Oe(t, e, r) {
|
438
|
+
return await Ce.post("/api/twofa/sendcode", {
|
439
|
+
phone: t.phone.number,
|
440
|
+
email: t.email,
|
441
|
+
method: e,
|
442
|
+
type: r
|
443
|
+
}).then(
|
444
|
+
(o) => ($.code = o.data, $.code.isSended = !0, Promise.resolve(o.data)),
|
445
|
+
(o) => (console.log(o), E(o), Promise.reject(o))
|
446
|
+
);
|
447
|
+
}
|
448
|
+
Q($, (t, e) => {
|
449
|
+
});
|
450
|
+
const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
451
|
+
__proto__: null,
|
452
|
+
sendCode: Oe,
|
453
|
+
state: $
|
454
|
+
}, Symbol.toStringTag, { value: "Module" })), A = V.create({ baseURL: process.env.API_URL, withCredentials: !0 }), m = Z({
|
455
|
+
user: {
|
456
|
+
_id: void 0,
|
457
|
+
username: "",
|
458
|
+
email: "",
|
459
|
+
phone: "",
|
460
|
+
password: "",
|
461
|
+
passwordRepeat: ""
|
462
|
+
},
|
463
|
+
access: {
|
464
|
+
roles: null,
|
465
|
+
token: null,
|
466
|
+
status: !1
|
467
|
+
}
|
468
|
+
});
|
469
|
+
async function Le() {
|
470
|
+
const t = await Ee("user");
|
471
|
+
if (t) {
|
472
|
+
const { _id: e, email: r, phone: o, roles: n, accessToken: s } = t;
|
473
|
+
Object.assign(m.user, { _id: e, email: r, phone: o }), Object.assign(m.access, { token: s, roles: n, status: !!s }), A.interceptors.request.use((i) => (s && (i.headers["x-access-token"] = s), i), (i) => Promise.reject(i));
|
474
|
+
}
|
475
|
+
}
|
476
|
+
Le();
|
477
|
+
const ke = {
|
478
|
+
async login(t, e) {
|
479
|
+
try {
|
480
|
+
const r = await A.post("/api/auth/signin", {
|
481
|
+
...t,
|
482
|
+
type: e
|
483
|
+
});
|
484
|
+
return q("user", r.data), Object.assign(m.user, {
|
485
|
+
...r.data
|
486
|
+
}), Object.assign(m.access, {
|
487
|
+
token: r.data.accessToken,
|
488
|
+
status: !0,
|
489
|
+
roles: r.data.roles
|
490
|
+
}), r.data;
|
491
|
+
} catch (r) {
|
492
|
+
return Object.assign(m.access, {
|
493
|
+
token: null,
|
494
|
+
status: !1,
|
495
|
+
roles: null
|
496
|
+
}), E(r), Promise.reject(r);
|
497
|
+
}
|
498
|
+
},
|
499
|
+
async signup(t, e, r) {
|
500
|
+
const { password: o, passwordRepeat: n } = m.user;
|
501
|
+
if (o !== n) {
|
502
|
+
const s = {
|
503
|
+
response: {
|
504
|
+
data: { errorCode: "PASSWORDS_DO_NOT_MATCH" }
|
505
|
+
}
|
506
|
+
};
|
507
|
+
throw E(s), new Error(s.response.status);
|
508
|
+
}
|
509
|
+
try {
|
510
|
+
t.phone = t.phone.number;
|
511
|
+
const s = await A.post("/api/auth/signup", {
|
512
|
+
...t,
|
513
|
+
type: e,
|
514
|
+
inviteCode: r
|
515
|
+
});
|
516
|
+
return s.data.accessToken && q("user", s.data), Object.assign(m.user, {
|
517
|
+
...s.data
|
518
|
+
}), Object.assign(m.access, {
|
519
|
+
token: s.data.accessToken,
|
520
|
+
status: !0,
|
521
|
+
roles: s.data.roles
|
522
|
+
}), s.data;
|
523
|
+
} catch (s) {
|
524
|
+
throw E(s), console.log("Sign up falied"), s;
|
525
|
+
}
|
526
|
+
},
|
527
|
+
logout() {
|
528
|
+
_e("user"), Object.assign(m.user, {
|
529
|
+
email: "",
|
530
|
+
phone: "",
|
531
|
+
password: "",
|
532
|
+
passwordRepeat: ""
|
533
|
+
}), Object.assign(m.access, {
|
534
|
+
token: null,
|
535
|
+
status: !1
|
536
|
+
});
|
537
|
+
},
|
538
|
+
async resetPassword(t, e) {
|
539
|
+
try {
|
540
|
+
const r = await A.post("/api/auth/reset-password", {
|
541
|
+
email: t.email,
|
542
|
+
phone: t.phone.number,
|
543
|
+
type: e
|
544
|
+
});
|
545
|
+
return Object.assign($.code, {
|
546
|
+
...r.data,
|
547
|
+
isSended: !0
|
548
|
+
}), r.data;
|
549
|
+
} catch (r) {
|
550
|
+
return E(r), Promise.reject(r);
|
551
|
+
}
|
552
|
+
},
|
553
|
+
async updatePassword(t, e) {
|
554
|
+
const { password: r, passwordRepeat: o } = m.user;
|
555
|
+
if (r !== o) {
|
556
|
+
const n = {
|
557
|
+
response: {
|
558
|
+
data: { errorCode: "PASSWORDS_DO_NOT_MATCH" }
|
559
|
+
}
|
560
|
+
};
|
561
|
+
throw E(n), new Error(n.response.status);
|
562
|
+
}
|
563
|
+
try {
|
564
|
+
const n = await A.post("/api/auth/update-password", {
|
565
|
+
email: t.email,
|
566
|
+
phone: t.phone.number,
|
567
|
+
password: t.password,
|
568
|
+
passwordRepeat: t.passwordRepeat,
|
569
|
+
type: e
|
570
|
+
});
|
571
|
+
return n.data.accessToken && q("user", n.data), Object.assign(m.user, {
|
572
|
+
...n.data
|
573
|
+
}), Object.assign(m.access, {
|
574
|
+
token: n.data.accessToken,
|
575
|
+
status: !0
|
576
|
+
}), n.data;
|
577
|
+
} catch (n) {
|
578
|
+
return E(n), Promise.reject(n);
|
579
|
+
}
|
580
|
+
}
|
581
|
+
}, je = {
|
582
|
+
development: { secure: !1, expires: 1 },
|
583
|
+
production: { expires: 1, domain: process.env.API_URL, sameSite: "none", secure: !0 }
|
584
|
+
};
|
585
|
+
function Ee(t) {
|
586
|
+
if (process.env.MOBILE_APP)
|
587
|
+
return J.getCookie({
|
588
|
+
url: process.env.API_URL,
|
589
|
+
key: t
|
590
|
+
}).then((e) => JSON.parse(e.value));
|
591
|
+
{
|
592
|
+
const e = F.get(t);
|
593
|
+
return e ? JSON.parse(e) : null;
|
594
|
+
}
|
595
|
+
}
|
596
|
+
function q(t, e, r = process.env.NODE_ENV) {
|
597
|
+
process.env.MOBILE_APP ? J.setCookie({
|
598
|
+
url: process.env.API_URL,
|
599
|
+
// используйте ваш API_URL
|
600
|
+
key: t,
|
601
|
+
value: JSON.stringify(e)
|
602
|
+
}) : F.set(t, JSON.stringify(e), je[r]);
|
603
|
+
}
|
604
|
+
function _e(t, e = process.env.NODE_ENV) {
|
605
|
+
if (process.env.MOBILE_APP)
|
606
|
+
J.deleteCookie({
|
607
|
+
url: process.env.API_URL,
|
608
|
+
// используйте ваш API_URL
|
609
|
+
key: t
|
610
|
+
});
|
611
|
+
else {
|
612
|
+
const r = e === "production" ? { domain: process.env.API_URL } : {};
|
613
|
+
F.remove(t, r);
|
614
|
+
}
|
615
|
+
}
|
616
|
+
Q(m, (t, e) => {
|
617
|
+
});
|
618
|
+
const Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
619
|
+
__proto__: null,
|
620
|
+
actions: ke,
|
621
|
+
state: m
|
622
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
623
|
+
export {
|
624
|
+
F as C,
|
625
|
+
ke as a,
|
626
|
+
$ as b,
|
627
|
+
Oe as c,
|
628
|
+
Re as d,
|
629
|
+
Ae as e,
|
630
|
+
le as g,
|
631
|
+
m as s,
|
632
|
+
$e as t
|
633
|
+
};
|