@useinsider/guido 1.0.0-beta.b79463f → 1.0.0-beta.b8ba815
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 +311 -22
- package/dist/@types/generic.d.ts +3 -0
- package/dist/components/Guido.vue.d.ts +7 -1
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +51 -29
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +10 -8
- package/dist/components/organisms/header/MiddleSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue2.js +28 -14
- package/dist/composables/useExport.d.ts +1 -1
- package/dist/composables/useExport.js +35 -20
- package/dist/composables/useGuidoActions.d.ts +46 -0
- package/dist/composables/useGuidoActions.js +37 -0
- package/dist/composables/useHtmlCompiler.d.ts +4 -0
- package/dist/composables/useHtmlCompiler.js +16 -0
- package/dist/composables/useProvideInject.d.ts +14 -0
- package/dist/composables/useProvideInject.js +17 -0
- package/dist/composables/useStripo.js +15 -14
- 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/guido.css +1 -1
- package/dist/mock/api/default-template.d.ts +2 -0
- package/dist/services/stripoApi.d.ts +2 -1
- package/dist/services/stripoApi.js +27 -7
- package/dist/utils/htmlCompiler.d.ts +12 -0
- package/dist/utils/htmlCompiler.js +70 -0
- package/package.json +2 -2
- package/dist/composables/useTemplates.d.ts +0 -5
- package/dist/composables/useTemplates.js +0 -27
- package/dist/static/templates/default/index.html.js +0 -5
- package/dist/static/templates/default/style.css.js +0 -119
package/README.md
CHANGED
|
@@ -27,10 +27,15 @@ npm install @useinsider/guido
|
|
|
27
27
|
<div>
|
|
28
28
|
<Guido
|
|
29
29
|
ref="guidoEditor"
|
|
30
|
-
:
|
|
30
|
+
:template-id="templateId"
|
|
31
31
|
:user-id="userId"
|
|
32
32
|
:guido-config="guidoConfig"
|
|
33
|
+
:html="initialHtml"
|
|
34
|
+
:css="initialCss"
|
|
33
35
|
@dynamic-content:open="handleDynamicContentOpen"
|
|
36
|
+
@back="handleBack"
|
|
37
|
+
@save:start="handleSaveStart"
|
|
38
|
+
@save:complete="handleSaveComplete"
|
|
34
39
|
/>
|
|
35
40
|
</div>
|
|
36
41
|
</template>
|
|
@@ -44,34 +49,55 @@ export default {
|
|
|
44
49
|
},
|
|
45
50
|
data() {
|
|
46
51
|
return {
|
|
47
|
-
|
|
48
|
-
userId: '
|
|
52
|
+
templateId: 'template-123',
|
|
53
|
+
userId: 'user-456',
|
|
54
|
+
initialHtml: '<p>Initial HTML content</p>',
|
|
55
|
+
initialCss: 'p { color: #333; }',
|
|
49
56
|
guidoConfig: {
|
|
50
|
-
translationsPath: 'window.trans.en'
|
|
51
|
-
|
|
57
|
+
translationsPath: 'window.trans.en',
|
|
58
|
+
htmlCompilerRules: [],
|
|
59
|
+
ignoreDefaultHtmlCompilerRules: false,
|
|
60
|
+
},
|
|
52
61
|
dynamicContentModalVisible: false
|
|
53
62
|
};
|
|
54
63
|
},
|
|
55
64
|
|
|
56
65
|
methods: {
|
|
57
|
-
handleDynamicContentOpen() {
|
|
66
|
+
handleDynamicContentOpen(detail) {
|
|
67
|
+
console.log('Dynamic content requested:', detail);
|
|
58
68
|
this.dynamicContentModalVisible = true;
|
|
59
|
-
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
handleBack() {
|
|
72
|
+
console.log('User clicked back button');
|
|
73
|
+
// Handle navigation back
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
handleSaveStart() {
|
|
77
|
+
console.log('Save process started');
|
|
78
|
+
// Show loading indicator
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
handleSaveComplete(template) {
|
|
82
|
+
console.log('Save completed:', template);
|
|
83
|
+
// Handle saved template data
|
|
84
|
+
},
|
|
85
|
+
|
|
60
86
|
// ⚠️ Your own Dynamic Content Modal should have this id: #guido-dynamic-content-modal
|
|
61
87
|
handleDynamicContentInsert() {
|
|
62
|
-
this.$
|
|
63
|
-
text: 'Text',
|
|
64
|
-
value: '
|
|
65
|
-
fallback: 'Fallback'
|
|
88
|
+
this.$refs.guidoEditor?.dynamicContent.insert({
|
|
89
|
+
text: 'Display Text',
|
|
90
|
+
value: 'actual-value',
|
|
91
|
+
fallback: 'Fallback Text'
|
|
66
92
|
});
|
|
67
93
|
|
|
68
94
|
this.dynamicContentModalVisible = false;
|
|
69
95
|
},
|
|
96
|
+
|
|
70
97
|
// ⚠️ It's mandatory. There is no way to understand if user closes the modal without selection.
|
|
71
98
|
handleDynamicContentClose() {
|
|
72
|
-
this.$
|
|
99
|
+
this.$refs.guidoEditor?.dynamicContent.close();
|
|
73
100
|
}
|
|
74
|
-
|
|
75
101
|
}
|
|
76
102
|
};
|
|
77
103
|
</script>
|
|
@@ -83,12 +109,14 @@ export default {
|
|
|
83
109
|
|
|
84
110
|
| Prop | Type | Required | Default | Description |
|
|
85
111
|
|------|------|----------|---------|-------------|
|
|
86
|
-
| `
|
|
87
|
-
| `userId` | `string` | ✅ | - | Unique identifier for the user
|
|
88
|
-
| `username` | `string` | ⚪ | Guido User | User name |
|
|
89
|
-
| `partnerName` | `string` | ⚪ | Getting from URL host | Unique identifier for the partner draft |
|
|
90
|
-
| `productType` | `string` | ⚪ | Getting from URL path | Unique identifier for the product draft |
|
|
112
|
+
| `templateId` | `string` | ✅ | - | Unique identifier for the email template |
|
|
113
|
+
| `userId` | `string` | ✅ | - | Unique identifier for the user |
|
|
91
114
|
| `guidoConfig` | `GuidoConfig` | ✅ | - | Configuration object for the editor |
|
|
115
|
+
| `partnerName` | `string` | ⚪ | From URL host | Partner identifier |
|
|
116
|
+
| `productType` | `string` | ⚪ | From URL path | Product type identifier |
|
|
117
|
+
| `username` | `string` | ⚪ | `'Guido User'` | Display name for the user |
|
|
118
|
+
| `html` | `string` | ⚪ | `''` | Initial HTML content for the template |
|
|
119
|
+
| `css` | `string` | ⚪ | `''` | Initial CSS styles for the template |
|
|
92
120
|
|
|
93
121
|
### Guido Exposed Methods
|
|
94
122
|
```typescript
|
|
@@ -101,12 +129,16 @@ dynamicContent.close();
|
|
|
101
129
|
```typescript
|
|
102
130
|
interface GuidoConfig {
|
|
103
131
|
translationsPath: string;
|
|
132
|
+
htmlCompilerRules: CompilerRule[];
|
|
133
|
+
ignoreDefaultHtmlCompilerRules: boolean;
|
|
104
134
|
}
|
|
105
135
|
```
|
|
106
136
|
|
|
107
137
|
| Property | Type | Default | Description |
|
|
108
138
|
|----------|------|---------|-------------|
|
|
109
139
|
| `translationsPath` | `string` | `'window.trans.en'` | JavaScript path to the translations object |
|
|
140
|
+
| `htmlCompilerRules` | `CompilerRule[]` | `[]` | Additional compiler rules to apply to HTML content. See [HTML Compiler Rules](#-html-compiler-rules) section below |
|
|
141
|
+
| `ignoreDefaultHtmlCompilerRules` | `boolean` | `false` | Skip default compiler rules and only use custom rules. Default rules: `src/config/compiler/htmlCompilerRules.ts` |
|
|
110
142
|
|
|
111
143
|
```typescript
|
|
112
144
|
interface DynamicContent {
|
|
@@ -115,6 +147,7 @@ interface DynamicContent {
|
|
|
115
147
|
fallback?: string;
|
|
116
148
|
}
|
|
117
149
|
```
|
|
150
|
+
---
|
|
118
151
|
|
|
119
152
|
| Property | Type | Default | Description |
|
|
120
153
|
|----------|------|---------|-------------|
|
|
@@ -135,6 +168,185 @@ import type { GuidoConfig } from '@useinsider/guido';
|
|
|
135
168
|
import type { StripoEventType } from '@useinsider/guido';
|
|
136
169
|
```
|
|
137
170
|
|
|
171
|
+
## 🔨 HTML Compiler Rules
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
|
|
175
|
+
### Rule Types
|
|
176
|
+
|
|
177
|
+
There are 4 types of compiler rules:
|
|
178
|
+
|
|
179
|
+
#### 1. Replace Rule
|
|
180
|
+
Replace specific strings in HTML content.
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
{
|
|
184
|
+
id: 'fix-encoding',
|
|
185
|
+
description: 'Fix URL encoding issues',
|
|
186
|
+
type: 'replace',
|
|
187
|
+
search: '{%22', // String to find
|
|
188
|
+
replacement: '%7B%22', // String to replace with
|
|
189
|
+
replaceAll: true, // Replace all occurrences (default: true)
|
|
190
|
+
priority: 10 // Execution priority (lower = earlier)
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### 2. Regex Rule
|
|
195
|
+
Use regular expressions for complex pattern matching and replacement.
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
{
|
|
199
|
+
id: 'remove-comments',
|
|
200
|
+
description: 'Remove HTML comments',
|
|
201
|
+
type: 'regex',
|
|
202
|
+
pattern: '<!--.*?-->', // Regex pattern
|
|
203
|
+
replacement: '', // Replacement string
|
|
204
|
+
flags: 'g', // Regex flags (default: 'g')
|
|
205
|
+
priority: 20
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### 3. Remove Rule
|
|
210
|
+
Remove specific strings or patterns from HTML content.
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
{
|
|
214
|
+
id: 'cleanup-scripts',
|
|
215
|
+
description: 'Remove unwanted script tags',
|
|
216
|
+
type: 'remove',
|
|
217
|
+
targets: [ // Array of strings or RegExp objects
|
|
218
|
+
'<script src="unwanted.js"></script>',
|
|
219
|
+
/onclick="[^"]*"/g
|
|
220
|
+
],
|
|
221
|
+
priority: 30
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### 4. Custom Rule
|
|
226
|
+
Define complex transformation logic with a custom processor function.
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
{
|
|
230
|
+
id: 'add-meta-tags',
|
|
231
|
+
description: 'Add custom meta tags to head',
|
|
232
|
+
type: 'custom',
|
|
233
|
+
processor: (html: string): string => {
|
|
234
|
+
// Custom transformation logic
|
|
235
|
+
const metaTags = '<meta name="custom" content="value">';
|
|
236
|
+
return html.replace('</head>', `${metaTags}</head>`);
|
|
237
|
+
},
|
|
238
|
+
priority: 40
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Using HTML Compiler Rules
|
|
243
|
+
|
|
244
|
+
#### Basic Usage with Custom Rules
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
const guidoConfig = {
|
|
248
|
+
translationsPath: 'window.trans.en',
|
|
249
|
+
htmlCompilerRules: [
|
|
250
|
+
{
|
|
251
|
+
id: 'replace-domain',
|
|
252
|
+
description: 'Replace old domain with new one',
|
|
253
|
+
type: 'replace',
|
|
254
|
+
search: 'old-domain.com',
|
|
255
|
+
replacement: 'new-domain.com',
|
|
256
|
+
replaceAll: true,
|
|
257
|
+
priority: 10
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: 'remove-tracking',
|
|
261
|
+
description: 'Remove tracking pixels',
|
|
262
|
+
type: 'regex',
|
|
263
|
+
pattern: '<img[^>]*tracking[^>]*>',
|
|
264
|
+
replacement: '',
|
|
265
|
+
flags: 'gi',
|
|
266
|
+
priority: 20
|
|
267
|
+
}
|
|
268
|
+
]
|
|
269
|
+
};
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### Ignoring Default Rules
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
const guidoConfig = {
|
|
276
|
+
translationsPath: 'window.trans.en',
|
|
277
|
+
ignoreDefaultHtmlCompilerRules: true, // Skip all default rules
|
|
278
|
+
htmlCompilerRules: [
|
|
279
|
+
// Only your custom rules will be applied
|
|
280
|
+
{
|
|
281
|
+
id: 'custom-transformation',
|
|
282
|
+
type: 'replace',
|
|
283
|
+
search: 'old-text',
|
|
284
|
+
replacement: 'new-text',
|
|
285
|
+
priority: 1
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
};
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Rule Execution Order
|
|
292
|
+
|
|
293
|
+
Rules are executed in priority order (lower numbers first). Rules with the same priority are executed in array order.
|
|
294
|
+
|
|
295
|
+
- **Priority 1-99**: Reserved for critical transformations
|
|
296
|
+
- **Priority 100-999**: Standard transformations
|
|
297
|
+
- **Priority 1000+**: Additional custom rules (automatically assigned)
|
|
298
|
+
|
|
299
|
+
### Default Rules
|
|
300
|
+
|
|
301
|
+
Guido includes several default rules for common email HTML optimizations:
|
|
302
|
+
|
|
303
|
+
- **URL encoding fixes**: Fixes malformed URL encoding in dynamic content
|
|
304
|
+
- **Template tag restoration**: Restores `{{}}` template tags that got URL encoded
|
|
305
|
+
- **HTML entity decoding**: Converts `<` and `>` back to `<` and `>`
|
|
306
|
+
- **Cleanup rules**: Removes unwanted iframe and style elements
|
|
307
|
+
- **MSO conditions**: Manages Outlook-specific conditional comments
|
|
308
|
+
- **Domain replacement**: Updates old image domains to current ones
|
|
309
|
+
|
|
310
|
+
You can view all default rules in: `src/config/compiler/htmlCompilerRules.ts`
|
|
311
|
+
|
|
312
|
+
### CompilerRule Interface
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
type CompilerRuleType = 'replace' | 'regex' | 'remove' | 'custom';
|
|
316
|
+
|
|
317
|
+
interface BaseCompilerRule {
|
|
318
|
+
id: string;
|
|
319
|
+
description?: string;
|
|
320
|
+
priority: number;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
interface ReplaceRule extends BaseCompilerRule {
|
|
324
|
+
type: 'replace';
|
|
325
|
+
search: string;
|
|
326
|
+
replacement: string;
|
|
327
|
+
replaceAll?: boolean; // Default: true
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
interface RegexRule extends BaseCompilerRule {
|
|
331
|
+
type: 'regex';
|
|
332
|
+
pattern: string;
|
|
333
|
+
replacement: string;
|
|
334
|
+
flags?: string; // Default: 'g'
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
interface RemoveRule extends BaseCompilerRule {
|
|
338
|
+
type: 'remove';
|
|
339
|
+
targets: (string | RegExp)[]; // Array of strings or RegExp objects
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
interface CustomRule extends BaseCompilerRule {
|
|
343
|
+
type: 'custom';
|
|
344
|
+
processor: (html: string) => string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
type CompilerRule = ReplaceRule | RegexRule | RemoveRule | CustomRule;
|
|
348
|
+
```
|
|
349
|
+
|
|
138
350
|
---
|
|
139
351
|
|
|
140
352
|
## 🔧 Development
|
|
@@ -191,6 +403,87 @@ src/
|
|
|
191
403
|
└── library.ts # Main export
|
|
192
404
|
```
|
|
193
405
|
|
|
406
|
+
## 🔌 Provide/Inject Utilities
|
|
407
|
+
|
|
408
|
+
Guido includes type-safe utilities for Vue's provide/inject system to facilitate dependency injection between components.
|
|
409
|
+
|
|
410
|
+
### useProvideInject
|
|
411
|
+
|
|
412
|
+
The `useProvideInject` composable provides two helper functions for type-safe dependency injection:
|
|
413
|
+
|
|
414
|
+
#### Basic Usage
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
// Parent component
|
|
418
|
+
import { provideValue } from '@useinsider/guido';
|
|
419
|
+
import { InjectionKey } from 'vue';
|
|
420
|
+
|
|
421
|
+
// Define a typed injection key
|
|
422
|
+
const MyServiceKey: InjectionKey<MyService> = Symbol('MyService');
|
|
423
|
+
|
|
424
|
+
// Provide the value
|
|
425
|
+
const myService = new MyService();
|
|
426
|
+
provideValue(MyServiceKey, myService);
|
|
427
|
+
|
|
428
|
+
// Child component
|
|
429
|
+
import { useInjectedValue } from '@useinsider/guido';
|
|
430
|
+
|
|
431
|
+
// Inject the value with type safety
|
|
432
|
+
const myService = useInjectedValue(MyServiceKey);
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
#### With Default Value
|
|
436
|
+
|
|
437
|
+
```typescript
|
|
438
|
+
// Inject with a fallback value
|
|
439
|
+
const myService = useInjectedValue(MyServiceKey, new DefaultService());
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
#### Error Handling
|
|
443
|
+
|
|
444
|
+
The `useInjectedValue` function will throw a descriptive error if no provider is found and no default value is provided:
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
// This will throw an error if no provider exists
|
|
448
|
+
try {
|
|
449
|
+
const myService = useInjectedValue(MyServiceKey);
|
|
450
|
+
} catch (error) {
|
|
451
|
+
console.error('No provider found for MyService');
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### API Reference
|
|
456
|
+
|
|
457
|
+
#### `provideValue`
|
|
458
|
+
|
|
459
|
+
```typescript
|
|
460
|
+
provideValue<T>(key: InjectionKey<T>, value: T): void
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Provides a value using Vue's provide system with type safety.
|
|
464
|
+
|
|
465
|
+
| Parameter | Type | Description |
|
|
466
|
+
|-----------|------|-------------|
|
|
467
|
+
| `key` | `InjectionKey<T>` | The typed injection key |
|
|
468
|
+
| `value` | `T` | The value to provide |
|
|
469
|
+
|
|
470
|
+
#### `useInjectedValue`
|
|
471
|
+
|
|
472
|
+
```typescript
|
|
473
|
+
useInjectedValue<T>(key: InjectionKey<T>, defaultValue?: T): T
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Injects a value using Vue's inject system with type safety and error handling.
|
|
477
|
+
|
|
478
|
+
| Parameter | Type | Required | Description |
|
|
479
|
+
|-----------|------|----------|-------------|
|
|
480
|
+
| `key` | `InjectionKey<T>` | ✅ | The typed injection key |
|
|
481
|
+
| `defaultValue` | `T` | ⚪ | Optional fallback value |
|
|
482
|
+
|
|
483
|
+
**Returns:** `T` - The injected value
|
|
484
|
+
|
|
485
|
+
**Throws:** `Error` - When no provider is found and no default value is provided
|
|
486
|
+
|
|
194
487
|
## 🌐 i18n
|
|
195
488
|
Before running the project, it sends to request to inone.useinsider.com/translations and writes the JSON file into - [trans.json](src/mock/responses/trans.json).
|
|
196
489
|
It allows to use production or local translations on your code. 🚀
|
|
@@ -277,8 +570,4 @@ ISC License
|
|
|
277
570
|
- Master Version Generator should be fixed.
|
|
278
571
|
- Playwright integration
|
|
279
572
|
- Commitlint & Precommit Hooks integration
|
|
280
|
-
- We need to emit save event and we should return template config to it
|
|
281
|
-
- Default template should be same with production
|
|
282
|
-
- Open Guido with saved template
|
|
283
|
-
- Get User ID, Email and Unique Template ID as dynamic from props
|
|
284
573
|
- Get Pre-built display conditions from API
|
package/dist/@types/generic.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { DynamicContent, GuidoConfig } from '@@/Types/generic';
|
|
2
|
+
import type { Template } from '@@/Types/stripo';
|
|
2
3
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
+
templateId: string;
|
|
4
5
|
userId: string;
|
|
5
6
|
partnerName?: string;
|
|
6
7
|
productType?: string;
|
|
7
8
|
username?: string;
|
|
9
|
+
html?: string;
|
|
10
|
+
css?: string;
|
|
8
11
|
guidoConfig: GuidoConfig;
|
|
9
12
|
};
|
|
10
13
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
@@ -14,6 +17,9 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
|
|
|
14
17
|
};
|
|
15
18
|
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
16
19
|
"dynamic-content:open": (detail: DynamicContent | null) => void;
|
|
20
|
+
back: () => void;
|
|
21
|
+
"save:start": () => void;
|
|
22
|
+
"save:complete": (template: Omit<Template, "forceRecreate">) => void;
|
|
17
23
|
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
18
24
|
export default _default;
|
|
19
25
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { DefaultUsername as _, DefaultGuidoConfig as
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { defineComponent as h, onMounted as w } from "vue";
|
|
2
|
+
import { provideGuidoActions as D } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as E } from "../composables/usePartner.js";
|
|
4
|
+
import { useStripo as S } from "../composables/useStripo.js";
|
|
5
|
+
import { DefaultUsername as _, DefaultGuidoConfig as G } from "../enums/defaults.js";
|
|
6
|
+
import I from "./organisms/header/HeaderWrapper.vue.js";
|
|
7
|
+
import { useStripoApi as k } from "../services/stripoApi.js";
|
|
8
|
+
const B = /* @__PURE__ */ h({
|
|
8
9
|
__name: "Guido",
|
|
9
10
|
props: {
|
|
10
|
-
|
|
11
|
+
templateId: null,
|
|
11
12
|
userId: null,
|
|
12
13
|
partnerName: null,
|
|
13
14
|
productType: null,
|
|
14
15
|
username: null,
|
|
16
|
+
html: null,
|
|
17
|
+
css: null,
|
|
15
18
|
guidoConfig: null
|
|
16
19
|
},
|
|
17
|
-
emits: ["dynamic-content:open"],
|
|
18
|
-
setup(
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
userId:
|
|
22
|
-
guidoConfig:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
emits: ["dynamic-content:open", "back", "save:start", "save:complete"],
|
|
21
|
+
setup(C, { expose: b, emit: t }) {
|
|
22
|
+
const o = C, { getPartnerName: n, getProductType: a } = E(), {
|
|
23
|
+
templateId: c,
|
|
24
|
+
userId: s,
|
|
25
|
+
guidoConfig: i,
|
|
26
|
+
html: r = "",
|
|
27
|
+
css: l = "",
|
|
28
|
+
partnerName: d = n(),
|
|
29
|
+
productType: u = a(),
|
|
30
|
+
username: m = _
|
|
31
|
+
} = o;
|
|
27
32
|
window.GuidoConfig = {
|
|
28
|
-
...
|
|
29
|
-
...
|
|
33
|
+
...G,
|
|
34
|
+
...i
|
|
30
35
|
};
|
|
31
|
-
const { initPlugin:
|
|
36
|
+
const { initPlugin: p } = S({ emailId: c, userId: s, username: m, partnerName: d, productType: u }), { getDefaultTemplate: g } = k();
|
|
37
|
+
D({
|
|
38
|
+
onBack: () => {
|
|
39
|
+
console.debug("guido:back"), t("back");
|
|
40
|
+
},
|
|
41
|
+
onSaveStart: () => {
|
|
42
|
+
console.debug("guido:save:start"), t("save:start");
|
|
43
|
+
},
|
|
44
|
+
onSaveComplete: (e) => {
|
|
45
|
+
console.debug("guido:save:complete", e), t("save:complete", e);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const f = (e) => {
|
|
32
49
|
console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
33
50
|
}, y = () => {
|
|
34
51
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
@@ -36,23 +53,28 @@ const W = /* @__PURE__ */ v({
|
|
|
36
53
|
return w(async () => {
|
|
37
54
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
38
55
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
56
|
+
let e = {
|
|
57
|
+
html: r,
|
|
58
|
+
css: l,
|
|
59
|
+
forceRecreate: !0
|
|
60
|
+
// TODO: It should be false for old templates. We will communicate with Stripo
|
|
61
|
+
};
|
|
62
|
+
e.html || (e = await g()), await p(e);
|
|
41
63
|
} catch (e) {
|
|
42
64
|
console.error("Failed to initialize Stripo editor:", e);
|
|
43
65
|
}
|
|
44
66
|
document.addEventListener("dynamic-content:open", (e) => {
|
|
45
|
-
const
|
|
46
|
-
console.debug("dynamic-content:open",
|
|
67
|
+
const v = e;
|
|
68
|
+
console.debug("dynamic-content:open", v.detail), t("dynamic-content:open", v.detail);
|
|
47
69
|
});
|
|
48
|
-
}),
|
|
70
|
+
}), b({
|
|
49
71
|
dynamicContent: {
|
|
50
|
-
insert:
|
|
72
|
+
insert: f,
|
|
51
73
|
close: y
|
|
52
74
|
}
|
|
53
|
-
}), { __sfc: !0, props:
|
|
75
|
+
}), { __sfc: !0, props: o, getPartnerName: n, getProductType: a, templateId: c, userId: s, guidoConfig: i, html: r, css: l, partnerName: d, productType: u, username: m, emit: t, initPlugin: p, getDefaultTemplate: g, insertDynamicContent: f, closeDynamicContent: y, HeaderWrapper: I };
|
|
54
76
|
}
|
|
55
77
|
});
|
|
56
78
|
export {
|
|
57
|
-
|
|
79
|
+
B as default
|
|
58
80
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import n from "./LeftSlot.vue2.js";
|
|
2
2
|
import o from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
return
|
|
3
|
+
var r = function() {
|
|
4
|
+
var e = this, s = e._self._c, t = e._self._setupProxy;
|
|
5
|
+
return s("div", { staticClass: "d-f a-i-c" }, [s(t.InButtonV2, { staticClass: "p-2", attrs: { id: "guido__back-button", "label-text": "Back", "left-icon": "line-arrow-left", styling: "text", type: "secondary" }, on: { click: t.handleBack } }), t.editorStore.isVersionHistoryOpen ? s(t.RestoreButton, { staticClass: "ml-3" }) : e._e()], 1);
|
|
6
6
|
}, a = [], i = /* @__PURE__ */ o(
|
|
7
|
-
r,
|
|
8
7
|
n,
|
|
8
|
+
r,
|
|
9
9
|
a,
|
|
10
10
|
!1,
|
|
11
11
|
null,
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { defineComponent as r } from "vue";
|
|
2
|
+
import { useBack as e } from "../../../composables/useGuidoActions.js";
|
|
3
|
+
import { useEditorStore as m } from "../../../stores/editor.js";
|
|
4
|
+
import { InButtonV2 as n } from "@useinsider/design-system-vue";
|
|
5
|
+
import s from "./version-history/RestoreButton.vue.js";
|
|
6
|
+
const c = /* @__PURE__ */ r({
|
|
6
7
|
__name: "LeftSlot",
|
|
7
|
-
setup(
|
|
8
|
-
|
|
8
|
+
setup(f) {
|
|
9
|
+
const o = m(), t = e();
|
|
10
|
+
return { __sfc: !0, editorStore: o, handleBack: t, InButtonV2: n, RestoreButton: s };
|
|
9
11
|
}
|
|
10
12
|
});
|
|
11
13
|
export {
|
|
12
|
-
|
|
14
|
+
c as default
|
|
13
15
|
};
|
|
@@ -2,7 +2,7 @@ import s from "./MiddleSlot.vue2.js";
|
|
|
2
2
|
import i from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var n = 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 } }), 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") } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
|
|
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 } }), 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", "data-testid": "Code Editor", "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") } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
|
|
6
6
|
}, l = [], r = /* @__PURE__ */ i(
|
|
7
7
|
s,
|
|
8
8
|
n,
|
|
@@ -2,7 +2,7 @@ import o from "./RightSlot.vue2.js";
|
|
|
2
2
|
import i from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var n = function() {
|
|
4
4
|
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
5
|
-
return 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 } }), e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": t.editorStore.isVersionHistoryOpen } })], 1);
|
|
5
|
+
return 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 } }), e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": t.editorStore.isVersionHistoryOpen }, on: { click: t.handleSave } })], 1);
|
|
6
6
|
}, r = [], a = /* @__PURE__ */ i(
|
|
7
7
|
o,
|
|
8
8
|
n,
|