@useinsider/guido 3.21.0-beta.ff98fc3 → 3.21.1-beta.18ab939

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,68 +1,85 @@
1
- import { ModificationDescription as g } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { RECOMMENDATION_ID_ATTR as l } from "../constants/selectors.js";
3
- import { isPartnerManagedBlock as m, updateProductContentInPlace as d, regenerateProductRowsWithStyles as C } from "../controls/main/utils.js";
1
+ import { ModificationDescription as a } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { RECOMMENDATION_ID_ATTR as m } from "../constants/selectors.js";
3
+ import { isPartnerManagedBlock as y, updateProductContentInPlace as I, regenerateProductRowsWithStyles as N } from "../controls/main/utils.js";
4
4
  import { RecommendationConfigService as c } from "../services/configService.js";
5
- import { useRecommendationExtensionStore as y } from "../store/recommendation.js";
5
+ import { useRecommendationExtensionStore as O } from "../store/recommendation.js";
6
6
  let r = null;
7
- function M(n) {
8
- r = n;
7
+ function $(t) {
8
+ r = t;
9
9
  }
10
- function a(n) {
11
- const e = r == null ? void 0 : r.getDocumentRootHtmlNode();
12
- return !e || !("querySelector" in e) ? null : e.querySelector(`[${l}="${n}"]`) ?? null;
10
+ function C(t) {
11
+ const n = r == null ? void 0 : r.getDocumentRootHtmlNode();
12
+ return !n || !("querySelector" in n) ? null : n.querySelector(`[${m}="${t}"]`) ?? null;
13
13
  }
14
- function N(n, e) {
15
- const o = c.getConfig(n);
16
- return Object.keys(e).some((t) => JSON.stringify(o[t]) !== JSON.stringify(e[t]));
14
+ function D(t, n) {
15
+ const o = c.getConfig(t);
16
+ return Object.keys(n).some((e) => JSON.stringify(o[e]) !== JSON.stringify(n[e]));
17
17
  }
18
- function S(n, e) {
19
- const o = c.getConfig(n);
20
- return ["filters", "strategy", "strategyId", "size"].some((t) => t in e && JSON.stringify(o[t]) !== JSON.stringify(e[t]));
18
+ function R(t, n) {
19
+ const o = c.getConfig(t);
20
+ return ["filters", "strategy", "strategyId", "size", "productIds"].some((e) => e in n && JSON.stringify(o[e]) !== JSON.stringify(n[e]));
21
21
  }
22
- function P(n, e, o) {
23
- const t = a(n);
24
- return !r || !t ? !1 : (S(t, e) && c.updateConfig(r, t, e, o), !0);
22
+ const p = "Updated product IDs";
23
+ function S(t, n) {
24
+ if (!("productIds" in n))
25
+ return !1;
26
+ const o = c.getConfig(t);
27
+ return JSON.stringify(o.productIds) !== JSON.stringify(n.productIds);
28
+ }
29
+ function h(t, n, o) {
30
+ return S(t, n) ? p : o;
31
+ }
32
+ function k(t, n, o) {
33
+ const e = C(t);
34
+ if (!r || !e)
35
+ return !1;
36
+ if (R(e, n)) {
37
+ const i = h(e, n, o);
38
+ c.updateConfig(r, e, n, i);
39
+ }
40
+ return !0;
25
41
  }
26
- function p(n, e) {
27
- const o = y(), t = o.currentRecommendationId;
28
- if (t === n || !o.blockStates[n]) {
29
- e();
42
+ function P(t, n) {
43
+ const o = O(), e = o.currentRecommendationId;
44
+ if (e === t || !o.blockStates[t]) {
45
+ n();
30
46
  return;
31
47
  }
32
- o.setCurrentBlock(n);
48
+ o.setCurrentBlock(t);
33
49
  try {
34
- e();
50
+ n();
35
51
  } finally {
36
- o.$patch({ currentRecommendationId: t });
52
+ o.$patch({ currentRecommendationId: e });
37
53
  }
38
54
  }
39
- function I(n) {
40
- const e = r == null ? void 0 : r.getDocumentRootHtmlNode();
41
- return !e || !("querySelectorAll" in e) ? [] : e.querySelectorAll(`[${l}="${n}"]`).map((o) => c.getConfig(o));
55
+ function q(t) {
56
+ const n = r == null ? void 0 : r.getDocumentRootHtmlNode();
57
+ return !n || !("querySelectorAll" in n) ? [] : n.querySelectorAll(`[${m}="${t}"]`).map((o) => c.getConfig(o));
42
58
  }
43
- function $(n, e, o, t) {
44
- const i = a(n);
59
+ function w(t, n, o, e) {
60
+ const i = C(t);
45
61
  if (!r || !i)
46
62
  return !1;
47
- const f = r.getDocumentModifier(), s = N(i, e);
48
- if (c.stageConfig(f, i, e), m(i))
49
- return s && f.apply(new g(t)), !0;
63
+ const f = r.getDocumentModifier(), d = D(i, n), g = S(i, n), s = g ? p : e, l = { currentNode: i, documentModifier: f, products: o, ...g ? { description: s } : {} };
64
+ if (c.stageConfig(f, i, n), y(i))
65
+ return d && f.apply(new a(s)), !0;
50
66
  let u = !1;
51
- return p(n, () => {
52
- d({
53
- currentNode: i,
54
- documentModifier: f,
55
- products: o,
67
+ return P(t, () => {
68
+ I({
69
+ ...l,
56
70
  onApplied: () => {
57
71
  u = !0;
58
72
  }
59
- }) || (u = C({ currentNode: i, documentModifier: f, products: o }));
60
- }), !u && s && f.apply(new g(t)), !0;
73
+ }) || (u = N(l));
74
+ }), !u && d && f.apply(new a(s)), !0;
61
75
  }
62
76
  export {
63
- $ as commitBlockChangeOutsidePanel,
64
- S as hasEditedConfigChange,
65
- I as readBlockNodeConfigs,
66
- M as registerNodeConfigWriter,
67
- P as writeBlockConfigOutsidePanel
77
+ p as PRODUCT_IDS_DESCRIPTION,
78
+ w as commitBlockChangeOutsidePanel,
79
+ R as hasEditedConfigChange,
80
+ S as isProductIdsChange,
81
+ h as pickConfigDescription,
82
+ q as readBlockNodeConfigs,
83
+ $ as registerNodeConfigWriter,
84
+ k as writeBlockConfigOutsidePanel
68
85
  };
package/dist/library.js CHANGED
@@ -1,20 +1,22 @@
1
1
  import { default as a } from "./components/Guido.vue.js";
2
- import { MessageType as t, ProductType as d } from "./@types/config/schemas.js";
2
+ import { MessageType as t, ProductType as f } from "./@types/config/schemas.js";
3
3
  import "./@types/config/defaults.js";
4
- import { getValidationErrors as s, isValidConfig as p, parseConfig as g, parseConfigSafe as m, validateConfig as n } from "./@types/config/validator.js";
5
- import { assignTrackingIds as u, readTrackFloor as x, readTrackSeq as T } from "./utils/linkTrackingIds.js";
4
+ import { getValidationErrors as p, isValidConfig as s, parseConfig as m, parseConfigSafe as g, validateConfig as n } from "./@types/config/validator.js";
5
+ import { assignTrackingIds as l, readTrackFloor as x, readTrackSeq as c } from "./utils/linkTrackingIds.js";
6
6
  import { useGuidoEmailEditorStore as C } from "./stores/guido-email-editor.js";
7
+ import { prefetchGuidoRuntime as E } from "./utils/runtimePrefetch.js";
7
8
  export {
8
9
  a as Guido,
9
10
  t as MessageType,
10
- d as ProductType,
11
- u as assignTrackingIds,
12
- s as getValidationErrors,
13
- p as isValidConfig,
14
- g as parseConfig,
15
- m as parseConfigSafe,
11
+ f as ProductType,
12
+ l as assignTrackingIds,
13
+ p as getValidationErrors,
14
+ s as isValidConfig,
15
+ m as parseConfig,
16
+ g as parseConfigSafe,
17
+ E as prefetchGuidoRuntime,
16
18
  x as readTrackFloor,
17
- T as readTrackSeq,
19
+ c as readTrackSeq,
18
20
  C as useGuidoEmailEditorStore,
19
21
  n as validateConfig
20
22
  };
@@ -1,4 +1,4 @@
1
- const o = "3.21.0-beta.ff98fc3", s = { stripo: { version: "2.79.0" } }, t = {
1
+ const o = "3.21.1-beta.18ab939", s = { stripo: { version: "2.81.1" } }, t = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
@@ -0,0 +1,4 @@
1
+ import { prefetchGuidoRuntime as r } from "../utils/runtimePrefetch.js";
2
+ export {
3
+ r as prefetchGuidoRuntime
4
+ };
@@ -78,6 +78,8 @@ export declare class RecommendationBlockControl extends CommonControl {
78
78
  /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
79
79
  private _isPendingStrategyIdChange;
80
80
  private _capturePendingNodeConfigWrite;
81
+ /** The pending write only when it belongs to the node this panel draws: a duplicate focuses the copy. */
82
+ private _pendingWriteForNode;
81
83
  private _getNodeConfigUpdates;
82
84
  /**
83
85
  * Accumulates the pending write into `documentModifier` without applying, so the
@@ -103,6 +105,9 @@ export declare class RecommendationBlockControl extends CommonControl {
103
105
  * the intervening re-render staled, and saveConfig swallows that failure.
104
106
  */
105
107
  private _flushPendingNodeConfig;
108
+ private _cardsPredatePendingWrite;
109
+ /** The Product Ids label when the pending write moves the node's ids; the caller's default otherwise. */
110
+ private _pendingDescription;
106
111
  private _syncNodeConfigToStore;
107
112
  /**
108
113
  * Fetches initial data for a block in three phases:
@@ -156,6 +161,7 @@ export declare class RecommendationBlockControl extends CommonControl {
156
161
  private _debouncedRegenerateWithProducts;
157
162
  /** Draws the current block's products into this panel's node. */
158
163
  private _regenerateWithProducts;
164
+ private _consumePendingNodeConfig;
159
165
  /**
160
166
  * Listen to store changes that require product refresh or regeneration.
161
167
  *
@@ -26,6 +26,8 @@ export declare const PRODUCT_LAYOUT_CONTROL_ID = "recommendation-product-layout-
26
26
  export declare class ProductLayoutControl extends CommonControl {
27
27
  private store;
28
28
  private storeUnsubscription;
29
+ private pendingMobileLayoutEnabled;
30
+ private pendingMobileLayoutBlockId;
29
31
  getId(): string;
30
32
  getTemplate(): string;
31
33
  onRender(): void;
@@ -37,7 +39,8 @@ export declare class ProductLayoutControl extends CommonControl {
37
39
  */
38
40
  _syncDisabledState(): void;
39
41
  onDestroy(): void;
40
- _setFormValues(): void;
42
+ _getBlockId(node: ImmutableHtmlNode | null | undefined): string | null;
43
+ _setFormValues(config?: import("../../types").RecommendationNodeConfig): void;
41
44
  /**
42
45
  * Returns true when the editor preview is in mobile mode.
43
46
  */
@@ -53,7 +56,7 @@ export declare class ProductLayoutControl extends CommonControl {
53
56
  * Only one row is visible at a time. This avoids setUIEAttribute on hidden
54
57
  * elements, which Stripo does not apply reliably.
55
58
  */
56
- _updateProductsInRowVisibility(): void;
59
+ _updateProductsInRowVisibility(config?: import("../../types").RecommendationNodeConfig): void;
57
60
  /**
58
61
  * Initializes the mobile layout toggle using the same pattern as shuffle.ts.
59
62
  * Sets the initial UI attribute value from the node config.
@@ -69,6 +69,8 @@ export interface RegenerateProductRowsOptions {
69
69
  layout?: Orientation;
70
70
  /** Optional: pass composition directly to avoid stale DOM reads after setAttribute */
71
71
  composition?: string[];
72
+ /** Optional: pass mobileLayoutEnabled directly to avoid stale node config reads after apply */
73
+ mobileLayoutEnabled?: boolean;
72
74
  }
73
75
  export declare function getMainContainerTbody(currentNode: ImmutableHtmlNode): ImmutableHtmlNode | null;
74
76
  /**
@@ -88,6 +90,8 @@ export interface RegenerateWithStylesOptions extends Omit<RegenerateProductRowsO
88
90
  products?: RecommendationProduct[];
89
91
  /** Optional: pass layout directly to avoid stale DOM reads after setAttribute */
90
92
  layout?: Orientation;
93
+ /** Undo label for the apply; the caller sets it when a config change rides in the same batch */
94
+ description?: string;
91
95
  }
92
96
  /**
93
97
  * Regenerates product rows while preserving user-applied styles, in a SINGLE commit.
@@ -156,6 +160,8 @@ export interface UpdateProductContentInPlaceOptions {
156
160
  * leaves anything a caller staged into the same batch unwritten unless it applies itself.
157
161
  */
158
162
  onApplied?: () => void;
163
+ /** Undo label for the apply; the caller sets it when a config change rides in the same batch */
164
+ description?: string;
159
165
  }
160
166
  /**
161
167
  * Updates product content in-place without regenerating HTML structure.
@@ -14,6 +14,10 @@ interface ConfigWriterApi {
14
14
  */
15
15
  export declare function registerNodeConfigWriter(api: ConfigWriterApi): void;
16
16
  export declare function hasEditedConfigChange(node: ImmutableHtmlNode, updates: PartialNodeConfig): boolean;
17
+ export declare const PRODUCT_IDS_DESCRIPTION = "Updated product IDs";
18
+ /** A deferred Product Ids edit keeps its own undo label wherever the write finally lands. */
19
+ export declare function isProductIdsChange(node: ImmutableHtmlNode, updates: PartialNodeConfig): boolean;
20
+ export declare function pickConfigDescription(node: ImmutableHtmlNode, updates: PartialNodeConfig, fallback: string): string;
17
21
  /**
18
22
  * Writes a config change to the block's node on its own, found by id — never through a
19
23
  * panel-held node, which may already belong to the block the user switched to.
@@ -4,5 +4,6 @@ export { validateConfig, parseConfig, parseConfigSafe, isValidConfig, getValidat
4
4
  export { assignTrackingIds, readTrackFloor, readTrackSeq } from './public/trackingIds';
5
5
  export { useGuidoEmailEditorStore } from './public/editorState';
6
6
  export type { GuidoEmailEditorState } from './public/editorState';
7
+ export { prefetchGuidoRuntime } from './public/prefetchRuntime';
7
8
  export type { StripoEventType } from './@types/events';
8
9
  export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, DynamicContentNode, DynamicContentList, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
@@ -0,0 +1 @@
1
+ export { prefetchGuidoRuntime } from '../utils/runtimePrefetch';
@@ -0,0 +1,4 @@
1
+ export type RuntimePrefetchState = 'none' | 'pending' | 'done';
2
+ export declare const RUNTIME_PREFETCH_ATTRIBUTE = "data-guido-prefetch";
3
+ export declare const prefetchGuidoRuntime: () => void;
4
+ export declare const readRuntimePrefetchState: () => RuntimePrefetchState;
@@ -0,0 +1,2 @@
1
+ /** Null when package.json does not pin `guido.stripo.version`. */
2
+ export declare const getStripoRuntimeBaseUrl: () => string | null;
@@ -0,0 +1,9 @@
1
+ const s = "2.79.0", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-MFU2R4FE.js", "chunk-2PIEA5YN.js", "chunk-5FVAINMG.js", "chunk-67OKDPNA.js", "chunk-BEE4NTMB.js", "chunk-FXMA33WF.js", "chunk-HEM7M3GC.js", "chunk-IP346EOD.js", "chunk-J3Q2HMUE.js", "chunk-JER72PP5.js", "chunk-LXRTAID3.js", "chunk-MV5VZJ34.js", "chunk-RTXKBDZV.js", "chunk-UQMM7Q74.js", "chunk-WCDYHSTN.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], c = {
2
+ version: s,
3
+ files: n
4
+ };
5
+ export {
6
+ c as default,
7
+ n as files,
8
+ s as version
9
+ };
@@ -10,6 +10,11 @@ ue-tabs-header .tabs-header {
10
10
  margin: 16px 16px 0;
11
11
  }
12
12
 
13
+ /* Stripo 2.81.0 sets margin: 15px 20px here; keep the 16px panel inset and its gap above the new divider. */
14
+ ue-control-panel .control-panel-card .control-panel-tabs .tabs-header {
15
+ margin: 16px 16px 15px;
16
+ }
17
+
13
18
  ue-tabs-header .tabs-header button {
14
19
  background-color: var(--guido-color-gray-0);
15
20
  outline: none;
@@ -0,0 +1,26 @@
1
+ import s from "../static/stripo-runtime-manifest.json.js";
2
+ import { getStripoRuntimeBaseUrl as c } from "./stripoRuntime.js";
3
+ const r = "data-guido-prefetch", d = "pending", o = "settled", i = `link[${r}]`, u = ["slow-2g", "2g"], l = /\.(?:js|json)$/, a = () => document.getElementById("UiEditorScript") !== null || window.UIEditor !== void 0, E = () => {
4
+ const { connection: e } = navigator;
5
+ return (e == null ? void 0 : e.saveData) === !0 || u.includes((e == null ? void 0 : e.effectiveType) ?? "");
6
+ }, m = (e) => {
7
+ const t = document.createElement("link"), n = () => t.setAttribute(r, o);
8
+ t.rel = "prefetch", t.href = e, l.test(e) && t.setAttribute("crossorigin", "anonymous"), t.setAttribute(r, d), t.addEventListener("load", n, { once: !0 }), t.addEventListener("error", n, { once: !0 }), document.head.appendChild(t);
9
+ }, T = () => {
10
+ try {
11
+ const e = c(), t = document.querySelector(i) !== null;
12
+ if (!e || t || a() || E())
13
+ return;
14
+ s.files.forEach((n) => m(`${e}${n}`));
15
+ } catch (e) {
16
+ console.debug("guido: runtime prefetch skipped", e);
17
+ }
18
+ }, g = () => {
19
+ const e = Array.from(document.querySelectorAll(i));
20
+ return e.length ? e.every((t) => t.getAttribute(r) === o) ? "done" : "pending" : "none";
21
+ };
22
+ export {
23
+ r as RUNTIME_PREFETCH_ATTRIBUTE,
24
+ T as prefetchGuidoRuntime,
25
+ g as readRuntimePrefetchState
26
+ };
@@ -0,0 +1,9 @@
1
+ import r from "../package.json.js";
2
+ const e = "https://email-static.useinsider.com/guido/", n = () => {
3
+ var s;
4
+ const t = r.guido, o = (s = t == null ? void 0 : t.stripo) == null ? void 0 : s.version;
5
+ return o ? `${e}${o}/` : null;
6
+ };
7
+ export {
8
+ n as getStripoRuntimeBaseUrl
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.21.0-beta.ff98fc3",
3
+ "version": "3.21.1-beta.18ab939",
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",
@@ -22,6 +22,10 @@
22
22
  "types": "./dist/src/public/editorState.d.ts",
23
23
  "import": "./dist/public/editorState.js"
24
24
  },
25
+ "./prefetch": {
26
+ "types": "./dist/src/public/prefetchRuntime.d.ts",
27
+ "import": "./dist/public/prefetchRuntime.js"
28
+ },
25
29
  "./style": "./dist/guido.css"
26
30
  },
27
31
  "scripts": {
@@ -45,6 +49,7 @@
45
49
  "coverage:e2e:report": "nyc report --reporter=lcov --reporter=text-summary --report-dir=coverage/e2e",
46
50
  "test:mutation": "stryker run",
47
51
  "test:mutation:since": "CHANGED=$(git diff --name-only --diff-filter=AMR origin/develop...HEAD -- 'src/**/*.ts' ':(glob)src/components/organisms/onboarding/**/*.vue' ':(glob)src/components/organisms/header/**/*.vue' ':(glob)src/components/organisms/unsubscribe/**/*.vue' ':(glob)src/components/organisms/save-as-template/**/*.vue' ':(glob)src/components/organisms/email-preview/**/*.vue' ':(glob)src/components/wrappers/**/*.vue' 'src/components/Guido.vue' ':(exclude)src/**/*.test.ts' ':(exclude)src/**/index.ts' ':(exclude)src/@types/**' ':(exclude)src/enums/**' ':(exclude)src/mock/**' ':(exclude)src/**/_Boilerplate/**' | paste -sd, -); if [ -n \"$CHANGED\" ]; then stryker run --incremental --mutate \"$CHANGED\"; else echo \"No changed mutatable src files vs origin/develop\"; fi",
52
+ "stripo:manifest": "node scripts/stripo-runtime-manifest.mjs",
48
53
  "prepare": "husky",
49
54
  "preinstall": "rm -rf ./node_modules/.vite"
50
55
  },
@@ -123,7 +128,7 @@
123
128
  },
124
129
  "guido": {
125
130
  "stripo": {
126
- "version": "2.79.0"
131
+ "version": "2.81.1"
127
132
  }
128
133
  }
129
134
  }