@useinsider/guido 1.0.0-beta.e40480e → 1.0.0-beta.e415f9e
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.
- package/README.md +282 -30
- package/dist/@types/generic.d.ts +8 -0
- package/dist/App.vue.d.ts +1 -1
- package/dist/_virtual/AddCustomFont.js +4 -0
- package/dist/_virtual/AiAssistantValueType.js +4 -0
- package/dist/_virtual/BackgroundColorBuiltInControl.js +4 -0
- package/dist/_virtual/BackgroundImageBuiltInControl.js +4 -0
- package/dist/_virtual/Block.js +4 -0
- package/dist/_virtual/BlockAttributes.js +4 -0
- package/dist/_virtual/BlockCompositionType.js +4 -0
- package/dist/_virtual/BlockPaddingsBuiltInControl.js +4 -0
- package/dist/_virtual/BlockRenderer.js +4 -0
- package/dist/_virtual/BlockType.js +4 -0
- package/dist/_virtual/BlocksPanel.js +4 -0
- package/dist/_virtual/BuiltInControl.js +4 -0
- package/dist/_virtual/BuiltInControlTypes.js +4 -0
- package/dist/_virtual/ButtonBorderBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonColorBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonFontColorBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonInternalIndentsBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonTextBuiltInControl.js +4 -0
- package/dist/_virtual/ContextAction.js +4 -0
- package/dist/_virtual/ContextActionType.js +4 -0
- package/dist/_virtual/Control.js +4 -0
- package/dist/_virtual/EditorStatePropertyType.js +4 -0
- package/dist/_virtual/Extension.js +4 -0
- package/dist/_virtual/ExtensionBuilder.js +4 -0
- package/dist/_virtual/FontFamilyBuiltInControl.js +4 -0
- package/dist/_virtual/LinkColorBuiltInControl.js +4 -0
- package/dist/_virtual/ModificationDescription.js +4 -0
- package/dist/_virtual/PanelPosition.js +4 -0
- package/dist/_virtual/PreviewDeviceMode.js +4 -0
- package/dist/_virtual/SettingsPanelRegistry.js +4 -0
- package/dist/_virtual/SettingsPanelTab.js +4 -0
- package/dist/_virtual/SettingsTab.js +4 -0
- package/dist/_virtual/StructureBorderBuiltInControl.js +4 -0
- package/dist/_virtual/StructurePaddingsBuiltInControl.js +4 -0
- package/dist/_virtual/TextColorBuiltInControl.js +4 -0
- package/dist/_virtual/TextLineSpacingBuiltInControl.js +4 -0
- package/dist/_virtual/TextSizeBuiltInControl.js +4 -0
- package/dist/_virtual/TextStyleBuiltInControl.js +4 -0
- package/dist/_virtual/UIElement.js +4 -0
- package/dist/_virtual/UIElementTagRegistry.js +4 -0
- package/dist/_virtual/UIElementType.js +4 -0
- package/dist/_virtual/UIElementsAttributes.js +4 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/components/Guido.vue.d.ts +15 -2
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +52 -18
- package/dist/components/organisms/header/LeftSlot.vue.d.ts +1 -1
- package/dist/components/organisms/header/LeftSlot.vue.js +8 -8
- package/dist/components/organisms/header/LeftSlot.vue2.js +5 -3
- package/dist/components/organisms/header/MiddleSlot.vue.js +7 -7
- package/dist/components/organisms/header/MiddleSlot.vue2.js +6 -4
- package/dist/components/organisms/header/RightSlot.vue.js +7 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +11 -14
- package/dist/components/organisms/header/ViewOptions.vue.d.ts +1 -1
- package/dist/components/organisms/header/ViewOptions.vue.js +1 -1
- package/dist/components/organisms/header/version-history/RestoreButton.vue.d.ts +2 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue.js +19 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue2.js +14 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +13 -1
- package/dist/components/organisms/header/version-history/VersionHistory.vue.js +7 -7
- package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +13 -10
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.d.ts +1 -1
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.js +1 -1
- package/dist/components/organisms/header/version-history/ViewOptions.vue.d.ts +1 -1
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +3 -3
- package/dist/composables/useActionsApi.d.ts +1 -0
- package/dist/composables/useActionsApi.js +14 -12
- package/dist/composables/useCustomInterfaceAppearance.js +45 -9
- package/dist/composables/useExport.d.ts +1 -1
- package/dist/composables/useExport.js +35 -20
- package/dist/composables/useHtmlCompiler.d.ts +4 -0
- package/dist/composables/useHtmlCompiler.js +16 -0
- package/dist/composables/useHttp.js +84 -0
- package/dist/composables/usePartner.d.ts +4 -0
- package/dist/composables/usePartner.js +16 -0
- package/dist/composables/useStripo.d.ts +2 -2
- package/dist/composables/useStripo.js +63 -55
- package/dist/composables/useToaster.d.ts +1 -0
- package/dist/composables/useToaster.js +24 -16
- package/dist/config/compiler/htmlCompilerRules.d.ts +2 -0
- package/dist/config/compiler/htmlCompilerRules.js +145 -0
- package/dist/config/compiler/outlookCompilerRules.d.ts +0 -0
- package/dist/enums/defaults.d.ts +2 -0
- package/dist/enums/defaults.js +5 -3
- package/dist/enums/displayConditions.d.ts +2 -0
- package/dist/enums/displayConditions.js +80 -0
- package/dist/extensions/DynamicContent/dynamic-content-modal.d.ts +6 -0
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +27 -0
- package/dist/extensions/DynamicContent/dynamic-content.css.js +24 -0
- package/dist/extensions/DynamicContent/dynamic-content.d.ts +16 -0
- package/dist/extensions/DynamicContent/dynamic-content.js +63 -0
- package/dist/extensions/DynamicContent/extension.d.ts +2 -0
- package/dist/extensions/DynamicContent/extension.js +11 -0
- package/dist/guido.css +1 -1
- package/dist/mock/api/custom-fonts.d.ts +2 -0
- package/dist/mock/api/default-template.d.ts +2 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +51 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +52 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +41 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlockRenderer.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlocksPanel.js +32 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/ContextAction.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AddCustomFont.js +8 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockAttributes.js +34 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +104 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundColorBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundImageBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BlockPaddingsBuiltInControl.js +44 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BuiltInControl.js +22 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonBorderBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonColorBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonFontColorBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonInternalIndentsBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonTextBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +20 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/FontFamilyBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/LinkColorBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +32 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructureBorderBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructurePaddingsBuiltInControl.js +44 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextColorBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextLineSpacingBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextSizeBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextStyleBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/index.js +266 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +26 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +22 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +18 -0
- package/dist/services/stripoApi.d.ts +8 -0
- package/dist/services/stripoApi.js +40 -0
- package/dist/static/styles/base.css.js +11 -0
- package/dist/static/styles/components/alert-message.css.js +39 -0
- package/dist/static/styles/components/amp-block.css.js +18 -0
- package/dist/static/styles/components/base-input.css.js +47 -0
- package/dist/static/styles/components/button-group.css.js +54 -0
- package/dist/static/styles/components/button.css.js +106 -0
- package/dist/static/styles/components/combobox.css.js +49 -0
- package/dist/static/styles/components/counter.css.js +42 -0
- package/dist/static/styles/components/dropdown-menu.css.js +52 -0
- package/dist/static/styles/components/narrow-panel.css.js +38 -0
- package/dist/static/styles/components/switcher.css.js +11 -0
- package/dist/static/styles/components/tabs.css.js +97 -0
- package/dist/static/styles/components/tools.css.js +23 -0
- package/dist/static/styles/components/version-history.css.js +30 -0
- package/dist/static/styles/components/wide-panel.css.js +135 -0
- package/dist/static/styles/variables.css.js +23 -0
- package/dist/stores/editor.js +1 -1
- package/dist/stores/version-history.js +1 -1
- package/dist/utils/htmlCompiler.d.ts +12 -0
- package/dist/utils/htmlCompiler.js +70 -0
- package/package.json +6 -5
- package/dist/composables/useTemplates.d.ts +0 -5
- package/dist/composables/useTemplates.js +0 -27
- package/dist/node_modules/pinia/dist/pinia.js +0 -317
- package/dist/node_modules/pinia/node_modules/vue-demi/lib/index.js +0 -11
- package/dist/static/editor.css.js +0 -182
- package/dist/static/templates/default/index.html.js +0 -5
- package/dist/static/templates/default/style.css.js +0 -119
package/README.md
CHANGED
|
@@ -14,7 +14,10 @@ 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`
|
|
17
19
|
|
|
20
|
+
---
|
|
18
21
|
## 🚀 Usage
|
|
19
22
|
|
|
20
23
|
### Basic Usage
|
|
@@ -23,8 +26,11 @@ npm install @useinsider/guido
|
|
|
23
26
|
<template>
|
|
24
27
|
<div>
|
|
25
28
|
<Guido
|
|
29
|
+
ref="guidoEditor"
|
|
26
30
|
:email-id="emailId"
|
|
31
|
+
:user-id="userId"
|
|
27
32
|
:guido-config="guidoConfig"
|
|
33
|
+
@dynamic-content:open="handleDynamicContentOpen"
|
|
28
34
|
/>
|
|
29
35
|
</div>
|
|
30
36
|
</template>
|
|
@@ -39,10 +45,35 @@ export default {
|
|
|
39
45
|
data() {
|
|
40
46
|
return {
|
|
41
47
|
emailId: 'abc123',
|
|
48
|
+
userId: '12345',
|
|
42
49
|
guidoConfig: {
|
|
43
|
-
translationsPath: 'window.trans.en'
|
|
50
|
+
translationsPath: 'window.trans.en',
|
|
51
|
+
htmlCompilerRules: [],
|
|
52
|
+
ignoreDefaultHtmlCompilerRules: false,
|
|
44
53
|
}
|
|
54
|
+
dynamicContentModalVisible: false
|
|
45
55
|
};
|
|
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
|
+
|
|
46
77
|
}
|
|
47
78
|
};
|
|
48
79
|
</script>
|
|
@@ -55,19 +86,48 @@ export default {
|
|
|
55
86
|
| Prop | Type | Required | Default | Description |
|
|
56
87
|
|------|------|----------|---------|-------------|
|
|
57
88
|
| `emailId` | `string` | ✅ | - | Unique identifier for the email draft |
|
|
89
|
+
| `userId` | `string` | ✅ | - | Unique identifier for the user draft |
|
|
90
|
+
| `username` | `string` | ⚪ | Guido User | User name |
|
|
91
|
+
| `partnerName` | `string` | ⚪ | Getting from URL host | Unique identifier for the partner draft |
|
|
92
|
+
| `productType` | `string` | ⚪ | Getting from URL path | Unique identifier for the product draft |
|
|
58
93
|
| `guidoConfig` | `GuidoConfig` | ✅ | - | Configuration object for the editor |
|
|
59
94
|
|
|
60
|
-
###
|
|
95
|
+
### Guido Exposed Methods
|
|
96
|
+
```typescript
|
|
97
|
+
dynamicContent.insert(DynamicContent);
|
|
98
|
+
dynamicContent.close();
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Guido Interfaces
|
|
61
102
|
|
|
62
103
|
```typescript
|
|
63
104
|
interface GuidoConfig {
|
|
64
105
|
translationsPath: string;
|
|
106
|
+
htmlCompilerRules: CompilerRule[];
|
|
107
|
+
ignoreDefaultHtmlCompilerRules: boolean;
|
|
65
108
|
}
|
|
66
109
|
```
|
|
67
110
|
|
|
68
111
|
| Property | Type | Default | Description |
|
|
69
112
|
|----------|------|---------|-------------|
|
|
70
113
|
| `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 |
|
|
71
131
|
|
|
72
132
|
### TypeScript Types
|
|
73
133
|
|
|
@@ -82,17 +142,183 @@ import type { GuidoConfig } from '@useinsider/guido';
|
|
|
82
142
|
import type { StripoEventType } from '@useinsider/guido';
|
|
83
143
|
```
|
|
84
144
|
|
|
85
|
-
|
|
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.
|
|
86
155
|
|
|
87
156
|
```typescript
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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 `<` and `>` 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;
|
|
96
322
|
```
|
|
97
323
|
|
|
98
324
|
---
|
|
@@ -138,24 +364,17 @@ VITE_STRIPO_ROLE=your_role
|
|
|
138
364
|
|
|
139
365
|
```
|
|
140
366
|
src/
|
|
141
|
-
├── components/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
├──
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
├──
|
|
151
|
-
|
|
152
|
-
│ ├── stripo.d.ts # Stripo-specific types
|
|
153
|
-
│ └── events.ts # Event types
|
|
154
|
-
├── static/
|
|
155
|
-
│ ├── editor.css # Custom editor styles
|
|
156
|
-
│ └── templates/
|
|
157
|
-
│ └── default/ # Default email template
|
|
158
|
-
└── library.ts # Main export for library
|
|
367
|
+
├── components/ # Vue components
|
|
368
|
+
├── composables/ # Vue composables & business logic
|
|
369
|
+
├── services/ # API layer
|
|
370
|
+
├── stores/ # State management
|
|
371
|
+
├── @types/ # TypeScript definitions
|
|
372
|
+
├── static/ # Static assets & templates
|
|
373
|
+
├── utils/ # Utility functions
|
|
374
|
+
├── enums/ # Constants & enums
|
|
375
|
+
├── mock/ # Mock data for development
|
|
376
|
+
├── plugins/ # Vue plugins
|
|
377
|
+
└── library.ts # Main export
|
|
159
378
|
```
|
|
160
379
|
|
|
161
380
|
## 🌐 i18n
|
|
@@ -171,6 +390,34 @@ const trans = useTranslations();
|
|
|
171
390
|
trans('foo.bar')
|
|
172
391
|
```
|
|
173
392
|
|
|
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
|
+
|
|
174
421
|
## 📦 Build Output
|
|
175
422
|
|
|
176
423
|
The library builds to multiple formats:
|
|
@@ -212,7 +459,12 @@ ISC License
|
|
|
212
459
|
- [@useinsider/design-system-vue](https://github.com/useinsider/design-system-vue) - Insider's Vue design system
|
|
213
460
|
|
|
214
461
|
## 🎯 TODO:
|
|
215
|
-
-
|
|
462
|
+
- CSS part should be optimized with variables & `sass-loader`.
|
|
216
463
|
- Master Version Generator should be fixed.
|
|
217
464
|
- Playwright integration
|
|
218
465
|
- 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
|
package/dist/@types/generic.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import type { CompilerRule } from './html-compiler';
|
|
1
2
|
export type GuidoConfig = {
|
|
2
3
|
translationsPath: string;
|
|
4
|
+
htmlCompilerRules?: CompilerRule[];
|
|
5
|
+
ignoreDefaultHtmlCompilerRules?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type DynamicContent = {
|
|
8
|
+
value: string;
|
|
9
|
+
text: string;
|
|
10
|
+
fallback?: string;
|
|
3
11
|
};
|
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").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
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<{}>>, {}>;
|
|
3
3
|
export default _default;
|