@useinsider/guido 3.30.2-beta.7e62a3a → 3.30.2-beta.a9ecedf

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.
@@ -1,5 +1,5 @@
1
1
  import { ModuleFolderDefaults as y } from "../../enums/defaults.js";
2
- import { object as o, number as c, optional as e, string as t, picklist as m, pipe as r, minLength as p, custom as k, boolean as a, array as n, transform as S, unknown as i, record as g, fallback as R, literal as u, lazy as T, looseObject as C, variant as I, union as h } from "../../node_modules/valibot/dist/index.js";
2
+ import { object as o, number as c, optional as e, string as t, picklist as m, pipe as r, minLength as p, custom as k, boolean as a, array as n, transform as S, unknown as i, variant as R, record as g, fallback as T, looseObject as C, union as h, literal as u, lazy as I } from "../../node_modules/valibot/dist/index.js";
3
3
  const b = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -76,7 +76,7 @@ const b = {
76
76
  value: t()
77
77
  })
78
78
  )
79
- }), f = T(() => C({
79
+ }), f = I(() => C({
80
80
  text: e(t()),
81
81
  // eslint-disable-next-line camelcase -- backend field name
82
82
  tag_text: e(t()),
@@ -86,7 +86,7 @@ const b = {
86
86
  select_items: e(n(f))
87
87
  })), P = g(
88
88
  t(),
89
- R(n(f), [])
89
+ T(n(f), [])
90
90
  ), v = C({
91
91
  /** Block ID (matches the dictionary key and the legacy HTML element id) */
92
92
  id: e(c()),
@@ -324,7 +324,7 @@ const b = {
324
324
  (s) => typeof s == "function",
325
325
  "processor must be a function"
326
326
  )
327
- }), V = I("type", [
327
+ }), V = R("type", [
328
328
  H,
329
329
  _,
330
330
  q,
@@ -1,4 +1,4 @@
1
- import { pipe as o, check as i, object as r, array as l, boolean as s, string as e, fallback as m, union as t, nullable as d, record as h, number as a, transform as u, tuple as p } from "../../node_modules/valibot/dist/index.js";
1
+ import { pipe as o, check as i, object as r, array as l, boolean as s, string as e, fallback as m, nullable as d, union as t, number as a, record as h, transform as u, tuple as p } from "../../node_modules/valibot/dist/index.js";
2
2
  const b = r({
3
3
  code: e(),
4
4
  trans: r({
@@ -0,0 +1,15 @@
1
+ import { array as c, object as e, string as a, number as t, boolean as o, optional as m, record as i, unknown as n } from "../../node_modules/valibot/dist/index.js";
2
+ const r = e({
3
+ id: t(),
4
+ name: a()
5
+ }), s = c(n()), p = e({ exists: o() }), h = e({ id: t() }), d = e({
6
+ clean: o(),
7
+ violations: m(i(a(), n()))
8
+ });
9
+ export {
10
+ d as AllowlistValidationSchema,
11
+ h as CreatedTemplateSchema,
12
+ s as TemplateCategoryListSchema,
13
+ r as TemplateCategorySchema,
14
+ p as TemplateNameCheckSchema
15
+ };
@@ -4,8 +4,8 @@ var r = function() {
4
4
  var a = this, e = a._self._c, t = a._self._setupProxy;
5
5
  return e(t.WpDrawer, { attrs: { id: "save-as-template-modal", "description-status": "", "description-text": t.trans("newsletter.save-template-description"), "footer-button-group-options": t.footerButtonGroupOptions, status: t.editorStore.isSaveAsTemplateDrawerOpen, "title-text": t.trans("products.save-template") }, on: { cancelOrBackButtonEvent: t.closeModal, onCloseEvent: t.closeModal, primaryButtonEvent: t.saveTemplate } }, [e(t.InBasicTextInput, { staticClass: "mb-5 w-1", attrs: { id: "guido__template-name-input", name: "templateName", "character-counter-status": !1, "disabled-status": t.isSaving, "label-text": t.trans("products.template-name"), "max-character-length": 1e3, "placeholder-text": t.trans("newsletter.enter-template-name"), "skeleton-sizing": { width: 495, height: 44 }, "skeleton-status": t.saveAsTemplateStore.skeletonStatus, "state-message": t.templateNameError, states: t.templateNameError ? "error" : "default", "tooltip-status": !1, value: t.saveAsTemplateStore.templateName }, on: { input: t.handleTemplateName } }), e(t.InMultiSelect, { staticClass: "template-category-dropdown mb-5 w-1", attrs: { id: "guido__template-category-dropdown", "create-option-status": "", "search-status": "", "button-status": !1, "character-limit-validation-text": t.trans("validation-v2.duration-value", {
6
6
  min: 1,
7
- max: 25
8
- }), "create-button-label": t.trans("products.create-new-category"), "disabled-status": t.isSaving, "label-text": t.trans("products.template-category"), "loading-state": t.isAddingOption, "max-character-limit": 25, "max-height": 350, options: t.saveAsTemplateStore.categories, "placeholder-text": t.trans("products.select-template-category"), "skeleton-sizing": { width: 495, height: 44 }, "skeleton-status": t.saveAsTemplateStore.skeletonStatus, value: t.saveAsTemplateStore.selectedCategories }, on: { addOption: t.handleAddOption, change: t.handleCategoryChange, resetAllOptions: t.handleResetAllOptions, selectAllOptions: t.handleSelectAllOptions } })], 1);
7
+ max: 40
8
+ }), "create-button-label": t.trans("products.create-new-category"), "disabled-status": t.isSaving, "label-text": t.trans("products.template-category"), "loading-state": t.isAddingOption, "max-character-limit": 40, "max-height": 350, options: t.saveAsTemplateStore.categories, "placeholder-text": t.trans("products.select-template-category"), "skeleton-sizing": { width: 495, height: 44 }, "skeleton-status": t.saveAsTemplateStore.skeletonStatus, value: t.saveAsTemplateStore.selectedCategories }, on: { addOption: t.handleAddOption, change: t.handleCategoryChange, resetAllOptions: t.handleResetAllOptions, selectAllOptions: t.handleSelectAllOptions } })], 1);
9
9
  }, l = [], n = /* @__PURE__ */ o(
10
10
  s,
11
11
  r,
@@ -1,15 +1,14 @@
1
1
  const e = {
2
2
  transactional: 2
3
- }, s = 2, a = 13, t = "https://email-static.useinsider.com", o = `${t}/templates/campaign/default.html`, l = `${t}/templates/campaign/default.css`, E = {
3
+ }, s = 13, t = "https://email-static.useinsider.com", a = `${t}/templates/campaign/default.html`, l = `${t}/templates/campaign/default.css`, L = {
4
4
  SAVED_MODULES: "savedModules",
5
5
  DEFAULT_MODULES: "defaultModules"
6
6
  };
7
7
  export {
8
8
  l as BLANK_TEMPLATE_CSS_URL,
9
- o as BLANK_TEMPLATE_HTML_URL,
9
+ a as BLANK_TEMPLATE_HTML_URL,
10
10
  t as EMAIL_STATIC_BASE_URL,
11
- s as EditorType,
12
- a as MAX_DEFAULT_TEMPLATE_ID,
13
- E as ModuleFolderDefaults,
11
+ s as MAX_DEFAULT_TEMPLATE_ID,
12
+ L as ModuleFolderDefaults,
14
13
  e as TemplateTypes
15
14
  };
@@ -1,6 +1,10 @@
1
- const E = "/email-proxy", e = {
2
- HTML_VALIDATE: "/v1/html/validate"
3
- }, n = {
1
+ const e = "/email-proxy", E = {
2
+ HTML_VALIDATE: "/v1/html/validate",
3
+ TEMPLATES: "/v1/templates",
4
+ TEMPLATE_NAME_CHECK: "/v1/templates/name-check",
5
+ TEMPLATE_CATEGORIES: "/v1/templates/categories",
6
+ ALLOWLIST_VALIDATE: "/v1/allowlist/validate"
7
+ }, t = "emailTemplateLibrary", T = {
4
8
  BAD_GATEWAY: "bad_gateway",
5
9
  BAD_REQUEST: "bad_request",
6
10
  CONFLICT: "conflict",
@@ -14,14 +18,21 @@ const E = "/email-proxy", e = {
14
18
  INVALID_RESPONSE: "invalid_response",
15
19
  NETWORK: "network_error",
16
20
  TIMEOUT: "timeout",
17
- UNKNOWN: "unknown"
18
- }, t = {
21
+ UNKNOWN: "unknown",
22
+ PRODUCT_TYPE_DISABLED: "product-type:errors.disabled",
23
+ PRODUCT_TYPE_FETCH_FAILED: "product-type:errors.fetch-failed",
24
+ TEMPLATE_NAME_CONFLICT: "template:errors.name-conflict",
25
+ TEMPLATE_CATEGORY_NAME_CONFLICT: "template:errors.category-name-conflict",
26
+ TEMPLATE_CONTENT_REJECTED: "template:errors.content-rejected",
27
+ TEMPLATE_ALLOWLIST_UNAVAILABLE: "template:errors.allowlist-unavailable"
28
+ }, r = {
19
29
  PONGO: "pongo",
20
30
  LIQUID: "liquid"
21
31
  };
22
32
  export {
23
- E as EMAIL_BE_BASE_URL,
24
- e as EmailBeEndPoints,
25
- n as EmailBeErrorCodes,
26
- t as HtmlSyntax
33
+ t as ALLOWLIST_TEMPLATE_TYPE,
34
+ e as EMAIL_BE_BASE_URL,
35
+ E as EmailBeEndPoints,
36
+ T as EmailBeErrorCodes,
37
+ r as HtmlSyntax
27
38
  };
@@ -30,21 +30,21 @@ function D(n) {
30
30
  const r = typeof n;
31
31
  return r === "string" ? `"${n}"` : r === "number" || r === "bigint" || r === "boolean" ? `${n}` : r === "object" || r === "function" ? (n && ((s = (e = Object.getPrototypeOf(n)) == null ? void 0 : e.constructor) == null ? void 0 : s.name)) ?? "null" : r;
32
32
  }
33
- function f(n, r, e, s, t) {
34
- const l = t && "input" in t ? t.input : e.value, u = (t == null ? void 0 : t.expected) ?? n.expects ?? null, p = (t == null ? void 0 : t.received) ?? /* @__PURE__ */ D(l), i = {
33
+ function f(n, r, e, s, u) {
34
+ const l = u && "input" in u ? u.input : e.value, t = (u == null ? void 0 : u.expected) ?? n.expects ?? null, p = (u == null ? void 0 : u.received) ?? /* @__PURE__ */ D(l), i = {
35
35
  kind: n.kind,
36
36
  type: n.type,
37
37
  input: l,
38
- expected: u,
38
+ expected: t,
39
39
  received: p,
40
- message: `Invalid ${r}: ${u ? `Expected ${u} but r` : "R"}eceived ${p}`,
40
+ message: `Invalid ${r}: ${t ? `Expected ${t} but r` : "R"}eceived ${p}`,
41
41
  requirement: n.requirement,
42
- path: t == null ? void 0 : t.path,
43
- issues: t == null ? void 0 : t.issues,
42
+ path: u == null ? void 0 : u.path,
43
+ issues: u == null ? void 0 : u.issues,
44
44
  lang: s.lang,
45
45
  abortEarly: s.abortEarly,
46
46
  abortPipeEarly: s.abortPipeEarly
47
- }, c = n.kind === "schema", a = (t == null ? void 0 : t.message) ?? n.message ?? /* @__PURE__ */ q(n.reference, i.lang) ?? (c ? /* @__PURE__ */ V(i.lang) : null) ?? s.message ?? /* @__PURE__ */ I(i.lang);
47
+ }, c = n.kind === "schema", a = (u == null ? void 0 : u.message) ?? n.message ?? /* @__PURE__ */ q(n.reference, i.lang) ?? (c ? /* @__PURE__ */ V(i.lang) : null) ?? s.message ?? /* @__PURE__ */ I(i.lang);
48
48
  a !== void 0 && (i.message = typeof a == "function" ? a(i) : a), c && (e.typed = !1), e.issues ? e.issues.push(i) : e.issues = [i];
49
49
  }
50
50
  // @__NO_SIDE_EFFECTS__
@@ -188,11 +188,11 @@ function ie(n, r) {
188
188
  return /* @__PURE__ */ o(this);
189
189
  },
190
190
  "~run"(e, s) {
191
- const t = n["~run"](e, s);
192
- return t.issues ? {
191
+ const u = n["~run"](e, s);
192
+ return u.issues ? {
193
193
  typed: !0,
194
- value: /* @__PURE__ */ P(this, t, s)
195
- } : t;
194
+ value: /* @__PURE__ */ P(this, u, s)
195
+ } : u;
196
196
  }
197
197
  };
198
198
  }
@@ -201,6 +201,10 @@ function k(n, r, e) {
201
201
  return typeof n.default == "function" ? n.default(r, e) : n.default;
202
202
  }
203
203
  // @__NO_SIDE_EFFECTS__
204
+ function le(n, r) {
205
+ return !n["~run"]({ value: r }, { abortEarly: !0 }).issues;
206
+ }
207
+ // @__NO_SIDE_EFFECTS__
204
208
  function R(n, r) {
205
209
  return {
206
210
  kind: "schema",
@@ -215,17 +219,17 @@ function R(n, r) {
215
219
  },
216
220
  "~run"(e, s) {
217
221
  var l;
218
- const t = e.value;
219
- if (Array.isArray(t)) {
222
+ const u = e.value;
223
+ if (Array.isArray(u)) {
220
224
  e.typed = !0, e.value = [];
221
- for (let u = 0; u < t.length; u++) {
222
- const p = t[u], i = this.item["~run"]({ value: p }, s);
225
+ for (let t = 0; t < u.length; t++) {
226
+ const p = u[t], i = this.item["~run"]({ value: p }, s);
223
227
  if (i.issues) {
224
228
  const c = {
225
229
  type: "array",
226
230
  origin: "value",
227
- input: t,
228
- key: u,
231
+ input: u,
232
+ key: t,
229
233
  value: p
230
234
  };
231
235
  for (const a of i.issues)
@@ -327,19 +331,19 @@ function T(n, r) {
327
331
  },
328
332
  "~run"(e, s) {
329
333
  var l;
330
- const t = e.value;
331
- if (t && typeof t == "object") {
334
+ const u = e.value;
335
+ if (u && typeof u == "object") {
332
336
  e.typed = !0, e.value = {};
333
- for (const u in this.entries) {
334
- const p = this.entries[u];
335
- if (u in t || (p.type === "exact_optional" || p.type === "optional" || p.type === "nullish") && p.default !== void 0) {
336
- const i = u in t ? t[u] : /* @__PURE__ */ k(p), c = p["~run"]({ value: i }, s);
337
+ for (const t in this.entries) {
338
+ const p = this.entries[t];
339
+ if (t in u || (p.type === "exact_optional" || p.type === "optional" || p.type === "nullish") && p.default !== void 0) {
340
+ const i = t in u ? u[t] : /* @__PURE__ */ k(p), c = p["~run"]({ value: i }, s);
337
341
  if (c.issues) {
338
342
  const a = {
339
343
  type: "object",
340
344
  origin: "value",
341
- input: t,
342
- key: u,
345
+ input: u,
346
+ key: t,
343
347
  value: i
344
348
  };
345
349
  for (const y of c.issues)
@@ -349,23 +353,23 @@ function T(n, r) {
349
353
  break;
350
354
  }
351
355
  }
352
- c.typed || (e.typed = !1), e.value[u] = c.value;
353
- } else if (p.fallback !== void 0) e.value[u] = /* @__PURE__ */ P(p);
356
+ c.typed || (e.typed = !1), e.value[t] = c.value;
357
+ } else if (p.fallback !== void 0) e.value[t] = /* @__PURE__ */ P(p);
354
358
  else if (p.type !== "exact_optional" && p.type !== "optional" && p.type !== "nullish" && (f(this, "key", e, s, {
355
359
  input: void 0,
356
- expected: `"${u}"`,
360
+ expected: `"${t}"`,
357
361
  path: [{
358
362
  type: "object",
359
363
  origin: "key",
360
- input: t,
361
- key: u,
362
- value: t[u]
364
+ input: u,
365
+ key: t,
366
+ value: u[t]
363
367
  }]
364
368
  }), s.abortEarly))
365
369
  break;
366
370
  }
367
371
  if (!e.issues || !s.abortEarly)
368
- for (const u in t) /* @__PURE__ */ S(t, u) && !(u in this.entries) && (e.value[u] = t[u]);
372
+ for (const t in u) /* @__PURE__ */ S(u, t) && !(t in this.entries) && (e.value[t] = u[t]);
369
373
  } else f(this, "type", e, s);
370
374
  return e;
371
375
  }
@@ -439,19 +443,19 @@ function Y(n, r) {
439
443
  },
440
444
  "~run"(e, s) {
441
445
  var l;
442
- const t = e.value;
443
- if (t && typeof t == "object") {
446
+ const u = e.value;
447
+ if (u && typeof u == "object") {
444
448
  e.typed = !0, e.value = {};
445
- for (const u in this.entries) {
446
- const p = this.entries[u];
447
- if (u in t || (p.type === "exact_optional" || p.type === "optional" || p.type === "nullish") && p.default !== void 0) {
448
- const i = u in t ? t[u] : /* @__PURE__ */ k(p), c = p["~run"]({ value: i }, s);
449
+ for (const t in this.entries) {
450
+ const p = this.entries[t];
451
+ if (t in u || (p.type === "exact_optional" || p.type === "optional" || p.type === "nullish") && p.default !== void 0) {
452
+ const i = t in u ? u[t] : /* @__PURE__ */ k(p), c = p["~run"]({ value: i }, s);
449
453
  if (c.issues) {
450
454
  const a = {
451
455
  type: "object",
452
456
  origin: "value",
453
- input: t,
454
- key: u,
457
+ input: u,
458
+ key: t,
455
459
  value: i
456
460
  };
457
461
  for (const y of c.issues)
@@ -461,17 +465,17 @@ function Y(n, r) {
461
465
  break;
462
466
  }
463
467
  }
464
- c.typed || (e.typed = !1), e.value[u] = c.value;
465
- } else if (p.fallback !== void 0) e.value[u] = /* @__PURE__ */ P(p);
468
+ c.typed || (e.typed = !1), e.value[t] = c.value;
469
+ } else if (p.fallback !== void 0) e.value[t] = /* @__PURE__ */ P(p);
466
470
  else if (p.type !== "exact_optional" && p.type !== "optional" && p.type !== "nullish" && (f(this, "key", e, s, {
467
471
  input: void 0,
468
- expected: `"${u}"`,
472
+ expected: `"${t}"`,
469
473
  path: [{
470
474
  type: "object",
471
475
  origin: "key",
472
- input: t,
473
- key: u,
474
- value: t[u]
476
+ input: u,
477
+ key: t,
478
+ value: u[t]
475
479
  }]
476
480
  }), s.abortEarly))
477
481
  break;
@@ -531,13 +535,13 @@ function ee(n, r, e) {
531
535
  get "~standard"() {
532
536
  return /* @__PURE__ */ o(this);
533
537
  },
534
- "~run"(s, t) {
535
- var u, p;
538
+ "~run"(s, u) {
539
+ var t, p;
536
540
  const l = s.value;
537
541
  if (l && typeof l == "object") {
538
542
  s.typed = !0, s.value = {};
539
543
  for (const i in l) if (/* @__PURE__ */ S(l, i)) {
540
- const c = l[i], a = this.key["~run"]({ value: i }, t);
544
+ const c = l[i], a = this.key["~run"]({ value: i }, u);
541
545
  if (a.issues) {
542
546
  const b = {
543
547
  type: "object",
@@ -547,13 +551,13 @@ function ee(n, r, e) {
547
551
  value: c
548
552
  };
549
553
  for (const h of a.issues)
550
- h.path = [b], (u = s.issues) == null || u.push(h);
551
- if (s.issues || (s.issues = a.issues), t.abortEarly) {
554
+ h.path = [b], (t = s.issues) == null || t.push(h);
555
+ if (s.issues || (s.issues = a.issues), u.abortEarly) {
552
556
  s.typed = !1;
553
557
  break;
554
558
  }
555
559
  }
556
- const y = this.value["~run"]({ value: c }, t);
560
+ const y = this.value["~run"]({ value: c }, u);
557
561
  if (y.issues) {
558
562
  const b = {
559
563
  type: "object",
@@ -564,14 +568,14 @@ function ee(n, r, e) {
564
568
  };
565
569
  for (const h of y.issues)
566
570
  h.path ? h.path.unshift(b) : h.path = [b], (p = s.issues) == null || p.push(h);
567
- if (s.issues || (s.issues = y.issues), t.abortEarly) {
571
+ if (s.issues || (s.issues = y.issues), u.abortEarly) {
568
572
  s.typed = !1;
569
573
  break;
570
574
  }
571
575
  }
572
576
  (!a.typed || !y.typed) && (s.typed = !1), a.typed && (s.value[a.value] = y.value);
573
577
  }
574
- } else f(this, "type", s, t);
578
+ } else f(this, "type", s, u);
575
579
  return s;
576
580
  }
577
581
  };
@@ -608,17 +612,17 @@ function re(n, r) {
608
612
  },
609
613
  "~run"(e, s) {
610
614
  var l;
611
- const t = e.value;
612
- if (Array.isArray(t)) {
615
+ const u = e.value;
616
+ if (Array.isArray(u)) {
613
617
  e.typed = !0, e.value = [];
614
- for (let u = 0; u < this.items.length; u++) {
615
- const p = t[u], i = this.items[u]["~run"]({ value: p }, s);
618
+ for (let t = 0; t < this.items.length; t++) {
619
+ const p = u[t], i = this.items[t]["~run"]({ value: p }, s);
616
620
  if (i.issues) {
617
621
  const c = {
618
622
  type: "array",
619
623
  origin: "value",
620
- input: t,
621
- key: u,
624
+ input: u,
625
+ key: t,
622
626
  value: p
623
627
  };
624
628
  for (const a of i.issues)
@@ -655,34 +659,34 @@ function se(n, r) {
655
659
  return /* @__PURE__ */ o(this);
656
660
  },
657
661
  "~run"(e, s) {
658
- let t, l, u;
662
+ let u, l, t;
659
663
  for (const p of this.options) {
660
664
  const i = p["~run"]({ value: e.value }, s);
661
665
  if (i.typed) if (i.issues) l ? l.push(i) : l = [i];
662
666
  else {
663
- t = i;
667
+ u = i;
664
668
  break;
665
669
  }
666
- else u ? u.push(i) : u = [i];
670
+ else t ? t.push(i) : t = [i];
667
671
  }
668
- if (t) return t;
672
+ if (u) return u;
669
673
  if (l) {
670
674
  if (l.length === 1) return l[0];
671
675
  f(this, "type", e, s, { issues: /* @__PURE__ */ A(l) }), e.typed = !0;
672
676
  } else {
673
- if ((u == null ? void 0 : u.length) === 1) return u[0];
674
- f(this, "type", e, s, { issues: /* @__PURE__ */ A(u) });
677
+ if ((t == null ? void 0 : t.length) === 1) return t[0];
678
+ f(this, "type", e, s, { issues: /* @__PURE__ */ A(t) });
675
679
  }
676
680
  return e;
677
681
  }
678
682
  };
679
683
  }
680
684
  // @__NO_SIDE_EFFECTS__
681
- function te() {
685
+ function ue() {
682
686
  return {
683
687
  kind: "schema",
684
688
  type: "unknown",
685
- reference: te,
689
+ reference: ue,
686
690
  expects: "unknown",
687
691
  async: !1,
688
692
  get "~standard"() {
@@ -694,11 +698,11 @@ function te() {
694
698
  };
695
699
  }
696
700
  // @__NO_SIDE_EFFECTS__
697
- function ue(n, r, e) {
701
+ function te(n, r, e) {
698
702
  return {
699
703
  kind: "schema",
700
704
  type: "variant",
701
- reference: ue,
705
+ reference: te,
702
706
  expects: "Object",
703
707
  async: !1,
704
708
  key: n,
@@ -707,10 +711,10 @@ function ue(n, r, e) {
707
711
  get "~standard"() {
708
712
  return /* @__PURE__ */ o(this);
709
713
  },
710
- "~run"(s, t) {
714
+ "~run"(s, u) {
711
715
  const l = s.value;
712
716
  if (l && typeof l == "object") {
713
- let u, p = 0, i = this.key, c = [];
717
+ let t, p = 0, i = this.key, c = [];
714
718
  const a = (y, b) => {
715
719
  for (const h of y.options) {
716
720
  if (h.type === "variant") a(h, new Set(b).add(h.key));
@@ -728,15 +732,15 @@ function ue(n, r, e) {
728
732
  g++;
729
733
  }
730
734
  if (O) {
731
- const v = h["~run"]({ value: l }, t);
732
- (!u || !u.typed && v.typed) && (u = v);
735
+ const v = h["~run"]({ value: l }, u);
736
+ (!t || !t.typed && v.typed) && (t = v);
733
737
  }
734
738
  }
735
- if (u && !u.issues) break;
739
+ if (t && !t.issues) break;
736
740
  }
737
741
  };
738
- if (a(this, /* @__PURE__ */ new Set([this.key])), u) return u;
739
- f(this, "type", s, t, {
742
+ if (a(this, /* @__PURE__ */ new Set([this.key])), t) return t;
743
+ f(this, "type", s, u, {
740
744
  input: l[i],
741
745
  expected: /* @__PURE__ */ w(c, "|"),
742
746
  path: [{
@@ -747,18 +751,18 @@ function ue(n, r, e) {
747
751
  value: l[i]
748
752
  }]
749
753
  });
750
- } else f(this, "type", s, t);
754
+ } else f(this, "type", s, u);
751
755
  return s;
752
756
  }
753
757
  };
754
758
  }
755
- function le(n, r, e) {
759
+ function pe(n, r, e) {
756
760
  const s = n["~run"]({ value: r }, /* @__PURE__ */ x(e));
757
761
  if (s.issues) throw new K(s.issues);
758
762
  return s.value;
759
763
  }
760
764
  // @__NO_SIDE_EFFECTS__
761
- function pe(...n) {
765
+ function ae(...n) {
762
766
  return {
763
767
  ...n[0],
764
768
  pipe: n,
@@ -778,7 +782,7 @@ function pe(...n) {
778
782
  };
779
783
  }
780
784
  // @__NO_SIDE_EFFECTS__
781
- function ae(...n) {
785
+ function ce(...n) {
782
786
  return {
783
787
  ...n[0],
784
788
  pipe: n,
@@ -799,7 +803,7 @@ function ae(...n) {
799
803
  };
800
804
  }
801
805
  // @__NO_SIDE_EFFECTS__
802
- function ce(n, r, e) {
806
+ function fe(n, r, e) {
803
807
  const s = n["~run"]({ value: r }, /* @__PURE__ */ x(e));
804
808
  return {
805
809
  typed: s.typed,
@@ -809,7 +813,7 @@ function ce(n, r, e) {
809
813
  };
810
814
  }
811
815
  // @__NO_SIDE_EFFECTS__
812
- async function fe(n, r, e) {
816
+ async function oe(n, r, e) {
813
817
  const s = await n["~run"]({ value: r }, /* @__PURE__ */ x(e));
814
818
  return {
815
819
  typed: s.typed,
@@ -837,6 +841,7 @@ export {
837
841
  I as getGlobalMessage,
838
842
  V as getSchemaMessage,
839
843
  q as getSpecificMessage,
844
+ le as is,
840
845
  J as lazy,
841
846
  Q as literal,
842
847
  T as looseObject,
@@ -848,18 +853,18 @@ export {
848
853
  X as number,
849
854
  Y as object,
850
855
  Z as optional,
851
- le as parse,
856
+ pe as parse,
852
857
  $ as picklist,
853
- pe as pipe,
854
- ae as pipeAsync,
858
+ ae as pipe,
859
+ ce as pipeAsync,
855
860
  ee as record,
856
- ce as safeParse,
857
- fe as safeParseAsync,
861
+ fe as safeParse,
862
+ oe as safeParseAsync,
858
863
  ne as string,
859
864
  C as transform,
860
865
  F as trim,
861
866
  re as tuple,
862
867
  se as union,
863
- te as unknown,
864
- ue as variant
868
+ ue as unknown,
869
+ te as variant
865
870
  };
@@ -1,9 +1,9 @@
1
- const o = "3.30.2-beta.7e62a3a", s = { stripo: { version: "2.87.0" } }, a = {
1
+ const o = "3.30.2-beta.a9ecedf", e = { stripo: { version: "2.87.0" } }, s = {
2
2
  version: o,
3
- guido: s
3
+ guido: e
4
4
  };
5
5
  export {
6
- a as default,
7
- s as guido,
6
+ s as default,
7
+ e as guido,
8
8
  o as version
9
9
  };
@@ -1,9 +1,9 @@
1
- var o = Object.defineProperty;
2
- var d = (e, r, s) => r in e ? o(e, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[r] = s;
3
- var t = (e, r, s) => d(e, typeof r != "symbol" ? r + "" : r, s);
4
- class a extends Error {
5
- constructor(s) {
6
- super(s.message);
1
+ var a = Object.defineProperty;
2
+ var d = (s, r, e) => r in s ? a(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
3
+ var t = (s, r, e) => d(s, typeof r != "symbol" ? r + "" : r, e);
4
+ class o extends Error {
5
+ constructor(e) {
6
+ super(e.message);
7
7
  t(this, "status");
8
8
  t(this, "code");
9
9
  t(this, "meta");
@@ -12,39 +12,40 @@ class a extends Error {
12
12
  // Guido already showed the auth modal/toast for this failure, so callers must not toast again.
13
13
  t(this, "authReported");
14
14
  t(this, "cause");
15
- this.name = new.target.name, this.status = s.status, this.code = s.code, this.meta = s.meta ?? {}, this.errors = s.errors ?? {}, this.requestId = s.requestId ?? "", this.authReported = s.authReported ?? !1, this.cause = s.cause;
15
+ this.name = new.target.name, this.status = e.status, this.code = e.code, this.meta = e.meta ?? {}, this.errors = e.errors ?? {}, this.requestId = e.requestId ?? "", this.authReported = e.authReported ?? !1, this.cause = e.cause;
16
16
  }
17
- is(s) {
18
- return this.code === s;
17
+ is(e) {
18
+ return this.code === e;
19
19
  }
20
20
  }
21
- class u extends a {
21
+ class c extends o {
22
22
  firstMessage() {
23
23
  const [r] = Object.values(this.errors);
24
24
  return (r == null ? void 0 : r[0]) ?? this.message;
25
25
  }
26
26
  }
27
- class h extends a {
27
+ class u extends o {
28
28
  }
29
- class n extends a {
29
+ class h extends o {
30
30
  }
31
- class l extends a {
31
+ class i extends o {
32
32
  }
33
- class E extends a {
33
+ class l extends o {
34
34
  }
35
- class x extends a {
35
+ class E extends o {
36
36
  }
37
- class i extends a {
37
+ class x extends o {
38
38
  }
39
- const m = (e) => e instanceof a;
39
+ const m = (s) => s instanceof o, p = (s) => s instanceof c;
40
40
  export {
41
- a as ApiError,
42
- n as ForbiddenError,
43
- i as NetworkError,
44
- h as NotFoundError,
45
- E as RateLimitError,
46
- x as ServerError,
47
- l as UnauthorizedError,
48
- u as ValidationError,
49
- m as isApiError
41
+ o as ApiError,
42
+ h as ForbiddenError,
43
+ x as NetworkError,
44
+ u as NotFoundError,
45
+ l as RateLimitError,
46
+ E as ServerError,
47
+ i as UnauthorizedError,
48
+ c as ValidationError,
49
+ m as isApiError,
50
+ p as isValidationError
50
51
  };
@@ -0,0 +1,149 @@
1
+ import { useToaster as p } from "../../../composables/useToaster.js";
2
+ import { useTranslations as m } from "../../../composables/useTranslations.js";
3
+ import { EmailBeErrorCodes as o, EmailBeEndPoints as i, ALLOWLIST_TEMPLATE_TYPE as A } from "../../../enums/email-be.js";
4
+ import { ToasterTypeOptions as y } from "../../../enums/toaster.js";
5
+ import { ApiError as h, isValidationError as f } from "../errors/ApiError.js";
6
+ import { handleApiError as c } from "../errors/handleApiError.js";
7
+ import { TemplateCategoryListSchema as O, TemplateCategorySchema as T, TemplateNameCheckSchema as L, AllowlistValidationSchema as w, CreatedTemplateSchema as C } from "../../../@types/email-be/templates.js";
8
+ import { escapeHtml as _ } from "../../../utils/htmlEscape.js";
9
+ import { is as g, safeParse as N } from "../../../node_modules/valibot/dist/index.js";
10
+ const S = "[TEMPLATE_SERVICE]", u = null, P = [
11
+ 400,
12
+ 404,
13
+ 409,
14
+ 500,
15
+ 503,
16
+ 504,
17
+ o.INVALID_RESPONSE,
18
+ o.NETWORK,
19
+ o.TIMEOUT,
20
+ o.UNKNOWN
21
+ ], d = () => m()("user-management.forbidden-action"), E = () => m()("newsletter.try-again-later"), k = () => m()("newsletter.template-category-name-exists");
22
+ function I(s) {
23
+ const e = Object.values(s).flatMap((t) => Array.isArray(t) ? t : []).filter((t) => typeof t == "string" && t !== "");
24
+ return [...new Set(e)];
25
+ }
26
+ function M(s, e) {
27
+ return f(s) ? Object.keys(s.errors).length ? s.firstMessage() : (!(s.cause instanceof Error) || s.message !== s.cause.message) && s.message ? s.message : e : e;
28
+ }
29
+ function R(s, e) {
30
+ return new h({ status: 200, code: o.INVALID_RESPONSE, message: s, cause: e });
31
+ }
32
+ function l(s, e, t) {
33
+ const r = N(s, e);
34
+ if (!r.success)
35
+ throw R(t, r.issues);
36
+ return r.output;
37
+ }
38
+ class K {
39
+ constructor(e) {
40
+ this.http = e;
41
+ }
42
+ errorOptions(e, t = "", r = {}) {
43
+ const a = t ? {
44
+ ...Object.fromEntries(P.map((n) => [n, () => t])),
45
+ 422: (n) => M(n, t)
46
+ } : {};
47
+ return {
48
+ context: `${S} ${e}`,
49
+ ...r,
50
+ overrides: {
51
+ ...a,
52
+ [o.FORBIDDEN]: d,
53
+ [o.PRODUCT_TYPE_DISABLED]: d,
54
+ [o.TEMPLATE_ALLOWLIST_UNAVAILABLE]: E,
55
+ [o.PRODUCT_TYPE_FETCH_FAILED]: E,
56
+ 429: E,
57
+ 502: E,
58
+ ...r.overrides
59
+ }
60
+ };
61
+ }
62
+ async listCategories(e = "") {
63
+ try {
64
+ const t = await this.http.request({
65
+ method: "GET",
66
+ url: i.TEMPLATE_CATEGORIES
67
+ });
68
+ return { ok: !0, data: l(O, t, "Categories answered without a list").filter((a) => g(T, a)) };
69
+ } catch (t) {
70
+ return { ok: !1, error: c(t, this.errorOptions("listCategories", e)) };
71
+ }
72
+ }
73
+ async createCategory(e) {
74
+ try {
75
+ const t = await this.http.request({
76
+ method: "POST",
77
+ url: i.TEMPLATE_CATEGORIES,
78
+ body: { name: e },
79
+ retry: u
80
+ });
81
+ return { ok: !0, data: l(T, t, "Category create answered without a category") };
82
+ } catch (t) {
83
+ return {
84
+ ok: !1,
85
+ error: c(t, this.errorOptions("createCategory", "", {
86
+ overrides: { [o.TEMPLATE_CATEGORY_NAME_CONFLICT]: k }
87
+ }))
88
+ };
89
+ }
90
+ }
91
+ async isNameTaken(e) {
92
+ try {
93
+ const t = await this.http.request({
94
+ method: "POST",
95
+ url: i.TEMPLATE_NAME_CHECK,
96
+ body: { name: e }
97
+ }), { exists: r } = l(L, t, "Name check answered without a verdict");
98
+ return { ok: !0, data: r };
99
+ } catch (t) {
100
+ return { ok: !1, error: c(t, this.errorOptions("isNameTaken", "", { silent: !0 })) };
101
+ }
102
+ }
103
+ async checkAllowlist(e, t) {
104
+ try {
105
+ const r = await this.http.request({
106
+ method: "POST",
107
+ url: i.ALLOWLIST_VALIDATE,
108
+ body: { type: A, fields: { html: e.html, css: e.css } }
109
+ }), a = l(w, r, "Allowlist answered without a verdict");
110
+ if (a.clean)
111
+ return { ok: !0, data: !0 };
112
+ const n = _(I(a.violations ?? {}).join(", "));
113
+ return p().showToaster({
114
+ type: y.Error,
115
+ message: m()("newsletter.template-allowlist-blocked-domains", { domains: n })
116
+ }), {
117
+ ok: !1,
118
+ error: new h({
119
+ status: 422,
120
+ code: o.TEMPLATE_CONTENT_REJECTED,
121
+ message: "Content links domains that are not allowlisted"
122
+ })
123
+ };
124
+ } catch (r) {
125
+ return { ok: !1, error: c(r, this.errorOptions("checkAllowlist", t)) };
126
+ }
127
+ }
128
+ async create(e, t) {
129
+ try {
130
+ const r = await this.http.request({
131
+ method: "POST",
132
+ url: i.TEMPLATES,
133
+ body: e,
134
+ retry: u
135
+ });
136
+ return { ok: !0, data: l(C, r, "Create answered without a template").id };
137
+ } catch (r) {
138
+ return {
139
+ ok: !1,
140
+ error: c(r, this.errorOptions("create", t.fallback, {
141
+ overrides: { [o.TEMPLATE_NAME_CONFLICT]: () => t.nameTaken }
142
+ }))
143
+ };
144
+ }
145
+ }
146
+ }
147
+ export {
148
+ K as TemplateService
149
+ };
@@ -0,0 +1,6 @@
1
+ import { emailBeHttp as e } from "../http/index.js";
2
+ import { TemplateService as t } from "./TemplateService.js";
3
+ const o = new t(e);
4
+ export {
5
+ o as templateService
6
+ };
@@ -1,105 +1,77 @@
1
- import { useActionsApi as A } from "../composables/useActionsApi.js";
2
- import { useConfig as S } from "../composables/useConfig.js";
3
- import { useHttp as E } from "../composables/useHttp.js";
4
- import { useToaster as x } from "../composables/useToaster.js";
5
- import { useTranslations as P } from "../composables/useTranslations.js";
6
- import { useHtmlDocumentCountValidator as L } from "../composables/validators/useHtmlDocumentCountValidator.js";
7
- import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
8
- import { EditorType as H } from "../enums/defaults.js";
9
- import { ToasterTypeOptions as T } from "../enums/toaster.js";
10
- import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
- import { useSaveAsTemplateStore as q } from "../stores/save-as-template.js";
12
- import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
13
- import { isPlainObject as w } from "../utils/genericUtil.js";
14
- import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
15
- const Z = () => {
16
- const { get: l, post: c } = E(), { handleError: o, showToaster: i } = x(), { config: p, isFeatureEnabled: u } = S(), { validateLiquidSyntax: b } = N(), { validateSingleHtmlDocument: C } = L(), { getTemplateData: h } = A(), n = P();
1
+ import { useActionsApi as S } from "../composables/useActionsApi.js";
2
+ import { useConfig as k } from "../composables/useConfig.js";
3
+ import { useToaster as v } from "../composables/useToaster.js";
4
+ import { useTranslations as A } from "../composables/useTranslations.js";
5
+ import { useHtmlDocumentCountValidator as b } from "../composables/validators/useHtmlDocumentCountValidator.js";
6
+ import { useLiquidValidator as L } from "../composables/validators/useLiquidValidator.js";
7
+ import { HtmlSyntax as d } from "../enums/email-be.js";
8
+ import { ToasterTypeOptions as N } from "../enums/toaster.js";
9
+ import { useRecommendationExtensionStore as H } from "../extensions/Blocks/Recommendation/store/recommendation.js";
10
+ import { templateService as o } from "./emailBe/templates/index.js";
11
+ import { useSaveAsTemplateStore as D } from "../stores/save-as-template.js";
12
+ import { ProductType as I, MessageType as x } from "../@types/config/schemas.js";
13
+ import "../@types/config/defaults.js";
14
+ import { base64EncodeWithSpecialChars as s } from "../utils/base64.js";
15
+ import { useTemplatePreparation as E } from "../utils/templatePreparation.js";
16
+ const ee = () => {
17
+ const { handleError: y, showToaster: f } = v(), { config: T, isFeatureEnabled: g } = k(), { validateLiquidSyntax: C } = L(), { validateSingleHtmlDocument: w } = b(), { getTemplateData: h } = S(), i = A();
17
18
  return {
18
19
  getCategories: async () => {
19
- try {
20
- const { data: e } = await l("/newsletter/template-library/get-template-categories");
21
- return Array.isArray(e) ? e : ((!w(e) || e.type !== "alert") && console.error("[TEMPLATE_LIBRARY_API] Unexpected get-template-categories response", e), i({
22
- message: n("newsletter.template-library-service-error"),
23
- type: T.Error
24
- }), []);
25
- } catch (e) {
26
- return o(e, "Failed to fetch template categories"), [];
27
- }
20
+ const e = await o.listCategories(i("newsletter.template-library-service-error"));
21
+ return e.ok ? e.data : [];
28
22
  },
29
23
  checkTemplateNameAvailability: async (e) => {
30
- const { data: { status: t = !1 } } = await l(
31
- `/newsletter/template-library/template-name-exists?name=${e}`
32
- );
33
- return !t;
24
+ const t = await o.isNameTaken(e);
25
+ return !t.ok || !t.data;
34
26
  },
35
27
  createCategory: async (e) => {
36
- try {
37
- const { data: { id: t } } = await c(
38
- "/newsletter/template-library/create-category",
39
- { name: e }
40
- );
41
- return t.toString();
42
- } catch (t) {
43
- return o(t, "Failed to create category"), "";
44
- }
28
+ const t = await o.createCategory(e);
29
+ return t.ok ? t.data.id.toString() : "";
45
30
  },
46
31
  createTemplate: async () => {
47
- var e, t, d, y;
32
+ var e;
48
33
  try {
49
- const { prepareTemplateDetails: m } = F(), s = q(), g = await h();
50
- if (!C(g.html))
34
+ const { prepareTemplateDetails: t } = E(), m = D(), c = await h();
35
+ if (!w(c.html))
51
36
  return !1;
52
- const a = await m(g);
53
- if (u("liquidSyntax") && !await b(a.compiledHtml))
37
+ const a = await t(c), l = g("liquidSyntax");
38
+ if (l && !await C(a.compiledHtml))
54
39
  return !1;
55
- const v = {
56
- name: s.getTemplateName,
57
- categories: s.getSelectedCategoryIds,
58
- productId: ((t = (e = p.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
59
- editorType: H,
60
- messageType: ((y = (d = p.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
61
- content: r(a.compiledHtml),
62
- css: r(a.css),
63
- unsubscriptionPreferencePageStatus: !1,
64
- unsubscriptionPreferencePages: [],
65
- recommendationCampaignUrls: r(
66
- D().recommendationCampaignUrls
67
- ),
68
- recommendationConfigs: r({}),
69
- isGuido: !0,
70
- // eslint-disable-next-line camelcase
71
- template_engine: u("liquidSyntax") ? 1 : 0,
72
- stripoConfig: r({
73
- editor: "stripo",
74
- html: a.rawHtml,
75
- css: a.css,
76
- dynamicContentList: a.dynamicContentList
77
- })
78
- }, { data: f } = await c(
79
- "/newsletter/template-library/create-template",
80
- v
81
- );
82
- if (!w(f))
83
- throw new Error("Unexpected create-template response");
84
- return f.type === "alert" ? (i({
85
- message: n(
86
- "newsletter.template-library-save-alert",
87
- { templateName: s.getTemplateName }
88
- ),
89
- type: T.Error
90
- }), !1) : (i({
91
- message: n(
92
- "newsletter.template-library-save-success",
93
- { templateName: s.getTemplateName }
94
- ),
95
- type: "success"
40
+ const n = m.getTemplateName, r = (e = T.value) == null ? void 0 : e.partner, p = {
41
+ name: n,
42
+ type: (r == null ? void 0 : r.messageType) === x.TRANSACTIONAL ? "transactional" : "promotional",
43
+ editor: "guido",
44
+ product: (r == null ? void 0 : r.productType) === I.ARCHITECT ? "architect" : "newsletter",
45
+ engine: l ? d.LIQUID : d.PONGO,
46
+ categoryIds: m.getSelectedCategoryIds,
47
+ content: {
48
+ html: s(a.compiledHtml),
49
+ css: s(a.css),
50
+ stripoConfig: s({
51
+ editor: "stripo",
52
+ html: a.rawHtml,
53
+ css: a.css,
54
+ dynamicContentList: a.dynamicContentList
55
+ }),
56
+ recommendationConfigs: s({}),
57
+ recommendationCampaignUrls: s(
58
+ H().recommendationCampaignUrls
59
+ )
60
+ }
61
+ }, u = i("newsletter.template-library-save-alert", { templateName: n });
62
+ return !(await o.checkAllowlist(p.content, u)).ok || !(await o.create(p, {
63
+ nameTaken: i("save-product-card.name-error"),
64
+ fallback: u
65
+ })).ok ? !1 : (f({
66
+ message: i("newsletter.template-library-save-success", { templateName: n }),
67
+ type: N.Success
96
68
  }), !0);
97
- } catch (m) {
98
- return o(m, "Failed to create template"), !1;
69
+ } catch (t) {
70
+ return y(t, "Failed to create template"), !1;
99
71
  }
100
72
  }
101
73
  };
102
74
  };
103
75
  export {
104
- Z as useTemplateLibraryApi
76
+ ee as useTemplateLibraryApi
105
77
  };
@@ -0,0 +1,40 @@
1
+ import type { HtmlSyntaxValue } from '@@/Enums/email-be';
2
+ import * as v from 'valibot';
3
+ export declare const TemplateCategorySchema: v.ObjectSchema<{
4
+ readonly id: v.NumberSchema<undefined>;
5
+ readonly name: v.StringSchema<undefined>;
6
+ }, undefined>;
7
+ export declare const TemplateCategoryListSchema: v.ArraySchema<v.UnknownSchema, undefined>;
8
+ export declare const TemplateNameCheckSchema: v.ObjectSchema<{
9
+ readonly exists: v.BooleanSchema<undefined>;
10
+ }, undefined>;
11
+ export declare const CreatedTemplateSchema: v.ObjectSchema<{
12
+ readonly id: v.NumberSchema<undefined>;
13
+ }, undefined>;
14
+ export declare const AllowlistValidationSchema: v.ObjectSchema<{
15
+ readonly clean: v.BooleanSchema<undefined>;
16
+ readonly violations: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
17
+ }, undefined>;
18
+ export type TemplateCategory = v.InferOutput<typeof TemplateCategorySchema>;
19
+ export type TemplateWireType = 'promotional' | 'transactional';
20
+ export type TemplateWireProduct = 'newsletter' | 'architect';
21
+ export interface TemplateCreateContent {
22
+ html: string;
23
+ css: string;
24
+ stripoConfig: string;
25
+ recommendationConfigs: string;
26
+ recommendationCampaignUrls: string;
27
+ }
28
+ export interface TemplateCreateBody {
29
+ name: string;
30
+ type: TemplateWireType;
31
+ editor: 'guido';
32
+ product: TemplateWireProduct;
33
+ engine: HtmlSyntaxValue;
34
+ categoryIds: number[];
35
+ content: TemplateCreateContent;
36
+ }
37
+ export interface TemplateCreateMessages {
38
+ nameTaken: string;
39
+ fallback: string;
40
+ }
@@ -2,29 +2,7 @@ export interface MappedCategory {
2
2
  value: string;
3
3
  text: string;
4
4
  }
5
- export interface Category {
6
- id: number;
7
- name: string;
8
- partnerId: number;
9
- isStripo: boolean;
10
- templatesCount: number;
11
- }
5
+ export type { TemplateCategory as Category } from '@@/Types/email-be/templates';
12
6
  export interface RecommendationCampaignUrls {
13
7
  [key: string]: string;
14
8
  }
15
- export interface CreateTemplateRequest {
16
- name: string;
17
- categories: number[];
18
- productId: number;
19
- editorType: number;
20
- messageType?: number;
21
- content: string;
22
- css?: string;
23
- stripoConfig: string;
24
- recommendationConfigs?: string;
25
- recommendationCampaignUrls?: string;
26
- unsubscriptionPreferencePages: number[];
27
- unsubscriptionPreferencePageStatus: boolean;
28
- isGuido: boolean;
29
- template_engine: number;
30
- }
@@ -1,7 +1,12 @@
1
1
  export declare const EMAIL_BE_BASE_URL = "/email-proxy";
2
2
  export declare const EmailBeEndPoints: {
3
3
  readonly HTML_VALIDATE: "/v1/html/validate";
4
+ readonly TEMPLATES: "/v1/templates";
5
+ readonly TEMPLATE_NAME_CHECK: "/v1/templates/name-check";
6
+ readonly TEMPLATE_CATEGORIES: "/v1/templates/categories";
7
+ readonly ALLOWLIST_VALIDATE: "/v1/allowlist/validate";
4
8
  };
9
+ export declare const ALLOWLIST_TEMPLATE_TYPE = "emailTemplateLibrary";
5
10
  export declare const EmailBeErrorCodes: {
6
11
  readonly BAD_GATEWAY: "bad_gateway";
7
12
  readonly BAD_REQUEST: "bad_request";
@@ -17,6 +22,12 @@ export declare const EmailBeErrorCodes: {
17
22
  readonly NETWORK: "network_error";
18
23
  readonly TIMEOUT: "timeout";
19
24
  readonly UNKNOWN: "unknown";
25
+ readonly PRODUCT_TYPE_DISABLED: "product-type:errors.disabled";
26
+ readonly PRODUCT_TYPE_FETCH_FAILED: "product-type:errors.fetch-failed";
27
+ readonly TEMPLATE_NAME_CONFLICT: "template:errors.name-conflict";
28
+ readonly TEMPLATE_CATEGORY_NAME_CONFLICT: "template:errors.category-name-conflict";
29
+ readonly TEMPLATE_CONTENT_REJECTED: "template:errors.content-rejected";
30
+ readonly TEMPLATE_ALLOWLIST_UNAVAILABLE: "template:errors.allowlist-unavailable";
20
31
  };
21
32
  export type ApiErrorCode = typeof EmailBeErrorCodes[keyof typeof EmailBeErrorCodes];
22
33
  export declare const HtmlSyntax: {
@@ -0,0 +1,13 @@
1
+ import type { HttpManager } from '@@/Services/emailBe/http/HttpManager';
2
+ import type { Result } from '@@/Services/emailBe/http/types';
3
+ import type { TemplateCategory, TemplateCreateBody, TemplateCreateContent, TemplateCreateMessages } from '@@/Types/email-be/templates';
4
+ export declare class TemplateService {
5
+ private readonly http;
6
+ constructor(http: HttpManager);
7
+ private errorOptions;
8
+ listCategories(fallback?: string): Promise<Result<TemplateCategory[]>>;
9
+ createCategory(name: string): Promise<Result<TemplateCategory>>;
10
+ isNameTaken(name: string): Promise<Result<boolean>>;
11
+ checkAllowlist(content: TemplateCreateContent, fallback: string): Promise<Result<true>>;
12
+ create(body: TemplateCreateBody, messages: TemplateCreateMessages): Promise<Result<number>>;
13
+ }
@@ -0,0 +1,2 @@
1
+ import { TemplateService } from './TemplateService';
2
+ export declare const templateService: TemplateService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.30.2-beta.7e62a3a",
3
+ "version": "3.30.2-beta.a9ecedf",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",