@useinsider/guido 3.26.0 → 3.27.0-beta.0dd857f

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.
Files changed (124) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +93 -91
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/@types/email-be/html-validation.js +28 -0
  5. package/dist/components/Guido.vue.js +5 -5
  6. package/dist/components/Guido.vue2.js +104 -98
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +17 -0
  8. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +41 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +81 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +17 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +45 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +36 -0
  14. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +63 -0
  15. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  16. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  17. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +5 -5
  18. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +15 -15
  19. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +6 -6
  20. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +28 -27
  21. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +3 -3
  22. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +42 -27
  23. package/dist/composables/useBlocksConfig.js +29 -20
  24. package/dist/composables/useCustomInterfaceAppearance.js +50 -50
  25. package/dist/composables/useDisplayConditions.js +116 -0
  26. package/dist/composables/useFullStoryBridge.js +10 -9
  27. package/dist/composables/useSave.js +19 -17
  28. package/dist/composables/useSaveValidation.js +134 -252
  29. package/dist/composables/useTranslations.js +14 -8
  30. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  31. package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
  32. package/dist/enums/academy.js +1 -0
  33. package/dist/enums/display-condition.js +12 -0
  34. package/dist/enums/email-be.js +27 -0
  35. package/dist/enums/save-validation.js +2 -2
  36. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +14 -14
  37. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -40
  38. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +15 -15
  39. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +17 -15
  40. package/dist/extensions/Blocks/common-control.js +25 -25
  41. package/dist/extensions/DisplayConditions/bridge.js +25 -0
  42. package/dist/extensions/DisplayConditions/constants.js +26 -0
  43. package/dist/extensions/DisplayConditions/control.js +215 -0
  44. package/dist/extensions/DisplayConditions/display-conditions.css.js +226 -0
  45. package/dist/extensions/DisplayConditions/extension.js +28 -0
  46. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  47. package/dist/extensions/DisplayConditions/library.js +30 -0
  48. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  49. package/dist/extensions/DynamicContent/dynamic-content.js +15 -17
  50. package/dist/guido.css +1 -1
  51. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  52. package/dist/node_modules/valibot/dist/index.js +405 -291
  53. package/dist/package.json.js +2 -2
  54. package/dist/services/displayConditionApi.js +39 -0
  55. package/dist/services/emailBe/errors/ApiError.js +50 -0
  56. package/dist/services/emailBe/errors/handleApiError.js +31 -0
  57. package/dist/services/emailBe/errors/toApiError.js +71 -0
  58. package/dist/services/emailBe/html/HtmlValidationService.js +35 -0
  59. package/dist/services/emailBe/html/index.js +6 -0
  60. package/dist/services/emailBe/http/HttpManager.js +68 -0
  61. package/dist/services/emailBe/http/RetryStack.js +24 -0
  62. package/dist/services/emailBe/http/client.js +61 -0
  63. package/dist/services/emailBe/http/index.js +10 -0
  64. package/dist/services/emailBe/http/transportErrors.js +20 -0
  65. package/dist/src/@types/config/schemas.d.ts +4 -0
  66. package/dist/src/@types/display-condition.d.ts +61 -0
  67. package/dist/src/@types/email-be/html-validation.d.ts +51 -0
  68. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  69. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
  70. package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +18 -0
  71. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  72. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  73. package/dist/src/composables/useConfig.d.ts +2 -0
  74. package/dist/src/composables/useDisplayConditions.d.ts +18 -0
  75. package/dist/src/composables/useSaveValidation.d.ts +2 -2
  76. package/dist/src/enums/academy.d.ts +1 -0
  77. package/dist/src/enums/display-condition.d.ts +15 -0
  78. package/dist/src/enums/email-be.d.ts +26 -0
  79. package/dist/src/enums/save-validation.d.ts +3 -15
  80. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
  81. package/dist/src/extensions/Blocks/common-control.d.ts +1 -1
  82. package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
  83. package/dist/src/extensions/DisplayConditions/constants.d.ts +23 -0
  84. package/dist/src/extensions/DisplayConditions/control.d.ts +25 -0
  85. package/dist/src/extensions/{Blocks/_Boilerplate → DisplayConditions}/iconsRegistry.d.ts +1 -1
  86. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  87. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  88. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  89. package/dist/src/services/displayConditionApi.d.ts +8 -0
  90. package/dist/src/services/emailBe/errors/ApiError.d.ts +40 -0
  91. package/dist/src/services/emailBe/errors/handleApiError.d.ts +11 -0
  92. package/dist/src/services/emailBe/errors/toApiError.d.ts +2 -0
  93. package/dist/src/services/emailBe/html/HtmlValidationService.d.ts +8 -0
  94. package/dist/src/services/emailBe/html/index.d.ts +2 -0
  95. package/dist/src/services/emailBe/http/HttpManager.d.ts +13 -0
  96. package/dist/src/services/emailBe/http/RetryStack.d.ts +6 -0
  97. package/dist/src/services/emailBe/http/client.d.ts +3 -0
  98. package/dist/src/services/emailBe/http/index.d.ts +2 -0
  99. package/dist/src/services/emailBe/http/transportErrors.d.ts +15 -0
  100. package/dist/src/services/emailBe/http/types.d.ts +46 -0
  101. package/dist/src/stores/config.d.ts +170 -0
  102. package/dist/src/stores/display-condition.d.ts +86 -0
  103. package/dist/src/stores/onboarding.d.ts +1 -0
  104. package/dist/src/utils/displayCondition.d.ts +11 -0
  105. package/dist/src/utils/editorShadowRoot.d.ts +1 -0
  106. package/dist/src/utils/protectTableText.d.ts +2 -0
  107. package/dist/static/styles/variables.css.js +1 -0
  108. package/dist/stores/config.js +13 -6
  109. package/dist/stores/display-condition.js +29 -0
  110. package/dist/stores/onboarding.js +4 -1
  111. package/dist/utils/displayCondition.js +29 -0
  112. package/dist/utils/editorShadowRoot.js +8 -0
  113. package/dist/utils/pairProductVariables.js +29 -28
  114. package/dist/utils/protectTableText.js +22 -0
  115. package/package.json +10 -2
  116. package/dist/src/extensions/Blocks/_Boilerplate/block.d.ts +0 -11
  117. package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +0 -7
  118. package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +0 -10
  119. package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +0 -16
  120. package/dist/src/extensions/Blocks/_Boilerplate/control.d.ts +0 -17
  121. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -15
  122. package/dist/src/extensions/Blocks/_Boilerplate/settingsPanel.d.ts +0 -4
  123. package/dist/src/extensions/Blocks/_Boilerplate/template.d.ts +0 -6
  124. /package/dist/src/extensions/{Blocks/_Boilerplate → DisplayConditions}/extension.d.ts +0 -0
