@fonderie/vue-courier-admin 0.2.0 → 0.4.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/index.cjs +40 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -19
- package/dist/index.d.ts +23 -19
- package/dist/index.js +38 -56
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -20,93 +20,75 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
CourierAdminClient: () =>
|
|
24
|
-
FonderieApiError: () =>
|
|
25
|
-
useDeleteTemplate: () => useDeleteTemplate,
|
|
26
|
-
useSaveTemplate: () => useSaveTemplate,
|
|
23
|
+
CourierAdminClient: () => import_client5.CourierAdminClient,
|
|
24
|
+
FonderieApiError: () => import_client5.FonderieApiError,
|
|
27
25
|
useTemplate: () => useTemplate,
|
|
26
|
+
useTemplatePreview: () => useTemplatePreview,
|
|
28
27
|
useTemplateRevisions: () => useTemplateRevisions,
|
|
29
28
|
useTemplates: () => useTemplates
|
|
30
29
|
});
|
|
31
30
|
module.exports = __toCommonJS(index_exports);
|
|
32
|
-
var
|
|
31
|
+
var import_client5 = require("@fonderie/client");
|
|
33
32
|
|
|
34
|
-
// src/composables/
|
|
33
|
+
// src/composables/useTemplate.ts
|
|
35
34
|
var import_client = require("@fonderie/client");
|
|
36
35
|
var import_vue = require("vue");
|
|
37
|
-
function
|
|
38
|
-
const
|
|
36
|
+
function useTemplate(client, type, locale) {
|
|
37
|
+
const template = (0, import_vue.ref)(null);
|
|
38
|
+
const isLoading = (0, import_vue.ref)(true);
|
|
39
39
|
const error = (0, import_vue.ref)(null);
|
|
40
|
-
async function
|
|
40
|
+
async function refresh() {
|
|
41
41
|
isLoading.value = true;
|
|
42
42
|
error.value = null;
|
|
43
43
|
try {
|
|
44
|
-
await client.
|
|
44
|
+
const { result } = await client.getTemplate(type, locale);
|
|
45
|
+
template.value = result;
|
|
45
46
|
} catch (err) {
|
|
46
47
|
const apiError = err instanceof import_client.FonderieApiError ? err : new import_client.FonderieApiError("unknown", String(err), 0);
|
|
47
48
|
error.value = apiError;
|
|
48
|
-
throw apiError;
|
|
49
49
|
} finally {
|
|
50
50
|
isLoading.value = false;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
void refresh();
|
|
54
|
+
return { template, isLoading, error, refresh };
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
// src/composables/
|
|
57
|
+
// src/composables/useTemplatePreview.ts
|
|
57
58
|
var import_client2 = require("@fonderie/client");
|
|
58
59
|
var import_vue2 = require("vue");
|
|
59
|
-
function
|
|
60
|
-
const
|
|
60
|
+
function useTemplatePreview(client) {
|
|
61
|
+
const preview = (0, import_vue2.ref)(null);
|
|
62
|
+
const isPreviewing = (0, import_vue2.ref)(false);
|
|
61
63
|
const error = (0, import_vue2.ref)(null);
|
|
62
|
-
async function
|
|
63
|
-
|
|
64
|
+
async function renderPreview(type, input, locale) {
|
|
65
|
+
isPreviewing.value = true;
|
|
64
66
|
error.value = null;
|
|
65
67
|
try {
|
|
66
|
-
const { result } = await client.
|
|
68
|
+
const { result } = await client.previewTemplate(type, input, locale);
|
|
69
|
+
preview.value = result;
|
|
67
70
|
return result;
|
|
68
71
|
} catch (err) {
|
|
69
72
|
const apiError = err instanceof import_client2.FonderieApiError ? err : new import_client2.FonderieApiError("unknown", String(err), 0);
|
|
70
73
|
error.value = apiError;
|
|
71
74
|
throw apiError;
|
|
72
75
|
} finally {
|
|
73
|
-
|
|
76
|
+
isPreviewing.value = false;
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
|
-
|
|
79
|
+
const clearPreview = () => {
|
|
80
|
+
preview.value = null;
|
|
81
|
+
};
|
|
82
|
+
return { preview, isPreviewing, error, renderPreview, clearPreview };
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
// src/composables/
|
|
85
|
+
// src/composables/useTemplateRevisions.ts
|
|
80
86
|
var import_client3 = require("@fonderie/client");
|
|
81
87
|
var import_vue3 = require("vue");
|
|
82
|
-
function
|
|
83
|
-
const
|
|
88
|
+
function useTemplateRevisions(client, type, locale) {
|
|
89
|
+
const revisions = (0, import_vue3.ref)([]);
|
|
84
90
|
const isLoading = (0, import_vue3.ref)(true);
|
|
85
91
|
const error = (0, import_vue3.ref)(null);
|
|
86
|
-
async function refresh() {
|
|
87
|
-
isLoading.value = true;
|
|
88
|
-
error.value = null;
|
|
89
|
-
try {
|
|
90
|
-
const { result } = await client.getTemplate(type, locale);
|
|
91
|
-
template.value = result;
|
|
92
|
-
} catch (err) {
|
|
93
|
-
const apiError = err instanceof import_client3.FonderieApiError ? err : new import_client3.FonderieApiError("unknown", String(err), 0);
|
|
94
|
-
error.value = apiError;
|
|
95
|
-
} finally {
|
|
96
|
-
isLoading.value = false;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
void refresh();
|
|
100
|
-
return { template, isLoading, error, refresh };
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// src/composables/useTemplateRevisions.ts
|
|
104
|
-
var import_client4 = require("@fonderie/client");
|
|
105
|
-
var import_vue4 = require("vue");
|
|
106
|
-
function useTemplateRevisions(client, type, locale) {
|
|
107
|
-
const revisions = (0, import_vue4.ref)([]);
|
|
108
|
-
const isLoading = (0, import_vue4.ref)(true);
|
|
109
|
-
const error = (0, import_vue4.ref)(null);
|
|
110
92
|
async function refresh() {
|
|
111
93
|
isLoading.value = true;
|
|
112
94
|
error.value = null;
|
|
@@ -114,7 +96,7 @@ function useTemplateRevisions(client, type, locale) {
|
|
|
114
96
|
const { result } = await client.listRevisions(type, locale);
|
|
115
97
|
revisions.value = result;
|
|
116
98
|
} catch (err) {
|
|
117
|
-
const apiError = err instanceof
|
|
99
|
+
const apiError = err instanceof import_client3.FonderieApiError ? err : new import_client3.FonderieApiError("unknown", String(err), 0);
|
|
118
100
|
error.value = apiError;
|
|
119
101
|
} finally {
|
|
120
102
|
isLoading.value = false;
|
|
@@ -127,7 +109,7 @@ function useTemplateRevisions(client, type, locale) {
|
|
|
127
109
|
await refresh();
|
|
128
110
|
return result;
|
|
129
111
|
} catch (err) {
|
|
130
|
-
const apiError = err instanceof
|
|
112
|
+
const apiError = err instanceof import_client3.FonderieApiError ? err : new import_client3.FonderieApiError("unknown", String(err), 0);
|
|
131
113
|
error.value = apiError;
|
|
132
114
|
throw apiError;
|
|
133
115
|
}
|
|
@@ -137,12 +119,12 @@ function useTemplateRevisions(client, type, locale) {
|
|
|
137
119
|
}
|
|
138
120
|
|
|
139
121
|
// src/composables/useTemplates.ts
|
|
140
|
-
var
|
|
141
|
-
var
|
|
122
|
+
var import_client4 = require("@fonderie/client");
|
|
123
|
+
var import_vue4 = require("vue");
|
|
142
124
|
function useTemplates(client) {
|
|
143
|
-
const templates = (0,
|
|
144
|
-
const isLoading = (0,
|
|
145
|
-
const error = (0,
|
|
125
|
+
const templates = (0, import_vue4.ref)([]);
|
|
126
|
+
const isLoading = (0, import_vue4.ref)(true);
|
|
127
|
+
const error = (0, import_vue4.ref)(null);
|
|
146
128
|
async function refresh() {
|
|
147
129
|
isLoading.value = true;
|
|
148
130
|
error.value = null;
|
|
@@ -150,7 +132,7 @@ function useTemplates(client) {
|
|
|
150
132
|
const { result } = await client.listTemplates();
|
|
151
133
|
templates.value = result;
|
|
152
134
|
} catch (err) {
|
|
153
|
-
const apiError = err instanceof
|
|
135
|
+
const apiError = err instanceof import_client4.FonderieApiError ? err : new import_client4.FonderieApiError("unknown", String(err), 0);
|
|
154
136
|
error.value = apiError;
|
|
155
137
|
} finally {
|
|
156
138
|
isLoading.value = false;
|
|
@@ -164,7 +146,7 @@ function useTemplates(client) {
|
|
|
164
146
|
await refresh();
|
|
165
147
|
return result;
|
|
166
148
|
} catch (err) {
|
|
167
|
-
const apiError = err instanceof
|
|
149
|
+
const apiError = err instanceof import_client4.FonderieApiError ? err : new import_client4.FonderieApiError("unknown", String(err), 0);
|
|
168
150
|
error.value = apiError;
|
|
169
151
|
throw apiError;
|
|
170
152
|
}
|
|
@@ -175,7 +157,7 @@ function useTemplates(client) {
|
|
|
175
157
|
await client.deleteTemplate(type, locale);
|
|
176
158
|
await refresh();
|
|
177
159
|
} catch (err) {
|
|
178
|
-
const apiError = err instanceof
|
|
160
|
+
const apiError = err instanceof import_client4.FonderieApiError ? err : new import_client4.FonderieApiError("unknown", String(err), 0);
|
|
179
161
|
error.value = apiError;
|
|
180
162
|
throw apiError;
|
|
181
163
|
}
|
|
@@ -186,9 +168,8 @@ function useTemplates(client) {
|
|
|
186
168
|
0 && (module.exports = {
|
|
187
169
|
CourierAdminClient,
|
|
188
170
|
FonderieApiError,
|
|
189
|
-
useDeleteTemplate,
|
|
190
|
-
useSaveTemplate,
|
|
191
171
|
useTemplate,
|
|
172
|
+
useTemplatePreview,
|
|
192
173
|
useTemplateRevisions,
|
|
193
174
|
useTemplates
|
|
194
175
|
});
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/composables/
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/composables/useTemplate.ts","../src/composables/useTemplatePreview.ts","../src/composables/useTemplateRevisions.ts","../src/composables/useTemplates.ts"],"sourcesContent":["export type {\n\tICourierAdminClientOptions,\n\tIPreviewTemplateInput,\n\tIRenderedTemplateResult,\n\tIRollbackTemplateInput,\n\tISetTemplateInput,\n\tITemplateEntry,\n\tITemplateRevision,\n} from '@fonderie/client';\n\nexport { CourierAdminClient, FonderieApiError } from '@fonderie/client';\nexport {\n\tuseTemplate,\n\tuseTemplatePreview,\n\tuseTemplateRevisions,\n\tuseTemplates,\n} from './composables';\n","import type { CourierAdminClient, ITemplateEntry } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\nexport function useTemplate(client: CourierAdminClient, type: string, locale?: string | null) {\n\tconst template = ref<ITemplateEntry | null>(null);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.getTemplate(type, locale);\n\t\t\ttemplate.value = result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\treturn { template, isLoading, error, refresh };\n}\n","import type {\n\tCourierAdminClient,\n\tIPreviewTemplateInput,\n\tIRenderedTemplateResult,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\n// On demand, not on mount: the caller decides when the editor's content is\n// worth rendering. Server-side, so what comes back is what the resolver\n// produces — the layout shell and the variable substitution included.\nexport function useTemplatePreview(client: CourierAdminClient) {\n\tconst preview = ref<IRenderedTemplateResult | null>(null);\n\tconst isPreviewing = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function renderPreview(\n\t\ttype: string,\n\t\tinput: IPreviewTemplateInput,\n\t\tlocale?: string | null,\n\t): Promise<IRenderedTemplateResult> {\n\t\tisPreviewing.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.previewTemplate(type, input, locale);\n\t\t\tpreview.value = result;\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisPreviewing.value = false;\n\t\t}\n\t}\n\n\tconst clearPreview = () => {\n\t\tpreview.value = null;\n\t};\n\n\treturn { preview, isPreviewing, error, renderPreview, clearPreview };\n}\n","import type { CourierAdminClient, ITemplateRevision } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\nexport function useTemplateRevisions(\n\tclient: CourierAdminClient,\n\ttype: string,\n\tlocale?: string | null,\n) {\n\tconst revisions = ref<ITemplateRevision[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.listRevisions(type, locale);\n\t\t\trevisions.value = result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function rollback(toVersion: number) {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.rollback(type, { toVersion }, locale);\n\t\t\tawait refresh();\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\treturn { revisions, isLoading, error, refresh, rollback };\n}\n","import type { CourierAdminClient, ISetTemplateInput, ITemplateEntry } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\nexport function useTemplates(client: CourierAdminClient) {\n\tconst templates = ref<ITemplateEntry[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.listTemplates();\n\t\t\ttemplates.value = result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\tasync function saveTemplate(type: string, input: ISetTemplateInput, locale?: string | null) {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.setTemplate(type, input, locale);\n\t\t\tawait refresh();\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\tasync function removeTemplate(type: string, locale?: string | null) {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait client.deleteTemplate(type, locale);\n\t\t\tawait refresh();\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\treturn { templates, isLoading, error, refresh, saveTemplate, removeTemplate };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAAA,iBAAqD;;;ACTrD,oBAAiC;AACjC,iBAAoB;AAEb,SAAS,YAAY,QAA4B,MAAc,QAAwB;AAC7F,QAAM,eAAW,gBAA2B,IAAI;AAChD,QAAM,gBAAY,gBAAI,IAAI;AAC1B,QAAM,YAAQ,gBAA6B,IAAI;AAE/C,iBAAe,UAAU;AACxB,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,EAAE,OAAO,IAAI,MAAM,OAAO,YAAY,MAAM,MAAM;AACxD,eAAS,QAAQ;AAAA,IAClB,SAAS,KAAK;AACb,YAAM,WACL,eAAe,iCAAmB,MAAM,IAAI,+BAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AAAA,IACf,UA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GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,YAAM;AAAA,IACP;AAAA,EACD;AAEA,iBAAe,eAAe,MAAc,QAAwB;AACnE,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,OAAO,eAAe,MAAM,MAAM;AACxC,YAAM,QAAQ;AAAA,IACf,SAAS,KAAK;AACb,YAAM,WACL,eAAe,kCAAmB,MAAM,IAAI,gCAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,YAAM;AAAA,IACP;AAAA,EACD;AAEA,SAAO,EAAE,WAAW,WAAW,OAAO,SAAS,cAAc,eAAe;AAC7E;","names":["import_client","import_client","import_vue","import_client","import_vue","import_client","import_vue"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import * as _fonderie_client from '@fonderie/client';
|
|
2
|
-
import { CourierAdminClient, FonderieApiError,
|
|
3
|
-
export { CourierAdminClient, FonderieApiError, ICourierAdminClientOptions, IRollbackTemplateInput, ISetTemplateInput, ITemplateEntry, ITemplateRevision } from '@fonderie/client';
|
|
2
|
+
import { CourierAdminClient, ITemplateEntry, FonderieApiError, IRenderedTemplateResult, IPreviewTemplateInput, ITemplateRevision, ISetTemplateInput } from '@fonderie/client';
|
|
3
|
+
export { CourierAdminClient, FonderieApiError, ICourierAdminClientOptions, IPreviewTemplateInput, IRenderedTemplateResult, IRollbackTemplateInput, ISetTemplateInput, ITemplateEntry, ITemplateRevision } from '@fonderie/client';
|
|
4
4
|
import * as vue from 'vue';
|
|
5
5
|
|
|
6
|
-
/** @deprecated Use useTemplates(client).removeTemplate — the list composable self-refreshes after the write. */
|
|
7
|
-
declare function useDeleteTemplate(client: CourierAdminClient): {
|
|
8
|
-
deleteTemplate: (type: string, locale?: string | null) => Promise<void>;
|
|
9
|
-
isLoading: vue.Ref<boolean, boolean>;
|
|
10
|
-
error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/** @deprecated Use useTemplates(client).saveTemplate — the list composable self-refreshes after the write. */
|
|
14
|
-
declare function useSaveTemplate(client: CourierAdminClient): {
|
|
15
|
-
saveTemplate: (type: string, input: ISetTemplateInput, locale?: string | null) => Promise<_fonderie_client.ITemplateEntry>;
|
|
16
|
-
isLoading: vue.Ref<boolean, boolean>;
|
|
17
|
-
error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
6
|
declare function useTemplate(client: CourierAdminClient, type: string, locale?: string | null): {
|
|
21
7
|
template: vue.Ref<{
|
|
22
8
|
type: string;
|
|
@@ -44,6 +30,24 @@ declare function useTemplate(client: CourierAdminClient, type: string, locale?:
|
|
|
44
30
|
refresh: () => Promise<void>;
|
|
45
31
|
};
|
|
46
32
|
|
|
33
|
+
declare function useTemplatePreview(client: CourierAdminClient): {
|
|
34
|
+
preview: vue.Ref<{
|
|
35
|
+
subject?: string;
|
|
36
|
+
html?: string;
|
|
37
|
+
text: string;
|
|
38
|
+
variables: string[];
|
|
39
|
+
} | null, IRenderedTemplateResult | {
|
|
40
|
+
subject?: string;
|
|
41
|
+
html?: string;
|
|
42
|
+
text: string;
|
|
43
|
+
variables: string[];
|
|
44
|
+
} | null>;
|
|
45
|
+
isPreviewing: vue.Ref<boolean, boolean>;
|
|
46
|
+
error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
|
|
47
|
+
renderPreview: (type: string, input: IPreviewTemplateInput, locale?: string | null) => Promise<IRenderedTemplateResult>;
|
|
48
|
+
clearPreview: () => void;
|
|
49
|
+
};
|
|
50
|
+
|
|
47
51
|
declare function useTemplateRevisions(client: CourierAdminClient, type: string, locale?: string | null): {
|
|
48
52
|
revisions: vue.Ref<{
|
|
49
53
|
type: string;
|
|
@@ -95,8 +99,8 @@ declare function useTemplates(client: CourierAdminClient): {
|
|
|
95
99
|
isLoading: vue.Ref<boolean, boolean>;
|
|
96
100
|
error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
|
|
97
101
|
refresh: () => Promise<void>;
|
|
98
|
-
saveTemplate: (type: string, input: ISetTemplateInput, locale?: string) => Promise<ITemplateEntry>;
|
|
99
|
-
removeTemplate: (type: string, locale?: string) => Promise<void>;
|
|
102
|
+
saveTemplate: (type: string, input: ISetTemplateInput, locale?: string | null) => Promise<ITemplateEntry>;
|
|
103
|
+
removeTemplate: (type: string, locale?: string | null) => Promise<void>;
|
|
100
104
|
};
|
|
101
105
|
|
|
102
|
-
export {
|
|
106
|
+
export { useTemplate, useTemplatePreview, useTemplateRevisions, useTemplates };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import * as _fonderie_client from '@fonderie/client';
|
|
2
|
-
import { CourierAdminClient, FonderieApiError,
|
|
3
|
-
export { CourierAdminClient, FonderieApiError, ICourierAdminClientOptions, IRollbackTemplateInput, ISetTemplateInput, ITemplateEntry, ITemplateRevision } from '@fonderie/client';
|
|
2
|
+
import { CourierAdminClient, ITemplateEntry, FonderieApiError, IRenderedTemplateResult, IPreviewTemplateInput, ITemplateRevision, ISetTemplateInput } from '@fonderie/client';
|
|
3
|
+
export { CourierAdminClient, FonderieApiError, ICourierAdminClientOptions, IPreviewTemplateInput, IRenderedTemplateResult, IRollbackTemplateInput, ISetTemplateInput, ITemplateEntry, ITemplateRevision } from '@fonderie/client';
|
|
4
4
|
import * as vue from 'vue';
|
|
5
5
|
|
|
6
|
-
/** @deprecated Use useTemplates(client).removeTemplate — the list composable self-refreshes after the write. */
|
|
7
|
-
declare function useDeleteTemplate(client: CourierAdminClient): {
|
|
8
|
-
deleteTemplate: (type: string, locale?: string | null) => Promise<void>;
|
|
9
|
-
isLoading: vue.Ref<boolean, boolean>;
|
|
10
|
-
error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/** @deprecated Use useTemplates(client).saveTemplate — the list composable self-refreshes after the write. */
|
|
14
|
-
declare function useSaveTemplate(client: CourierAdminClient): {
|
|
15
|
-
saveTemplate: (type: string, input: ISetTemplateInput, locale?: string | null) => Promise<_fonderie_client.ITemplateEntry>;
|
|
16
|
-
isLoading: vue.Ref<boolean, boolean>;
|
|
17
|
-
error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
6
|
declare function useTemplate(client: CourierAdminClient, type: string, locale?: string | null): {
|
|
21
7
|
template: vue.Ref<{
|
|
22
8
|
type: string;
|
|
@@ -44,6 +30,24 @@ declare function useTemplate(client: CourierAdminClient, type: string, locale?:
|
|
|
44
30
|
refresh: () => Promise<void>;
|
|
45
31
|
};
|
|
46
32
|
|
|
33
|
+
declare function useTemplatePreview(client: CourierAdminClient): {
|
|
34
|
+
preview: vue.Ref<{
|
|
35
|
+
subject?: string;
|
|
36
|
+
html?: string;
|
|
37
|
+
text: string;
|
|
38
|
+
variables: string[];
|
|
39
|
+
} | null, IRenderedTemplateResult | {
|
|
40
|
+
subject?: string;
|
|
41
|
+
html?: string;
|
|
42
|
+
text: string;
|
|
43
|
+
variables: string[];
|
|
44
|
+
} | null>;
|
|
45
|
+
isPreviewing: vue.Ref<boolean, boolean>;
|
|
46
|
+
error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
|
|
47
|
+
renderPreview: (type: string, input: IPreviewTemplateInput, locale?: string | null) => Promise<IRenderedTemplateResult>;
|
|
48
|
+
clearPreview: () => void;
|
|
49
|
+
};
|
|
50
|
+
|
|
47
51
|
declare function useTemplateRevisions(client: CourierAdminClient, type: string, locale?: string | null): {
|
|
48
52
|
revisions: vue.Ref<{
|
|
49
53
|
type: string;
|
|
@@ -95,8 +99,8 @@ declare function useTemplates(client: CourierAdminClient): {
|
|
|
95
99
|
isLoading: vue.Ref<boolean, boolean>;
|
|
96
100
|
error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
|
|
97
101
|
refresh: () => Promise<void>;
|
|
98
|
-
saveTemplate: (type: string, input: ISetTemplateInput, locale?: string) => Promise<ITemplateEntry>;
|
|
99
|
-
removeTemplate: (type: string, locale?: string) => Promise<void>;
|
|
102
|
+
saveTemplate: (type: string, input: ISetTemplateInput, locale?: string | null) => Promise<ITemplateEntry>;
|
|
103
|
+
removeTemplate: (type: string, locale?: string | null) => Promise<void>;
|
|
100
104
|
};
|
|
101
105
|
|
|
102
|
-
export {
|
|
106
|
+
export { useTemplate, useTemplatePreview, useTemplateRevisions, useTemplates };
|
package/dist/index.js
CHANGED
|
@@ -1,82 +1,65 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { CourierAdminClient, FonderieApiError as
|
|
2
|
+
import { CourierAdminClient, FonderieApiError as FonderieApiError5 } from "@fonderie/client";
|
|
3
3
|
|
|
4
|
-
// src/composables/
|
|
4
|
+
// src/composables/useTemplate.ts
|
|
5
5
|
import { FonderieApiError } from "@fonderie/client";
|
|
6
6
|
import { ref } from "vue";
|
|
7
|
-
function
|
|
8
|
-
const
|
|
7
|
+
function useTemplate(client, type, locale) {
|
|
8
|
+
const template = ref(null);
|
|
9
|
+
const isLoading = ref(true);
|
|
9
10
|
const error = ref(null);
|
|
10
|
-
async function
|
|
11
|
+
async function refresh() {
|
|
11
12
|
isLoading.value = true;
|
|
12
13
|
error.value = null;
|
|
13
14
|
try {
|
|
14
|
-
await client.
|
|
15
|
+
const { result } = await client.getTemplate(type, locale);
|
|
16
|
+
template.value = result;
|
|
15
17
|
} catch (err) {
|
|
16
18
|
const apiError = err instanceof FonderieApiError ? err : new FonderieApiError("unknown", String(err), 0);
|
|
17
19
|
error.value = apiError;
|
|
18
|
-
throw apiError;
|
|
19
20
|
} finally {
|
|
20
21
|
isLoading.value = false;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
void refresh();
|
|
25
|
+
return { template, isLoading, error, refresh };
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
// src/composables/
|
|
28
|
+
// src/composables/useTemplatePreview.ts
|
|
27
29
|
import { FonderieApiError as FonderieApiError2 } from "@fonderie/client";
|
|
28
30
|
import { ref as ref2 } from "vue";
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
+
function useTemplatePreview(client) {
|
|
32
|
+
const preview = ref2(null);
|
|
33
|
+
const isPreviewing = ref2(false);
|
|
31
34
|
const error = ref2(null);
|
|
32
|
-
async function
|
|
33
|
-
|
|
35
|
+
async function renderPreview(type, input, locale) {
|
|
36
|
+
isPreviewing.value = true;
|
|
34
37
|
error.value = null;
|
|
35
38
|
try {
|
|
36
|
-
const { result } = await client.
|
|
39
|
+
const { result } = await client.previewTemplate(type, input, locale);
|
|
40
|
+
preview.value = result;
|
|
37
41
|
return result;
|
|
38
42
|
} catch (err) {
|
|
39
43
|
const apiError = err instanceof FonderieApiError2 ? err : new FonderieApiError2("unknown", String(err), 0);
|
|
40
44
|
error.value = apiError;
|
|
41
45
|
throw apiError;
|
|
42
46
|
} finally {
|
|
43
|
-
|
|
47
|
+
isPreviewing.value = false;
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
|
-
|
|
50
|
+
const clearPreview = () => {
|
|
51
|
+
preview.value = null;
|
|
52
|
+
};
|
|
53
|
+
return { preview, isPreviewing, error, renderPreview, clearPreview };
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
// src/composables/
|
|
56
|
+
// src/composables/useTemplateRevisions.ts
|
|
50
57
|
import { FonderieApiError as FonderieApiError3 } from "@fonderie/client";
|
|
51
58
|
import { ref as ref3 } from "vue";
|
|
52
|
-
function
|
|
53
|
-
const
|
|
59
|
+
function useTemplateRevisions(client, type, locale) {
|
|
60
|
+
const revisions = ref3([]);
|
|
54
61
|
const isLoading = ref3(true);
|
|
55
62
|
const error = ref3(null);
|
|
56
|
-
async function refresh() {
|
|
57
|
-
isLoading.value = true;
|
|
58
|
-
error.value = null;
|
|
59
|
-
try {
|
|
60
|
-
const { result } = await client.getTemplate(type, locale);
|
|
61
|
-
template.value = result;
|
|
62
|
-
} catch (err) {
|
|
63
|
-
const apiError = err instanceof FonderieApiError3 ? err : new FonderieApiError3("unknown", String(err), 0);
|
|
64
|
-
error.value = apiError;
|
|
65
|
-
} finally {
|
|
66
|
-
isLoading.value = false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
void refresh();
|
|
70
|
-
return { template, isLoading, error, refresh };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/composables/useTemplateRevisions.ts
|
|
74
|
-
import { FonderieApiError as FonderieApiError4 } from "@fonderie/client";
|
|
75
|
-
import { ref as ref4 } from "vue";
|
|
76
|
-
function useTemplateRevisions(client, type, locale) {
|
|
77
|
-
const revisions = ref4([]);
|
|
78
|
-
const isLoading = ref4(true);
|
|
79
|
-
const error = ref4(null);
|
|
80
63
|
async function refresh() {
|
|
81
64
|
isLoading.value = true;
|
|
82
65
|
error.value = null;
|
|
@@ -84,7 +67,7 @@ function useTemplateRevisions(client, type, locale) {
|
|
|
84
67
|
const { result } = await client.listRevisions(type, locale);
|
|
85
68
|
revisions.value = result;
|
|
86
69
|
} catch (err) {
|
|
87
|
-
const apiError = err instanceof
|
|
70
|
+
const apiError = err instanceof FonderieApiError3 ? err : new FonderieApiError3("unknown", String(err), 0);
|
|
88
71
|
error.value = apiError;
|
|
89
72
|
} finally {
|
|
90
73
|
isLoading.value = false;
|
|
@@ -97,7 +80,7 @@ function useTemplateRevisions(client, type, locale) {
|
|
|
97
80
|
await refresh();
|
|
98
81
|
return result;
|
|
99
82
|
} catch (err) {
|
|
100
|
-
const apiError = err instanceof
|
|
83
|
+
const apiError = err instanceof FonderieApiError3 ? err : new FonderieApiError3("unknown", String(err), 0);
|
|
101
84
|
error.value = apiError;
|
|
102
85
|
throw apiError;
|
|
103
86
|
}
|
|
@@ -107,12 +90,12 @@ function useTemplateRevisions(client, type, locale) {
|
|
|
107
90
|
}
|
|
108
91
|
|
|
109
92
|
// src/composables/useTemplates.ts
|
|
110
|
-
import { FonderieApiError as
|
|
111
|
-
import { ref as
|
|
93
|
+
import { FonderieApiError as FonderieApiError4 } from "@fonderie/client";
|
|
94
|
+
import { ref as ref4 } from "vue";
|
|
112
95
|
function useTemplates(client) {
|
|
113
|
-
const templates =
|
|
114
|
-
const isLoading =
|
|
115
|
-
const error =
|
|
96
|
+
const templates = ref4([]);
|
|
97
|
+
const isLoading = ref4(true);
|
|
98
|
+
const error = ref4(null);
|
|
116
99
|
async function refresh() {
|
|
117
100
|
isLoading.value = true;
|
|
118
101
|
error.value = null;
|
|
@@ -120,7 +103,7 @@ function useTemplates(client) {
|
|
|
120
103
|
const { result } = await client.listTemplates();
|
|
121
104
|
templates.value = result;
|
|
122
105
|
} catch (err) {
|
|
123
|
-
const apiError = err instanceof
|
|
106
|
+
const apiError = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
|
|
124
107
|
error.value = apiError;
|
|
125
108
|
} finally {
|
|
126
109
|
isLoading.value = false;
|
|
@@ -134,7 +117,7 @@ function useTemplates(client) {
|
|
|
134
117
|
await refresh();
|
|
135
118
|
return result;
|
|
136
119
|
} catch (err) {
|
|
137
|
-
const apiError = err instanceof
|
|
120
|
+
const apiError = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
|
|
138
121
|
error.value = apiError;
|
|
139
122
|
throw apiError;
|
|
140
123
|
}
|
|
@@ -145,7 +128,7 @@ function useTemplates(client) {
|
|
|
145
128
|
await client.deleteTemplate(type, locale);
|
|
146
129
|
await refresh();
|
|
147
130
|
} catch (err) {
|
|
148
|
-
const apiError = err instanceof
|
|
131
|
+
const apiError = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
|
|
149
132
|
error.value = apiError;
|
|
150
133
|
throw apiError;
|
|
151
134
|
}
|
|
@@ -154,10 +137,9 @@ function useTemplates(client) {
|
|
|
154
137
|
}
|
|
155
138
|
export {
|
|
156
139
|
CourierAdminClient,
|
|
157
|
-
|
|
158
|
-
useDeleteTemplate,
|
|
159
|
-
useSaveTemplate,
|
|
140
|
+
FonderieApiError5 as FonderieApiError,
|
|
160
141
|
useTemplate,
|
|
142
|
+
useTemplatePreview,
|
|
161
143
|
useTemplateRevisions,
|
|
162
144
|
useTemplates
|
|
163
145
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/composables/
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/composables/useTemplate.ts","../src/composables/useTemplatePreview.ts","../src/composables/useTemplateRevisions.ts","../src/composables/useTemplates.ts"],"sourcesContent":["export type {\n\tICourierAdminClientOptions,\n\tIPreviewTemplateInput,\n\tIRenderedTemplateResult,\n\tIRollbackTemplateInput,\n\tISetTemplateInput,\n\tITemplateEntry,\n\tITemplateRevision,\n} from '@fonderie/client';\n\nexport { CourierAdminClient, FonderieApiError } from '@fonderie/client';\nexport {\n\tuseTemplate,\n\tuseTemplatePreview,\n\tuseTemplateRevisions,\n\tuseTemplates,\n} from './composables';\n","import type { CourierAdminClient, ITemplateEntry } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\nexport function useTemplate(client: CourierAdminClient, type: string, locale?: string | null) {\n\tconst template = ref<ITemplateEntry | null>(null);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.getTemplate(type, locale);\n\t\t\ttemplate.value = result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\treturn { template, isLoading, error, refresh };\n}\n","import type {\n\tCourierAdminClient,\n\tIPreviewTemplateInput,\n\tIRenderedTemplateResult,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\n// On demand, not on mount: the caller decides when the editor's content is\n// worth rendering. Server-side, so what comes back is what the resolver\n// produces — the layout shell and the variable substitution included.\nexport function useTemplatePreview(client: CourierAdminClient) {\n\tconst preview = ref<IRenderedTemplateResult | null>(null);\n\tconst isPreviewing = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function renderPreview(\n\t\ttype: string,\n\t\tinput: IPreviewTemplateInput,\n\t\tlocale?: string | null,\n\t): Promise<IRenderedTemplateResult> {\n\t\tisPreviewing.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.previewTemplate(type, input, locale);\n\t\t\tpreview.value = result;\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tisPreviewing.value = false;\n\t\t}\n\t}\n\n\tconst clearPreview = () => {\n\t\tpreview.value = null;\n\t};\n\n\treturn { preview, isPreviewing, error, renderPreview, clearPreview };\n}\n","import type { CourierAdminClient, ITemplateRevision } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\nexport function useTemplateRevisions(\n\tclient: CourierAdminClient,\n\ttype: string,\n\tlocale?: string | null,\n) {\n\tconst revisions = ref<ITemplateRevision[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.listRevisions(type, locale);\n\t\t\trevisions.value = result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tasync function rollback(toVersion: number) {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.rollback(type, { toVersion }, locale);\n\t\t\tawait refresh();\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\treturn { revisions, isLoading, error, refresh, rollback };\n}\n","import type { CourierAdminClient, ISetTemplateInput, ITemplateEntry } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\nexport function useTemplates(client: CourierAdminClient) {\n\tconst templates = ref<ITemplateEntry[]>([]);\n\tconst isLoading = ref(true);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function refresh() {\n\t\tisLoading.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.listTemplates();\n\t\t\ttemplates.value = result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\tasync function saveTemplate(type: string, input: ISetTemplateInput, locale?: string | null) {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.setTemplate(type, input, locale);\n\t\t\tawait refresh();\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\tasync function removeTemplate(type: string, locale?: string | null) {\n\t\terror.value = null;\n\t\ttry {\n\t\t\tawait client.deleteTemplate(type, locale);\n\t\t\tawait refresh();\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\terror.value = apiError;\n\t\t\tthrow apiError;\n\t\t}\n\t}\n\n\treturn { templates, isLoading, error, refresh, saveTemplate, removeTemplate };\n}\n"],"mappings":";AAUA,SAAS,oBAAoB,oBAAAA,yBAAwB;;;ACTrD,SAAS,wBAAwB;AACjC,SAAS,WAAW;AAEb,SAAS,YAAY,QAA4B,MAAc,QAAwB;AAC7F,QAAM,WAAW,IAA2B,IAAI;AAChD,QAAM,YAAY,IAAI,IAAI;AAC1B,QAAM,QAAQ,IAA6B,IAAI;AAE/C,iBAAe,UAAU;AACxB,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,EAAE,OAAO,IAAI,MAAM,OAAO,YAAY,MAAM,MAAM;AACxD,eAAS,QAAQ;AAAA,IAClB,SAAS,KAAK;AACb,YAAM,WACL,eAAe,mBAAmB,MAAM,IAAI,iBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AAAA,IACf,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,OAAK,QAAQ;AAEb,SAAO,EAAE,UAAU,WAAW,OAAO,QAAQ;AAC9C;;;ACtBA,SAAS,oBAAAC,yBAAwB;AACjC,SAAS,OAAAC,YAAW;AAKb,SAAS,mBAAmB,QAA4B;AAC9D,QAAM,UAAUA,KAAoC,IAAI;AACxD,QAAM,eAAeA,KAAI,KAAK;AAC9B,QAAM,QAAQA,KAA6B,IAAI;AAE/C,iBAAe,cACd,MACA,OACA,QACmC;AACnC,iBAAa,QAAQ;AACrB,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,EAAE,OAAO,IAAI,MAAM,OAAO,gBAAgB,MAAM,OAAO,MAAM;AACnE,cAAQ,QAAQ;AAChB,aAAO;AAAA,IACR,SAAS,KAAK;AACb,YAAM,WACL,eAAeD,oBAAmB,MAAM,IAAIA,kBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC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AsB,CAAC,CAAC;AAC1C,QAAM,YAAYA,KAAI,IAAI;AAC1B,QAAM,QAAQA,KAA6B,IAAI;AAE/C,iBAAe,UAAU;AACxB,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,EAAE,OAAO,IAAI,MAAM,OAAO,cAAc;AAC9C,gBAAU,QAAQ;AAAA,IACnB,SAAS,KAAK;AACb,YAAM,WACL,eAAeD,oBAAmB,MAAM,IAAIA,kBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AAAA,IACf,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,OAAK,QAAQ;AAEb,iBAAe,aAAa,MAAc,OAA0B,QAAwB;AAC3F,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,EAAE,OAAO,IAAI,MAAM,OAAO,YAAY,MAAM,OAAO,MAAM;AAC/D,YAAM,QAAQ;AACd,aAAO;AAAA,IACR,SAAS,KAAK;AACb,YAAM,WACL,eAAeA,oBAAmB,MAAM,IAAIA,kBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,YAAM;AAAA,IACP;AAAA,EACD;AAEA,iBAAe,eAAe,MAAc,QAAwB;AACnE,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,OAAO,eAAe,MAAM,MAAM;AACxC,YAAM,QAAQ;AAAA,IACf,SAAS,KAAK;AACb,YAAM,WACL,eAAeA,oBAAmB,MAAM,IAAIA,kBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,YAAM,QAAQ;AACd,YAAM;AAAA,IACP;AAAA,EACD;AAEA,SAAO,EAAE,WAAW,WAAW,OAAO,SAAS,cAAc,eAAe;AAC7E;","names":["FonderieApiError","FonderieApiError","ref","FonderieApiError","ref","FonderieApiError","ref"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonderie/vue-courier-admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Vue 3 composables for the Fonderie courier admin API (email/SMS/push template management) — thin bindings over @fonderie/client's CourierAdminClient.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fonderiejs",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"vue": ">=3.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/node": "^26.
|
|
44
|
+
"@types/node": "^26.6.1",
|
|
45
45
|
"tsup": "^8.5.1",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
|
-
"vue": "^3.5.
|
|
47
|
+
"vue": "^3.5.43"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|