@useinsider/guido 1.0.0-beta.dbd0bad → 1.0.0-beta.df613dd

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 (155) hide show
  1. package/README.md +12 -265
  2. package/dist/@types/generic.d.ts +0 -14
  3. package/dist/App.vue.d.ts +1 -1
  4. package/dist/components/Guido.vue.d.ts +2 -9
  5. package/dist/components/Guido.vue.js +1 -1
  6. package/dist/components/Guido.vue2.js +24 -39
  7. package/dist/components/organisms/header/LeftSlot.vue.d.ts +1 -1
  8. package/dist/components/organisms/header/LeftSlot.vue.js +8 -8
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +3 -5
  10. package/dist/components/organisms/header/MiddleSlot.vue.js +8 -8
  11. package/dist/components/organisms/header/MiddleSlot.vue2.js +15 -15
  12. package/dist/components/organisms/header/RightSlot.vue.js +13 -10
  13. package/dist/components/organisms/header/RightSlot.vue2.js +17 -16
  14. package/dist/components/organisms/header/ViewOptions.vue.d.ts +1 -1
  15. package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +1 -13
  16. package/dist/components/organisms/header/version-history/VersionHistory.vue.js +7 -7
  17. package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +10 -13
  18. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.d.ts +1 -1
  19. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.js +1 -1
  20. package/dist/components/organisms/header/version-history/ViewOptions.vue.d.ts +1 -1
  21. package/dist/composables/useActionsApi.d.ts +0 -1
  22. package/dist/composables/useActionsApi.js +12 -14
  23. package/dist/composables/useCustomInterfaceAppearance.js +9 -45
  24. package/dist/composables/useExport.d.ts +1 -1
  25. package/dist/composables/useExport.js +20 -35
  26. package/dist/composables/useStripo.js +28 -44
  27. package/dist/guido.css +1 -1
  28. package/dist/static/editor.css.js +232 -0
  29. package/dist/stores/editor.d.ts +0 -1
  30. package/dist/stores/editor.js +2 -3
  31. package/package.json +5 -6
  32. package/dist/_virtual/AddCustomFont.js +0 -4
  33. package/dist/_virtual/AiAssistantValueType.js +0 -4
  34. package/dist/_virtual/BackgroundColorBuiltInControl.js +0 -4
  35. package/dist/_virtual/BackgroundImageBuiltInControl.js +0 -4
  36. package/dist/_virtual/Block.js +0 -4
  37. package/dist/_virtual/BlockAttributes.js +0 -4
  38. package/dist/_virtual/BlockCompositionType.js +0 -4
  39. package/dist/_virtual/BlockPaddingsBuiltInControl.js +0 -4
  40. package/dist/_virtual/BlockRenderer.js +0 -4
  41. package/dist/_virtual/BlockType.js +0 -4
  42. package/dist/_virtual/BlocksPanel.js +0 -4
  43. package/dist/_virtual/BuiltInControl.js +0 -4
  44. package/dist/_virtual/BuiltInControlTypes.js +0 -4
  45. package/dist/_virtual/ButtonBorderBuiltInControl.js +0 -4
  46. package/dist/_virtual/ButtonColorBuiltInControl.js +0 -4
  47. package/dist/_virtual/ButtonFontColorBuiltInControl.js +0 -4
  48. package/dist/_virtual/ButtonInternalIndentsBuiltInControl.js +0 -4
  49. package/dist/_virtual/ButtonTextBuiltInControl.js +0 -4
  50. package/dist/_virtual/ContextAction.js +0 -4
  51. package/dist/_virtual/ContextActionType.js +0 -4
  52. package/dist/_virtual/Control.js +0 -4
  53. package/dist/_virtual/EditorStatePropertyType.js +0 -4
  54. package/dist/_virtual/Extension.js +0 -4
  55. package/dist/_virtual/ExtensionBuilder.js +0 -4
  56. package/dist/_virtual/FontFamilyBuiltInControl.js +0 -4
  57. package/dist/_virtual/LinkColorBuiltInControl.js +0 -4
  58. package/dist/_virtual/ModificationDescription.js +0 -4
  59. package/dist/_virtual/PanelPosition.js +0 -4
  60. package/dist/_virtual/PreviewDeviceMode.js +0 -4
  61. package/dist/_virtual/SettingsPanelRegistry.js +0 -4
  62. package/dist/_virtual/SettingsPanelTab.js +0 -4
  63. package/dist/_virtual/SettingsTab.js +0 -4
  64. package/dist/_virtual/StructureBorderBuiltInControl.js +0 -4
  65. package/dist/_virtual/StructurePaddingsBuiltInControl.js +0 -4
  66. package/dist/_virtual/TextColorBuiltInControl.js +0 -4
  67. package/dist/_virtual/TextLineSpacingBuiltInControl.js +0 -4
  68. package/dist/_virtual/TextSizeBuiltInControl.js +0 -4
  69. package/dist/_virtual/TextStyleBuiltInControl.js +0 -4
  70. package/dist/_virtual/UIElement.js +0 -4
  71. package/dist/_virtual/UIElementTagRegistry.js +0 -4
  72. package/dist/_virtual/UIElementType.js +0 -4
  73. package/dist/_virtual/UIElementsAttributes.js +0 -4
  74. package/dist/_virtual/index.js +0 -5
  75. package/dist/_virtual/index2.js +0 -4
  76. package/dist/components/organisms/header/version-history/RestoreButton.vue.d.ts +0 -2
  77. package/dist/components/organisms/header/version-history/RestoreButton.vue.js +0 -19
  78. package/dist/components/organisms/header/version-history/RestoreButton.vue2.js +0 -14
  79. package/dist/composables/useHtmlCompiler.d.ts +0 -4
  80. package/dist/composables/useHtmlCompiler.js +0 -16
  81. package/dist/config/compiler/htmlCompilerRules.d.ts +0 -2
  82. package/dist/config/compiler/htmlCompilerRules.js +0 -145
  83. package/dist/config/compiler/outlookCompilerRules.d.ts +0 -0
  84. package/dist/enums/displayConditions.d.ts +0 -2
  85. package/dist/enums/displayConditions.js +0 -80
  86. package/dist/extensions/DynamicContent/dynamic-content-modal.d.ts +0 -6
  87. package/dist/extensions/DynamicContent/dynamic-content-modal.js +0 -27
  88. package/dist/extensions/DynamicContent/dynamic-content.css.js +0 -24
  89. package/dist/extensions/DynamicContent/dynamic-content.d.ts +0 -16
  90. package/dist/extensions/DynamicContent/dynamic-content.js +0 -63
  91. package/dist/extensions/DynamicContent/extension.d.ts +0 -2
  92. package/dist/extensions/DynamicContent/extension.js +0 -11
  93. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +0 -51
  94. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +0 -52
  95. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +0 -41
  96. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlockRenderer.js +0 -18
  97. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlocksPanel.js +0 -32
  98. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/ContextAction.js +0 -18
  99. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AddCustomFont.js +0 -8
  100. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +0 -13
  101. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockAttributes.js +0 -34
  102. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +0 -13
  103. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +0 -13
  104. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +0 -104
  105. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +0 -13
  106. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +0 -13
  107. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +0 -13
  108. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +0 -13
  109. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +0 -13
  110. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +0 -13
  111. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +0 -45
  112. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundColorBuiltInControl.js +0 -43
  113. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundImageBuiltInControl.js +0 -46
  114. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BlockPaddingsBuiltInControl.js +0 -44
  115. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BuiltInControl.js +0 -22
  116. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonBorderBuiltInControl.js +0 -46
  117. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonColorBuiltInControl.js +0 -46
  118. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonFontColorBuiltInControl.js +0 -45
  119. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonInternalIndentsBuiltInControl.js +0 -45
  120. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonTextBuiltInControl.js +0 -45
  121. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +0 -20
  122. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/FontFamilyBuiltInControl.js +0 -43
  123. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/LinkColorBuiltInControl.js +0 -45
  124. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +0 -18
  125. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +0 -32
  126. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructureBorderBuiltInControl.js +0 -46
  127. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructurePaddingsBuiltInControl.js +0 -44
  128. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextColorBuiltInControl.js +0 -43
  129. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextLineSpacingBuiltInControl.js +0 -43
  130. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextSizeBuiltInControl.js +0 -45
  131. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextStyleBuiltInControl.js +0 -43
  132. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/index.js +0 -266
  133. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +0 -26
  134. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +0 -22
  135. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +0 -18
  136. package/dist/static/styles/base.css.js +0 -11
  137. package/dist/static/styles/components/alert-message.css.js +0 -39
  138. package/dist/static/styles/components/amp-block.css.js +0 -18
  139. package/dist/static/styles/components/base-input.css.js +0 -47
  140. package/dist/static/styles/components/button-group.css.js +0 -54
  141. package/dist/static/styles/components/button.css.js +0 -106
  142. package/dist/static/styles/components/combobox.css.js +0 -49
  143. package/dist/static/styles/components/counter.css.js +0 -42
  144. package/dist/static/styles/components/dropdown-menu.css.js +0 -52
  145. package/dist/static/styles/components/narrow-panel.css.js +0 -38
  146. package/dist/static/styles/components/switcher.css.js +0 -11
  147. package/dist/static/styles/components/tabs.css.js +0 -97
  148. package/dist/static/styles/components/tools.css.js +0 -23
  149. package/dist/static/styles/components/version-history.css.js +0 -30
  150. package/dist/static/styles/components/wide-panel.css.js +0 -135
  151. package/dist/static/styles/variables.css.js +0 -23
  152. package/dist/utils/htmlCompiler.d.ts +0 -12
  153. package/dist/utils/htmlCompiler.js +0 -70
  154. package/dist/utils/tooltipUtils.d.ts +0 -2
  155. package/dist/utils/tooltipUtils.js +0 -9
