@useinsider/guido 3.8.0-beta.910d4af → 3.8.0-beta.eb4074b

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 (69) hide show
  1. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
  2. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +12 -15
  3. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  4. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +15 -16
  5. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +37 -42
  7. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  8. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +37 -40
  9. package/dist/composables/useHtmlValidator.js +180 -133
  10. package/dist/composables/useSave.js +14 -14
  11. package/dist/composables/validators/useUnsubscribeBlockValidator.js +17 -26
  12. package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -69
  13. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
  14. package/dist/config/migrator/recommendation/extractors.js +44 -22
  15. package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
  16. package/dist/config/migrator/recommendationMigrator.js +30 -31
  17. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +22 -15
  18. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +55 -41
  19. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +42 -43
  20. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -45
  21. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
  22. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +64 -60
  23. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +294 -335
  24. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
  25. package/dist/extensions/Blocks/Recommendation/extension.js +7 -5
  26. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -2
  27. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
  28. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +142 -173
  29. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -29
  30. package/dist/extensions/Blocks/Recommendation/templates/index.js +30 -8
  31. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +132 -105
  32. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +44 -23
  33. package/dist/extensions/Blocks/Recommendation/templates/utils.js +112 -64
  34. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +219 -0
  35. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
  36. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +30 -22
  37. package/dist/extensions/Blocks/Unsubscribe/block.js +37 -40
  38. package/dist/extensions/Blocks/Unsubscribe/control.js +16 -19
  39. package/dist/extensions/Blocks/controlFactories.js +159 -133
  40. package/dist/guido.css +1 -1
  41. package/dist/src/composables/useHtmlValidator.d.ts +27 -0
  42. package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
  43. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -1
  44. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
  45. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
  46. package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
  47. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
  48. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  49. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  50. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +23 -0
  51. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  52. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
  53. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +7 -1
  54. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
  55. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +29 -47
  56. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  57. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  58. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
  59. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +165 -11
  60. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +78 -0
  61. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
  62. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +29 -9
  63. package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
  64. package/dist/src/stores/unsubscribe.d.ts +1 -11
  65. package/dist/stores/unsubscribe.js +7 -8
  66. package/package.json +1 -1
  67. package/dist/composables/usePreviewInteractionGuard.js +0 -17
  68. package/dist/src/composables/usePreviewInteractionGuard.d.ts +0 -3
  69. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
@@ -10,7 +10,6 @@ interface StoreState {
10
10
  typeSelectionDrawerStatus: boolean;
11
11
  isGlobalUnsubscribeDisabled: boolean;
12
12
  isSubscriptionPreferencesCenterDisabled: boolean;
13
- pendingBlockId: string | null;
14
13
  }
15
14
  export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guidoUnsubscribe", StoreState, {
