@useinsider/guido 3.19.0-beta.f05f865 → 3.19.0-beta.f4a9ef5

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,17 +1,17 @@
1
1
  import { useConfig as E } from "./useConfig.js";
2
- import { useEditorLock as p } from "./useEditorLock.js";
3
- import { useAutosaveStore as A, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
4
- import { useEditorStore as f } from "../stores/editor.js";
2
+ import { useEditorLock as f } from "./useEditorLock.js";
3
+ import { useAutosaveStore as p, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
4
+ import { useEditorStore as A } from "../stores/editor.js";
5
5
  import { computed as y, watch as I, onUnmounted as L } from "vue";
6
6
  const w = 18e4, v = 6e4, R = (b) => {
7
- const { isFeatureEnabled: S } = E(), o = f(), t = A(), { isEditorBusy: g } = p();
7
+ const { isFeatureEnabled: S } = E(), o = A(), t = p(), { isEditorBusy: g } = f();
8
8
  let i = null, c = 0;
9
9
  const u = y(
10
10
  () => S("autosave") && t.isOn
11
11
  ), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
12
12
  hasChanges: o.hasChanges,
13
13
  isInSaveableState: o.isInSaveableState
14
- }), r = async (e) => {
14
+ }), l = async (e) => {
15
15
  if (!u.value) {
16
16
  console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
17
17
  return;
@@ -28,7 +28,7 @@ const w = 18e4, v = 6e4, R = (b) => {
28
28
  console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
29
29
  return;
30
30
  }
31
- console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
31
+ e === "visibility" && (c = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
32
32
  try {
33
33
  if (await b() === void 0) {
34
34
  console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
@@ -53,22 +53,22 @@ const w = 18e4, v = 6e4, R = (b) => {
53
53
  });
54
54
  return;
55
55
  }
56
- c = Date.now(), r("visibility");
56
+ l("visibility");
57
57
  }, d = () => {
58
58
  i && (clearInterval(i), i = null);
59
- }, l = () => {
59
+ }, r = () => {
60
60
  document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
61
61
  };
62
62
  I(
63
63
  u,
64
64
  (e) => {
65
65
  console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
66
- console.debug("guido:autosave:interval-tick"), r("interval");
67
- }, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), l(), t.status = s.IDLE);
66
+ console.debug("guido:autosave:interval-tick"), l("interval");
67
+ }, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), r(), t.status = s.IDLE);
68
68
  },
69
69
  { immediate: !0 }
70
70
  ), L(() => {
71
- d(), l(), t.status = s.IDLE, t.lastSavedAt = null;
71
+ d(), r(), t.status = s.IDLE, t.lastSavedAt = null;
72
72
  });
73
73
  };
