@useinsider/guido 3.19.0-beta.acb00a2 → 3.19.0-beta.c0e1797

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,13 +1,3 @@
1
- /** Terminal outcome of an editor write, keyed by `${blueprintId}:${version}`. */
2
- export interface ApplyAck {
3
- status: 'applied' | 'failed';
4
- /** The `applyRequestedAt` of the click this ack answers — lets cortex drop stale acks. */
5
- requestedAt: number;
6
- /** Strictly increasing per key, so two acks in the same millisecond still order. */
7
- ackAt: number;
8
- /** Stringified — cortex JSON-clones store-derived payloads, an Error would not survive. */
9
- error?: string;
10
- }
11
1
  /** The published editor snapshot — the shape a consumer reads off the shared store. */
12
2
  export interface GuidoEmailEditorState {
13
3
  /** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
@@ -18,10 +8,6 @@ export interface GuidoEmailEditorState {
18
8
  lastUpdatedAt: number;
19
9
  /** Template id from the editor config, so a consumer can scope per-template. */
20
10
  templateId: string;
21
- /** True while a mounted Guido bridge is consuming the chat store. Gates cortex's Apply button. */
22
- bridgeActive: boolean;
23
- /** `${blueprintId}:${version}` → terminal outcome of the editor write, written only after it settles. */
24
- applyAcks: Record<string, ApplyAck>;
25
11
  }
26
12
  /**
27
13
  * Outbound contract Guido publishes to the host's shared Pinia singleton so a
@@ -32,11 +18,17 @@ export interface GuidoEmailEditorState {
32
18
  * Published as `@useinsider/guido/editor-state` and from the root barrel, so a
33
19
  * consumer imports this store instead of re-declaring one under the same id.
34
20
  *
35
- * State-only by contract: cortex-fe reads `pinia.state.value['guidoEmailEditor']`, which misses
36
- * actions and getters. Intended writers: `useGuidoStateBridge` and `useCortexBlueprintBridge`.
21
+ * State + getters only, no actions. `useGuidoStateBridge` is the only intended
22
+ * writer, but that is Guido's own convention rather than something the store
23
+ * enforces: publishing the definition hands a consumer `$patch` as well, exactly
24
+ * as the runtime `pinia._s` probe always did.
37
25
  *
38
- * The id `guidoEmailEditor` is part of the cross-MFE contract; the internal
39
- * store `guidoEditor` is intentionally separate.
26
+ * Store id `guidoEmailEditor` is cross-MFE: cortex-fe reads it via
27
+ * `pinia._s.get('guidoEmailEditor')` at runtime rather than importing it, so the
28
+ * id stays part of the contract. The internal Guido editor store keeps id
29
+ * `guidoEditor` — these are intentionally separate. The internal store carries
30
+ * UI state a consumer should not see; this public store carries the contract
31
+ * Guido is willing to share.
40
32
  */
41
33
  export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"guidoEmailEditor", GuidoEmailEditorState, {
42
34
  /** True once the bridge has published at least one snapshot. */
@@ -45,7 +37,5 @@ export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"
45
37
  css: string;
46
38
  lastUpdatedAt: number;
47
39
  templateId: string;
48
- bridgeActive: boolean;
49
- applyAcks: Record<string, ApplyAck>;
50
40
  } & import("pinia").PiniaCustomStateProperties<GuidoEmailEditorState>) => boolean;
51
41
  }, {}>;
@@ -0,0 +1,4 @@
1
+ import type { StripoEditorApi } from '@@/Types/stripo';
2
+ export declare const EDITOR_NOT_READY_MESSAGE = "The editor is not ready yet. Please wait for it to load and try again.";
3
+ export declare const findEditorApi: () => StripoEditorApi | undefined;
4
+ export declare const getEditorApi: () => StripoEditorApi;
@@ -4,9 +4,7 @@ const d = e("guidoEmailEditor", {
4
4
  html: "",
5
5
  css: "",
6
6
  lastUpdatedAt: 0,
7
- templateId: "",
8
- bridgeActive: !1,
9
- applyAcks: {}
7
+ templateId: ""
10
8
  }),
11
9
  getters: {
12
10
  /** True once the bridge has published at least one snapshot. */
@@ -39,16 +39,16 @@ const r = () => ({
39
39
  });
40
40
  },
41
41
  isActiveTypeFirstInCollection: (e) => {
42
- const t = i[e.selectedCollectionType];
42
+ const t = i[e.selectedCollectionType] ?? [];
43
43
  return e.activeType === t[0];
44
44
  },
45
45
  isActiveTypeLastInCollection: (e) => {
46
- const t = i[e.selectedCollectionType];
46
+ const t = i[e.selectedCollectionType] ?? [];
47
47
  return e.activeType === t[t.length - 1];
48
48
  },
49
49
  hasTemplatesByCollectionType: (e) => {
50
50
  const t = {};
51
- return i[e.selectedCollectionType].forEach((s) => {
51
+ return (i[e.selectedCollectionType] ?? []).forEach((s) => {
52
52
  t[s] = e.templates.some((c) => c.type === s);
53
53
  }), t;
54
54
  },
@@ -0,0 +1,11 @@
1
+ const o = "The editor is not ready yet. Please wait for it to load and try again.", i = () => window.StripoEditorApi, r = () => {
2
+ const t = i();
3
+ if (!t)
4
+ throw new Error(o);
5
+ return t;
6
+ };
7
+ export {
8
+ o as EDITOR_NOT_READY_MESSAGE,
9
+ i as findEditorApi,
10
+ r as getEditorApi
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.19.0-beta.acb00a2",
3
+ "version": "3.19.0-beta.c0e1797",
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",
@@ -38,6 +38,7 @@
38
38
  "test:e2e-mutation": "node scripts/e2e-mutation-check.mjs",
39
39
  "type-check": "vue-tsc --noEmit --project tsconfig.config.json && vue-tsc --noEmit --project tsconfig.app.json",
40
40
  "test": "vitest run --coverage",
41
+ "test:run": "vitest run",
41
42
  "test:watch": "vitest",
42
43
  "test:visual-update": "npx playwright test --update-snapshots --reporter html",
43
44
  "test:e2e:coverage": "E2E_COVERAGE=true playwright test",