package/README.md CHANGED
@@ -14,10 +14,7 @@ Guido is a Vue 2 + TypeScript wrapper for the Stripo Email Editor plugin. Easily
14
14
  ```bash
15
15
  npm install @useinsider/guido
16
16
  ```
17
- ### Prerequisites
18
- 🍍 Your project should have `pinia`
19
17
 
20
- ---
21
18
  ## 🚀 Usage
22
19
 
23
20
  ### Basic Usage
@@ -26,11 +23,9 @@ npm install @useinsider/guido
26
23
  <template>
27
24
  <div>
28
25
  <Guido
29
- ref="guidoEditor"
30
26
  :email-id="emailId"
31
27
  :user-id="userId"
32
28
  :guido-config="guidoConfig"
33
- @dynamic-content:open="handleDynamicContentOpen"
34
29
  />
35
30
  </div>
36
31
  </template>
@@ -47,33 +42,9 @@ export default {
47
42
  emailId: 'abc123',
48
43
  userId: '12345',
49
44
  guidoConfig: {
50
- translationsPath: 'window.trans.en',
51
- htmlCompilerRules: [],
52
- ignoreDefaultHtmlCompilerRules: false,
45
+ translationsPath: 'window.trans.en'
53
46
  }
54
- dynamicContentModalVisible: false
55
47
  };
