@useinsider/guido 1.0.0-beta.f5fd3cf → 1.0.0-beta.f7c239e

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/README.md CHANGED
@@ -144,24 +144,17 @@ VITE_STRIPO_ROLE=your_role
144
144
 
145
145
  ```
146
146
  src/
147
- ├── components/
148
- │ ├── Guido.vue # Main component
149
- │ └── organisms/
150
- │ └── header/ # Header components
151
- │ └── version-history/ # Version History components
152
- ...
153
- ├── composables/
154
- │ ├── useStripo.ts # Stripo integration
155
- │ └── useTranslations.ts # Translation management
156
- ├── @types/
157
- │ ├── generic.ts # Generic types
158
- │ ├── stripo.d.ts # Stripo-specific types
159
- │ └── events.ts # Event types
160
- ├── static/
161
- │ ├── editor.css # Custom editor styles
162
- │ └── templates/
163
- │ └── default/ # Default email template
164
- └── library.ts # Main export for library
147
+ ├── components/ # Vue components
148
+ ├── composables/ # Vue composables & business logic
149
+ ├── services/ # API layer
150
+ ├── stores/ # State management
151
+ ├── @types/ # TypeScript definitions
152
+ ├── static/ # Static assets & templates
153
+ ├── utils/ # Utility functions
154
+ ├── enums/ # Constants & enums
155
+ ├── mock/ # Mock data for development
156
+ ├── plugins/ # Vue plugins
157
+ └── library.ts # Main export
165
158
  ```
166
159
 
167
160
  ## 🌐 i18n
@@ -1,3 +1,29 @@
1
1
  export type GuidoConfig = {
2
2
  translationsPath: string;
3
3
  };