@@ -1,9 +1,9 @@
1
- const o = "3.26.0", s = { stripo: { version: "2.83.1" } }, n = {
1
+ const o = "3.27.0-beta.0dd857f", s = { stripo: { version: "2.83.1" } }, t = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
5
5
  export {
6
- n as default,
6
+ t as default,
7
7
  s as guido,
8
8
  o as version
9
9
  };
@@ -0,0 +1,39 @@
1
+ import { useHttp as p } from "../composables/useHttp.js";
2
+ import { SavedDisplayConditionSchema as y, DisplayConditionListResponseSchema as S } from "../@types/display-condition.js";
3
+ import { parse as r } from "../node_modules/valibot/dist/index.js";
4
+ const s = "/email-proxy/v1/display-conditions", u = 100, P = () => {
5
+ const { get: c, post: m, delete: l } = p(), i = async (t, e) => {
6
+ const o = new URLSearchParams({
7
+ page: String(e),
8
+ limit: String(u),
9
+ sortColumn: "id",
10
+ sortDirection: "desc",
11
+ "filter[syntax]": t
12
+ }), { data: n } = await c(`${s}?${o.toString()}`);
13
+ return r(S, n);
14
+ };
15
+ return { list: async (t) => {
16
+ const e = await i(t, 1), o = await Promise.all(Array.from(
17
+ { length: Math.max(e.meta.lastPage - 1, 0) },
18
+ (a, d) => i(t, d + 2)
19
+ )), n = [e, ...o].flatMap((a) => a.data);
20
+ return [...new Map(n.map((a) => [a.id, a])).values()];
21
+ }, create: async (t, e) => {
22
+ const { data: o } = await m(s, {
23
+ name: t.name.trim(),
24
+ description: t.description.trim() || null,
25
+ syntax: e,
26
+ method: "codeOnly",
27
+ codeBefore: t.codeBefore,
28
+ codeAfter: t.codeAfter
29
+ });
30
+ return r(y, o.data);
31
+ }, remove: async (t) => {
32
+ await l(`${s}/${t}`);
33
+ } };
34
+ };
35
+ export {
36
+ u as DISPLAY_CONDITIONS_PAGE_LIMIT,
37
+ s as DISPLAY_CONDITIONS_URL,
38
+ P as useDisplayConditionApi
39
+ };
@@ -0,0 +1,50 @@
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);
7
+ t(this, "status");
8
+ t(this, "code");
9
+ t(this, "meta");
10
+ t(this, "errors");
11
+ t(this, "requestId");
12
+ // Guido already showed the auth modal/toast for this failure, so callers must not toast again.
13
+ t(this, "authReported");
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;
16
+ }
17
+ is(s) {
18
+ return this.code === s;
19
+ }
20
+ }
21
+ class u extends a {
22
+ firstMessage() {
23
+ const [r] = Object.values(this.errors);
24
+ return (r == null ? void 0 : r[0]) ?? this.message;
25
+ }
26
+ }
27
+ class h extends a {
28
+ }
29
+ class n extends a {
30
+ }
31
+ class l extends a {
32
+ }
33
+ class E extends a {
34
+ }
35
+ class x extends a {
36
+ }
37
+ class i extends a {
38
+ }
39
+ const m = (e) => e instanceof a;
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
50
+ };
@@ -0,0 +1,31 @@
1
+ import { useToaster as a } from "../../../composables/useToaster.js";
2
+ import { useTranslations as f } from "../../../composables/useTranslations.js";
3
+ import { ToasterTypeOptions as i } from "../../../enums/toaster.js";
4
+ import { UnauthorizedError as u, ValidationError as c } from "./ApiError.js";
5
+ import { toApiError as m } from "./toApiError.js";
6
+ const p = "products.something-went-wrong";
7
+ function l(o) {
8
+ return o instanceof c ? o.firstMessage() : f()(p);
9
+ }
10
+ function E(o, t) {
11
+ return (t == null ? void 0 : t[o.code]) ?? (t == null ? void 0 : t[o.status]);
12
+ }
13
+ function A(o, t) {
14
+ const r = m(o);
15
+ if (r.authReported || r instanceof u)
16
+ return r;
17
+ const s = E(r, t.overrides);
18
+ let n = "";
19
+ if (s) {
20
+ const e = s(r);
21
+ if (e === !1)
22
+ return r;
23
+ n = typeof e == "string" ? e : "";
24
+ } else
25
+ n = l(r);
26
+ return console.error(`${t.context} failed`, r), n && !t.silent && a().showToaster({ type: i.Error, message: n }), r;
27
+ }
28
+ export {
29
+ p as GENERIC_MESSAGE_KEY,
30
+ A as handleApiError
31
+ };
@@ -0,0 +1,71 @@
1
+ import { EmailBeErrorCodes as t } from "../../../enums/email-be.js";
2
+ import { HttpStatusError as u, TransportNetworkError as i, SessionExpiredError as c } from "../http/transportErrors.js";
3
+ import { isApiError as d, NetworkError as m, UnauthorizedError as a, ServerError as E, ApiError as N, RateLimitError as A, ValidationError as T, NotFoundError as f, ForbiddenError as I } from "./ApiError.js";
4
+ const p = {
5
+ 400: t.BAD_REQUEST,
6
+ 401: t.UNAUTHENTICATED,
7
+ 403: t.FORBIDDEN,
8
+ 404: t.NOT_FOUND,
9
+ 409: t.CONFLICT,
10
+ 419: t.SESSION_EXPIRED,
11
+ 422: t.VALIDATION_FAILED,
12
+ 429: t.RATE_LIMITED,
13
+ 500: t.INTERNAL_ERROR,
14
+ 502: t.BAD_GATEWAY
15
+ };
16
+ function R(e) {
17
+ return typeof e == "object" && e !== null && !Array.isArray(e);
18
+ }
19
+ function S(e) {
20
+ const { status: n } = e, o = R(e.body) ? e.body : {}, r = o.error ?? {}, s = {
21
+ status: n,
22
+ code: r.code ?? p[n] ?? t.UNKNOWN,
23
+ message: r.message ?? e.message,
24
+ meta: r.meta ?? {},
25
+ errors: r.errors ?? {},
26
+ requestId: o.requestId ?? e.requestId,
27
+ authReported: e.authReported,
28
+ cause: e
29
+ };
30
+ switch (n) {
31
+ case 401:
32
+ case 419:
33
+ return new a(s);
34
+ case 403:
35
+ return new I(s);
36
+ case 404:
37
+ return new f(s);
38
+ case 422:
39
+ return new T(s);
40
+ case 429:
41
+ return new A(s);
42
+ default:
43
+ return n >= 500 ? new E(s) : new N(s);
44
+ }
45
+ }
46
+ function g(e) {
47
+ if (d(e))
48
+ return e;
49
+ if (e instanceof u)
50
+ return S(e);
51
+ if (e instanceof i)
52
+ return new m({
53
+ status: 0,
54
+ code: e.isTimeout ? t.TIMEOUT : t.NETWORK,
55
+ message: e.message,
56
+ cause: e.cause
57
+ });
58
+ if (e instanceof c)
59
+ return new a({
60
+ status: 0,
61
+ code: t.SESSION_EXPIRED,
62
+ message: e.message,
63
+ authReported: !0,
64
+ cause: e
65
+ });
66
+ const n = e instanceof Error ? e.message : String(e);
67
+ return new E({ status: 0, code: t.UNKNOWN, message: n, cause: e });
68
+ }
69
+ export {
70
+ g as toApiError
71
+ };
@@ -0,0 +1,35 @@
1
+ import { EmailBeEndPoints as a, EmailBeErrorCodes as s } from "../../../enums/email-be.js";
2
+ import { ApiError as i } from "../errors/ApiError.js";
3
+ import { handleApiError as c } from "../errors/handleApiError.js";
4
+ import { HtmlValidationResultSchema as m } from "../../../@types/email-be/html-validation.js";
5
+ import { base64EncodeWithSpecialChars as n } from "../../../utils/base64.js";
6
+ import { safeParse as d } from "../../../node_modules/valibot/dist/index.js";
7
+ const l = "[HTML_VALIDATION_SERVICE]", p = { maxRetries: 1, backoffMs: [500] };
8
+ class I {
9
+ constructor(t) {
10
+ this.http = t;
11
+ }
12
+ async validate({ html: t, syntax: o }) {
13
+ try {
14
+ const r = await this.http.request({
15
+ method: "POST",
16
+ url: a.HTML_VALIDATE,
17
+ body: { html: n(t), syntax: o },
18
+ retry: p
19
+ }), e = d(m, r);
20
+ if (!e.success)
21
+ throw new i({
22
+ status: 200,
23
+ code: s.INVALID_RESPONSE,
24
+ message: "Validate answered with an unexpected body",
25
+ cause: e.issues
26
+ });
27
+ return { ok: !0, data: e.output };
28
+ } catch (r) {
29
+ return { ok: !1, error: c(r, { context: `${l} validate` }) };
30
+ }
31
+ }
32
+ }
33
+ export {
34
+ I as HtmlValidationService
35
+ };
@@ -0,0 +1,6 @@
1
+ import { emailBeHttp as t } from "../http/index.js";
2
+ import { HtmlValidationService as i } from "./HtmlValidationService.js";
3
+ const m = new i(t);
4
+ export {
5
+ m as htmlValidationService
6
+ };
@@ -0,0 +1,68 @@
1
+ var u = Object.defineProperty;
2
+ var l = (r, t, e) => t in r ? u(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var o = (r, t, e) => l(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { toApiError as y } from "../errors/toApiError.js";
5
+ import { defaultRetryFor as d, shouldRetry as h, delay as p, backoffDelay as c } from "./RetryStack.js";
6
+ const f = 204, m = (r, t) => {
7
+ if (t === null || typeof t != "object" || Array.isArray(t))
8
+ return t;
9
+ const e = t;
10
+ return Object.fromEntries(Object.keys(e).sort().map((s) => [s, e[s]]));
11
+ };
12
+ function a(r) {
13
+ return r == null ? "" : typeof r == "string" ? r : JSON.stringify(r, m);
14
+ }
15
+ class w {
16
+ constructor(t, e) {
17
+ o(this, "inFlight", /* @__PURE__ */ new Map());
18
+ this.transport = t, this.defaults = e;
19
+ }
20
+ async request(t) {
21
+ return (await this.requestEnvelope(t)).data;
22
+ }
23
+ async requestEnvelope(t) {
24
+ if (!this.shouldDedup(t))
25
+ return this.executeWithRetry(t);
26
+ const e = this.buildKey(t), s = this.inFlight.get(e);
27
+ if (s)
28
+ return s;
29
+ const i = this.executeWithRetry(t);
30
+ this.inFlight.set(e, i);
31
+ try {
32
+ return await i;
33
+ } finally {
34
+ this.inFlight.delete(e);
35
+ }
36
+ }
37
+ buildKey(t) {
38
+ return [
39
+ t.method,
40
+ t.url,
41
+ a(t.params),
42
+ a(t.body)
43
+ ].join("|");
44
+ }
45
+ shouldDedup(t) {
46
+ return t.body instanceof FormData || t.dedup === !1 ? !1 : t.dedup === !0 || this.defaults.dedup && t.method === "GET";
47
+ }
48
+ resolveRetry(t) {
49
+ return t.retry === null ? null : t.retry ?? d(t.method, this.defaults.retry);
50
+ }
51
+ async executeWithRetry(t) {
52
+ const e = this.resolveRetry(t);
53
+ let s = 0;
54
+ for (; ; )
55
+ try {
56
+ const { status: i, data: n } = await this.transport.request(t);
57
+ return i === f || n === "" || n == null ? { data: void 0, meta: [] } : n;
58
+ } catch (i) {
59
+ const n = y(i);
60
+ if (!h(n, e, s))
61
+ throw n;
62
+ await p(c(e, s)), s += 1;
63
+ }
64
+ }
65
+ }
66
+ export {
67
+ w as HttpManager
68
+ };
@@ -0,0 +1,24 @@
1
+ import { EmailBeErrorCodes as f } from "../../../enums/email-be.js";
2
+ import { NetworkError as o } from "../errors/ApiError.js";
3
+ const r = /* @__PURE__ */ new Set(["GET", "PUT", "DELETE"]);
4
+ function a(t, e) {
5
+ return r.has(t) ? e : null;
6
+ }
7
+ function E(t, e, n) {
8
+ return !e || n >= e.maxRetries || t.authReported ? !1 : t instanceof o ? t.code !== f.TIMEOUT : t.status === 429 || t.status >= 500;
9
+ }
10
+ function i(t, e) {
11
+ const n = t.backoffMs[t.backoffMs.length - 1] ?? 0;
12
+ return t.backoffMs[e] ?? n;
13
+ }
14
+ function c(t) {
15
+ return new Promise((e) => {
16
+ setTimeout(e, t);
17
+ });
18
+ }
19
+ export {
20
+ i as backoffDelay,
21
+ a as defaultRetryFor,
22
+ c as delay,
23
+ E as shouldRetry
24
+ };
@@ -0,0 +1,61 @@
1
+ import { isPanelOrigin as u, reportAuthError as l } from "../../../composables/useAuthError.js";
2
+ import { getCsrfToken as p } from "../../../utils/genericUtil.js";
3
+ import { SessionExpiredError as h, TransportNetworkError as m, HttpStatusError as T } from "./transportErrors.js";
4
+ const w = 3e4, y = [401, 403, 419], S = ["POST", "PUT", "PATCH"], E = (t, s, e) => {
5
+ const o = new URLSearchParams();
6
+ Object.entries(e ?? {}).forEach(([i, r]) => {
7
+ r != null && o.append(i, String(r));
8
+ });
9
+ const n = o.toString();
10
+ return `${t}${s}${n ? `?${n}` : ""}`;
11
+ }, b = (t, s) => {
12
+ const e = {
13
+ Accept: "application/json",
14
+ "X-CSRF-TOKEN": p(),
15
+ // Without this a guest fetch gets a 302 to the login page, never an auth status.
16
+ "X-Requested-With": "XMLHttpRequest"
17
+ }, o = { method: t.method, headers: e, signal: s, credentials: "same-origin" };
18
+ return t.body !== void 0 && S.includes(t.method) && (t.body instanceof FormData ? o.body = t.body : (e["Content-Type"] = "application/json", o.body = JSON.stringify(t.body))), o;
19
+ }, f = (t) => {
20
+ if (t === "")
21
+ return null;
22
+ try {
23
+ return JSON.parse(t);
24
+ } catch {
25
+ return t;
26
+ }
27
+ }, O = (t, s, e) => {
28
+ try {
29
+ l(t, s, new URL(e, window.location.href).href);
30
+ } catch {
31
+ }
32
+ }, q = (t, s = w) => ({
33
+ async request(e) {
34
+ if (window.isSessionExpired)
35
+ throw new h();
36
+ const o = E(t, e.url, e.params), n = new AbortController(), i = setTimeout(() => n.abort(), e.timeoutMs ?? s);
37
+ let r, c;
38
+ try {
39
+ r = await fetch(o, b(e, n.signal)), c = await r.text();
40
+ } catch (a) {
41
+ throw new m(n.signal.aborted, a);
42
+ } finally {
43
+ clearTimeout(i);
44
+ }
45
+ const d = f(c);
46
+ if (!r.ok) {
47
+ const a = y.includes(r.status) && u(o);
48
+ throw a && O(r.status, c, o), new T(
49
+ r.status,
50
+ d,
51
+ r.headers.get("x-request-id") ?? "",
52
+ a
53
+ );
54
+ }
55
+ return { status: r.status, data: d };
56
+ }
57
+ });
58
+ export {
59
+ w as REQUEST_TIMEOUT_MS,
60
+ q as createFetchTransport
61
+ };
@@ -0,0 +1,10 @@
1
+ import { EMAIL_BE_BASE_URL as r } from "../../../enums/email-be.js";
2
+ import { createFetchTransport as t } from "./client.js";
3
+ import { HttpManager as e } from "./HttpManager.js";
4
+ const a = new e(t(r), {
5
+ retry: { maxRetries: 2, backoffMs: [250, 1e3] },
6
+ dedup: !0
7
+ });
8
+ export {
9
+ a as emailBeHttp
10
+ };
@@ -0,0 +1,20 @@
1
+ class i extends Error {
2
+ constructor(r, t, e, o) {
3
+ super(`HTTP Error: ${r}`), this.status = r, this.body = t, this.requestId = e, this.authReported = o, this.name = "HttpStatusError";
4
+ }
5
+ }
6
+ class n extends Error {
7
+ constructor(r, t) {
8
+ super(r ? "Request timeout" : "Network error"), this.isTimeout = r, this.cause = t, this.name = "TransportNetworkError";
9
+ }
10
+ }
11
+ class u extends Error {
12
+ constructor() {
13
+ super("Session expired"), this.name = "SessionExpiredError";
14
+ }
15
+ }
16
+ export {
17
+ i as HttpStatusError,
18
+ u as SessionExpiredError,
19
+ n as TransportNetworkError
20
+ };
@@ -384,6 +384,8 @@ export declare const UISchema: v.ObjectSchema<{
384
384
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
385
385
  /** Custom label for back button (if shown) */
386
386
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
387
+ /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
388
+ readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
387
389
  }, undefined>;
388
390
  /**
389
391
  * Features configuration - enable/disable editor features
@@ -811,6 +813,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
811
813
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
812
814
  /** Custom label for back button (if shown) */
813
815
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
816
+ /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
817
+ readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
814
818
  }, undefined>, {}>;
815
819
  /** Feature toggles */
816
820
  readonly features: v.OptionalSchema<v.ObjectSchema<{
@@ -0,0 +1,61 @@
1
+ import * as v from 'valibot';
2
+ export declare const DisplayConditionSyntaxSchema: v.PicklistSchema<["liquid", "pongo"], undefined>;
3
+ export declare const DisplayConditionMethodSchema: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
4
+ export declare const SavedDisplayConditionSchema: v.ObjectSchema<{
5
+ readonly id: v.NumberSchema<undefined>;
6
+ readonly name: v.StringSchema<undefined>;
7
+ readonly description: v.NullishSchema<v.StringSchema<undefined>, "">;
8
+ readonly syntax: v.PicklistSchema<["liquid", "pongo"], undefined>;
9
+ readonly method: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
10
+ readonly codeBefore: v.StringSchema<undefined>;
11
+ readonly codeAfter: v.NullishSchema<v.StringSchema<undefined>, "">;
12
+ readonly createdAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
13
+ }, undefined>;
14
+ export declare const DisplayConditionListResponseSchema: v.ObjectSchema<{
15
+ readonly data: v.ArraySchema<v.ObjectSchema<{
16
+ readonly id: v.NumberSchema<undefined>;
17
+ readonly name: v.StringSchema<undefined>;
18
+ readonly description: v.NullishSchema<v.StringSchema<undefined>, "">;
19
+ readonly syntax: v.PicklistSchema<["liquid", "pongo"], undefined>;
20
+ readonly method: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
21
+ readonly codeBefore: v.StringSchema<undefined>;
22
+ readonly codeAfter: v.NullishSchema<v.StringSchema<undefined>, "">;
23
+ readonly createdAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
24
+ }, undefined>, undefined>;
25
+ readonly meta: v.ObjectSchema<{
26
+ readonly totalCount: v.NumberSchema<undefined>;
27
+ readonly perPage: v.NumberSchema<undefined>;
28
+ readonly currentPage: v.NumberSchema<undefined>;
29
+ readonly lastPage: v.NumberSchema<undefined>;
30
+ }, undefined>;
31
+ }, undefined>;
32
+ export type DisplayConditionSyntax = v.InferOutput<typeof DisplayConditionSyntaxSchema>;
33
+ export type DisplayConditionMethod = v.InferOutput<typeof DisplayConditionMethodSchema>;
34
+ export type SavedDisplayCondition = v.InferOutput<typeof SavedDisplayConditionSchema>;
35
+ export type DisplayConditionListResponse = v.InferOutput<typeof DisplayConditionListResponseSchema>;
36
+ export interface DisplayConditionDraft {
37
+ name: string;
38
+ description: string;
39
+ codeBefore: string;
40
+ codeAfter: string;
41
+ }
42
+ /** Mirrors Stripo's `DisplayCondition`; kept local so Vue code does not import the Stripo package. */
43
+ export interface AppliedDisplayCondition {
44
+ id: number;
45
+ name: string;
46
+ description: string;
47
+ beforeScript: string;
48
+ afterScript: string;
49
+ extraData?: string;
50
+ type?: string;
51
+ }
52
+ export type DisplayConditionOpenMode = 'select' | 'create' | 'edit';
53
+ export type DisplayConditionListState = 'error' | 'empty' | 'no-result';
54
+ export interface DisplayConditionOpenDetail {
55
+ mode: DisplayConditionOpenMode;
56
+ current: AppliedDisplayCondition | null;
57
+ }
58
+ export interface DisplayConditionApplyDetail {
59
+ condition: AppliedDisplayCondition | null;
60
+ applied?: boolean;
61
+ }
@@ -0,0 +1,51 @@
1
+ import type { HtmlSyntaxValue } from '@@/Enums/email-be';
2
+ import * as v from 'valibot';
3
+ export declare const HtmlValidationErrorSchema: v.ObjectSchema<{
4
+ readonly code: v.StringSchema<undefined>;
5
+ readonly trans: v.ObjectSchema<{
6
+ readonly key: v.StringSchema<undefined>;
7
+ readonly replace: v.UnionSchema<[v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.SchemaWithPipe<readonly [v.TupleSchema<[], undefined>, v.TransformAction<[], {}>]>], undefined>;
8
+ }, undefined>;
9
+ readonly anchor: v.SchemaWithFallback<v.NullableSchema<v.ObjectSchema<{
10
+ readonly selector: v.StringSchema<undefined>;
11
+ readonly indexes: v.ArraySchema<v.NumberSchema<undefined>, undefined>;
12
+ }, undefined>, undefined>, null>;
13
+ readonly details: v.ArraySchema<v.StringSchema<undefined>, undefined>;
14
+ }, undefined>;
15
+ export declare const HtmlValidationResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
16
+ readonly valid: v.BooleanSchema<undefined>;
17
+ readonly errors: v.ArraySchema<v.ObjectSchema<{
18
+ readonly code: v.StringSchema<undefined>;
19
+ readonly trans: v.ObjectSchema<{
20
+ readonly key: v.StringSchema<undefined>;
21
+ readonly replace: v.UnionSchema<[v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.SchemaWithPipe<readonly [v.TupleSchema<[], undefined>, v.TransformAction<[], {}>]>], undefined>;
22
+ }, undefined>;
23
+ readonly anchor: v.SchemaWithFallback<v.NullableSchema<v.ObjectSchema<{
24
+ readonly selector: v.StringSchema<undefined>;
25
+ readonly indexes: v.ArraySchema<v.NumberSchema<undefined>, undefined>;
26
+ }, undefined>, undefined>, null>;
27
+ readonly details: v.ArraySchema<v.StringSchema<undefined>, undefined>;
28
+ }, undefined>, undefined>;
29
+ }, undefined>, v.CheckAction<{
30
+ valid: boolean;
31
+ errors: {
32
+ code: string;
33
+ trans: {
34
+ key: string;
35
+ replace: {
36
+ [x: string]: string | number;
37
+ } | {};
38
+ };
39
+ anchor: {
40
+ selector: string;
41
+ indexes: number[];
42
+ } | null;
43
+ details: string[];
44
+ }[];
45
+ }, "valid must match the error list">]>;
46
+ export type HtmlValidationError = v.InferOutput<typeof HtmlValidationErrorSchema>;
47
+ export type HtmlValidationResult = v.InferOutput<typeof HtmlValidationResultSchema>;
48
+ export type ValidateHtmlParams = {
49
+ html: string;
50
+ syntax: HtmlSyntaxValue;
51
+ };
@@ -0,0 +1,43 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ label: string;
4
+ value: string;
5
+ placeholder?: string;
6
+ error?: string;
7
+ disabled?: boolean;
8
+ };
9
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
10
+ placeholder: string;
11
+ error: string;
12
+ disabled: boolean;
13
+ }>, {
14
+ read: () => Promise<string>;
15
+ }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
16
+ input: (value: string) => void;
17
+ }, string, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
18
+ placeholder: string;
19
+ error: string;
20
+ disabled: boolean;
21
+ }>>>, {
22
+ error: string;
23
+ placeholder: string;
24
+ disabled: boolean;
25
+ }>;
26
+ export default _default;
27
+ type __VLS_WithDefaults<P, D> = {
28
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
29
+ default: D[K];
30
+ }> : P[K];
31
+ };
32
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
33
+ type __VLS_TypePropsToOption<T> = {
34
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
35
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
36
+ } : {
37
+ type: import('vue').PropType<T[K]>;
38
+ required: true;
39
+ };
40
+ };
41
+ type __VLS_PrettifyLocal<T> = {
42
+ [K in keyof T]: T[K];
43
+ } & {};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import type { DisplayConditionListState } from '@@/Types/display-condition';
2
+ type __VLS_Props = {
3
+ state: DisplayConditionListState;
4
+ };
5
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
6
+ retry: () => void;
7
+ create: () => void;
8
+ }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
9
+ export default _default;
10
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
11
+ type __VLS_TypePropsToOption<T> = {
12
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
13
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
14
+ } : {
15
+ type: import('vue').PropType<T[K]>;
16
+ required: true;
17
+ };
18
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ export default _default;
@@ -89,6 +89,7 @@ export declare const useConfig: () => {
89
89
  ui: {
90
90
  showHeader: boolean;
91
91
  backButtonLabel?: string | undefined;
92
+ externalDisplayConditions: boolean;
92
93
  };
93
94
  features: {
94
95
  dynamicContent: boolean;
@@ -232,6 +233,7 @@ export declare const useConfig: () => {
232
233
  ui: import("vue").ComputedRef<{
233
234
  showHeader: boolean;
234
235
  backButtonLabel?: string | undefined;
236
+ externalDisplayConditions: boolean;
235
237
  } | null>;
236
238
  features: import("vue").ComputedRef<{
237
239
  dynamicContent: boolean;