16
15
  getSelectedCollection: (state: {
@@ -36,7 +35,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
36
35
  typeSelectionDrawerStatus: boolean;
37
36
  isGlobalUnsubscribeDisabled: boolean;
38
37
  isSubscriptionPreferencesCenterDisabled: boolean;
39
- pendingBlockId: string | null;
40
38
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => number[];
41
39
  getSelectedTemplateByActiveType: (state: {
42
40
  templates: {
@@ -61,7 +59,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
61
59
  typeSelectionDrawerStatus: boolean;
62
60
  isGlobalUnsubscribeDisabled: boolean;
63
61
  isSubscriptionPreferencesCenterDisabled: boolean;
64
- pendingBlockId: string | null;
65
62
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => number;
66
63
  getTemplatesByActiveType: (state: {
67
64
  templates: {
@@ -86,7 +83,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
86
83
  typeSelectionDrawerStatus: boolean;
87
84
  isGlobalUnsubscribeDisabled: boolean;
88
85
  isSubscriptionPreferencesCenterDisabled: boolean;
89
- pendingBlockId: string | null;
90
86
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => {
91
87
  id: number;
92
88
  name: string;
@@ -123,7 +119,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
123
119
  typeSelectionDrawerStatus: boolean;
124
120
  isGlobalUnsubscribeDisabled: boolean;
125
121
  isSubscriptionPreferencesCenterDisabled: boolean;
126
- pendingBlockId: string | null;
127
122
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => (id: number) => string;
128
123
  getSelectedUnsubscribePagesByCollection: (state: {
129
124
  templates: {
@@ -148,7 +143,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
148
143
  typeSelectionDrawerStatus: boolean;
149
144
  isGlobalUnsubscribeDisabled: boolean;
150
145
  isSubscriptionPreferencesCenterDisabled: boolean;
151
- pendingBlockId: string | null;
152
146
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => (collectionType: number) => number[];
153
147
  isActiveTypeFirstInCollection: (state: {
154
148
  templates: {
@@ -173,7 +167,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
173
167
  typeSelectionDrawerStatus: boolean;
174
168
  isGlobalUnsubscribeDisabled: boolean;
175
169
  isSubscriptionPreferencesCenterDisabled: boolean;
176
- pendingBlockId: string | null;
177
170
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
178
171
  isActiveTypeLastInCollection: (state: {
179
172
  templates: {
@@ -198,7 +191,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
198
191
  typeSelectionDrawerStatus: boolean;
199
192
  isGlobalUnsubscribeDisabled: boolean;
200
193
  isSubscriptionPreferencesCenterDisabled: boolean;
201
- pendingBlockId: string | null;
202
194
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
203
195
  hasTemplatesByCollectionType: (state: {
204
196
  templates: {
@@ -223,7 +215,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
223
215
  typeSelectionDrawerStatus: boolean;
224
216
  isGlobalUnsubscribeDisabled: boolean;
225
217
  isSubscriptionPreferencesCenterDisabled: boolean;
226
- pendingBlockId: string | null;
227
218
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => Record<number, boolean>;
228
219
  unsubscribePagesStatus: (state: {
229
220
  templates: {
@@ -248,11 +239,10 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
248
239
  typeSelectionDrawerStatus: boolean;
249
240
  isGlobalUnsubscribeDisabled: boolean;
250
241
  isSubscriptionPreferencesCenterDisabled: boolean;
251
- pendingBlockId: string | null;
252
242
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
253
243
  }, {
254
244
  $reset(): void;
255
- fetchTemplates(force?: boolean): Promise<void>;
245
+ fetchTemplates(): Promise<void>;
256
246
  setCollection(collectionType: number): void;
257
247
  setCollectionWithoutAutoSelection(collectionType: number): void;
258
248
  setSelectedTemplate(template: number): void;
@@ -1,6 +1,6 @@
1
1
  import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
2
2
  import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
3
- import { defineStore as u } from "pinia";
3
+ import { defineStore as h } from "pinia";
4
4
  let o = null;
5
5
  const r = () => ({
6
6
  templates: [],
@@ -12,9 +12,8 @@ const r = () => ({
12
12
  pageSelectionDrawerStatus: !1,
13
13
  typeSelectionDrawerStatus: !1,
14
14
  isGlobalUnsubscribeDisabled: !1,
15
- isSubscriptionPreferencesCenterDisabled: !1,
16
- pendingBlockId: null
17
- }), b = u("guidoUnsubscribe", {
15
+ isSubscriptionPreferencesCenterDisabled: !1
16
+ }), b = h("guidoUnsubscribe", {
18
17
  state: () => r(),
19
18
  getters: {
20
19
  getSelectedCollection: (e) => i[e.selectedCollectionType],
@@ -63,10 +62,10 @@ const r = () => ({
63
62
  selectedUnsubscribePages: t
64
63
  });
65
64
  },
66
- async fetchTemplates(e = !1) {
67
- !e && this.templates.length || ((e || !o) && (o = (async () => {
68
- const { getUnsubscribePages: t } = d();
69
- this.templates = await t();
65
+ async fetchTemplates() {
66
+ this.templates.length || (o || (o = (async () => {
67
+ const { getUnsubscribePages: e } = d();
68
+ this.templates = await e();
70
69
  })().finally(() => {
71
70
  o = null;
72
71
  })), await o);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.8.0-beta.910d4af",
3
+ "version": "3.8.0-beta.eb4074b",
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",
@@ -1,17 +0,0 @@
1
- const o = ["click", "auxclick", "submit"], c = (t) => {
2
- t.preventDefault(), t.stopPropagation();
3
- }, a = () => ({ blockPreviewInteractions: (r) => {
4
- try {
5
- const e = r.contentDocument;
6
- if (!e)
7
- return;
8
- o.forEach((n) => {
9
- e.addEventListener(n, c, !0);
10
- });
11
- } catch (e) {
12
- console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:", e);
13
- }
14
- } });
15
- export {
16
- a as usePreviewInteractionGuard
17
- };
@@ -1,3 +0,0 @@
1
- export declare const usePreviewInteractionGuard: () => {
2
- blockPreviewInteractions: (iframe: HTMLIFrameElement) => void;
3
- };
@@ -1,113 +0,0 @@
1
- /**
2
- * Style Preserver Utility
3
- *
4
- * Captures and restores element styles during block regeneration.
5
- * This ensures user styling is preserved when:
6
- * - Layout changes (grid <-> list)
7
- * - Cards per row changes
8
- * - Composition order changes
9
- *
10
- * Works with the node config system to provide complete style persistence.
11
- */
12
- import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
13
- import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
14
- /**
15
- * Style properties that can be captured for text elements
16
- */
17
- export interface TextElementStyles {
18
- fontSize?: string;
19
- fontFamily?: string;
20
- fontWeight?: string;
21
- fontStyle?: string;
22
- color?: string;
23
- textAlign?: string;
24
- lineHeight?: string;
25
- textDecoration?: string;
26
- }
27
- /**
28
- * Style properties for button elements
29
- */
30
- export interface ButtonElementStyles extends TextElementStyles {
31
- backgroundColor?: string;
32
- borderRadius?: string;
33
- border?: string;
34
- padding?: string;
35
- }
36
- /**
37
- * Style properties for image elements
38
- */
39
- export interface ImageElementStyles {
40
- width?: string;
41
- height?: string;
42
- maxWidth?: string;
43
- }
44
- /**
45
- * Complete captured styles for a recommendation block
46
- */
47
- export interface CapturedStyles {
48
- /** Product name text styles */
49
- name: TextElementStyles;
50
- /** Current price text styles */
51
- price: TextElementStyles;
52
- /** Original/old price text styles */
53
- oldPrice: TextElementStyles;
54
- /** Omnibus price text styles */
55
- omnibusPrice: TextElementStyles;
56
- /** Omnibus discount text styles */
57
- omnibusDiscount: TextElementStyles;
58
- /** CTA button styles */
59
- button: ButtonElementStyles;
60
- /** Product image styles */
61
- image: ImageElementStyles;
62
- /** Card background color */
63
- cardBackgroundColor: string | null;
64
- /** Column spacing in pixels */
65
- columnSpacing: number;
66
- /** Row spacing in pixels */
67
- rowSpacing: number;
68
- /** Element composition order */
69
- composition: string[];
70
- /** Element visibility flags */
71
- visibility: Record<string, boolean>;
72
- }
73
- type DocumentModifier = {
74
- modifyHtml: (node: ImmutableHtmlNode) => {
75
- setStyle: (prop: string, value: string) => DocumentModifier;
76
- };
77
- apply: (description: ModificationDescription) => void;
78
- };
79
- /**
80
- * Capture all styles from a recommendation block
81
- *
82
- * Call this BEFORE any operation that regenerates the block HTML.
83
- * The captured styles can then be restored after regeneration.
84
- * @example
85
- * // Before layout change
86
- * const styles = captureStyles(this.currentNode);
87
- *
88
- * // ... regenerate block HTML ...
89
- *
90
- * // After regeneration
91
- * restoreStyles(this.currentNode, this.api.getDocumentModifier(), styles);
92
- * @param node - The block node to capture styles from
93
- * @returns Complete captured styles object
94
- */
95
- export declare function captureStyles(node: ImmutableHtmlNode | null | undefined): CapturedStyles;
96
- /**
97
- * Restore captured styles to a regenerated block
98
- *
99
- * Call this AFTER regenerating block HTML to reapply user styling.
100
- * @example
101
- * restoreStyles(this.currentNode, this.api.getDocumentModifier(), capturedStyles);
102
- * @param node - The block node to restore styles to
103
- * @param modifier - Document modifier for applying changes
104
- * @param styles - Previously captured styles
105
- */
106
- export declare function restoreStyles(node: ImmutableHtmlNode | null | undefined, modifier: DocumentModifier, styles: CapturedStyles): void;
107
- /**
108
- * Check if styles have meaningful content worth restoring
109
- * @param styles - Captured styles to check
110
- * @returns True if styles contain restorable content
111
- */
112
- export declare function hasRestorableStyles(styles: CapturedStyles): boolean;
113
- export {};