4
+ export interface User {
5
+ id: number;
6
+ name: string;
7
+ email: string;
8
+ }
9
+ export interface ApiResponse<T> {
10
+ data: T;
11
+ message: string;
12
+ success: boolean;
13
+ }
14
+ export type ToasterType = 'success' | 'error' | 'info' | 'warning';
15
+ export interface ToasterActionButton {
16
+ text: string;
17
+ onClick: () => void;
18
+ }
19
+ export interface ToasterOptions {
20
+ type?: ToasterType;
21
+ message: string;
22
+ actionButton?: ToasterActionButton;
23
+ }
24
+ export interface Translations {
25
+ [key: string]: string;
26
+ }
27
+ export interface TranslationValues {
28
+ [key: string]: string | number | boolean;
29
+ }
@@ -0,0 +1,19 @@
1
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
2
+ export interface HttpOptions extends Omit<RequestInit, 'method' | 'body'> {
3
+ baseURL?: string;
4
+ timeout?: number;
5
+ retry?: number;
6
+ retryDelay?: number;
7
+ }
8
+ export interface HttpResponse<T = unknown> {
9
+ data: T;
10
+ status: number;
11
+ statusText: string;
12
+ headers: Headers;
13
+ }
14
+ export interface HttpError {
15
+ message: string;
16
+ status?: number;
17
+ statusText?: string;
18
+ response?: Response;
19
+ }
@@ -1,8 +1,7 @@
1
- interface User {
2
- id: number;
3
- name: string;
4
- email: string;
5
- }
1
+ /**
2
+ * @deprecated - It's added for example purposes.
3
+ */
4
+ import type { User } from '../@types/generic';
6
5
  export declare const useApiExample: () => {
7
6
  loading: import("vue").ComputedRef<boolean>;
8
7
  error: import("vue").ComputedRef<{
@@ -60,4 +59,3 @@ export declare const useApiExample: () => {
60
59
  uploadFile: (file: File) => Promise<string>;
61
60
  clearError: () => void;
62
61
  };
63
- export {};
@@ -1,22 +1,4 @@
1
- export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
2
- export interface HttpOptions extends Omit<RequestInit, 'method' | 'body'> {
3
- baseURL?: string;
4
- timeout?: number;
5
- retry?: number;
6
- retryDelay?: number;
7
- }
8
- export interface HttpResponse<T = unknown> {
9
- data: T;
10
- status: number;
11
- statusText: string;
12
- headers: Headers;
13
- }
14
- export interface HttpError {
15
- message: string;
16
- status?: number;
17
- statusText?: string;
18
- response?: Response;
19
- }
1
+ import type { HttpMethod, HttpOptions, HttpResponse } from '@/@types/http';
20
2
  export declare const useHttp: (defaultOptions?: HttpOptions) => {
21
3
  loading: import("vue").ComputedRef<boolean>;
22
4
  error: import("vue").ComputedRef<{
@@ -1,36 +1,16 @@
1
- import { useCustomInterfaceAppearance as g } from "./useCustomInterfaceAppearance.js";
2
- import { useHttp as y } from "./useHttp.js";
3
- import { useToaster as h } from "./useToaster.js";
4
- import { useEditorStore as w } from "../stores/editor.js";
5
- const k = (c) => {
6
- const { get: a, post: u } = y(), { handleError: i } = h(), l = async () => {
7
- try {
8
- return (await u("/v2/stripo/get-user-token", {
9
- pluginId: void 0,
10
- secretKey: void 0,
11
- role: void 0,
12
- userId: c.emailId
13
- })).data.token;
14
- } catch (t) {
15
- return i(t, "Failed to fetch token"), "";
16
- }
17
- }, p = async () => {
18
- try {
19
- return ((await a("/stripo/get-partner-custom-fonts")).data || []).map((n) => ({
20
- ...n,
21
- active: !0
22
- }));
23
- } catch (t) {
24
- return i(t, "Failed to fetch custom fonts"), [];
25
- }
26
- }, m = (t, r = []) => {
27
- const n = w(), { html: e, css: s } = t;
1
+ import { useCustomInterfaceAppearance as p } from "./useCustomInterfaceAppearance.js";
2
+ import { useToaster as m } from "./useToaster.js";
3
+ import c from "../services/stripoApi.js";
4
+ import { useEditorStore as g } from "../stores/editor.js";
5
+ const f = (a) => {
6
+ const { handleError: d } = m(), u = (e, i = []) => {
7
+ const r = g(), { html: t, css: n } = e;
28
8
  window.UIEditor.initEditor(
29
9
  document.querySelector("#guido-editor"),
30
10
  {
31
- metadata: c,
32
- html: e,
33
- css: s,
11
+ metadata: a,
12
+ html: t,
13
+ css: n,
34
14
  locale: "en",
35
15
  undoButtonSelector: "#guido__undo-button",
36
16
  redoButtonSelector: "#guido__redo-button",
@@ -40,55 +20,55 @@ const k = (c) => {
40
20
  editorFonts: {
41
21
  showDefaultStandardFonts: !0,
42
22
  showDefaultNotStandardFonts: !0,
43
- customFonts: r
23
+ customFonts: i
44
24
  },
45
25
  async onTokenRefreshRequest(o) {
46
26
  try {
47
- const d = await l();
48
- o(d);
49
- } catch (d) {
50
- i(d, "Failed to refresh token");
27
+ const s = await c.getToken();
28
+ o(s);
29
+ } catch (s) {
30
+ d(s, "Failed to refresh token");
51
31
  }
52
32
  },
53
33
  onTemplateLoaded() {
54
34
  try {
55
- const { importCss: o } = g();
35
+ const { importCss: o } = p();
56
36
  o();
57
37
  } catch (o) {
58
- i(o, "Failed to load custom interface appearance");
38
+ d(o, "Failed to load custom interface appearance");
59
39
  }
60
40
  },
61
41
  onCodeEditorVisibilityChanged(o) {
62
- n.isCodeEditorOpen = o;
42
+ r.isCodeEditorOpen = o;
63
43
  },
64
44
  onEditorVisualModeChanged(o) {
65
- n.editorVisualMode = o.toLowerCase();
45
+ r.editorVisualMode = o.toLowerCase();
66
46
  },
67
47
  onVersionHistoryVisibilityChanged(o) {
68
- n.isVersionHistoryOpen = o;
48
+ r.isVersionHistoryOpen = o;
69
49
  }
70
50
  }
71
51
  );
72
- }, f = (t) => new Promise((r, n) => {
52
+ }, l = (e) => new Promise((i, r) => {
73
53
  if (document.getElementById("UiEditorScript")) {
74
- t(), r();
54
+ e(), i();
75
55
  return;
76
56
  }
77
- const e = document.createElement("script");
78
- e.id = "UiEditorScript", e.type = "module", e.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", e.onload = () => {
79
- t(), r();
80
- }, e.onerror = () => {
81
- const s = new Error("Failed to load Stripo UIEditor script");
82
- n(s);
83
- }, document.body.appendChild(e);
57
+ const t = document.createElement("script");
58
+ t.id = "UiEditorScript", t.type = "module", t.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", t.onload = () => {
59
+ e(), i();
60
+ }, t.onerror = () => {
61
+ const n = new Error("Failed to load Stripo UIEditor script");
62
+ r(n);
63
+ }, document.body.appendChild(t);
84
64
  });
85
- return { initPlugin: async (t) => {
86
- await f(async () => {
87
- const r = await p();
88
- m(t, r);
65
+ return { initPlugin: async (e) => {
66
+ await l(async () => {
67
+ const i = await c.getCustomFonts();
68
+ u(e, i);
89
69
  });
90
70
  } };
91
71
  };
92
72
  export {
93
- k as useStripo
73
+ f as useStripo
94
74
  };
@@ -1,12 +1,4 @@
1
- export type ToasterType = 'success' | 'error' | 'info' | 'warning';
2
- export type ToasterOptions = {
3
- type?: ToasterType;
4
- message: string;
5
- actionButton?: {
6
- text: string;
7
- onClick: () => void;
8
- };
9
- };
1
+ import type { ToasterType, ToasterOptions } from '@/@types/generic';
10
2
  export declare const useToaster: () => {
11
3
  isToasterVisible: import("vue").Ref<boolean>;
12
4
  toasterMessage: import("vue").Ref<string>;
@@ -1,5 +1,2 @@
1
- interface TranslationValues {
2
- [key: string]: string | number | boolean;
3
- }
1
+ import type { TranslationValues } from '@/@types/generic';
4
2
  export declare const useTranslations: () => ((key: string, params?: TranslationValues) => string) & import("lodash").MemoizedFunction;
5
- export {};
@@ -0,0 +1,9 @@
1
+ import type { CustomFont } from '@@/Types/stripo';
2
+ export interface StripoApiService {
3
+ getToken(): Promise<string>;
4
+ getCustomFonts(): Promise<(CustomFont & {
5
+ active: boolean;
6
+ })[]>;
7
+ }
8
+ declare const stripoApiService: StripoApiService;
9
+ export default stripoApiService;
@@ -0,0 +1,28 @@
1
+ import { useHttp as r } from "../composables/useHttp.js";
2
+ import { useToaster as s } from "../composables/useToaster.js";
3
+ const c = {
4
+ async getToken() {
5
+ try {
6
+ const t = Number(localStorage.getItem("ins-guido-test-instance")), { get: e } = r(), { data: o } = await e(`/stripo/get-user-token?test=${t}`);
7
+ return o.body.token;
8
+ } catch (t) {
9
+ const { handleError: e } = s();
10
+ return e(t, "Failed to fetch token"), "";
11
+ }
12
+ },
13
+ async getCustomFonts() {
14
+ try {
15
+ const { get: t } = r(), { data: e = [] } = await t("/stripo/get-partner-custom-fonts");
16
+ return e.map((o) => ({
17
+ ...o,
18
+ active: !0
19
+ }));
20
+ } catch (t) {
21
+ const { handleError: e } = s();
22
+ return e(t, "Failed to fetch custom fonts"), [];
23
+ }
24
+ }
25
+ };
26
+ export {
27
+ c as default
28
+ };
@@ -1,4 +1,4 @@
1
- import { defineStore as e } from "../node_modules/pinia/dist/pinia.js";
1
+ import { defineStore as e } from "pinia";
2
2
  const t = e("editor", {
3
3
  state: () => ({
4
4
  isCodeEditorOpen: !1,
@@ -1,4 +1,4 @@
1
- import { defineStore as a } from "../node_modules/pinia/dist/pinia.js";
1
+ import { defineStore as a } from "pinia";
2
2
  const e = () => ({
3
3
  id: "",
4
4
  date: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.0-beta.f5fd3cf",
3
+ "version": "1.0.0-beta.f7c239e",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -1,317 +0,0 @@
1
- import { hasInjectionContext as ut } from "../node_modules/vue-demi/lib/index.js";
2
- import { inject as at, getCurrentInstance as it, set as O, ref as K, reactive as ft, markRaw as j, effectScope as _t, isRef as x, isReactive as J, toRef as T, del as A, nextTick as B, computed as tt, getCurrentScope as lt, onScopeDispose as Et, watch as pt, toRefs as Q } from "vue";
3
- /*!
4
- * pinia v2.3.1
5
- * (c) 2025 Eduardo San Martin Morote
6
- * @license MIT
7
- */
8
- let R;
9
- const L = (t) => R = t, dt = process.env.NODE_ENV !== "production" ? Symbol("pinia") : (
10
- /* istanbul ignore next */
11
- Symbol()
12
- );
13
- function V(t) {
14
- return t && typeof t == "object" && Object.prototype.toString.call(t) === "[object Object]" && typeof t.toJSON != "function";
15
- }
16
- var w;
17
- (function(t) {
18
- t.direct = "direct", t.patchObject = "patch object", t.patchFunction = "patch function";
19
- })(w || (w = {}));
20
- const C = typeof window < "u";
21
- function et(t, u) {
22
- for (const r in u) {
23
- const o = u[r];
24
- if (!(r in t))
25
- continue;
26
- const c = t[r];
27
- V(c) && V(o) && !x(o) && !J(o) ? t[r] = et(c, o) : O(t, r, o);
28
- }
29
- return t;
30
- }
31
- const ot = () => {
32
- };
33
- function X(t, u, r, o = ot) {
34
- t.push(u);
35
- const c = () => {
36
- const f = t.indexOf(u);
37
- f > -1 && (t.splice(f, 1), o());
38
- };
39
- return !r && lt() && Et(c), c;
40
- }
41
- function g(t, ...u) {
42
- t.slice().forEach((r) => {
43
- r(...u);
44
- });
45
- }
46
- const ht = (t) => t(), Y = Symbol(), W = Symbol();
47
- function H(t, u) {
48
- t instanceof Map && u instanceof Map ? u.forEach((r, o) => t.set(o, r)) : t instanceof Set && u instanceof Set && u.forEach(t.add, t);
49
- for (const r in u) {
50
- if (!u.hasOwnProperty(r))
51
- continue;
52
- const o = u[r], c = t[r];
53
- V(c) && V(o) && t.hasOwnProperty(r) && !x(o) && !J(o) ? t[r] = H(c, o) : t[r] = o;
54
- }
55
- return t;
56
- }
57
- const Nt = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : (
58
- /* istanbul ignore next */
59
- Symbol()
60
- );
61
- function vt(t) {
62
- return !V(t) || !t.hasOwnProperty(Nt);
63
- }
64
- const { assign: y } = Object;
65
- function Z(t) {
66
- return !!(x(t) && t.effect);
67
- }
68
- function G(t, u, r, o) {
69
- const { state: c, actions: f, getters: E } = u, i = r.state.value[t];
70
- let b;
71
- function N() {
72
- !i && (process.env.NODE_ENV === "production" || !o) && O(r.state.value, t, c ? c() : {});
73
- const p = process.env.NODE_ENV !== "production" && o ? (
74
- // use ref() to unwrap refs inside state TODO: check if this is still necessary
75
- Q(K(c ? c() : {}).value)
76
- ) : Q(r.state.value[t]);
77
- return y(p, f, Object.keys(E || {}).reduce((_, l) => (process.env.NODE_ENV !== "production" && l in p && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${l}" in store "${t}".`), _[l] = j(tt(() => {
78
- L(r);
79
- const v = r._s.get(t);
80
- if (v._r)
81
- return E[l].call(v, v);
82
- })), _), {}));
83
- }
84
- return b = M(t, N, u, r, o, !0), b;
85
- }
86
- function M(t, u, r = {}, o, c, f) {
87
- let E;
88
- const i = y({ actions: {} }, r);
89
- if (process.env.NODE_ENV !== "production" && !o._e.active)
90
- throw new Error("Pinia destroyed");
91
- const b = { deep: !0 };
92
- process.env.NODE_ENV;
93
- let N, p, _ = [], l = [], v;
94
- const D = o.state.value[t];
95
- !f && !D && (process.env.NODE_ENV === "production" || !c) && O(o.state.value, t, {});
96
- const $ = K({});
97
- let q;
98
- function z(s) {
99
- let e;
100
- N = p = !1, process.env.NODE_ENV !== "production" && (v = []), typeof s == "function" ? (s(o.state.value[t]), e = {
101
- type: w.patchFunction,
102
- storeId: t,
103
- events: v
104
- }) : (H(o.state.value[t], s), e = {
105
- type: w.patchObject,
106
- payload: s,
107
- storeId: t,
108
- events: v
109
- });
110
- const a = q = Symbol();
111
- B().then(() => {
112
- q === a && (N = !0);
113
- }), p = !0, g(_, e, o.state.value[t]);
114
- }
115
- const st = f ? function() {
116
- const { state: e } = r, a = e ? e() : {};
117
- this.$patch((d) => {
118
- y(d, a);
119
- });
120
- } : (
121
- /* istanbul ignore next */
122
- process.env.NODE_ENV !== "production" ? () => {
123
- throw new Error(`🍍: Store "${t}" is built using the setup syntax and does not implement $reset().`);
124
- } : ot
125
- );
126
- function nt() {
127
- E.stop(), _ = [], l = [], o._s.delete(t);
128
- }
129
- const k = (s, e = "") => {
130
- if (Y in s)
131
- return s[W] = e, s;
132
- const a = function() {
133
- L(o);
134
- const d = Array.from(arguments), P = [], F = [];
135
- function rt(h) {
136
- P.push(h);
137
- }
138
- function ct(h) {
139
- F.push(h);
140
- }
141
- g(l, {
142
- args: d,
143
- name: a[W],
144
- store: n,
145
- after: rt,
146
- onError: ct
147
- });
148
- let S;
149
- try {
150
- S = s.apply(this && this.$id === t ? this : n, d);
151
- } catch (h) {
152
- throw g(F, h), h;
153
- }
154
- return S instanceof Promise ? S.then((h) => (g(P, h), h)).catch((h) => (g(F, h), Promise.reject(h))) : (g(P, S), S);
155
- };
156
- return a[Y] = !0, a[W] = e, a;
157
- }, I = /* @__PURE__ */ j({
158
- actions: {},
159
- getters: {},
160
- state: [],
161
- hotState: $
162
- }), U = {
163
- _p: o,
164
- // _s: scope,
165
- $id: t,
166
- $onAction: X.bind(null, l),
167
- $patch: z,
168
- $reset: st,
169
- $subscribe(s, e = {}) {
170
- const a = X(_, s, e.detached, () => d()), d = E.run(() => pt(() => o.state.value[t], (P) => {
171
- (e.flush === "sync" ? p : N) && s({
172
- storeId: t,
173
- type: w.direct,
174
- events: v
175
- }, P);
176
- }, y({}, b, e)));
177
- return a;
178
- },
179
- $dispose: nt
180
- };
181
- U._r = !1;
182
- const n = ft(process.env.NODE_ENV !== "production" || (process.env.NODE_ENV !== "production" || typeof __VUE_PROD_DEVTOOLS__ < "u" && __VUE_PROD_DEVTOOLS__) && process.env.NODE_ENV !== "test" && C ? y(
183
- {
184
- _hmrPayload: I,
185
- _customProperties: j(/* @__PURE__ */ new Set())
186
- // devtools custom properties
187
- },
188
- U
189
- // must be added later
190
- // setupStore
191
- ) : U);
192
- o._s.set(t, n);
193
- const m = (o._a && o._a.runWithContext || ht)(() => o._e.run(() => (E = _t()).run(() => u({ action: k }))));
194
- for (const s in m) {
195
- const e = m[s];
196
- if (x(e) && !Z(e) || J(e))
197
- process.env.NODE_ENV !== "production" && c ? O($.value, s, T(m, s)) : f || (D && vt(e) && (x(e) ? e.value = D[s] : H(e, D[s])), O(o.state.value[t], s, e)), process.env.NODE_ENV !== "production" && I.state.push(s);
198
- else if (typeof e == "function") {
199
- const a = process.env.NODE_ENV !== "production" && c ? e : k(e, s);
200
- O(m, s, a), process.env.NODE_ENV !== "production" && (I.actions[s] = e), i.actions[s] = e;
201
- } else process.env.NODE_ENV !== "production" && Z(e) && (I.getters[s] = f ? (
202
- // @ts-expect-error
203
- r.getters[s]
204
- ) : e, C && (m._getters || // @ts-expect-error: same
205
- (m._getters = j([]))).push(s));
206
- }
207
- if (Object.keys(m).forEach((s) => {
208
- O(n, s, m[s]);
209
- }), Object.defineProperty(n, "$state", {
210
- get: () => process.env.NODE_ENV !== "production" && c ? $.value : o.state.value[t],
211
- set: (s) => {
212
- if (process.env.NODE_ENV !== "production" && c)
213
- throw new Error("cannot set hotState");
214
- z((e) => {
215
- y(e, s);
216
- });
217
- }
218
- }), process.env.NODE_ENV !== "production" && (n._hotUpdate = j((s) => {
219
- n._hotUpdating = !0, s._hmrPayload.state.forEach((e) => {
220
- if (e in n.$state) {
221
- const a = s.$state[e], d = n.$state[e];
222
- typeof a == "object" && V(a) && V(d) ? et(a, d) : s.$state[e] = d;
223
- }
224
- O(n, e, T(s.$state, e));
225
- }), Object.keys(n.$state).forEach((e) => {
226
- e in s.$state || A(n, e);
227
- }), N = !1, p = !1, o.state.value[t] = T(s._hmrPayload, "hotState"), p = !0, B().then(() => {
228
- N = !0;
229
- });
230
- for (const e in s._hmrPayload.actions) {
231
- const a = s[e];
232
- O(n, e, k(a, e));
233
- }
234
- for (const e in s._hmrPayload.getters) {
235
- const a = s._hmrPayload.getters[e], d = f ? (
236
- // special handling of options api
237
- tt(() => (L(o), a.call(n, n)))
238
- ) : a;
239
- O(n, e, d);
240
- }
241
- Object.keys(n._hmrPayload.getters).forEach((e) => {
242
- e in s._hmrPayload.getters || A(n, e);
243
- }), Object.keys(n._hmrPayload.actions).forEach((e) => {
244
- e in s._hmrPayload.actions || A(n, e);
245
- }), n._hmrPayload = s._hmrPayload, n._getters = s._getters, n._hotUpdating = !1;
246
- })), (process.env.NODE_ENV !== "production" || typeof __VUE_PROD_DEVTOOLS__ < "u" && __VUE_PROD_DEVTOOLS__) && process.env.NODE_ENV !== "test" && C) {
247
- const s = {
248
- writable: !0,
249
- configurable: !0,
250
- // avoid warning on devtools trying to display this property
251
- enumerable: !1
252
- };
253
- ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((e) => {
254
- Object.defineProperty(n, e, y({ value: n[e] }, s));
255
- });
256
- }
257
- return n._r = !0, o._p.forEach((s) => {
258
- if ((process.env.NODE_ENV !== "production" || typeof __VUE_PROD_DEVTOOLS__ < "u" && __VUE_PROD_DEVTOOLS__) && process.env.NODE_ENV !== "test" && C) {
259
- const e = E.run(() => s({
260
- store: n,
261
- app: o._a,
262
- pinia: o,
263
- options: i
264
- }));
265
- Object.keys(e || {}).forEach((a) => n._customProperties.add(a)), y(n, e);
266
- } else
267
- y(n, E.run(() => s({
268
- store: n,
269
- app: o._a,
270
- pinia: o,
271
- options: i
272
- })));
273
- }), process.env.NODE_ENV !== "production" && n.$state && typeof n.$state == "object" && typeof n.$state.constructor == "function" && !n.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
274
- state: () => new MyClass()
275
- Found in store "${n.$id}".`), D && f && r.hydrate && r.hydrate(n.$state, D), N = !0, p = !0, n;
276
- }
277
- /*! #__NO_SIDE_EFFECTS__ */
278
- // @__NO_SIDE_EFFECTS__
279
- function mt(t, u, r) {
280
- let o, c;
281
- const f = typeof u == "function";
282
- if (typeof t == "string")
283
- o = t, c = f ? r : u;
284
- else if (c = t, o = t.id, process.env.NODE_ENV !== "production" && typeof o != "string")
285
- throw new Error('[🍍]: "defineStore()" must be passed a store id as its first argument.');
286
- function E(i, b) {
287
- const N = ut();
288
- if (i = // in test mode, ignore the argument provided as we can always retrieve a
289
- // pinia instance with getActivePinia()
290
- (process.env.NODE_ENV === "test" && R && R._testing ? null : i) || (N ? at(dt, null) : null), i && L(i), process.env.NODE_ENV !== "production" && !R)
291
- throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
292
- See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
293
- This will fail in production.`);
294
- i = R, i._s.has(o) || (f ? M(o, u, c, i) : G(o, c, i), process.env.NODE_ENV !== "production" && (E._pinia = i));
295
- const p = i._s.get(o);
296
- if (process.env.NODE_ENV !== "production" && b) {
297
- const _ = "__hot:" + o, l = f ? M(_, u, c, i, !0) : G(_, y({}, c), i, !0);
298
- b._hotUpdate(l), delete i.state.value[_], i._s.delete(_);
299
- }
300
- if (process.env.NODE_ENV !== "production" && C) {
301
- const _ = it();
302
- if (_ && _.proxy && // avoid adding stores that are just built for hot module replacement
303
- !b) {
304
- const l = _.proxy, v = "_pStores" in l ? l._pStores : l._pStores = {};
305
- v[o] = p;
306
- }
307
- }
308
- return p;
309
- }
310
- return E.$id = o, E;
311
- }
312
- export {
313
- w as MutationType,
314
- mt as defineStore,
315
- L as setActivePinia,
316
- vt as shouldHydrate
317
- };
@@ -1,11 +0,0 @@
1
- import t, { getCurrentInstance as e } from "vue";
2
- export * from "vue";
3
- import { default as f } from "vue";
4
- t.util.warn;
5
- function n() {
6
- return !!e();
7
- }
8
- export {
9
- f as Vue,
10
- n as hasInjectionContext
11
- };