74
74
  export {
@@ -1,6 +1,6 @@
1
1
  import { BlockId as f } from "../../enums/block.js";
2
- import { DEFAULT_NODE_CONFIG as b } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
- import { ATTR_RECOMMENDATION_TITLE as y } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ import { DEFAULT_NODE_CONFIG as y } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
+ import { ATTR_RECOMMENDATION_TITLE as b } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
4
  import { useTemplateStore as T } from "../../stores/template.js";
5
5
  import { mapComposition as v } from "./recommendation/compositionMapper.js";
6
6
  import { extractCurrencyFromBlock as C, extractTitleText as M, hasVisibleTitle as R, extractCardBgColor as S, isPartnerManagedBlock as h } from "./recommendation/extractors.js";
@@ -8,28 +8,28 @@ import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
8
8
  import { parseRecommendationId as x, parseLegacyConfig as E } from "./recommendation/parseLegacyConfig.js";
9
9
  import { mapSettings as A } from "./recommendation/settingsMapper.js";
10
10
  const H = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
11
- function B(n, t, a) {
11
+ function B(n, t, c) {
12
12
  var l;
13
- const o = x(t);
14
- if (o === null)
13
+ const r = x(t);
14
+ if (r === null)
15
15
  return console.warn(
16
16
  "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
17
17
  ), !1;
18
- const r = E(t);
19
- if (!r)
18
+ const o = E(t);
19
+ if (!o)
20
20
  return console.warn(
21
- `[RecommendationMigrator] Aborting block id=${o} — \`esd-dev-product-config\` missing or unable to be parsed`
21
+ `[RecommendationMigrator] Aborting block id=${r} — \`esd-dev-product-config\` missing or unable to be parsed`
22
22
  ), !1;
23
- const i = a[String(o)] ?? {
23
+ const a = c[String(r)] ?? {
24
24
  currencySettings: C(t)
25
- }, c = A(i, r, o), e = v((l = r.composition) == null ? void 0 : l.variables), d = M(t);
26
- e.titleVariable || (e.visibility[y] = R(t));
25
+ }, i = A(a, o, r), e = v((l = o.composition) == null ? void 0 : l.variables), d = M(t);
26
+ e.titleVariable || (e.visibility[b] = R(t));
27
27
  const p = S(t), g = {
28
- ...c,
28
+ ...i,
29
29
  strategyId: "",
30
30
  composition: e.composition,
31
31
  visibility: e.visibility,
32
- previousTitleHtml: b.previousTitleHtml,
32
+ previousTitleHtml: y.previousTitleHtml,
33
33
  textTrimming: e.anyTextTrimming
34
34
  }, m = h(t), u = `
35
35
  <table>
@@ -56,30 +56,37 @@ function B(n, t, a) {
56
56
  </table>
57
57
  `, s = n.parseFromString(u, "text/html").querySelector("td.esd-structure");
58
58
  return !s || !t.parentNode ? (console.warn(
59
- `[RecommendationMigrator] Aborting block id=${o} — failed to construct new HTML element`
59
+ `[RecommendationMigrator] Aborting block id=${r} — failed to construct new HTML element`
60
60
  ), !1) : (t.parentNode.replaceChild(s, t), !0);
61
61
  }
62
62
  function G(n, t = {}) {
63
- const a = new DOMParser(), o = a.parseFromString(n, "text/html"), r = Array.from(o.querySelectorAll(H));
63
+ const c = new DOMParser();
64
+ let r;
65
+ try {
66
+ r = c.parseFromString(n, "text/html");
67
+ } catch (i) {
68
+ return console.error("[RecommendationMigrator] Failed to parse template:", i), n;
69
+ }
70
+ const o = Array.from(r.querySelectorAll(H));
64
71
  try {
65
72
  T().$patch((e) => {
66
73
  e.migrations = {
67
74
  ...e.migrations,
68
- [f.Recommendation]: r.length
75
+ [f.Recommendation]: o.length
69
76
  };
70
77
  });
71
78
  } catch {
72
79
  }
73
- if (r.length === 0)
80
+ if (o.length === 0)
74
81
  return n;
75
- let i = 0;
76
- return r.forEach((c) => {
82
+ let a = 0;
83
+ return o.forEach((i) => {
77
84
  try {
78
- B(a, c, t) && (i += 1);
85
+ B(c, i, t) && (a += 1);
79
86
  } catch (e) {
80
87
  console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
81
88
  }
82
- }), i > 0 && console.info(`[RecommendationMigrator] Migrated ${i} legacy Recommendation block(s)`), o.documentElement.outerHTML;
89
+ }), a > 0 && console.info(`[RecommendationMigrator] Migrated ${a} legacy Recommendation block(s)`), r.documentElement.outerHTML;
83
90
  }
84
91
  export {
85
92
  G as migrateRecommendation
@@ -1,50 +1,56 @@
1
- import { RECOMMENDATION_ID_ATTR as f, SELECTOR_ATTRIBUTE_ROW as _, ATTR_DATA_ATTRIBUTE_TYPE as a, ATTR_CUSTOM_PREFIX as g, ATTR_DATA_CARD_COMPOSITION as O, ATTR_DATA_CUSTOM_ATTRIBUTES as R } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
2
- import { carriesForeignPartnerConfig as m, canJudgeUnstampedBlock as E, withoutCustomAttributes as d } from "../../extensions/Blocks/Recommendation/utils/partnerScope.js";
3
- const S = ".recommendation-block-v2[esd-ext-config]", c = "esd-ext-config";
4
- function C(t) {
5
- const e = t.getAttribute(c);
6
- if (!e)
1
+ import { RECOMMENDATION_ID_ATTR as a, SELECTOR_ATTRIBUTE_ROW as f, ATTR_DATA_ATTRIBUTE_TYPE as _, ATTR_CUSTOM_PREFIX as g, ATTR_DATA_CARD_COMPOSITION as m, ATTR_DATA_CUSTOM_ATTRIBUTES as R } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ import { carriesForeignPartnerConfig as O, canJudgeUnstampedBlock as d, withoutCustomAttributes as l } from "../../extensions/Blocks/Recommendation/utils/partnerScope.js";
3
+ const E = ".recommendation-block-v2[esd-ext-config]", T = "esd-ext-config";
4
+ function S(t) {
5
+ const r = t.getAttribute(T);
6
+ if (!r)
7
7
  return null;
8
8
  try {
9
- const r = JSON.parse(e);
10
- return r && typeof r == "object" && !Array.isArray(r) ? r : null;
9
+ const e = JSON.parse(r);
10
+ return e && typeof e == "object" && !Array.isArray(e) ? e : null;
11
11
  } catch {
12
12
  return null;
13
13
  }
14
14
  }
15
- function I(t, e, r) {
16
- const o = d(e.composition ?? []);
17
- t.querySelectorAll(_).forEach((i) => {
18
- var s;
19
- (s = i.getAttribute(a)) != null && s.startsWith(g) && i.remove();
20
- }), t.setAttribute(O, o.join(",")), t.setAttribute(R, "[]"), t.setAttribute(c, JSON.stringify({
21
- ...e,
15
+ function p(t, r, e) {
16
+ const s = l(r.composition ?? []);
17
+ t.querySelectorAll(f).forEach((o) => {
18
+ var u;
19
+ (u = o.getAttribute(_)) != null && u.startsWith(g) && o.remove();
20
+ }), t.setAttribute(m, s.join(",")), t.setAttribute(R, "[]"), t.setAttribute(T, JSON.stringify({
21
+ ...r,
22
22
  strategyId: "",
23
23
  strategy: "",
24
24
  filters: [],
25
25
  productIds: [],
26
- composition: o,
27
- partnerName: r
26
+ composition: s,
27
+ partnerName: e
28
28
  }));
29
29
  }
30
- function p(t, { partnerName: e, campaignUrls: r, rrsEnabled: o }) {
31
- if (!e)
30
+ function I(t, { partnerName: r, campaignUrls: e, rrsEnabled: s }) {
31
+ if (!r)
32
32
  return t;
33
- const i = new DOMParser().parseFromString(t, "text/html"), s = Array.from(i.querySelectorAll(S));
34
- if (s.length === 0)
33
+ let o;
34
+ try {
35
+ o = new DOMParser().parseFromString(t, "text/html");
36
+ } catch (n) {
37
+ return console.error("[RecommendationPartnerMigrator] Failed to parse template:", n), t;
38
+ }
39
+ const u = Array.from(o.querySelectorAll(E));
40
+ if (u.length === 0)
35
41
  return t;
36
- let T = 0;
37
- return s.forEach((u) => {
38
- const n = C(u), A = Number(u.getAttribute(f));
39
- if (!(!n || !Number.isFinite(A))) {
40
- if (m({ config: n, blockId: A, partnerName: e, campaignUrls: r, rrsEnabled: o })) {
41
- I(u, n, e), T += 1;
42
+ let c = 0;
43
+ return u.forEach((n) => {
44
+ const i = S(n), A = Number(n.getAttribute(a));
45
+ if (!(!i || !Number.isFinite(A))) {
46
+ if (O({ config: i, blockId: A, partnerName: r, campaignUrls: e, rrsEnabled: s })) {
47
+ p(n, i, r), c += 1;
42
48
  return;
43
49
  }
44
- n.partnerName || !E({ config: n, campaignUrls: r, rrsEnabled: o }) || (u.setAttribute(c, JSON.stringify({ ...n, partnerName: e })), T += 1);
50
+ i.partnerName || !d({ config: i, campaignUrls: e, rrsEnabled: s }) || (n.setAttribute(T, JSON.stringify({ ...i, partnerName: r })), c += 1);
45
51
  }
46
- }), T > 0 ? i.documentElement.outerHTML : t;
52
+ }), c > 0 ? o.documentElement.outerHTML : t;
47
53
  }
48
54
  export {
49
- p as migrateRecommendationPartnerScope
55
+ I as migrateRecommendationPartnerScope
50
56
  };
@@ -19,6 +19,8 @@ export declare const provideGuidoActions: (actions: {
19
19
  }) => void;
20
20
  /**
21
21
  * Provides individual Guido action handlers
22
+ * @deprecated No consumer in src/ and not exported from library.ts — provideGuidoActions
23
+ * provides all four keys itself. Slated for deletion, see the SD-667788 dead-code ledger.
22
24
  */
23
25
  export declare const provideBackHandler: (handler: BackHandler) => void;
24
26
  export declare const provideSaveStartHandler: (handler: SaveStartHandler) => void;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Dev-harness stand-in for the cortex-fe MFE's shared `chat` store.
3
+ *
4
+ * `useCortexBlueprintBridge` resolves that store by id off the host's pinia at
5
+ * Guido's setup time, so a store registered after mount is never seen. Installing
6
+ * it here — before `<Guido>` renders — lets e2e drive the bridge through its real
7
+ * registration path instead of re-invoking the composable by hand.
8
+ *
9
+ * Activated with `?chatStore=true`; the instance is exposed on `window` so a test
10
+ * can push agent messages into it.
11
+ */
12
+ export declare const installMockChatStore: () => void;
@@ -1,5 +1,6 @@
1
1
  import type { OnboardingCardConfig, OnboardingType, OnboardingStoreState } from '@@/Types/onboarding';
2
2
  export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoOnboarding", OnboardingStoreState, {
3
+ /** @deprecated Components use the type-specific getters. Slated for deletion, see the SD-667788 dead-code ledger. */
3
4
  getOnboarding: (state: {
4
5
  onboardings: {
5
6
  newVersionPopup: {
@@ -390,6 +391,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
390
391
  };
391
392
  isFetched: boolean;
392
393
  } & import("pinia").PiniaCustomStateProperties<OnboardingStoreState>) => (type: OnboardingType) => boolean;
394
+ /** @deprecated Components use getGenericCurrentCard / getTextBlockCurrentCard. Slated for deletion, see the SD-667788 dead-code ledger. */
393
395
  getCurrentCard: (state: {
394
396
  onboardings: {
395
397
  newVersionPopup: {
@@ -2190,6 +2192,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
2190
2192
  close(type: OnboardingType): Promise<void>;
2191
2193
  next(type: OnboardingType): void;
2192
2194
  previous(type: OnboardingType): void;
2195
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
2193
2196
  updateCardPosition(type: OnboardingType, cardIndex: number, position: {
2194
2197
  top: string;
2195
2198
  position: string;
@@ -2198,6 +2201,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
2198
2201
  onDiscoverNowClicked(): Promise<void>;
2199
2202
  onRemindMeLater(): void;
2200
2203
  onNewVersionPopupClose(): Promise<void>;
2204
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
2201
2205
  isOnboardingActive(): boolean;
2202
2206
  fetchUserModalState(): Promise<void>;
2203
2207
  setUserModalState(modal: string, state: string, page: string): Promise<void>;
@@ -6,5 +6,10 @@ type RecommendationConfig = {
6
6
  interface StoreState {
7
7
  recommendationConfigs: RecommendationConfig[];
8
8
  }
9
+ /**
10
+ * @deprecated recommendationConfigs has no writer in src/, so the store is
11
+ * permanently empty and its only readers (useHtmlValidator.ts:496-497) are a
12
+ * no-op. Slated for deletion, see the SD-667788 dead-code ledger.
13
+ */
9
14
  export declare const useRecommendationStore: import("pinia").StoreDefinition<"guidoRecommendation", StoreState, {}, {}>;
10
15
  export {};
@@ -3,12 +3,22 @@
3
3
  * en-US -> MM/DD/YYYY
4
4
  * en-GB -> DD/MM/YYYY
5
5
  * tr-TR -> DD.MM.YYYY
6
+ *
7
+ * The non-string branches below are unreachable: the only caller chain is
8
+ * formatShortDate -> AssignStrategyDrawer.vue:74, which passes a non-empty string.
9
+ * The function itself is live — do not delete it with them.
6
10
  */
7
11
  export declare const convertToDateObject: (date: string | number | Date | null | undefined) => Date;
8
12
  export declare const locale: () => string;
9
13
  export declare const localTz: string;
10
14
  export declare const timezone: () => string;
15
+ /**
16
+ * @deprecated No caller in src/ and not exported from library.ts. Slated for deletion, see the SD-667788 dead-code ledger.
17
+ */
11
18
  export declare const hour12: () => boolean;
19
+ /**
20
+ * @deprecated No caller in src/ and not exported from library.ts. Slated for deletion, see the SD-667788 dead-code ledger.
21
+ */
12
22
  export declare const dateFormat: () => string;
13
23
  /**
14
24
  * @example 04/22/2024
@@ -24,6 +24,9 @@ export declare const getCsrfToken: () => string;
24
24
  */
25
25
  export declare const getUrlParams: () => URLSearchParams;
26
26
  export declare const getUrlParam: (paramName: string, defaultValue?: string) => string;
27
+ /**
28
+ * @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger.
29
+ */
27
30
  export declare const replaceString: (string?: string, values?: Record<string, string | number>, isRemoveEmptyValues?: boolean) => string;
28
31
  /**
29
32
  * Narrows an unknown API value to a printable string; anything that is neither
@@ -20,8 +20,10 @@ const t = () => ({
20
20
  }), c = s("guidoOnboarding", {
21
21
  state: () => a(),
22
22
  getters: {
23
+ /** @deprecated Components use the type-specific getters. Slated for deletion, see the SD-667788 dead-code ledger. */
23
24
  getOnboarding: (n) => (o) => n.onboardings[o],
24
25
  isActive: (n) => (o) => n.onboardings[o].isActive,
26
+ /** @deprecated Components use getGenericCurrentCard / getTextBlockCurrentCard. Slated for deletion, see the SD-667788 dead-code ledger. */
25
27
  getCurrentCard: (n) => (o) => {
26
28
  const i = n.onboardings[o];
27
29
  return i.config[i.cardIndex];
@@ -81,6 +83,7 @@ const t = () => ({
81
83
  previous(n) {
82
84
  this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
83
85
  },
86
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
84
87
  updateCardPosition(n, o, i) {
85
88
  const r = this.onboardings[n].config[o];
86
89
  r && (r.top = i.top, r.position = i.position);
@@ -97,6 +100,7 @@ const t = () => ({
97
100
  async onNewVersionPopupClose() {
98
101
  await this.setUserModalState("newVersionPopup", "true", "Guido");
99
102
  },
103
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
100
104
  isOnboardingActive() {
101
105
  return Object.values(this.onboardings).some((n) => n.isActive);
102
106
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.19.0-beta.f05f865",
3
+ "version": "3.19.0-beta.f4a9ef5",
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",