@fonderie/vue-courier-admin 0.4.1 → 0.5.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 CHANGED
@@ -20,23 +20,51 @@ 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: () => import_client5.CourierAdminClient,
24
- FonderieApiError: () => import_client5.FonderieApiError,
23
+ CourierAdminClient: () => import_client8.CourierAdminClient,
24
+ FonderieApiError: () => import_client8.FonderieApiError,
25
+ useBuiltInTemplate: () => useBuiltInTemplate,
25
26
  useTemplate: () => useTemplate,
27
+ useTemplateCatalog: () => useTemplateCatalog,
26
28
  useTemplatePreview: () => useTemplatePreview,
29
+ useTemplateResolution: () => useTemplateResolution,
27
30
  useTemplateRevisions: () => useTemplateRevisions,
28
31
  useTemplates: () => useTemplates
29
32
  });
30
33
  module.exports = __toCommonJS(index_exports);
31
- var import_client5 = require("@fonderie/client");
34
+ var import_client8 = require("@fonderie/client");
32
35
 
33
- // src/composables/useTemplate.ts
36
+ // src/composables/useBuiltInTemplate.ts
34
37
  var import_client = require("@fonderie/client");
35
38
  var import_vue = require("vue");
36
- function useTemplate(client, type, locale) {
37
- const template = (0, import_vue.ref)(null);
39
+ function useBuiltInTemplate(client, type, locale) {
40
+ const builtIn = (0, import_vue.ref)(null);
38
41
  const isLoading = (0, import_vue.ref)(true);
39
42
  const error = (0, import_vue.ref)(null);
43
+ async function refresh() {
44
+ isLoading.value = true;
45
+ error.value = null;
46
+ try {
47
+ const { result } = await client.getBuiltInTemplate(type, locale);
48
+ builtIn.value = result;
49
+ } catch (err) {
50
+ const apiError = err instanceof import_client.FonderieApiError ? err : new import_client.FonderieApiError("unknown", String(err), 0);
51
+ if (apiError.status === 404) builtIn.value = null;
52
+ else error.value = apiError;
53
+ } finally {
54
+ isLoading.value = false;
55
+ }
56
+ }
57
+ void refresh();
58
+ return { builtIn, isLoading, error, refresh };
59
+ }
60
+
61
+ // src/composables/useTemplate.ts
62
+ var import_client2 = require("@fonderie/client");
63
+ var import_vue2 = require("vue");
64
+ function useTemplate(client, type, locale) {
65
+ const template = (0, import_vue2.ref)(null);
66
+ const isLoading = (0, import_vue2.ref)(true);
67
+ const error = (0, import_vue2.ref)(null);
40
68
  async function refresh() {
41
69
  isLoading.value = true;
42
70
  error.value = null;
@@ -44,7 +72,8 @@ function useTemplate(client, type, locale) {
44
72
  const { result } = await client.getTemplate(type, locale);
45
73
  template.value = result;
46
74
  } catch (err) {
47
- const apiError = err instanceof import_client.FonderieApiError ? err : new import_client.FonderieApiError("unknown", String(err), 0);
75
+ const apiError = err instanceof import_client2.FonderieApiError ? err : new import_client2.FonderieApiError("unknown", String(err), 0);
76
+ if (apiError.status === 404) template.value = null;
48
77
  error.value = apiError;
49
78
  } finally {
50
79
  isLoading.value = false;
@@ -54,13 +83,61 @@ function useTemplate(client, type, locale) {
54
83
  return { template, isLoading, error, refresh };
55
84
  }
56
85
 
86
+ // src/composables/useTemplateCatalog.ts
87
+ var import_client3 = require("@fonderie/client");
88
+ var import_vue3 = require("vue");
89
+ function useTemplateCatalog(client) {
90
+ const catalog = (0, import_vue3.ref)(null);
91
+ const isLoading = (0, import_vue3.ref)(true);
92
+ const error = (0, import_vue3.ref)(null);
93
+ async function refresh() {
94
+ isLoading.value = true;
95
+ error.value = null;
96
+ try {
97
+ const { result } = await client.getTemplateCatalog();
98
+ catalog.value = result;
99
+ } catch (err) {
100
+ error.value = err instanceof import_client3.FonderieApiError ? err : new import_client3.FonderieApiError("unknown", String(err), 0);
101
+ } finally {
102
+ isLoading.value = false;
103
+ }
104
+ }
105
+ void refresh();
106
+ return { catalog, isLoading, error, refresh };
107
+ }
108
+
109
+ // src/composables/useTemplateResolution.ts
110
+ var import_client4 = require("@fonderie/client");
111
+ var import_vue4 = require("vue");
112
+ function useTemplateResolution(client) {
113
+ const resolution = (0, import_vue4.ref)(null);
114
+ const isResolving = (0, import_vue4.ref)(false);
115
+ const error = (0, import_vue4.ref)(null);
116
+ async function resolve(type, locale) {
117
+ isResolving.value = true;
118
+ error.value = null;
119
+ try {
120
+ const { result } = await client.resolveTemplate(type, locale);
121
+ resolution.value = result;
122
+ return result;
123
+ } catch (err) {
124
+ error.value = err instanceof import_client4.FonderieApiError ? err : new import_client4.FonderieApiError("unknown", String(err), 0);
125
+ resolution.value = null;
126
+ return null;
127
+ } finally {
128
+ isResolving.value = false;
129
+ }
130
+ }
131
+ return { resolution, isResolving, error, resolve };
132
+ }
133
+
57
134
  // src/composables/useTemplatePreview.ts
58
- var import_client2 = require("@fonderie/client");
59
- var import_vue2 = require("vue");
135
+ var import_client5 = require("@fonderie/client");
136
+ var import_vue5 = require("vue");
60
137
  function useTemplatePreview(client) {
61
- const preview = (0, import_vue2.ref)(null);
62
- const isPreviewing = (0, import_vue2.ref)(false);
63
- const error = (0, import_vue2.ref)(null);
138
+ const preview = (0, import_vue5.ref)(null);
139
+ const isPreviewing = (0, import_vue5.ref)(false);
140
+ const error = (0, import_vue5.ref)(null);
64
141
  async function renderPreview(type, input, locale) {
65
142
  isPreviewing.value = true;
66
143
  error.value = null;
@@ -69,7 +146,7 @@ function useTemplatePreview(client) {
69
146
  preview.value = result;
70
147
  return result;
71
148
  } catch (err) {
72
- const apiError = err instanceof import_client2.FonderieApiError ? err : new import_client2.FonderieApiError("unknown", String(err), 0);
149
+ const apiError = err instanceof import_client5.FonderieApiError ? err : new import_client5.FonderieApiError("unknown", String(err), 0);
73
150
  error.value = apiError;
74
151
  throw apiError;
75
152
  } finally {
@@ -83,12 +160,12 @@ function useTemplatePreview(client) {
83
160
  }
84
161
 
85
162
  // src/composables/useTemplateRevisions.ts
86
- var import_client3 = require("@fonderie/client");
87
- var import_vue3 = require("vue");
163
+ var import_client6 = require("@fonderie/client");
164
+ var import_vue6 = require("vue");
88
165
  function useTemplateRevisions(client, type, locale) {
89
- const revisions = (0, import_vue3.ref)([]);
90
- const isLoading = (0, import_vue3.ref)(true);
91
- const error = (0, import_vue3.ref)(null);
166
+ const revisions = (0, import_vue6.ref)([]);
167
+ const isLoading = (0, import_vue6.ref)(true);
168
+ const error = (0, import_vue6.ref)(null);
92
169
  async function refresh() {
93
170
  isLoading.value = true;
94
171
  error.value = null;
@@ -96,7 +173,7 @@ function useTemplateRevisions(client, type, locale) {
96
173
  const { result } = await client.listRevisions(type, locale);
97
174
  revisions.value = result;
98
175
  } catch (err) {
99
- const apiError = err instanceof import_client3.FonderieApiError ? err : new import_client3.FonderieApiError("unknown", String(err), 0);
176
+ const apiError = err instanceof import_client6.FonderieApiError ? err : new import_client6.FonderieApiError("unknown", String(err), 0);
100
177
  error.value = apiError;
101
178
  } finally {
102
179
  isLoading.value = false;
@@ -109,7 +186,7 @@ function useTemplateRevisions(client, type, locale) {
109
186
  await refresh();
110
187
  return result;
111
188
  } catch (err) {
112
- const apiError = err instanceof import_client3.FonderieApiError ? err : new import_client3.FonderieApiError("unknown", String(err), 0);
189
+ const apiError = err instanceof import_client6.FonderieApiError ? err : new import_client6.FonderieApiError("unknown", String(err), 0);
113
190
  error.value = apiError;
114
191
  throw apiError;
115
192
  }
@@ -119,12 +196,12 @@ function useTemplateRevisions(client, type, locale) {
119
196
  }
120
197
 
121
198
  // src/composables/useTemplates.ts
122
- var import_client4 = require("@fonderie/client");
123
- var import_vue4 = require("vue");
199
+ var import_client7 = require("@fonderie/client");
200
+ var import_vue7 = require("vue");
124
201
  function useTemplates(client) {
125
- const templates = (0, import_vue4.ref)([]);
126
- const isLoading = (0, import_vue4.ref)(true);
127
- const error = (0, import_vue4.ref)(null);
202
+ const templates = (0, import_vue7.ref)([]);
203
+ const isLoading = (0, import_vue7.ref)(true);
204
+ const error = (0, import_vue7.ref)(null);
128
205
  async function refresh() {
129
206
  isLoading.value = true;
130
207
  error.value = null;
@@ -132,7 +209,7 @@ function useTemplates(client) {
132
209
  const { result } = await client.listTemplates();
133
210
  templates.value = result;
134
211
  } catch (err) {
135
- const apiError = err instanceof import_client4.FonderieApiError ? err : new import_client4.FonderieApiError("unknown", String(err), 0);
212
+ const apiError = err instanceof import_client7.FonderieApiError ? err : new import_client7.FonderieApiError("unknown", String(err), 0);
136
213
  error.value = apiError;
137
214
  } finally {
138
215
  isLoading.value = false;
@@ -146,7 +223,7 @@ function useTemplates(client) {
146
223
  await refresh();
147
224
  return result;
148
225
  } catch (err) {
149
- const apiError = err instanceof import_client4.FonderieApiError ? err : new import_client4.FonderieApiError("unknown", String(err), 0);
226
+ const apiError = err instanceof import_client7.FonderieApiError ? err : new import_client7.FonderieApiError("unknown", String(err), 0);
150
227
  error.value = apiError;
151
228
  throw apiError;
152
229
  }
@@ -157,7 +234,7 @@ function useTemplates(client) {
157
234
  await client.deleteTemplate(type, locale);
158
235
  await refresh();
159
236
  } catch (err) {
160
- const apiError = err instanceof import_client4.FonderieApiError ? err : new import_client4.FonderieApiError("unknown", String(err), 0);
237
+ const apiError = err instanceof import_client7.FonderieApiError ? err : new import_client7.FonderieApiError("unknown", String(err), 0);
161
238
  error.value = apiError;
162
239
  throw apiError;
163
240
  }
@@ -168,8 +245,11 @@ function useTemplates(client) {
168
245
  0 && (module.exports = {
169
246
  CourierAdminClient,
170
247
  FonderieApiError,
248
+ useBuiltInTemplate,
171
249
  useTemplate,
250
+ useTemplateCatalog,
172
251
  useTemplatePreview,
252
+ useTemplateResolution,
173
253
  useTemplateRevisions,
174
254
  useTemplates
175
255
  });
@@ -1 +1 @@
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,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AE,OAAO,IAAI,MAAM,OAAO,YAAY,MAAM,OAAO,MAAM;AAC/D,YAAM,QAAQ;AACd,aAAO;AAAA,IACR,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,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"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/composables/useBuiltInTemplate.ts","../src/composables/useTemplate.ts","../src/composables/useTemplateCatalog.ts","../src/composables/useTemplateResolution.ts","../src/composables/useTemplatePreview.ts","../src/composables/useTemplateRevisions.ts","../src/composables/useTemplates.ts"],"sourcesContent":["export type {\n\tIBuiltInTemplate,\n\tICourierAdminClientOptions,\n\tIPreviewTemplateInput,\n\tIRenderedTemplateResult,\n\tIRollbackTemplateInput,\n\tISetTemplateInput,\n\tITemplateCatalog,\n\tITemplateCatalogEntry,\n\tITemplateEntry,\n\tITemplateResolution,\n\tITemplateRevision,\n} from '@fonderie/client';\n\nexport { CourierAdminClient, FonderieApiError } from '@fonderie/client';\nexport {\n\tuseBuiltInTemplate,\n\tuseTemplate,\n\tuseTemplateCatalog,\n\tuseTemplateResolution,\n\tuseTemplatePreview,\n\tuseTemplateRevisions,\n\tuseTemplates,\n} from './composables';\n","import type { CourierAdminClient, IBuiltInTemplate } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\n// Fonderie's own copy of an email in a language — to open a language nobody has\n// saved yet, or to compare a saved version with what ships. `builtIn` stays null\n// when none ships in that language (a 404 is an answer here, not an error).\nexport function useBuiltInTemplate(\n\tclient: CourierAdminClient,\n\ttype: string,\n\tlocale?: string | null,\n) {\n\tconst builtIn = ref<IBuiltInTemplate | 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.getBuiltInTemplate(type, locale);\n\t\t\tbuiltIn.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\tif (apiError.status === 404) builtIn.value = null;\n\t\t\telse error.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\treturn { builtIn, isLoading, error, refresh };\n}\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\t// Gone (deleted, or never saved): drop what was shown, or a screen keeps\n\t\t\t// rendering a version that no longer exists.\n\t\t\tif (apiError.status === 404) template.value = null;\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 { CourierAdminClient, ITemplateCatalog } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\n// Every email — saved or built-in only — with its languages and the app's\n// locales, for a template list that shows what actually exists.\nexport function useTemplateCatalog(client: CourierAdminClient) {\n\tconst catalog = ref<ITemplateCatalog | 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.getTemplateCatalog();\n\t\t\tcatalog.value = result;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\treturn { catalog, isLoading, error, refresh };\n}\n","import type { CourierAdminClient, ITemplateResolution } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\n// Who receives what — asked of the server, which decides with the same function\n// a real send runs.\nexport function useTemplateResolution(client: CourierAdminClient) {\n\tconst resolution = ref<ITemplateResolution | null>(null);\n\tconst isResolving = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function resolve(\n\t\ttype: string,\n\t\tlocale?: string | null,\n\t): Promise<ITemplateResolution | null> {\n\t\tisResolving.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.resolveTemplate(type, locale);\n\t\t\tresolution.value = result;\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tresolution.value = null;\n\t\t\treturn null;\n\t\t} finally {\n\t\t\tisResolving.value = false;\n\t\t}\n\t}\n\n\treturn { resolution, isResolving, error, resolve };\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;AAAA;AAAA;AAAA;AAcA,IAAAA,iBAAqD;;;ACbrD,oBAAiC;AACjC,iBAAoB;AAKb,SAAS,mBACf,QACA,MACA,QACC;AACD,QAAM,cAAU,gBAA6B,IAAI;AACjD,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,mBAAmB,MAAM,MAAM;AAC/D,cAAQ,QAAQ;AAAA,IACjB,SAAS,KAAK;AACb,YAAM,WACL,eAAe,iCAAmB,MAAM,IAAI,+BAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,UAAI,SAAS,WAAW,IAAK,SAAQ,QAAQ;AAAA,UACxC,OAAM,QAAQ;AAAA,IACpB,UAAE;AACD,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD;AAEA,OAAK,QAAQ;AAEb,SAAO,EAAE,SAAS,WAAW,OAAO,QAAQ;AAC7C;;;AClCA,IAAAC,iBAAiC;AACjC,IAAAC,cAAoB;AAEb,SAAS,YAAY,QAA4B,MAAc,QAAwB;AAC7F,QAAM,eAAW,iBAA2B,IAAI;AAChD,QAAM,gBAAY,iBAAI,IAAI;AAC1B,QAAM,YAAQ,iBAA6B,IAAI;AAE/C,iBAAe,UAAU;AACxB,cAAU,QAAQ;AAClB,UAAM,QAAQ;AACd,QAAI;AACH,YAAM,EAAE,OAAO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AM,OAAO,YAAY,MAAM,OAAO,MAAM;AAC/D,YAAM,QAAQ;AACd,aAAO;AAAA,IACR,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,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","import_client","import_vue","import_client","import_vue","import_client","import_vue"]}
package/dist/index.d.cts CHANGED
@@ -1,10 +1,30 @@
1
1
  import * as _fonderie_client 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';
2
+ import { CourierAdminClient, IBuiltInTemplate, FonderieApiError, ITemplateEntry, ITemplateCatalog, ITemplateResolution, IRenderedTemplateResult, IPreviewTemplateInput, ITemplateRevision, ISetTemplateInput } from '@fonderie/client';
3
+ export { CourierAdminClient, FonderieApiError, IBuiltInTemplate, ICourierAdminClientOptions, IPreviewTemplateInput, IRenderedTemplateResult, IRollbackTemplateInput, ISetTemplateInput, ITemplateCatalog, ITemplateCatalogEntry, ITemplateEntry, ITemplateResolution, ITemplateRevision } from '@fonderie/client';
4
4
  import * as vue from 'vue';
5
5
 
6
+ declare function useBuiltInTemplate(client: CourierAdminClient, type: string, locale?: string | null): {
7
+ builtIn: vue.Ref<{
8
+ type: string;
9
+ locale: string;
10
+ subject: string | null;
11
+ html: string | null;
12
+ text: string;
13
+ } | null, IBuiltInTemplate | {
14
+ type: string;
15
+ locale: string;
16
+ subject: string | null;
17
+ html: string | null;
18
+ text: string;
19
+ } | null>;
20
+ isLoading: vue.Ref<boolean, boolean>;
21
+ error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
22
+ refresh: () => Promise<void>;
23
+ };
24
+
6
25
  declare function useTemplate(client: CourierAdminClient, type: string, locale?: string | null): {
7
26
  template: vue.Ref<{
27
+ system?: boolean;
8
28
  type: string;
9
29
  locale: string | null;
10
30
  subject: string | null;
@@ -15,6 +35,7 @@ declare function useTemplate(client: CourierAdminClient, type: string, locale?:
15
35
  updatedBy: string | null;
16
36
  updatedAt: string;
17
37
  } | null, ITemplateEntry | {
38
+ system?: boolean;
18
39
  type: string;
19
40
  locale: string | null;
20
41
  subject: string | null;
@@ -30,6 +51,66 @@ declare function useTemplate(client: CourierAdminClient, type: string, locale?:
30
51
  refresh: () => Promise<void>;
31
52
  };
32
53
 
54
+ declare function useTemplateCatalog(client: CourierAdminClient): {
55
+ catalog: vue.Ref<{
56
+ defaultLocale: string;
57
+ fallbacks: Record<string, string[]>;
58
+ emails: {
59
+ type: string;
60
+ system: boolean;
61
+ builtIn: {
62
+ default: boolean;
63
+ languages: string[];
64
+ };
65
+ versions: {
66
+ locale: string | null;
67
+ active: boolean;
68
+ version: number;
69
+ updatedAt: string;
70
+ }[];
71
+ }[];
72
+ } | null, ITemplateCatalog | {
73
+ defaultLocale: string;
74
+ fallbacks: Record<string, string[]>;
75
+ emails: {
76
+ type: string;
77
+ system: boolean;
78
+ builtIn: {
79
+ default: boolean;
80
+ languages: string[];
81
+ };
82
+ versions: {
83
+ locale: string | null;
84
+ active: boolean;
85
+ version: number;
86
+ updatedAt: string;
87
+ }[];
88
+ }[];
89
+ } | null>;
90
+ isLoading: vue.Ref<boolean, boolean>;
91
+ error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
92
+ refresh: () => Promise<void>;
93
+ };
94
+
95
+ declare function useTemplateResolution(client: CourierAdminClient): {
96
+ resolution: vue.Ref<{
97
+ requested: string;
98
+ chain: string[];
99
+ defaultLocale: string;
100
+ sent: string;
101
+ source: "saved" | "built-in";
102
+ } | null, ITemplateResolution | {
103
+ requested: string;
104
+ chain: string[];
105
+ defaultLocale: string;
106
+ sent: string;
107
+ source: "saved" | "built-in";
108
+ } | null>;
109
+ isResolving: vue.Ref<boolean, boolean>;
110
+ error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
111
+ resolve: (type: string, locale?: string | null) => Promise<ITemplateResolution | null>;
112
+ };
113
+
33
114
  declare function useTemplatePreview(client: CourierAdminClient): {
34
115
  preview: vue.Ref<{
35
116
  subject?: string;
@@ -76,6 +157,7 @@ declare function useTemplateRevisions(client: CourierAdminClient, type: string,
76
157
 
77
158
  declare function useTemplates(client: CourierAdminClient): {
78
159
  templates: vue.Ref<{
160
+ system?: boolean;
79
161
  type: string;
80
162
  locale: string | null;
81
163
  subject: string | null;
@@ -86,6 +168,7 @@ declare function useTemplates(client: CourierAdminClient): {
86
168
  updatedBy: string | null;
87
169
  updatedAt: string;
88
170
  }[], ITemplateEntry[] | {
171
+ system?: boolean;
89
172
  type: string;
90
173
  locale: string | null;
91
174
  subject: string | null;
@@ -103,4 +186,4 @@ declare function useTemplates(client: CourierAdminClient): {
103
186
  removeTemplate: (type: string, locale?: string | null) => Promise<void>;
104
187
  };
105
188
 
106
- export { useTemplate, useTemplatePreview, useTemplateRevisions, useTemplates };
189
+ export { useBuiltInTemplate, useTemplate, useTemplateCatalog, useTemplatePreview, useTemplateResolution, useTemplateRevisions, useTemplates };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,30 @@
1
1
  import * as _fonderie_client 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';
2
+ import { CourierAdminClient, IBuiltInTemplate, FonderieApiError, ITemplateEntry, ITemplateCatalog, ITemplateResolution, IRenderedTemplateResult, IPreviewTemplateInput, ITemplateRevision, ISetTemplateInput } from '@fonderie/client';
3
+ export { CourierAdminClient, FonderieApiError, IBuiltInTemplate, ICourierAdminClientOptions, IPreviewTemplateInput, IRenderedTemplateResult, IRollbackTemplateInput, ISetTemplateInput, ITemplateCatalog, ITemplateCatalogEntry, ITemplateEntry, ITemplateResolution, ITemplateRevision } from '@fonderie/client';
4
4
  import * as vue from 'vue';
5
5
 
6
+ declare function useBuiltInTemplate(client: CourierAdminClient, type: string, locale?: string | null): {
7
+ builtIn: vue.Ref<{
8
+ type: string;
9
+ locale: string;
10
+ subject: string | null;
11
+ html: string | null;
12
+ text: string;
13
+ } | null, IBuiltInTemplate | {
14
+ type: string;
15
+ locale: string;
16
+ subject: string | null;
17
+ html: string | null;
18
+ text: string;
19
+ } | null>;
20
+ isLoading: vue.Ref<boolean, boolean>;
21
+ error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
22
+ refresh: () => Promise<void>;
23
+ };
24
+
6
25
  declare function useTemplate(client: CourierAdminClient, type: string, locale?: string | null): {
7
26
  template: vue.Ref<{
27
+ system?: boolean;
8
28
  type: string;
9
29
  locale: string | null;
10
30
  subject: string | null;
@@ -15,6 +35,7 @@ declare function useTemplate(client: CourierAdminClient, type: string, locale?:
15
35
  updatedBy: string | null;
16
36
  updatedAt: string;
17
37
  } | null, ITemplateEntry | {
38
+ system?: boolean;
18
39
  type: string;
19
40
  locale: string | null;
20
41
  subject: string | null;
@@ -30,6 +51,66 @@ declare function useTemplate(client: CourierAdminClient, type: string, locale?:
30
51
  refresh: () => Promise<void>;
31
52
  };
32
53
 
54
+ declare function useTemplateCatalog(client: CourierAdminClient): {
55
+ catalog: vue.Ref<{
56
+ defaultLocale: string;
57
+ fallbacks: Record<string, string[]>;
58
+ emails: {
59
+ type: string;
60
+ system: boolean;
61
+ builtIn: {
62
+ default: boolean;
63
+ languages: string[];
64
+ };
65
+ versions: {
66
+ locale: string | null;
67
+ active: boolean;
68
+ version: number;
69
+ updatedAt: string;
70
+ }[];
71
+ }[];
72
+ } | null, ITemplateCatalog | {
73
+ defaultLocale: string;
74
+ fallbacks: Record<string, string[]>;
75
+ emails: {
76
+ type: string;
77
+ system: boolean;
78
+ builtIn: {
79
+ default: boolean;
80
+ languages: string[];
81
+ };
82
+ versions: {
83
+ locale: string | null;
84
+ active: boolean;
85
+ version: number;
86
+ updatedAt: string;
87
+ }[];
88
+ }[];
89
+ } | null>;
90
+ isLoading: vue.Ref<boolean, boolean>;
91
+ error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
92
+ refresh: () => Promise<void>;
93
+ };
94
+
95
+ declare function useTemplateResolution(client: CourierAdminClient): {
96
+ resolution: vue.Ref<{
97
+ requested: string;
98
+ chain: string[];
99
+ defaultLocale: string;
100
+ sent: string;
101
+ source: "saved" | "built-in";
102
+ } | null, ITemplateResolution | {
103
+ requested: string;
104
+ chain: string[];
105
+ defaultLocale: string;
106
+ sent: string;
107
+ source: "saved" | "built-in";
108
+ } | null>;
109
+ isResolving: vue.Ref<boolean, boolean>;
110
+ error: vue.Ref<FonderieApiError | null, FonderieApiError | null>;
111
+ resolve: (type: string, locale?: string | null) => Promise<ITemplateResolution | null>;
112
+ };
113
+
33
114
  declare function useTemplatePreview(client: CourierAdminClient): {
34
115
  preview: vue.Ref<{
35
116
  subject?: string;
@@ -76,6 +157,7 @@ declare function useTemplateRevisions(client: CourierAdminClient, type: string,
76
157
 
77
158
  declare function useTemplates(client: CourierAdminClient): {
78
159
  templates: vue.Ref<{
160
+ system?: boolean;
79
161
  type: string;
80
162
  locale: string | null;
81
163
  subject: string | null;
@@ -86,6 +168,7 @@ declare function useTemplates(client: CourierAdminClient): {
86
168
  updatedBy: string | null;
87
169
  updatedAt: string;
88
170
  }[], ITemplateEntry[] | {
171
+ system?: boolean;
89
172
  type: string;
90
173
  locale: string | null;
91
174
  subject: string | null;
@@ -103,4 +186,4 @@ declare function useTemplates(client: CourierAdminClient): {
103
186
  removeTemplate: (type: string, locale?: string | null) => Promise<void>;
104
187
  };
105
188
 
106
- export { useTemplate, useTemplatePreview, useTemplateRevisions, useTemplates };
189
+ export { useBuiltInTemplate, useTemplate, useTemplateCatalog, useTemplatePreview, useTemplateResolution, useTemplateRevisions, useTemplates };
package/dist/index.js CHANGED
@@ -1,13 +1,38 @@
1
1
  // src/index.ts
2
- import { CourierAdminClient, FonderieApiError as FonderieApiError5 } from "@fonderie/client";
2
+ import { CourierAdminClient, FonderieApiError as FonderieApiError8 } from "@fonderie/client";
3
3
 
4
- // src/composables/useTemplate.ts
4
+ // src/composables/useBuiltInTemplate.ts
5
5
  import { FonderieApiError } from "@fonderie/client";
6
6
  import { ref } from "vue";
7
- function useTemplate(client, type, locale) {
8
- const template = ref(null);
7
+ function useBuiltInTemplate(client, type, locale) {
8
+ const builtIn = ref(null);
9
9
  const isLoading = ref(true);
10
10
  const error = ref(null);
11
+ async function refresh() {
12
+ isLoading.value = true;
13
+ error.value = null;
14
+ try {
15
+ const { result } = await client.getBuiltInTemplate(type, locale);
16
+ builtIn.value = result;
17
+ } catch (err) {
18
+ const apiError = err instanceof FonderieApiError ? err : new FonderieApiError("unknown", String(err), 0);
19
+ if (apiError.status === 404) builtIn.value = null;
20
+ else error.value = apiError;
21
+ } finally {
22
+ isLoading.value = false;
23
+ }
24
+ }
25
+ void refresh();
26
+ return { builtIn, isLoading, error, refresh };
27
+ }
28
+
29
+ // src/composables/useTemplate.ts
30
+ import { FonderieApiError as FonderieApiError2 } from "@fonderie/client";
31
+ import { ref as ref2 } from "vue";
32
+ function useTemplate(client, type, locale) {
33
+ const template = ref2(null);
34
+ const isLoading = ref2(true);
35
+ const error = ref2(null);
11
36
  async function refresh() {
12
37
  isLoading.value = true;
13
38
  error.value = null;
@@ -15,7 +40,8 @@ function useTemplate(client, type, locale) {
15
40
  const { result } = await client.getTemplate(type, locale);
16
41
  template.value = result;
17
42
  } catch (err) {
18
- const apiError = err instanceof FonderieApiError ? err : new FonderieApiError("unknown", String(err), 0);
43
+ const apiError = err instanceof FonderieApiError2 ? err : new FonderieApiError2("unknown", String(err), 0);
44
+ if (apiError.status === 404) template.value = null;
19
45
  error.value = apiError;
20
46
  } finally {
21
47
  isLoading.value = false;
@@ -25,13 +51,61 @@ function useTemplate(client, type, locale) {
25
51
  return { template, isLoading, error, refresh };
26
52
  }
27
53
 
54
+ // src/composables/useTemplateCatalog.ts
55
+ import { FonderieApiError as FonderieApiError3 } from "@fonderie/client";
56
+ import { ref as ref3 } from "vue";
57
+ function useTemplateCatalog(client) {
58
+ const catalog = ref3(null);
59
+ const isLoading = ref3(true);
60
+ const error = ref3(null);
61
+ async function refresh() {
62
+ isLoading.value = true;
63
+ error.value = null;
64
+ try {
65
+ const { result } = await client.getTemplateCatalog();
66
+ catalog.value = result;
67
+ } catch (err) {
68
+ error.value = err instanceof FonderieApiError3 ? err : new FonderieApiError3("unknown", String(err), 0);
69
+ } finally {
70
+ isLoading.value = false;
71
+ }
72
+ }
73
+ void refresh();
74
+ return { catalog, isLoading, error, refresh };
75
+ }
76
+
77
+ // src/composables/useTemplateResolution.ts
78
+ import { FonderieApiError as FonderieApiError4 } from "@fonderie/client";
79
+ import { ref as ref4 } from "vue";
80
+ function useTemplateResolution(client) {
81
+ const resolution = ref4(null);
82
+ const isResolving = ref4(false);
83
+ const error = ref4(null);
84
+ async function resolve(type, locale) {
85
+ isResolving.value = true;
86
+ error.value = null;
87
+ try {
88
+ const { result } = await client.resolveTemplate(type, locale);
89
+ resolution.value = result;
90
+ return result;
91
+ } catch (err) {
92
+ error.value = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
93
+ resolution.value = null;
94
+ return null;
95
+ } finally {
96
+ isResolving.value = false;
97
+ }
98
+ }
99
+ return { resolution, isResolving, error, resolve };
100
+ }
101
+
28
102
  // src/composables/useTemplatePreview.ts
29
- import { FonderieApiError as FonderieApiError2 } from "@fonderie/client";
30
- import { ref as ref2 } from "vue";
103
+ import { FonderieApiError as FonderieApiError5 } from "@fonderie/client";
104
+ import { ref as ref5 } from "vue";
31
105
  function useTemplatePreview(client) {
32
- const preview = ref2(null);
33
- const isPreviewing = ref2(false);
34
- const error = ref2(null);
106
+ const preview = ref5(null);
107
+ const isPreviewing = ref5(false);
108
+ const error = ref5(null);
35
109
  async function renderPreview(type, input, locale) {
36
110
  isPreviewing.value = true;
37
111
  error.value = null;
@@ -40,7 +114,7 @@ function useTemplatePreview(client) {
40
114
  preview.value = result;
41
115
  return result;
42
116
  } catch (err) {
43
- const apiError = err instanceof FonderieApiError2 ? err : new FonderieApiError2("unknown", String(err), 0);
117
+ const apiError = err instanceof FonderieApiError5 ? err : new FonderieApiError5("unknown", String(err), 0);
44
118
  error.value = apiError;
45
119
  throw apiError;
46
120
  } finally {
@@ -54,12 +128,12 @@ function useTemplatePreview(client) {
54
128
  }
55
129
 
56
130
  // src/composables/useTemplateRevisions.ts
57
- import { FonderieApiError as FonderieApiError3 } from "@fonderie/client";
58
- import { ref as ref3 } from "vue";
131
+ import { FonderieApiError as FonderieApiError6 } from "@fonderie/client";
132
+ import { ref as ref6 } from "vue";
59
133
  function useTemplateRevisions(client, type, locale) {
60
- const revisions = ref3([]);
61
- const isLoading = ref3(true);
62
- const error = ref3(null);
134
+ const revisions = ref6([]);
135
+ const isLoading = ref6(true);
136
+ const error = ref6(null);
63
137
  async function refresh() {
64
138
  isLoading.value = true;
65
139
  error.value = null;
@@ -67,7 +141,7 @@ function useTemplateRevisions(client, type, locale) {
67
141
  const { result } = await client.listRevisions(type, locale);
68
142
  revisions.value = result;
69
143
  } catch (err) {
70
- const apiError = err instanceof FonderieApiError3 ? err : new FonderieApiError3("unknown", String(err), 0);
144
+ const apiError = err instanceof FonderieApiError6 ? err : new FonderieApiError6("unknown", String(err), 0);
71
145
  error.value = apiError;
72
146
  } finally {
73
147
  isLoading.value = false;
@@ -80,7 +154,7 @@ function useTemplateRevisions(client, type, locale) {
80
154
  await refresh();
81
155
  return result;
82
156
  } catch (err) {
83
- const apiError = err instanceof FonderieApiError3 ? err : new FonderieApiError3("unknown", String(err), 0);
157
+ const apiError = err instanceof FonderieApiError6 ? err : new FonderieApiError6("unknown", String(err), 0);
84
158
  error.value = apiError;
85
159
  throw apiError;
86
160
  }
@@ -90,12 +164,12 @@ function useTemplateRevisions(client, type, locale) {
90
164
  }
91
165
 
92
166
  // src/composables/useTemplates.ts
93
- import { FonderieApiError as FonderieApiError4 } from "@fonderie/client";
94
- import { ref as ref4 } from "vue";
167
+ import { FonderieApiError as FonderieApiError7 } from "@fonderie/client";
168
+ import { ref as ref7 } from "vue";
95
169
  function useTemplates(client) {
96
- const templates = ref4([]);
97
- const isLoading = ref4(true);
98
- const error = ref4(null);
170
+ const templates = ref7([]);
171
+ const isLoading = ref7(true);
172
+ const error = ref7(null);
99
173
  async function refresh() {
100
174
  isLoading.value = true;
101
175
  error.value = null;
@@ -103,7 +177,7 @@ function useTemplates(client) {
103
177
  const { result } = await client.listTemplates();
104
178
  templates.value = result;
105
179
  } catch (err) {
106
- const apiError = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
180
+ const apiError = err instanceof FonderieApiError7 ? err : new FonderieApiError7("unknown", String(err), 0);
107
181
  error.value = apiError;
108
182
  } finally {
109
183
  isLoading.value = false;
@@ -117,7 +191,7 @@ function useTemplates(client) {
117
191
  await refresh();
118
192
  return result;
119
193
  } catch (err) {
120
- const apiError = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
194
+ const apiError = err instanceof FonderieApiError7 ? err : new FonderieApiError7("unknown", String(err), 0);
121
195
  error.value = apiError;
122
196
  throw apiError;
123
197
  }
@@ -128,7 +202,7 @@ function useTemplates(client) {
128
202
  await client.deleteTemplate(type, locale);
129
203
  await refresh();
130
204
  } catch (err) {
131
- const apiError = err instanceof FonderieApiError4 ? err : new FonderieApiError4("unknown", String(err), 0);
205
+ const apiError = err instanceof FonderieApiError7 ? err : new FonderieApiError7("unknown", String(err), 0);
132
206
  error.value = apiError;
133
207
  throw apiError;
134
208
  }
@@ -137,9 +211,12 @@ function useTemplates(client) {
137
211
  }
138
212
  export {
139
213
  CourierAdminClient,
140
- FonderieApiError5 as FonderieApiError,
214
+ FonderieApiError8 as FonderieApiError,
215
+ useBuiltInTemplate,
141
216
  useTemplate,
217
+ useTemplateCatalog,
142
218
  useTemplatePreview,
219
+ useTemplateResolution,
143
220
  useTemplateRevisions,
144
221
  useTemplates
145
222
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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,mBAAm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e,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"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/composables/useBuiltInTemplate.ts","../src/composables/useTemplate.ts","../src/composables/useTemplateCatalog.ts","../src/composables/useTemplateResolution.ts","../src/composables/useTemplatePreview.ts","../src/composables/useTemplateRevisions.ts","../src/composables/useTemplates.ts"],"sourcesContent":["export type {\n\tIBuiltInTemplate,\n\tICourierAdminClientOptions,\n\tIPreviewTemplateInput,\n\tIRenderedTemplateResult,\n\tIRollbackTemplateInput,\n\tISetTemplateInput,\n\tITemplateCatalog,\n\tITemplateCatalogEntry,\n\tITemplateEntry,\n\tITemplateResolution,\n\tITemplateRevision,\n} from '@fonderie/client';\n\nexport { CourierAdminClient, FonderieApiError } from '@fonderie/client';\nexport {\n\tuseBuiltInTemplate,\n\tuseTemplate,\n\tuseTemplateCatalog,\n\tuseTemplateResolution,\n\tuseTemplatePreview,\n\tuseTemplateRevisions,\n\tuseTemplates,\n} from './composables';\n","import type { CourierAdminClient, IBuiltInTemplate } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\n// Fonderie's own copy of an email in a language — to open a language nobody has\n// saved yet, or to compare a saved version with what ships. `builtIn` stays null\n// when none ships in that language (a 404 is an answer here, not an error).\nexport function useBuiltInTemplate(\n\tclient: CourierAdminClient,\n\ttype: string,\n\tlocale?: string | null,\n) {\n\tconst builtIn = ref<IBuiltInTemplate | 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.getBuiltInTemplate(type, locale);\n\t\t\tbuiltIn.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\tif (apiError.status === 404) builtIn.value = null;\n\t\t\telse error.value = apiError;\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\treturn { builtIn, isLoading, error, refresh };\n}\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\t// Gone (deleted, or never saved): drop what was shown, or a screen keeps\n\t\t\t// rendering a version that no longer exists.\n\t\t\tif (apiError.status === 404) template.value = null;\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 { CourierAdminClient, ITemplateCatalog } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\n// Every email — saved or built-in only — with its languages and the app's\n// locales, for a template list that shows what actually exists.\nexport function useTemplateCatalog(client: CourierAdminClient) {\n\tconst catalog = ref<ITemplateCatalog | 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.getTemplateCatalog();\n\t\t\tcatalog.value = result;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t} finally {\n\t\t\tisLoading.value = false;\n\t\t}\n\t}\n\n\tvoid refresh();\n\n\treturn { catalog, isLoading, error, refresh };\n}\n","import type { CourierAdminClient, ITemplateResolution } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { ref } from 'vue';\n\n// Who receives what — asked of the server, which decides with the same function\n// a real send runs.\nexport function useTemplateResolution(client: CourierAdminClient) {\n\tconst resolution = ref<ITemplateResolution | null>(null);\n\tconst isResolving = ref(false);\n\tconst error = ref<FonderieApiError | null>(null);\n\n\tasync function resolve(\n\t\ttype: string,\n\t\tlocale?: string | null,\n\t): Promise<ITemplateResolution | null> {\n\t\tisResolving.value = true;\n\t\terror.value = null;\n\t\ttry {\n\t\t\tconst { result } = await client.resolveTemplate(type, locale);\n\t\t\tresolution.value = result;\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\terror.value =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tresolution.value = null;\n\t\t\treturn null;\n\t\t} finally {\n\t\t\tisResolving.value = false;\n\t\t}\n\t}\n\n\treturn { resolution, isResolving, error, resolve };\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":";AAcA,SAAS,oBAAoB,oBAAAA,yBAAwB;;;ACbrD,SAAS,wBAAwB;AACjC,SAAS,WAAW;AAKb,SAAS,mB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AM;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","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.4.1",
3
+ "version": "0.5.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",