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

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 (156) hide show
  1. package/README.md +159 -23
  2. package/dist/@types/generic.d.ts +22 -1
  3. package/dist/components/Guido.vue.d.ts +11 -1
  4. package/dist/components/Guido.vue.js +8 -8
  5. package/dist/components/Guido.vue2.js +73 -34
  6. package/dist/components/organisms/base/Toaster.vue.d.ts +2 -0
  7. package/dist/components/organisms/base/Toaster.vue.js +17 -0
  8. package/dist/components/organisms/base/Toaster.vue2.js +15 -0
  9. package/dist/components/organisms/email-preview/PreviewContainer.vue.d.ts +2 -0
  10. package/dist/components/organisms/email-preview/PreviewContainer.vue.js +19 -0
  11. package/dist/components/organisms/email-preview/PreviewContainer.vue2.js +19 -0
  12. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.d.ts +4 -0
  13. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +22 -0
  14. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue2.js +30 -0
  15. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.d.ts +2 -0
  16. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +19 -0
  17. package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +29 -0
  18. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.d.ts +2 -0
  19. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +22 -0
  20. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +31 -0
  21. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.d.ts +2 -0
  22. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +17 -0
  23. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +20 -0
  24. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.d.ts +2 -0
  25. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +18 -0
  26. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +25 -0
  27. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.d.ts +4 -0
  28. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +19 -0
  29. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +23 -0
  30. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.d.ts +4 -0
  31. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +20 -0
  32. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +21 -0
  33. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.d.ts +2 -0
  34. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +17 -0
  35. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +22 -0
  36. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  37. package/dist/components/organisms/header/LeftSlot.vue2.js +10 -8
  38. package/dist/components/organisms/header/MiddleSlot.vue.js +5 -5
  39. package/dist/components/organisms/header/MiddleSlot.vue2.js +16 -15
  40. package/dist/components/organisms/header/RightSlot.vue.js +11 -10
  41. package/dist/components/organisms/header/RightSlot.vue2.js +31 -15
  42. package/dist/components/organisms/header/ViewOptions.vue.js +8 -8
  43. package/dist/components/organisms/header/ViewOptions.vue2.js +30 -10
  44. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +3 -3
  45. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +34 -16
  46. package/dist/components/wrappers/WpModal.vue.d.ts +65 -0
  47. package/dist/components/wrappers/WpModal.vue.js +27 -0
  48. package/dist/components/wrappers/WpModal.vue2.js +22 -0
  49. package/dist/composables/useActionsApi.d.ts +2 -0
  50. package/dist/composables/useActionsApi.js +62 -36
  51. package/dist/composables/useCodeEditorApi.d.ts +4 -0
  52. package/dist/composables/useCodeEditorApi.js +11 -0
  53. package/dist/composables/useConfig.d.ts +4 -0
  54. package/dist/composables/useConfig.js +7 -0
  55. package/dist/composables/useDebounce.d.ts +4 -0
  56. package/dist/composables/useDebounce.js +12 -0
  57. package/dist/composables/useExport.js +6 -6
  58. package/dist/composables/useGuidoActions.d.ts +46 -0
  59. package/dist/composables/useGuidoActions.js +37 -0
  60. package/dist/composables/useHtmlCompiler.js +9 -8
  61. package/dist/composables/usePreviewMode.d.ts +5 -0
  62. package/dist/composables/usePreviewMode.js +31 -0
  63. package/dist/composables/useProvideInject.d.ts +14 -0
  64. package/dist/composables/useProvideInject.js +17 -0
  65. package/dist/composables/useResponsivePreview.d.ts +5 -0
  66. package/dist/composables/useResponsivePreview.js +86 -0
  67. package/dist/composables/useStripo.js +27 -20
  68. package/dist/composables/useToaster.d.ts +1 -16
  69. package/dist/composables/useToaster.js +23 -30
  70. package/dist/composables/useTranslations.js +3 -2
  71. package/dist/composables/useVersionHistoryApi.js +4 -4
  72. package/dist/enums/defaults.js +14 -5
  73. package/dist/enums/preview.d.ts +13 -0
  74. package/dist/enums/preview.js +23 -0
  75. package/dist/extensions/DynamicContent/dynamic-content.js +13 -15
  76. package/dist/guido.css +1 -1
  77. package/dist/mock/api/default-template.d.ts +2 -0
  78. package/dist/node_modules/lodash-es/_Stack.js +18 -0
  79. package/dist/node_modules/lodash-es/_Uint8Array.js +5 -0
  80. package/dist/node_modules/lodash-es/_apply.js +16 -0
  81. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +19 -0
  82. package/dist/node_modules/lodash-es/_assignMergeValue.js +8 -0
  83. package/dist/node_modules/lodash-es/_assignValue.js +10 -0
  84. package/dist/node_modules/lodash-es/_baseAssignValue.js +12 -0
  85. package/dist/node_modules/lodash-es/_baseCreate.js +17 -0
  86. package/dist/node_modules/lodash-es/_baseFor.js +5 -0
  87. package/dist/node_modules/lodash-es/_baseIsArguments.js +9 -0
  88. package/dist/node_modules/lodash-es/_baseIsTypedArray.js +12 -0
  89. package/dist/node_modules/lodash-es/_baseKeysIn.js +15 -0
  90. package/dist/node_modules/lodash-es/_baseMerge.js +20 -0
  91. package/dist/node_modules/lodash-es/_baseMergeDeep.js +31 -0
  92. package/dist/node_modules/lodash-es/_baseRest.js +9 -0
  93. package/dist/node_modules/lodash-es/_baseSetToString.js +14 -0
  94. package/dist/node_modules/lodash-es/_baseTimes.js +8 -0
  95. package/dist/node_modules/lodash-es/_baseUnary.js +8 -0
  96. package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  97. package/dist/node_modules/lodash-es/_cloneBuffer.js +9 -0
  98. package/dist/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  99. package/dist/node_modules/lodash-es/_copyArray.js +9 -0
  100. package/dist/node_modules/lodash-es/_copyObject.js +14 -0
  101. package/dist/node_modules/lodash-es/_createAssigner.js +15 -0
  102. package/dist/node_modules/lodash-es/_createBaseFor.js +13 -0
  103. package/dist/node_modules/lodash-es/_defineProperty.js +11 -0
  104. package/dist/node_modules/lodash-es/_getPrototype.js +5 -0
  105. package/dist/node_modules/lodash-es/_initCloneObject.js +9 -0
  106. package/dist/node_modules/lodash-es/_isIndex.js +8 -0
  107. package/dist/node_modules/lodash-es/_isIterateeCall.js +13 -0
  108. package/dist/node_modules/lodash-es/_isPrototype.js +8 -0
  109. package/dist/node_modules/lodash-es/_nativeKeysIn.js +10 -0
  110. package/dist/node_modules/lodash-es/_nodeUtil.js +11 -0
  111. package/dist/node_modules/lodash-es/_overArg.js +8 -0
  112. package/dist/node_modules/lodash-es/_overRest.js +15 -0
  113. package/dist/node_modules/lodash-es/_safeGet.js +7 -0
  114. package/dist/node_modules/lodash-es/_setToString.js +6 -0
  115. package/dist/node_modules/lodash-es/_shortOut.js +16 -0
  116. package/dist/node_modules/lodash-es/_stackClear.js +7 -0
  117. package/dist/node_modules/lodash-es/_stackDelete.js +7 -0
  118. package/dist/node_modules/lodash-es/_stackGet.js +6 -0
  119. package/dist/node_modules/lodash-es/_stackHas.js +6 -0
  120. package/dist/node_modules/lodash-es/_stackSet.js +17 -0
  121. package/dist/node_modules/lodash-es/constant.js +8 -0
  122. package/dist/node_modules/lodash-es/identity.js +6 -0
  123. package/dist/node_modules/lodash-es/isArguments.js +10 -0
  124. package/dist/node_modules/lodash-es/isArray.js +4 -0
  125. package/dist/node_modules/lodash-es/isArrayLike.js +8 -0
  126. package/dist/node_modules/lodash-es/isArrayLikeObject.js +8 -0
  127. package/dist/node_modules/lodash-es/isBuffer.js +6 -0
  128. package/dist/node_modules/lodash-es/isLength.js +7 -0
  129. package/dist/node_modules/lodash-es/isObjectLike.js +6 -0
  130. package/dist/node_modules/lodash-es/isPlainObject.js +16 -0
  131. package/dist/node_modules/lodash-es/isTypedArray.js +7 -0
  132. package/dist/node_modules/lodash-es/keysIn.js +9 -0
  133. package/dist/node_modules/lodash-es/merge.js +8 -0
  134. package/dist/node_modules/lodash-es/stubFalse.js +6 -0
  135. package/dist/node_modules/lodash-es/toPlainObject.js +8 -0
  136. package/dist/services/stripoApi.d.ts +2 -1
  137. package/dist/services/stripoApi.js +27 -7
  138. package/dist/static/assets/inbox-mockup.svg.js +4 -0
  139. package/dist/static/assets/phone-mockup.svg.js +4 -0
  140. package/dist/stores/dynamic-content.d.ts +27 -0
  141. package/dist/stores/dynamic-content.js +23 -0
  142. package/dist/stores/preview.d.ts +46 -0
  143. package/dist/stores/preview.js +53 -0
  144. package/dist/stores/toaster.d.ts +25 -0
  145. package/dist/stores/toaster.js +28 -0
  146. package/dist/utils/arrayUtil.d.ts +1 -0
  147. package/dist/utils/arrayUtil.js +10 -0
  148. package/dist/utils/genericUtil.d.ts +2 -0
  149. package/dist/utils/genericUtil.js +7 -0
  150. package/dist/utils/tooltipUtils.d.ts +1 -1
  151. package/dist/utils/tooltipUtils.js +8 -6
  152. package/package.json +1 -1
  153. package/dist/composables/useTemplates.d.ts +0 -5
  154. package/dist/composables/useTemplates.js +0 -27
  155. package/dist/static/templates/default/index.html.js +0 -5
  156. 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
