@useinsider/guido 3.18.1-beta.280b4e1 → 3.18.1-beta.2b89365

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,54 +1,59 @@
1
- import { useActionsApi as b } from "./useActionsApi.js";
2
- import { useEditorLock as v } from "./useEditorLock.js";
1
+ import { useActionsApi as v } from "./useActionsApi.js";
2
+ import { useEditorLock as C } from "./useEditorLock.js";
3
3
  import { useConfigStore as T } from "../stores/config.js";
4
4
  import { useEditorStore as w } from "../stores/editor.js";
5
5
  import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
6
- import { watch as a, onUnmounted as B } from "vue";
7
- const C = 500, L = () => {
8
- const i = w(), u = y(), l = T(), { getTemplateData: d } = b(), { runExclusive: m, isEditorBusy: p } = v();
9
- let o = null, s = !1;
10
- const n = () => {
6
+ import { watch as c, onUnmounted as z } from "vue";
7
+ const B = 500, G = () => {
8
+ const i = w(), u = y(), d = T(), { getTemplateData: l } = v(), { runExclusive: m, isEditorBusy: p } = C();
9
+ let o = null, n = !1;
10
+ const r = () => {
11
11
  o && (clearTimeout(o), o = null);
12
- }, c = (t) => {
13
- n(), o = setTimeout(() => {
12
+ }, a = (t) => {
13
+ r(), o = setTimeout(() => {
14
14
  o = null, t();
15
- }, C);
15
+ }, B);
16
16
  }, e = async () => {
17
- var t, r;
18
- if (!(s || !i.isStripoInitialized)) {
17
+ var t, s;
18
+ if (!(n || !i.isStripoInitialized)) {
19
19
  if (p()) {
20
- c(() => void e());
20
+ a(() => void e());
21
21
  return;
22
22
  }
23
23
  try {
24
- const { html: E, css: g } = await m(d), I = ((r = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : r.templateId) ?? "";
25
- if (s)
24
+ const { html: E, css: I } = await m(l), b = ((s = (t = d.config) == null ? void 0 : t.identity) == null ? void 0 : s.templateId) ?? "";
25
+ if (n)
26
26
  return;
27
27
  u.$patch({
28
28
  html: E ?? "",
29
- css: g ?? "",
30
- templateId: I,
29
+ css: I ?? "",
30
+ templateId: b,
31
31
  lastUpdatedAt: Date.now()
32
32
  });
33
33
  } catch {
34
34
  }
35
35
  }
36
- }, f = () => c(() => void e()), h = a(
36
+ }, f = () => a(() => void e()), h = c(
37
37
  () => i.isStripoInitialized,
38
38
  (t) => {
39
39
  t && e();
40
40
  },
41
41
  { immediate: !0 }
42
- ), S = a(
42
+ ), S = c(
43
+ () => i.changeSeq,
44
+ () => {
45
+ i.isStripoInitialized && f();
46
+ }
47
+ ), g = c(
43
48
  () => i.hasChanges,
44
- (t, r) => {
45
- i.isStripoInitialized && (t ? f() : r && (n(), e()));
49
+ (t, s) => {
50
+ !t && s && i.isStripoInitialized && (r(), e());
46
51
  }
47
52
  );
48
- B(() => {
49
- s = !0, n(), h(), S();
53
+ z(() => {
54
+ n = !0, r(), h(), S(), g();
50
55
  });
51
56
  };
52
57
  export {
53
- L as useGuidoStateBridge
58
+ G as useGuidoStateBridge
54
59
  };
@@ -1,6 +1,6 @@
1
- import { useActionsApi as L } from "./useActionsApi.js";
2
- import { useBlocksConfig as O } from "./useBlocksConfig.js";
3
- import { useConfig as q } from "./useConfig.js";
1
+ import { useActionsApi as x } from "./useActionsApi.js";
2
+ import { useBlocksConfig as L } from "./useBlocksConfig.js";
3
+ import { useConfig as O } from "./useConfig.js";
4
4
  import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
5
5
  import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
6
6
  import { useModuleRepair as j } from "./useModuleRepair.js";
@@ -17,7 +17,7 @@ import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../ut
17
17
  import Z from "../package.json.js";
18
18
  let n = null;
19
19
  const Ce = () => {
20
- const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
20
+ const { features: c, template: u, isFeatureEnabled: m } = O(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = L(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
21
21
  var d;
22
22
  if (document.getElementById("UiEditorScript")) {
23
23
  i();
@@ -88,8 +88,8 @@ const Ce = () => {
88
88
  },
89
89
  onTemplateLoaded() {
90
90
  try {
91
- const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
92
- t(), l(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
91
+ const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = x(), { injectFullStory: q } = N();
92
+ t(), l(), q(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
93
93
  e.hasChanges = !1;
94
94
  }, 1e3);
95
95
  } catch (t) {
@@ -106,7 +106,7 @@ const Ce = () => {
106
106
  e.isVersionHistoryOpen = t;
107
107
  },
108
108
  onDataChanged() {
109
- e.hasChanges = !0;
109
+ e.hasChanges = !0, e.changeSeq += 1;
110
110
  },
111
111
  onEvent: v,
112
112
  onModuleAdd: F,
@@ -1,22 +1,26 @@
1
1
  /**
2
2
  * Outbound bridge — publishes the current editor's html/css to the shared
3
- * Pinia store `guidoEmailEditor` so cortex-fe can read it at chat-stream
4
- * submit time and forward it as `clientState.editor`. This is what enables
3
+ * Pinia store `guidoEmailEditor`. cortex-fe reads it at chat-stream submit
4
+ * time and forwards it as `clientState.editor`, which is what enables
5
5
  * sub-case 1.3 (refine an already-loaded template via the email-agent).
6
6
  *
7
7
  * The bridge writes on three triggers:
8
8
  *
9
9
  * 1. Stripo finishes initializing — first snapshot.
10
- * 2. Editor `hasChanges` flips to true — debounced 500 ms so a streaming
11
- * Stripo edit doesn't thrash the store.
10
+ * 2. Every document change, via the `changeSeq` counter — debounced 500 ms
11
+ * so a streaming Stripo edit doesn't thrash the store.
12
12
  * 3. Editor `hasChanges` flips back to false (post-save / autosave) —
13
13
  * immediate, since this is the canonical "saved" snapshot.
14
14
  *
15
15
  * `getTemplateData()` is a Stripo iframe call; it must not run before
16
16
  * `isStripoInitialized` is true. The bridge guards against that.
17
17
  *
18
- * If cortex-fe isn't loaded the store still gets written — that's fine;
19
- * the store has zero overhead and any future reader will find consistent
20
- * state. The bridge is a one-way pipe with no consumer dependency.
18
+ * The store is written even with no reader attached — it has zero overhead,
19
+ * and a late reader still finds consistent state.
20
+ *
21
+ * Readers are not optional any more, so treat the publish timing as part of
22
+ * the contract: the store ships as `@useinsider/guido/editor-state`, and
23
+ * email-fe imports it to scan the live html for its Array of Objects lock.
24
+ * Weakening a trigger here silently breaks that lock in the consumer.
21
25
  */
22
26
  export declare const useGuidoStateBridge: () => void;
@@ -6,6 +6,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
6
6
  isPreviewModeOpen: boolean;
7
7
  editorVisualMode: string;
8
8
  hasChanges: boolean;
9
+ changeSeq: number;
9
10
  isStripoInitialized: boolean;
10
11
  templateId: string;
11
12
  syncModulesEnabled: boolean;
@@ -19,6 +20,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
19
20
  isPreviewModeOpen: boolean;
20
21
  editorVisualMode: string;
21
22
  hasChanges: boolean;
23
+ changeSeq: number;
22
24
  isStripoInitialized: boolean;
23
25
  templateId: string;
24
26
  syncModulesEnabled: boolean;
@@ -31,6 +33,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
31
33
  isPreviewModeOpen: boolean;
32
34
  editorVisualMode: string;
33
35
  hasChanges: boolean;
36
+ changeSeq: number;
34
37
  isStripoInitialized: boolean;
35
38
  templateId: string;
36
39
  syncModulesEnabled: boolean;
@@ -44,6 +47,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
44
47
  isPreviewModeOpen: boolean;
45
48
  editorVisualMode: string;
46
49
  hasChanges: boolean;
50
+ changeSeq: number;
47
51
  isStripoInitialized: boolean;
48
52
  templateId: string;
49
53
  syncModulesEnabled: boolean;
@@ -56,6 +60,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
56
60
  isPreviewModeOpen: boolean;
57
61
  editorVisualMode: string;
58
62
  hasChanges: boolean;
63
+ changeSeq: number;
59
64
  isStripoInitialized: boolean;
60
65
  templateId: string;
61
66
  syncModulesEnabled: boolean;
@@ -69,6 +74,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
69
74
  isPreviewModeOpen: boolean;
70
75
  editorVisualMode: string;
71
76
  hasChanges: boolean;
77
+ changeSeq: number;
72
78
  isStripoInitialized: boolean;
73
79
  templateId: string;
74
80
  syncModulesEnabled: boolean;
@@ -81,6 +87,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
81
87
  isPreviewModeOpen: boolean;
82
88
  editorVisualMode: string;
83
89
  hasChanges: boolean;
90
+ changeSeq: number;
84
91
  isStripoInitialized: boolean;
85
92
  templateId: string;
86
93
  syncModulesEnabled: boolean;
@@ -94,6 +101,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
94
101
  isPreviewModeOpen: boolean;
95
102
  editorVisualMode: string;
96
103
  hasChanges: boolean;
104
+ changeSeq: number;
97
105
  isStripoInitialized: boolean;
98
106
  templateId: string;
99
107
  syncModulesEnabled: boolean;
@@ -106,6 +114,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
106
114
  isPreviewModeOpen: boolean;
107
115
  editorVisualMode: string;
108
116
  hasChanges: boolean;
117
+ changeSeq: number;
109
118
  isStripoInitialized: boolean;
110
119
  templateId: string;
111
120
  syncModulesEnabled: boolean;
@@ -119,6 +128,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
119
128
  isPreviewModeOpen: boolean;
120
129
  editorVisualMode: string;
121
130
  hasChanges: boolean;
131
+ changeSeq: number;
122
132
  isStripoInitialized: boolean;
123
133
  templateId: string;
124
134
  syncModulesEnabled: boolean;
@@ -131,6 +141,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
131
141
  isPreviewModeOpen: boolean;
132
142
  editorVisualMode: string;
133
143
  hasChanges: boolean;
144
+ changeSeq: number;
134
145
  isStripoInitialized: boolean;
135
146
  templateId: string;
136
147
  syncModulesEnabled: boolean;
@@ -144,6 +155,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
144
155
  isPreviewModeOpen: boolean;
145
156
  editorVisualMode: string;
146
157
  hasChanges: boolean;
158
+ changeSeq: number;
147
159
  isStripoInitialized: boolean;
148
160
  templateId: string;
149
161
  syncModulesEnabled: boolean;
@@ -156,6 +168,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
156
168
  isPreviewModeOpen: boolean;
157
169
  editorVisualMode: string;
158
170
  hasChanges: boolean;
171
+ changeSeq: number;
159
172
  isStripoInitialized: boolean;
160
173
  templateId: string;
161
174
  syncModulesEnabled: boolean;
@@ -169,6 +182,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
169
182
  isPreviewModeOpen: boolean;
170
183
  editorVisualMode: string;
171
184
  hasChanges: boolean;
185
+ changeSeq: number;
172
186
  isStripoInitialized: boolean;
173
187
  templateId: string;
174
188
  syncModulesEnabled: boolean;
@@ -181,6 +195,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
181
195
  isPreviewModeOpen: boolean;
182
196
  editorVisualMode: string;
183
197
  hasChanges: boolean;
198
+ changeSeq: number;
184
199
  isStripoInitialized: boolean;
185
200
  templateId: string;
186
201
  syncModulesEnabled: boolean;
@@ -194,6 +209,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
194
209
  isPreviewModeOpen: boolean;
195
210
  editorVisualMode: string;
196
211
  hasChanges: boolean;
212
+ changeSeq: number;
197
213
  isStripoInitialized: boolean;
198
214
  templateId: string;
199
215
  syncModulesEnabled: boolean;
@@ -206,6 +222,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
206
222
  isPreviewModeOpen: boolean;
207
223
  editorVisualMode: string;
208
224
  hasChanges: boolean;
225
+ changeSeq: number;
209
226
  isStripoInitialized: boolean;
210
227
  templateId: string;
211
228
  syncModulesEnabled: boolean;
@@ -219,6 +236,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
219
236
  isPreviewModeOpen: boolean;
220
237
  editorVisualMode: string;
221
238
  hasChanges: boolean;
239
+ changeSeq: number;
222
240
  isStripoInitialized: boolean;
223
241
  templateId: string;
224
242
  syncModulesEnabled: boolean;
@@ -231,6 +249,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
231
249
  isPreviewModeOpen: boolean;
232
250
  editorVisualMode: string;
233
251
  hasChanges: boolean;
252
+ changeSeq: number;
234
253
  isStripoInitialized: boolean;
235
254
  templateId: string;
236
255
  syncModulesEnabled: boolean;
@@ -244,6 +263,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
244
263
  isPreviewModeOpen: boolean;
245
264
  editorVisualMode: string;
246
265
  hasChanges: boolean;
266
+ changeSeq: number;
247
267
  isStripoInitialized: boolean;
248
268
  templateId: string;
249
269
  syncModulesEnabled: boolean;
@@ -256,6 +276,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
256
276
  isPreviewModeOpen: boolean;
257
277
  editorVisualMode: string;
258
278
  hasChanges: boolean;
279
+ changeSeq: number;
259
280
  isStripoInitialized: boolean;
260
281
  templateId: string;
261
282
  syncModulesEnabled: boolean;
@@ -269,6 +290,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
269
290
  isPreviewModeOpen: boolean;
270
291
  editorVisualMode: string;
271
292
  hasChanges: boolean;
293
+ changeSeq: number;
272
294
  isStripoInitialized: boolean;
273
295
  templateId: string;
274
296
  syncModulesEnabled: boolean;
@@ -281,6 +303,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
281
303
  isPreviewModeOpen: boolean;
282
304
  editorVisualMode: string;
283
305
  hasChanges: boolean;
306
+ changeSeq: number;
284
307
  isStripoInitialized: boolean;
285
308
  templateId: string;
286
309
  syncModulesEnabled: boolean;
@@ -294,6 +317,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
294
317
  isPreviewModeOpen: boolean;
295
318
  editorVisualMode: string;
296
319
  hasChanges: boolean;
320
+ changeSeq: number;
297
321
  isStripoInitialized: boolean;
298
322
  templateId: string;
299
323
  syncModulesEnabled: boolean;
@@ -306,6 +330,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
306
330
  isPreviewModeOpen: boolean;
307
331
  editorVisualMode: string;
308
332
  hasChanges: boolean;
333
+ changeSeq: number;
309
334
  isStripoInitialized: boolean;
310
335
  templateId: string;
311
336
  syncModulesEnabled: boolean;
@@ -8,6 +8,10 @@ const o = e("guidoEditor", {
8
8
  isPreviewModeOpen: !1,
9
9
  editorVisualMode: "desktop",
10
10
  hasChanges: !1,
11
+ // Bumped on every Stripo document change. `hasChanges` is a latch that stays
12
+ // true until a save, so it cannot signal the second edit onwards; watchers
13
+ // that need every change (the outbound state bridge) watch this instead.
14
+ changeSeq: 0,
11
15
  isStripoInitialized: !1,
12
16
  templateId: "",
13
17
  syncModulesEnabled: !1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.18.1-beta.280b4e1",
3
+ "version": "3.18.1-beta.2b89365",
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",