56
- },
57
-
58
- methods: {
59
- handleDynamicContentOpen() {
60
- this.dynamicContentModalVisible = true;
61
- }
62
- // ⚠️ Your own Dynamic Content Modal should have this id: #guido-dynamic-content-modal
63
- handleDynamicContentInsert() {
64
- this.$ref.guidoEditor?.dynamicContent.insert({
65
- text: 'Text',
66
- value: 'Value',
67
- fallback: 'Fallback'
68
- });
69
-
70
- this.dynamicContentModalVisible = false;
71
- },
72
- // ⚠️ It's mandatory. There is no way to understand if user closes the modal without selection.
73
- handleDynamicContentClose() {
74
- this.$ref.guidoEditor?.dynamicContent.close();
75
- }
76
-
77
48
  }
78
49
  };
79
50
  </script>
@@ -92,42 +63,17 @@ export default {
92
63
  | `productType` | `string` | ⚪ | Getting from URL path | Unique identifier for the product draft |
93
64
  | `guidoConfig` | `GuidoConfig` | ✅ | - | Configuration object for the editor |
94
65
 
95
- ### Guido Exposed Methods
96
- ```typescript
97
- dynamicContent.insert(DynamicContent);
98
- dynamicContent.close();
99
- ```
100
-
101
- ### Guido Interfaces
66
+ ### GuidoConfig Interface
102
67
 
103
68
  ```typescript
104
69
  interface GuidoConfig {
105
70
  translationsPath: string;
106
- htmlCompilerRules: CompilerRule[];
107
- ignoreDefaultHtmlCompilerRules: boolean;
108
71
  }
109
72
  ```
110
73
 
111
74
  | Property | Type | Default | Description |
112
75
  |----------|------|---------|-------------|
113
76
  | `translationsPath` | `string` | `'window.trans.en'` | JavaScript path to the translations object |
114
- | `htmlCompilerRules` | `CompilerRule[]` | `[]` | Additional compiler rules to apply to HTML content. See [HTML Compiler Rules](#-html-compiler-rules) section below |
115
- | `ignoreDefaultHtmlCompilerRules` | `boolean` | `false` | Skip default compiler rules and only use custom rules. Default rules: `src/config/compiler/htmlCompilerRules.ts` |
116
-
117
- ```typescript
118
- interface DynamicContent {
119
- value: string;
120
- text: string;
121
- fallback?: string;
122
- }
123
- ```
124
- ---
125
-
126
- | Property | Type | Default | Description |
127
- |----------|------|---------|-------------|
128
- | `value` | `string` | '' | Value of the dynamic content |
129
- | `text` | `string` | '' | Visible value of the dynamic content |
130
- | `fallback?` | `string` | '' | Fallback value of the dynamic content. Optional |
131
77
 
132
78
  ### TypeScript Types
133
79
 
@@ -142,183 +88,17 @@ import type { GuidoConfig } from '@useinsider/guido';
142
88
  import type { StripoEventType } from '@useinsider/guido';
143
89
  ```
144
90
 
145
- ## 🔨 HTML Compiler Rules
146
-
147
- Guido includes a powerful HTML compiler system that allows you to transform HTML content with custom rules. You can define additional rules and optionally ignore the default rules.
148
-
149
- ### Rule Types
150
-
151
- There are 4 types of compiler rules:
152
-
153
- #### 1. Replace Rule
154
- Replace specific strings in HTML content.
91
+ ### StripoEventType
155
92
 
156
93
  ```typescript
157
- {
158
- id: 'fix-encoding',
159
- description: 'Fix URL encoding issues',
160
- type: 'replace',
161
- search: '{%22', // String to find
162
- replacement: '%7B%22', // String to replace with
163
- replaceAll: true, // Replace all occurrences (default: true)
164
- priority: 10 // Execution priority (lower = earlier)
165
- }
166
- ```
167
-
168
- #### 2. Regex Rule
169
- Use regular expressions for complex pattern matching and replacement.
170
-
171
- ```typescript
172
- {
173
- id: 'remove-comments',
174
- description: 'Remove HTML comments',
175
- type: 'regex',
176
- pattern: '<!--.*?-->', // Regex pattern
177
- replacement: '', // Replacement string
178
- flags: 'g', // Regex flags (default: 'g')
179
- priority: 20
180
- }
181
- ```
182
-
183
- #### 3. Remove Rule
184
- Remove specific strings or patterns from HTML content.
185
-
186
- ```typescript
187
- {
188
- id: 'cleanup-scripts',
189
- description: 'Remove unwanted script tags',
190
- type: 'remove',
191
- targets: [ // Array of strings or RegExp objects
192
- '<script src="unwanted.js"></script>',
193
- /onclick="[^"]*"/g
194
- ],
195
- priority: 30
196
- }
197
- ```
198
-
199
- #### 4. Custom Rule
200
- Define complex transformation logic with a custom processor function.
201
-
202
- ```typescript
203
- {
204
- id: 'add-meta-tags',
205
- description: 'Add custom meta tags to head',
206
- type: 'custom',
207
- processor: (html: string): string => {
208
- // Custom transformation logic
209
- const metaTags = '<meta name="custom" content="value">';
210
- return html.replace('</head>', `${metaTags}</head>`);
211
- },
212
- priority: 40
213
- }
214
- ```
215
-
216
- ### Using HTML Compiler Rules
217
-
218
- #### Basic Usage with Custom Rules
219
-
220
- ```typescript
221
- const guidoConfig = {
222
- translationsPath: 'window.trans.en',
223
- htmlCompilerRules: [
224
- {
225
- id: 'replace-domain',
226
- description: 'Replace old domain with new one',
227
- type: 'replace',
228
- search: 'old-domain.com',
229
- replacement: 'new-domain.com',
230
- replaceAll: true,
231
- priority: 10
232
- },
233
- {
234
- id: 'remove-tracking',
235
- description: 'Remove tracking pixels',
236
- type: 'regex',
237
- pattern: '<img[^>]*tracking[^>]*>',
238
- replacement: '',
239
- flags: 'gi',
240
- priority: 20
241
- }
242
- ]
243
- };
244
- ```
245
-
246
- #### Ignoring Default Rules
247
-
248
- ```typescript
249
- const guidoConfig = {
250
- translationsPath: 'window.trans.en',
251
- ignoreDefaultHtmlCompilerRules: true, // Skip all default rules
252
- htmlCompilerRules: [
253
- // Only your custom rules will be applied
254
- {
255
- id: 'custom-transformation',
256
- type: 'replace',
257
- search: 'old-text',
258
- replacement: 'new-text',
259
- priority: 1
260
- }
261
- ]
262
- };
263
- ```
264
-
265
- ### Rule Execution Order
266
-
267
- Rules are executed in priority order (lower numbers first). Rules with the same priority are executed in array order.
268
-
269
- - **Priority 1-99**: Reserved for critical transformations
270
- - **Priority 100-999**: Standard transformations
271
- - **Priority 1000+**: Additional custom rules (automatically assigned)
272
-
273
- ### Default Rules
274
-
275
- Guido includes several default rules for common email HTML optimizations:
276
-
277
- - **URL encoding fixes**: Fixes malformed URL encoding in dynamic content
278
- - **Template tag restoration**: Restores `{{}}` template tags that got URL encoded
279
- - **HTML entity decoding**: Converts `&lt;` and `&gt;` back to `<` and `>`
280
- - **Cleanup rules**: Removes unwanted iframe and style elements
281
- - **MSO conditions**: Manages Outlook-specific conditional comments
282
- - **Domain replacement**: Updates old image domains to current ones
283
-
284
- You can view all default rules in: `src/config/compiler/htmlCompilerRules.ts`
285
-
286
- ### CompilerRule Interface
287
-
288
- ```typescript
289
- type CompilerRuleType = 'replace' | 'regex' | 'remove' | 'custom';
290
-
291
- interface BaseCompilerRule {
292
- id: string;
293
- description?: string;
294
- priority: number;
295
- }
296
-
297
- interface ReplaceRule extends BaseCompilerRule {
298
- type: 'replace';
299
- search: string;
300
- replacement: string;
301
- replaceAll?: boolean; // Default: true
302
- }
303
-
304
- interface RegexRule extends BaseCompilerRule {
305
- type: 'regex';
306
- pattern: string;
307
- replacement: string;
308
- flags?: string; // Default: 'g'
309
- }
310
-
311
- interface RemoveRule extends BaseCompilerRule {
312
- type: 'remove';
313
- targets: (string | RegExp)[]; // Array of strings or RegExp objects
314
- }
315
-
316
- interface CustomRule extends BaseCompilerRule {
317
- type: 'custom';
318
- processor: (html: string) => string;
319
- }
320
-
321
- type CompilerRule = ReplaceRule | RegexRule | RemoveRule | CustomRule;
94
+ type StripoEventType =
95
+ | 'save'
96
+ | 'export'
97
+ | 'close'
98
+ | 'autosave'
99
+ | 'publish'
100
+ | 'export:requested'
101
+ | 'export:ready';
322
102
  ```
323
103
 
324
104
  ---
@@ -390,34 +170,6 @@ const trans = useTranslations();
390
170
  trans('foo.bar')
391
171
  ```
392
172
 
393
- ## 📦 Local Building (Recommended)
394
-
395
- Run this commands if you want to test the package on your local before sending to NPM.
396
- ```sh
397
- bun run build
398
- ```
399
-
400
- Since bun does not have packaging yet, use npm here: 🥲
401
- ```sh
402
- npm pack
403
- ```
404
-
405
- It'll crate like `useinsider-guido-1.0.0.tgz` file.
406
-
407
- Move this file to your project path like: `email-fe` via:
408
- ```sh
409
- cp useinsider-guido-1.0.0.tgz ../email-fe
410
- ```
411
-
412
- Install the file to your project:
413
- ```sh
414
- npm i ./useinsider-guido-1.0.0.tgz
415
- ```
416
-
417
- Then you just need to rebuild to your project or restart the Container. 🎉
418
-
419
- For Future, we can create a shell script for it. Feel free to help 🙃
420
-
421
173
  ## 📦 Build Output
422
174
 
423
175
  The library builds to multiple formats:
@@ -459,12 +211,7 @@ ISC License
459
211
  - [@useinsider/design-system-vue](https://github.com/useinsider/design-system-vue) - Insider's Vue design system
460
212
 
461
213
  ## 🎯 TODO:
462
- - CSS part should be optimized with variables & `sass-loader`.
214
+ - [editor.css](src/static/editor.css) should be optimized with variables & `sass-loader`.
463
215
  - Master Version Generator should be fixed.
464
216
  - Playwright integration
465
217
  - Commitlint & Precommit Hooks integration
466
- - We need to emit save event and we should return template config to it
467
- - Default template should be same with production
468
- - Open Guido with saved template
469
- - Get User ID, Email and Unique Template ID as dynamic from props
470
- - Get Pre-built display conditions from API
@@ -1,17 +1,3 @@
1
- import type { CompilerRule } from './html-compiler';
2
1
  export type GuidoConfig = {
3
2
  translationsPath: string;
4
- htmlCompilerRules?: CompilerRule[];
5
- ignoreDefaultHtmlCompilerRules?: boolean;
6
3
  };
7
- export type DynamicContent = {
8
- value: string;
9
- text: string;
10
- fallback?: string;
11
- };
12
- export interface TooltipOptions {
13
- id: string;
14
- dynamicPosition: boolean;
15
- staticPosition: string;
16
- iconStatus: boolean;
17
- }
package/dist/App.vue.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import '../node_modules/@useinsider/design-system-vue/dist/design-system-vue.css';
2
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
3
3
  export default _default;
@@ -1,4 +1,4 @@
1
- import type { DynamicContent, GuidoConfig } from '@@/Types/generic';
1
+ import type { GuidoConfig } from '@@/Types/generic';
2
2
  type __VLS_Props = {
3
3
  emailId: string;
4
4
  userId: string;
@@ -7,14 +7,7 @@ type __VLS_Props = {
7
7
  username?: string;
8
8
  guidoConfig: GuidoConfig;
9
9
  };
10
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
11
- dynamicContent: {
12
- insert: (data: DynamicContent) => void;
13
- close: () => void;
14
- };
15
- }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
16
- "dynamic-content:open": (detail: DynamicContent | null) => void;
17
- }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
10
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
18
11
  export default _default;
19
12
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
20
13
  type __VLS_TypePropsToOption<T> = {
@@ -10,7 +10,7 @@ var s = function() {
10
10
  _,
11
11
  !1,
12
12
  null,
13
- "89423288"
13
+ "d4a5c957"
14
14
  );
15
15
  const f = a.exports;
16
16
  export {
@@ -1,10 +1,10 @@
1
- import { defineComponent as v, onMounted as w } from "vue";
2
- import { usePartner as h } from "../composables/usePartner.js";
3
- import { useStripo as D } from "../composables/useStripo.js";
4
- import { useTemplates as E } from "../composables/useTemplates.js";
5
- import { DefaultUsername as _, DefaultGuidoConfig as b } from "../enums/defaults.js";
6
- import T from "./organisms/header/HeaderWrapper.vue.js";
7
- const W = /* @__PURE__ */ v({
1
+ import { defineComponent as f, onMounted as c } from "vue";
2
+ import { usePartner as g } from "../composables/usePartner.js";
3
+ import { useStripo as _ } from "../composables/useStripo.js";
4
+ import { useTemplates as y } from "../composables/useTemplates.js";
5
+ import { DefaultUsername as C, DefaultGuidoConfig as T } from "../enums/defaults.js";
6
+ import w from "./organisms/header/HeaderWrapper.vue.js";
7
+ const h = /* @__PURE__ */ f({
8
8
  __name: "Guido",
9
9
  props: {
10
10
  emailId: null,
@@ -14,45 +14,30 @@ const W = /* @__PURE__ */ v({
14
14
  username: null,
15
15
  guidoConfig: null
16
16
  },
17
- emits: ["dynamic-content:open"],
18
- setup(g, { expose: C, emit: n }) {
19
- const t = g, { getPartnerName: o, getProductType: c } = h(), {
20
- emailId: i,
21
- userId: a,
22
- guidoConfig: r,
23
- partnerName: s = o(),
24
- productType: d = c(),
25
- username: u = _
26
- } = t;
17
+ setup(d) {
18
+ const o = d, { getPartnerName: r, getProductType: t } = g(), {
19
+ emailId: n,
20
+ userId: i,
21
+ guidoConfig: a,
22
+ partnerName: u = r(),
23
+ productType: p = t(),
24
+ username: m = C
25
+ } = o;
27
26
  window.GuidoConfig = {
28
- ...b,
29
- ...r
27
+ ...T,
28
+ ...a
30
29
  };
31
- const { initPlugin: m } = D({ emailId: i, userId: a, username: u, partnerName: s, productType: d }), { getDefaultTemplate: l } = E(), p = (e) => {
32
- console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
33
- }, y = () => {
34
- console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
35
- };
36
- return w(async () => {
37
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
30
+ const { initPlugin: l } = _({ emailId: n, userId: i, username: m, partnerName: u, productType: p }), { getDefaultTemplate: s } = y();
31
+ return c(async () => {
38
32
  try {
39
- const e = await l();
40
- await m(e);
33
+ const e = await s();
34
+ await l(e);
41
35
  } catch (e) {
42
36
  console.error("Failed to initialize Stripo editor:", e);
43
37
  }
44
- document.addEventListener("dynamic-content:open", (e) => {
45
- const f = e;
46
- console.debug("dynamic-content:open", f.detail), n("dynamic-content:open", f.detail);
47
- });
48
- }), C({
49
- dynamicContent: {
50
- insert: p,
51
- close: y
52
- }
53
- }), { __sfc: !0, props: t, getPartnerName: o, getProductType: c, emailId: i, userId: a, guidoConfig: r, partnerName: s, productType: d, username: u, emit: n, initPlugin: m, getDefaultTemplate: l, insertDynamicContent: p, closeDynamicContent: y, HeaderWrapper: T };
38
+ }), { __sfc: !0, props: o, getPartnerName: r, getProductType: t, emailId: n, userId: i, guidoConfig: a, partnerName: u, productType: p, username: m, initPlugin: l, getDefaultTemplate: s, HeaderWrapper: w };
54
39
  }
55
40
  });
56
41
  export {
57
- W as default
42
+ h as default
58
43
  };
@@ -1,2 +1,2 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
2
  export default _default;
@@ -1,17 +1,17 @@
1
1
  import r from "./LeftSlot.vue2.js";
2
2
  import o from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var n = function() {
4
- var t = this, e = t._self._c, s = t._self._setupProxy;
5
- return e("div", { staticClass: "d-f a-i-c" }, [e(s.InButtonV2, { staticClass: "p-2", attrs: { id: "guido__back-button", "label-text": "Back", "left-icon": "line-arrow-left", styling: "text", type: "secondary" } }), s.editorStore.isVersionHistoryOpen ? e(s.RestoreButton, { staticClass: "ml-3" }) : t._e()], 1);
6
- }, a = [], i = /* @__PURE__ */ o(
3
+ var _ = function() {
4
+ var t = this, e = t._self._c, n = t._self._setupProxy;
5
+ return e("div", [e(n.InButtonV2, { attrs: { id: "guido__back-button", "label-text": "Back", "left-icon": "line-arrow-left", styling: "text", type: "secondary" } })], 1);
6
+ }, s = [], a = /* @__PURE__ */ o(
7
7
  r,
8
- n,
9
- a,
8
+ _,
9
+ s,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const f = i.exports;
14
+ const i = a.exports;
15
15
  export {
16
- f as default
16
+ i as default
17
17
  };
@@ -1,11 +1,9 @@
1
1
  import { defineComponent as t } from "vue";
2
- import { useEditorStore as o } from "../../../stores/editor.js";
3
- import { InButtonV2 as r } from "@useinsider/design-system-vue";
4
- import e from "./version-history/RestoreButton.vue.js";
2
+ import { InButtonV2 as o } from "@useinsider/design-system-vue";
5
3
  const _ = /* @__PURE__ */ t({
6
4
  __name: "LeftSlot",
7
- setup(m) {
8
- return { __sfc: !0, editorStore: o(), InButtonV2: r, RestoreButton: e };
5
+ setup(e) {
6
+ return { __sfc: !0, InButtonV2: o };
9
7
  }
10
8
  });
11
9
  export {
@@ -1,17 +1,17 @@
1
- import i from "./MiddleSlot.vue2.js";
2
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var n = function() {
1
+ import s from "./MiddleSlot.vue2.js";
2
+ import n from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var i = function() {
4
4
  var e = this, o = e._self._c, t = e._self._setupProxy;
5
- return t.editorStore.isVersionHistoryOpen ? o("div", { staticClass: "d-f" }, [o(t.VersionHistory), o(t.VersionHistoryViewOptions)], 1) : o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__undo-button"), "tooltip-text": t.trans("action-builder.undo") } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__redo-button"), "tooltip-text": t.trans("action-builder.redo") } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button"), "tooltip-text": t.codeEditorTooltipText } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isPreviewModeOpen, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.previewTooltipText }, on: { click: t.handlePreview } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
6
- }, l = [], r = /* @__PURE__ */ s(
5
+ return t.editorStore.isVersionHistoryOpen ? o(t.VersionHistory) : o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "left-icon": "line-code", styling: "ghost", "tooltip-text": "Code Editor", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button") } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.trans("newsletter.email-preview") } })], 1);
6
+ }, l = [], r = /* @__PURE__ */ n(
7
+ s,
7
8
  i,
8
- n,
9
9
  l,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const u = r.exports;
14
+ const _ = r.exports;
15
15
  export {
16
- u as default
16
+ _ as default
17
17
  };
@@ -1,20 +1,20 @@
1
- import { defineComponent as s, computed as t } from "vue";
2
- import { useTranslations as n } from "../../../composables/useTranslations.js";
3
- import { useEditorStore as p } from "../../../stores/editor.js";
4
- import { getTooltipOptions as m } from "../../../utils/tooltipUtils.js";
5
- import { InButtonV2 as l } from "@useinsider/design-system-vue";
6
- import d from "./version-history/VersionHistory.vue.js";
7
- import w from "./version-history/ViewOptions.vue.js";
8
- import c from "./ViewOptions.vue.js";
9
- const M = /* @__PURE__ */ s({
1
+ import { defineComponent as r } from "vue";
2
+ import { useTranslations as s } from "../../../composables/useTranslations.js";
3
+ import { useEditorStore as n } from "../../../stores/editor.js";
4
+ import { InButtonV2 as e } from "@useinsider/design-system-vue";
5
+ import m from "./version-history/VersionHistory.vue.js";
6
+ const _ = /* @__PURE__ */ r({
10
7
  __name: "MiddleSlot",
11
- setup(f) {
12
- const e = p(), o = n(), r = t(() => e.isCodeEditorOpen ? o("newsletter.close-html-editor") : o("newsletter.html-editor")), i = t(() => e.isPreviewModeOpen ? o("newsletter.close-email-preview") : o("newsletter.email-preview"));
13
- return { __sfc: !0, editorStore: e, trans: o, codeEditorTooltipText: r, previewTooltipText: i, handlePreview: () => {
14
- e.isPreviewModeOpen = !e.isPreviewModeOpen;
15
- }, getTooltipOptions: m, InButtonV2: l, VersionHistory: d, VersionHistoryViewOptions: w, ViewOptions: c };
8
+ setup(p) {
9
+ const o = n(), t = s();
10
+ return { __sfc: !0, editorStore: o, trans: t, getTooltipOptions: (i) => ({
11
+ id: `${i}-tooltip`,
12
+ dynamicPosition: !1,
13
+ staticPosition: "bottom center",
14
+ iconStatus: !1
15
+ }), InButtonV2: e, VersionHistory: m };
16
16
  }
17
17
  });
18
18
  export {
19
- M as default
19
+ _ as default
20
20
  };
@@ -1,17 +1,20 @@
1
- import s from "./RightSlot.vue2.js";
1
+ import o from "./RightSlot.vue2.js";
2
+ /* empty css */
2
3
  import i from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var n = function() {
4
- var e = this, o = e._self._c, t = e._self._setupProxy;
5
- return o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }), o(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.exportHtml } }), o(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") } }), o(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button"), "tooltip-text": t.trans("newsletter.test-email") } }), o(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": t.editorStore.isVersionHistoryOpen } })], 1);
6
- }, r = [], l = /* @__PURE__ */ i(
7
- s,
8
- n,
4
+ var r = function() {
5
+ var s = this, e = s._self._c, t = s._self._setupProxy;
6
+ return e("div", { staticClass: "d-f header-right-slot" }, [e("div", { staticClass: "d-f" }, [t.editorStore.isVersionHistoryOpen ? e(t.VersionHistoryViewOptions) : e(t.ViewOptions)], 1), e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen }, on: { click: t.handleVersionHistory } }), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 }, on: { click: t.exportHtml } }), e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 } }), e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 } })], 1), t.editorStore.isVersionHistoryOpen ? e(t.InButtonV2, { attrs: { id: "guido__restore-button", "label-text": "Restore" }, on: { click: function(d) {
7
+ return t.restoreVersion(t.versionHistoryStore.currentPatch.id);
8
+ } } }) : e(t.InButtonV2, { attrs: { id: "guido__save-button", "label-text": "Save" } })], 1);
9
+ }, n = [], a = /* @__PURE__ */ i(
10
+ o,
9
11
  r,
12
+ n,
10
13
  !1,
11
14
  null,
12
- null
15
+ "fefca98f"
13
16
  );
14
- const d = l.exports;
17
+ const f = a.exports;
15
18
  export {
16
- d as default
19
+ f as default
17
20
  };