- :email-id="emailId"
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,36 +49,60 @@ export default {
44
49
  },
45
50
  data() {
46
51
  return {
47
- emailId: 'abc123',
48
- userId: '12345',
52
+ templateId: 'template-123',
53
+ userId: 'user-456',
54
+ initialHtml: '<p>Initial HTML content</p>',
55
+ initialCss: 'p { color: #333; }',
49
56
  guidoConfig: {
50
57
  translationsPath: 'window.trans.en',
51
58
  htmlCompilerRules: [],
52
59
  ignoreDefaultHtmlCompilerRules: false,
53
- }
60
+ features: {
61
+ dynamicContent: true,
62
+ saveAsTemplate: true,
63
+ versionHistory: true
64
+ }
65
+ },
54
66
  dynamicContentModalVisible: false
55
67
  };
56
68
  },
57
69
 
58
70
  methods: {
59
- handleDynamicContentOpen() {
71
+ handleDynamicContentOpen(detail) {
72
+ console.log('Dynamic content requested:', detail);
60
73
  this.dynamicContentModalVisible = true;
61
- }
74
+ },
75
+
76
+ handleBack() {
77
+ console.log('User clicked back button');
78
+ // Handle navigation back
79
+ },
80
+
81
+ handleSaveStart() {
82
+ console.log('Save process started');
83
+ // Show loading indicator
84
+ },
85
+
86
+ handleSaveComplete(template) {
87
+ console.log('Save completed:', template);
88
+ // Handle saved template data
89
+ },
90
+
62
91
  // ⚠️ Your own Dynamic Content Modal should have this id: #guido-dynamic-content-modal
63
92
  handleDynamicContentInsert() {
64
- this.$ref.guidoEditor?.dynamicContent.insert({
65
- text: 'Text',
66
- value: 'Value',
67
- fallback: 'Fallback'
93
+ this.$refs.guidoEditor?.dynamicContent.insert({
94
+ text: 'Display Text',
95
+ value: 'actual-value',
96
+ fallback: 'Fallback Text'
68
97
  });
69
98
 
70
99
  this.dynamicContentModalVisible = false;
71
100
  },
101
+
72
102
  // ⚠️ It's mandatory. There is no way to understand if user closes the modal without selection.
73
103
  handleDynamicContentClose() {
74
- this.$ref.guidoEditor?.dynamicContent.close();
104
+ this.$refs.guidoEditor?.dynamicContent.close();
75
105
  }
76
-
77
106
  }
78
107
  };
79
108
  </script>
@@ -85,12 +114,23 @@ export default {
85
114
 
86
115
  | Prop | Type | Required | Default | Description |
87
116
  |------|------|----------|---------|-------------|
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 |
117
+ | `templateId` | `string` | ✅ | - | Unique identifier for the email template |
118
+ | `userId` | `string` | ✅ | - | Unique identifier for the user |
93
119
  | `guidoConfig` | `GuidoConfig` | ✅ | - | Configuration object for the editor |
120
+ | `partnerName` | `string` | ⚪ | From URL host | Partner identifier |
121
+ | `productType` | `string` | ⚪ | From URL path | Product type identifier |
122
+ | `username` | `string` | ⚪ | `'Guido User'` | Display name for the user |
123
+ | `html` | `string` | ⚪ | `''` | Initial HTML content for the template |
124
+ | `css` | `string` | ⚪ | `''` | Initial CSS styles for the template |
125
+
126
+ ### Guido Component Events
127
+
128
+ | Event | Payload | Description |
129
+ |-------|---------|-------------|
130
+ | `dynamic-content:open` | `DynamicContent \| null` | Fired when user requests to insert dynamic content |
131
+ | `back` | - | Fired when user clicks the back button |
132
+ | `save:start` | - | Fired when the save process begins |
133
+ | `save:complete` | `Omit<Template, 'forceRecreate'>` | Fired when template is successfully saved |
94
134
 
95
135
  ### Guido Exposed Methods
96
136
  ```typescript
@@ -103,8 +143,13 @@ dynamicContent.close();
103
143
  ```typescript
104
144
  interface GuidoConfig {
105
145
  translationsPath: string;
106
- htmlCompilerRules: CompilerRule[];
107
- ignoreDefaultHtmlCompilerRules: boolean;
146
+ htmlCompilerRules?: CompilerRule[];
147
+ ignoreDefaultHtmlCompilerRules?: boolean;
148
+ features: {
149
+ dynamicContent: boolean;
150
+ saveAsTemplate: boolean;
151
+ versionHistory: boolean;
152
+ };
108
153
  }
109
154
  ```
110
155
 
@@ -113,6 +158,10 @@ interface GuidoConfig {
113
158
  | `translationsPath` | `string` | `'window.trans.en'` | JavaScript path to the translations object |
114
159
  | `htmlCompilerRules` | `CompilerRule[]` | `[]` | Additional compiler rules to apply to HTML content. See [HTML Compiler Rules](#-html-compiler-rules) section below |
115
160
  | `ignoreDefaultHtmlCompilerRules` | `boolean` | `false` | Skip default compiler rules and only use custom rules. Default rules: `src/config/compiler/htmlCompilerRules.ts` |
161
+ | `features` | `Features` | `{ dynamicContent: true, saveAsTemplate: true, versionHistory: true }` | Feature flags to enable/disable editor functionality |
162
+ | `features.dynamicContent` | `boolean` | `true` | Enable dynamic content insertion feature |
163
+ | `features.saveAsTemplate` | `boolean` | `true` | Enable save as template feature |
164
+ | `features.versionHistory` | `boolean` | `true` | Enable version history feature |
116
165
 
117
166
  ```typescript
118
167
  interface DynamicContent {
@@ -220,6 +269,11 @@ Define complex transformation logic with a custom processor function.
220
269
  ```typescript
221
270
  const guidoConfig = {
222
271
  translationsPath: 'window.trans.en',
272
+ features: {
273
+ dynamicContent: true,
274
+ saveAsTemplate: true,
275
+ versionHistory: false // Disable version history
276
+ },
223
277
  htmlCompilerRules: [
224
278
  {
225
279
  id: 'replace-domain',
@@ -248,6 +302,11 @@ const guidoConfig = {
248
302
  ```typescript
249
303
  const guidoConfig = {
250
304
  translationsPath: 'window.trans.en',
305
+ features: {
306
+ dynamicContent: true,
307
+ saveAsTemplate: true,
308
+ versionHistory: true
309
+ },
251
310
  ignoreDefaultHtmlCompilerRules: true, // Skip all default rules
252
311
  htmlCompilerRules: [
253
312
  // Only your custom rules will be applied
@@ -377,6 +436,87 @@ src/
377
436
  └── library.ts # Main export
378
437
  ```
379
438
 
439
+ ## 🔌 Provide/Inject Utilities
440
+
441
+ Guido includes type-safe utilities for Vue's provide/inject system to facilitate dependency injection between components.
442
+
443
+ ### useProvideInject
444
+
445
+ The `useProvideInject` composable provides two helper functions for type-safe dependency injection:
446
+
447
+ #### Basic Usage
448
+
449
+ ```typescript
450
+ // Parent component
451
+ import { provideValue } from '@useinsider/guido';
452
+ import { InjectionKey } from 'vue';
453
+
454
+ // Define a typed injection key
455
+ const MyServiceKey: InjectionKey<MyService> = Symbol('MyService');
456
+
457
+ // Provide the value
458
+ const myService = new MyService();
459
+ provideValue(MyServiceKey, myService);
460
+
461
+ // Child component
462
+ import { useInjectedValue } from '@useinsider/guido';
463
+
464
+ // Inject the value with type safety
465
+ const myService = useInjectedValue(MyServiceKey);
466
+ ```
467
+
468
+ #### With Default Value
469
+
470
+ ```typescript
471
+ // Inject with a fallback value
472
+ const myService = useInjectedValue(MyServiceKey, new DefaultService());
473
+ ```
474
+
475
+ #### Error Handling
476
+
477
+ The `useInjectedValue` function will throw a descriptive error if no provider is found and no default value is provided:
478
+
479
+ ```typescript
480
+ // This will throw an error if no provider exists
481
+ try {
482
+ const myService = useInjectedValue(MyServiceKey);
483
+ } catch (error) {
484
+ console.error('No provider found for MyService');
485
+ }
486
+ ```
487
+
488
+ ### API Reference
489
+
490
+ #### `provideValue`
491
+
492
+ ```typescript
493
+ provideValue<T>(key: InjectionKey<T>, value: T): void
494
+ ```
495
+
496
+ Provides a value using Vue's provide system with type safety.
497
+
498
+ | Parameter | Type | Description |
499
+ |-----------|------|-------------|
500
+ | `key` | `InjectionKey<T>` | The typed injection key |
501
+ | `value` | `T` | The value to provide |
502
+
503
+ #### `useInjectedValue`
504
+
505
+ ```typescript
506
+ useInjectedValue<T>(key: InjectionKey<T>, defaultValue?: T): T
507
+ ```
508
+
509
+ Injects a value using Vue's inject system with type safety and error handling.
510
+
511
+ | Parameter | Type | Required | Description |
512
+ |-----------|------|----------|-------------|
513
+ | `key` | `InjectionKey<T>` | ✅ | The typed injection key |
514
+ | `defaultValue` | `T` | ⚪ | Optional fallback value |
515
+
516
+ **Returns:** `T` - The injected value
517
+
518
+ **Throws:** `Error` - When no provider is found and no default value is provided
519
+
380
520
  ## 🌐 i18n
381
521
  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).
382
522
  It allows to use production or local translations on your code. 🚀
@@ -463,8 +603,4 @@ ISC License
463
603
  - Master Version Generator should be fixed.
464
604
  - Playwright integration
465
605
  - 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
606
  - Get Pre-built display conditions from API
@@ -1,17 +1,38 @@
1
1
  import type { CompilerRule } from './html-compiler';
2
+ type Features = {
3
+ dynamicContent?: boolean;
4
+ saveAsTemplate?: boolean;
5
+ versionHistory?: boolean;
6
+ };
2
7
  export type GuidoConfig = {
3
8
  translationsPath: string;
4
9
  htmlCompilerRules?: CompilerRule[];
5
10
  ignoreDefaultHtmlCompilerRules?: boolean;
11
+ emailHeader: EmailHeader;
12
+ features?: Features;
6
13
  };
7
14
  export type DynamicContent = {
8
15
  value: string;
9
16
  text: string;
10
17
  fallback?: string;
11
18
  };
19
+ export interface EmailHeader {
20
+ senderName: string;
21
+ subject: string;
22
+ }
12
23
  export interface TooltipOptions {
13
24
  id: string;
14
25
  dynamicPosition: boolean;
15
- staticPosition: string;
26
+ staticPosition: 'top center' | 'top left' | 'top right' | 'bottom center' | 'bottom left' | 'bottom right' | 'right center' | 'right top' | 'right bottom' | 'left center' | 'left top' | 'left bottom';
16
27
  iconStatus: boolean;
28
+ offset?: {
29
+ x: number;
30
+ y: number;
31
+ };
32
+ preventXss?: boolean;
17
33
  }
34
+ export type MergeTag = {
35
+ label: string;
36
+ value: string;
37
+ };
38
+ export {};
@@ -1,10 +1,14 @@
1
1
  import type { DynamicContent, GuidoConfig } from '@@/Types/generic';
2
+ import type { Template } from '@@/Types/stripo';
2
3
  type __VLS_Props = {
3
- emailId: string;
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;
11
+ preselectedDynamicContentList: DynamicContent[];
8
12
  guidoConfig: GuidoConfig;
9
13
  };
10
14
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
@@ -14,6 +18,12 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
14
18
  };
15
19
  }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
16
20
  "dynamic-content:open": (detail: DynamicContent | null) => void;
21
+ back: () => void;
22
+ "save:start": () => void;
23
+ "save:complete": (data: {
24
+ template: Omit<Template, "forceRecreate">;
25
+ dynamicContentList: DynamicContent[];
26
+ }) => void;
17
27
  }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
18
28
  export default _default;
19
29
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -1,18 +1,18 @@
1
1
  import o from "./Guido.vue2.js";
2
2
  /* empty css */
3
- import i from "../_virtual/_plugin-vue2_normalizer.js";
3
+ import t from "../_virtual/_plugin-vue2_normalizer.js";
4
4
  var s = function() {
5
- var e = this, r = e._self._c, t = e._self._setupProxy;
6
- return r("div", { staticClass: "guido-editor__wrapper" }, [r(t.HeaderWrapper), r("div", { staticClass: "guido-editor__container", attrs: { id: "guido-editor" } })], 1);
7
- }, _ = [], a = /* @__PURE__ */ i(
5
+ var i = this, e = i._self._c, r = i._self._setupProxy;
6
+ return e("div", { staticClass: "guido-editor__wrapper" }, [e(r.HeaderWrapper), r.previewStore.isPreviewModeOpen ? e(r.PreviewContainer) : i._e(), e("div", { directives: [{ name: "show", rawName: "v-show", value: !r.previewStore.isPreviewModeOpen, expression: "!previewStore.isPreviewModeOpen" }], staticClass: "guido-editor__container", attrs: { id: "guido-editor" } }), e(r.Toaster)], 1);
7
+ }, a = [], n = /* @__PURE__ */ t(
8
8
  o,
9
9
  s,
10
- _,
10
+ a,
11
11
  !1,
12
12
  null,
13
- "89423288"
13
+ "09c28ccc"
14
14
  );
15
- const f = a.exports;
15
+ const v = n.exports;
16
16
  export {
17
- f as default
17
+ v as default
18
18
  };
@@ -1,58 +1,97 @@
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 L, defineAsyncComponent as E, onMounted as P } from "vue";
2
+ import { provideGuidoActions as _ } from "../composables/useGuidoActions.js";
3
+ import { usePartner as G } from "../composables/usePartner.js";
4
+ import { useStripo as I } from "../composables/useStripo.js";
5
+ import { DefaultUsername as T, DefaultGuidoConfig as k } from "../enums/defaults.js";
6
+ import A from "./organisms/base/Toaster.vue.js";
7
+ import N from "./organisms/header/HeaderWrapper.vue.js";
8
+ import { useStripoApi as x } from "../services/stripoApi.js";
9
+ import { useDynamicContentStore as W } from "../stores/dynamic-content.js";
10
+ import { usePreviewStore as z } from "../stores/preview.js";
11
+ import B from "../node_modules/lodash-es/merge.js";
12
+ const V = /* @__PURE__ */ L({
8
13
  __name: "Guido",
9
14
  props: {
10
- emailId: null,
15
+ templateId: null,
11
16
  userId: null,
12
17
  partnerName: null,
13
18
  productType: null,
14
19
  username: null,
20
+ html: null,
21
+ css: null,
22
+ preselectedDynamicContentList: null,
15
23
  guidoConfig: null
16
24
  },
17
- emits: ["dynamic-content:open"],
18
- setup(g, { expose: C, emit: n }) {
19
- const t = g, { getPartnerName: o, getProductType: c } = h(), {
20
- emailId: i,
25
+ emits: ["dynamic-content:open", "back", "save:start", "save:complete"],
26
+ setup(S, { expose: b, emit: t }) {
27
+ const o = S, w = E(
28
+ () => import("./organisms/email-preview/PreviewContainer.vue.js")
29
+ ), n = W(), c = o.preselectedDynamicContentList || [], { getPartnerName: i, getProductType: s } = G(), h = z(), {
30
+ templateId: r,
21
31
  userId: a,
22
- guidoConfig: r,
23
- partnerName: s = o(),
24
- productType: d = c(),
25
- username: u = _
26
- } = t;
27
- window.GuidoConfig = {
28
- ...b,
29
- ...r
30
- };
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 = () => {
32
+ guidoConfig: m,
33
+ html: d = "",
34
+ css: l = "",
35
+ partnerName: u = i(),
36
+ productType: p = s(),
37
+ username: y = T
38
+ } = o;
39
+ window.GuidoConfig = B(k, m);
40
+ const { initPlugin: f } = I({
41
+ emailId: r,
42
+ userId: a,
43
+ username: y,
44
+ partnerName: u,
45
+ productType: p,
46
+ preselectedDynamicContentList: c
47
+ }), { getDefaultTemplate: g } = x();
48
+ _({
49
+ onBack: () => {
50
+ console.debug("guido:back"), t("back");
51
+ },
52
+ onSaveStart: () => {
53
+ console.debug("guido:save:start"), t("save:start");
54
+ },
55
+ onSaveComplete: (e) => {
56
+ console.debug("guido:save:complete", {
57
+ template: e,
58
+ dynamicContentList: n.getSelectedDynamicContentList
59
+ }), t("save:complete", {
60
+ template: e,
61
+ dynamicContentList: n.getSelectedDynamicContentList
62
+ });
63
+ }
64
+ });
65
+ const C = (e) => {
66
+ console.debug("dynamic-content:close", e), n.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
67
+ }, v = () => {
34
68
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
35
69
  };
36
- return w(async () => {
70
+ return P(async () => {
37
71
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
38
72
  try {
39
- const e = await l();
40
- await m(e);
73
+ let e = {
74
+ html: d,
75
+ css: l,
76
+ forceRecreate: !0
77
+ // TODO: It should be false for old templates. We will communicate with Stripo
78
+ };
79
+ e.html || (e = await g()), await f(e), n.selectedDynamicContentList = c;
41
80
  } catch (e) {
42
81
  console.error("Failed to initialize Stripo editor:", e);
43
82
  }
44
83
  document.addEventListener("dynamic-content:open", (e) => {
45
- const f = e;
46
- console.debug("dynamic-content:open", f.detail), n("dynamic-content:open", f.detail);
84
+ const D = e;
85
+ console.debug("dynamic-content:open", D.detail), t("dynamic-content:open", D.detail);
47
86
  });
48
- }), C({
87
+ }), b({
49
88
  dynamicContent: {
50
- insert: p,
51
- close: y
89
+ insert: C,
90
+ close: v
52
91
  }
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 };
92
+ }), { __sfc: !0, PreviewContainer: w, dynamicContentStore: n, props: o, preselectedDynamicContentList: c, getPartnerName: i, getProductType: s, previewStore: h, templateId: r, userId: a, guidoConfig: m, html: d, css: l, partnerName: u, productType: p, username: y, emit: t, initPlugin: f, getDefaultTemplate: g, insertDynamicContent: C, closeDynamicContent: v, Toaster: A, HeaderWrapper: N };
54
93
  }
55
94
  });
56
95
  export {
57
- W as default
96
+ V as default
58
97
  };
@@ -0,0 +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<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import n from "./Toaster.vue2.js";
2
+ import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var r = function() {
4
+ var o = this, e = o._self._c, t = o._self._setupProxy;
5
+ return e(t.InToasts, { attrs: { "action-buttons-config": t.store.actionButtonsConfig, status: t.store.status, text: t.store.text, type: t.store.type }, on: { actionButtonClick0: t.handleActionClick } });
6
+ }, a = [], _ = /* @__PURE__ */ s(
7
+ n,
8
+ r,
9
+ a,
10
+ !1,
11
+ null,
12
+ null
13
+ );
14
+ const l = _.exports;
15
+ export {
16
+ l as default
17
+ };
@@ -0,0 +1,15 @@
1
+ import { defineComponent as o } from "vue";
2
+ import { useToasterStore as n } from "../../../stores/toaster.js";
3
+ import { InToasts as e } from "@useinsider/design-system-vue";
4
+ const m = /* @__PURE__ */ o({
5
+ __name: "Toaster",
6
+ setup(r) {
7
+ const t = n();
8
+ return { __sfc: !0, store: t, handleActionClick: () => {
9
+ t.actionButtonOnClick && t.actionButtonOnClick(), t.hideToaster();
10
+ }, InToasts: e };
11
+ }
12
+ });
13
+ export {
14
+ m as default
15
+ };
@@ -0,0 +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<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import i from "./PreviewContainer.vue2.js";
2
+ import o from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var t = function() {
4
+ var s = this, e = s._self._c, r = s._self._setupProxy;
5
+ return e("div", { staticClass: "d-f f-d-c h-1 b-c-5 bor-r-2 pb-5" }, [e("div", { staticClass: "f-g-1 d-f p-5 o-a g-4 min-h-600" }, [r.previewStore.isLoading ? [e("div", { staticClass: "d-f a-i-c j-c-c w-1 h-1 f-g-1" }, [e(r.InLoading, { attrs: { "color-class": "i-c-1", size: "32" } })], 1)] : [e(r.DesktopPreview, { staticClass: "f-g-1 min-w-0" }), e(r.MobilePreview, { staticClass: "f-0 min-w-a" })]], 2), r.previewStore.isAMPErrorModalVisible ? e(r.AmpErrorModal, { on: { close: function(l) {
6
+ return r.previewStore.closeErrorModal();
7
+ } } }) : s._e()], 1);
8
+ }, a = [], n = /* @__PURE__ */ o(
9
+ i,
10
+ t,
11
+ a,
12
+ !1,
13
+ null,
14
+ null
15
+ );
16
+ const d = n.exports;
17
+ export {
18
+ d as default
19
+ };
@@ -0,0 +1,19 @@
1
+ import { defineComponent as r, onMounted as t } from "vue";
2
+ import { usePreviewMode as i } from "../../../composables/usePreviewMode.js";
3
+ import { usePreviewStore as m } from "../../../stores/preview.js";
4
+ import { InLoading as n } from "@useinsider/design-system-vue";
5
+ import p from "./amp/AmpErrorModal.vue.js";
6
+ import f from "./desktop-preview/DesktopPreview.vue.js";
7
+ import s from "./mobile-preview/MobilePreview.vue.js";
8
+ const l = /* @__PURE__ */ r({
9
+ __name: "PreviewContainer",
10
+ setup(a) {
11
+ const { loadPreviewData: o } = i(), e = m();
12
+ return t(() => {
13
+ o();
14
+ }), { __sfc: !0, loadPreviewData: o, previewStore: e, InLoading: n, AmpErrorModal: p, DesktopPreview: f, MobilePreview: s };
15
+ }
16
+ });
17
+ export {
18
+ l as default
19
+ };
@@ -0,0 +1,4 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
2
+ close: () => void;
3
+ }, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
4
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import s from "./AmpErrorModal.vue2.js";
2
+ /* empty css */
3
+ import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var n = function() {
5
+ var e = this, r = e._self._c, t = e._self._setupProxy;
6
+ return r(t.WpModal, { attrs: { id: "amp-error-modal", size: "medium", description: t.trans("email-editor.amp-validation-description"), "footer-button-options": t.footerButtonOptions, title: t.trans("email-editor.amp-validation-title") }, on: { close: function(o) {
7
+ return t.emit("close");
8
+ }, "primary-action": t.handleFixInCodeEditor } }, [r("div", { staticClass: "d-f f-d-c" }, [r("div", { staticClass: "mb-3" }, [r("div", { staticClass: "l-s-5 f-s-1 f-w-600 t-c-55 t-t-u" }, [e._v(" " + e._s(t.errorCountText) + " ")])]), r("div", { staticClass: "d-f f-d-c g-13 max-h-21-s o-y-a error-list" }, e._l(t.previewStore.ampErrors, function(o, i) {
9
+ return r(t.InOnPageMessage, { key: i, attrs: { icon: "filled-error-box", size: "medium", type: "alert", text: o } });
10
+ }), 1)])]);
11
+ }, l = [], d = /* @__PURE__ */ a(
12
+ s,
13
+ n,
14
+ l,
15
+ !1,
16
+ null,
17
+ "7a09985c"
18
+ );
19
+ const _ = d.exports;
20
+ export {
21
+ _ as default
22
+ };
@@ -0,0 +1,30 @@
1
+ import { defineComponent as p, ref as m, computed as c } from "vue";
2
+ import d from "../../../wrappers/WpModal.vue.js";
3
+ import { useCodeEditorApi as l } from "../../../../composables/useCodeEditorApi.js";
4
+ import { usePreviewMode as u } from "../../../../composables/usePreviewMode.js";
5
+ import { useTranslations as f } from "../../../../composables/useTranslations.js";
6
+ import { usePreviewStore as _ } from "../../../../stores/preview.js";
7
+ import { InOnPageMessage as g } from "@useinsider/design-system-vue";
8
+ const P = /* @__PURE__ */ p({
9
+ __name: "AmpErrorModal",
10
+ emits: ["close"],
11
+ setup(x, { emit: e }) {
12
+ const o = f(), { closePreviewMode: r } = u(), { openCodeEditor: t } = l(), n = _(), s = m({
13
+ cancelOrBackButton: {
14
+ type: "secondary",
15
+ labelText: o("campaign-builder.cancel"),
16
+ styling: "ghost"
17
+ },
18
+ primaryButton: {
19
+ type: "primary",
20
+ labelText: o("email-editor.amp-validation-fix")
21
+ }
22
+ }), i = () => {
23
+ e("close"), r(), t();
24
+ }, a = c(() => `${o("products.errors")}(${n.ampErrors.length})`);
25
+ return { __sfc: !0, emit: e, trans: o, closePreviewMode: r, openCodeEditor: t, previewStore: n, footerButtonOptions: s, handleFixInCodeEditor: i, errorCountText: a, WpModal: d, InOnPageMessage: g };
26
+ }
27
+ });
28
+ export {
29
+ P as default
30
+ };
@@ -0,0 +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<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import o from "./AmpToggle.vue2.js";
2
+ import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var s = function() {
4
+ var r = this, t = r._self._c, e = r._self._setupProxy;
5
+ return t("div", [t("div", { staticClass: "d-f a-i-c ml-3" }, [t(e.InSegments, { attrs: { id: "guido__amp-toggle", "segment-list": e.segmentList, selected: e.previewStore.emailFormat }, on: { click: e.handleFormatChange } }), e.previewStore.showAMPErrorButton ? t(e.InButtonV2, { staticClass: "ml-2 d-f a-i-c b-c-11 b-c-h-11 t-c-4 t-c-h-4 i-c-4 bor-w-1 bor-s-s bor-c-11 bor-r-2", attrs: { id: "guido__amp-error-button", "left-icon": "line-error-box", type: "danger", "label-text-status": !1 }, on: { click: function(c) {
6
+ return e.previewStore.openErrorModal();
7
+ } } }) : r._e()], 1)]);
8
+ }, a = [], i = /* @__PURE__ */ n(
9
+ o,
10
+ s,
11
+ a,
12
+ !1,
13
+ null,
14
+ null
15
+ );
16
+ const d = i.exports;
17
+ export {
18
+ d as default
19
+ };