@useinsider/guido 1.0.0-beta.e239762 → 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.
Files changed (240) hide show
  1. package/README.md +425 -84
  2. package/dist/@types/generic.d.ts +9 -4
  3. package/dist/App.vue.d.ts +1 -1
  4. package/dist/_virtual/AddCustomFont.js +4 -0
  5. package/dist/_virtual/AiAssistantValueType.js +4 -0
  6. package/dist/_virtual/BackgroundColorBuiltInControl.js +4 -0
  7. package/dist/_virtual/BackgroundImageBuiltInControl.js +4 -0
  8. package/dist/_virtual/Block.js +4 -0
  9. package/dist/_virtual/BlockAttributes.js +4 -0
  10. package/dist/_virtual/BlockCompositionType.js +4 -0
  11. package/dist/_virtual/BlockPaddingsBuiltInControl.js +4 -0
  12. package/dist/_virtual/BlockRenderer.js +4 -0
  13. package/dist/_virtual/BlockType.js +4 -0
  14. package/dist/_virtual/BlocksPanel.js +4 -0
  15. package/dist/_virtual/BuiltInControl.js +4 -0
  16. package/dist/_virtual/BuiltInControlTypes.js +4 -0
  17. package/dist/_virtual/ButtonBorderBuiltInControl.js +4 -0
  18. package/dist/_virtual/ButtonColorBuiltInControl.js +4 -0
  19. package/dist/_virtual/ButtonFontColorBuiltInControl.js +4 -0
  20. package/dist/_virtual/ButtonInternalIndentsBuiltInControl.js +4 -0
  21. package/dist/_virtual/ButtonTextBuiltInControl.js +4 -0
  22. package/dist/_virtual/ContextAction.js +4 -0
  23. package/dist/_virtual/ContextActionType.js +4 -0
  24. package/dist/_virtual/Control.js +4 -0
  25. package/dist/_virtual/EditorStatePropertyType.js +4 -0
  26. package/dist/_virtual/Extension.js +4 -0
  27. package/dist/_virtual/ExtensionBuilder.js +4 -0
  28. package/dist/_virtual/FontFamilyBuiltInControl.js +4 -0
  29. package/dist/_virtual/LinkColorBuiltInControl.js +4 -0
  30. package/dist/_virtual/ModificationDescription.js +4 -0
  31. package/dist/_virtual/PanelPosition.js +4 -0
  32. package/dist/_virtual/PreviewDeviceMode.js +4 -0
  33. package/dist/_virtual/SettingsPanelRegistry.js +4 -0
  34. package/dist/_virtual/SettingsPanelTab.js +4 -0
  35. package/dist/_virtual/SettingsTab.js +4 -0
  36. package/dist/_virtual/StructureBorderBuiltInControl.js +4 -0
  37. package/dist/_virtual/StructurePaddingsBuiltInControl.js +4 -0
  38. package/dist/_virtual/TextColorBuiltInControl.js +4 -0
  39. package/dist/_virtual/TextLineSpacingBuiltInControl.js +4 -0
  40. package/dist/_virtual/TextSizeBuiltInControl.js +4 -0
  41. package/dist/_virtual/TextStyleBuiltInControl.js +4 -0
  42. package/dist/_virtual/UIElement.js +4 -0
  43. package/dist/_virtual/UIElementTagRegistry.js +4 -0
  44. package/dist/_virtual/UIElementType.js +4 -0
  45. package/dist/_virtual/UIElementsAttributes.js +4 -0
  46. package/dist/_virtual/index.js +5 -0
  47. package/dist/_virtual/index2.js +4 -0
  48. package/dist/components/Guido.vue.d.ts +16 -1
  49. package/dist/components/Guido.vue.js +6 -6
  50. package/dist/components/Guido.vue2.js +56 -15
  51. package/dist/components/organisms/{top-bar/Header.vue.js → header/HeaderWrapper.vue.js} +7 -7
  52. package/dist/components/organisms/header/HeaderWrapper.vue2.js +14 -0
  53. package/dist/components/organisms/header/LeftSlot.vue.d.ts +2 -0
  54. package/dist/components/organisms/header/LeftSlot.vue.js +17 -0
  55. package/dist/components/organisms/header/LeftSlot.vue2.js +13 -0
  56. package/dist/components/organisms/header/MiddleSlot.vue.d.ts +2 -0
  57. package/dist/components/organisms/header/MiddleSlot.vue.js +17 -0
  58. package/dist/components/organisms/header/MiddleSlot.vue2.js +22 -0
  59. package/dist/components/organisms/header/RightSlot.vue.d.ts +2 -0
  60. package/dist/components/organisms/header/RightSlot.vue.js +17 -0
  61. package/dist/components/organisms/header/RightSlot.vue2.js +21 -0
  62. package/dist/components/organisms/header/ViewOptions.vue.d.ts +2 -0
  63. package/dist/components/organisms/header/ViewOptions.vue.js +18 -0
  64. package/dist/components/organisms/header/ViewOptions.vue2.js +15 -0
  65. package/dist/components/organisms/header/version-history/RestoreButton.vue.d.ts +2 -0
  66. package/dist/components/organisms/header/version-history/RestoreButton.vue.js +19 -0
  67. package/dist/components/organisms/header/version-history/RestoreButton.vue2.js +14 -0
  68. package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +14 -0
  69. package/dist/components/organisms/header/version-history/VersionHistory.vue.js +22 -0
  70. package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +18 -0
  71. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.d.ts +16 -0
  72. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.js +18 -0
  73. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue2.js +16 -0
  74. package/dist/components/organisms/header/version-history/ViewOptions.vue.d.ts +2 -0
  75. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +18 -0
  76. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +23 -0
  77. package/dist/composables/useActionsApi.d.ts +5 -0
  78. package/dist/composables/useActionsApi.js +38 -0
  79. package/dist/composables/useCustomInterfaceAppearance.js +45 -9
  80. package/dist/composables/useExport.d.ts +3 -0
  81. package/dist/composables/useExport.js +45 -0
  82. package/dist/composables/useHtmlCompiler.d.ts +4 -0
  83. package/dist/composables/useHtmlCompiler.js +16 -0
  84. package/dist/composables/useHttp.js +84 -0
  85. package/dist/composables/usePartner.d.ts +4 -0
  86. package/dist/composables/usePartner.js +16 -0
  87. package/dist/composables/useStripo.d.ts +2 -2
  88. package/dist/composables/useStripo.js +73 -50
  89. package/dist/composables/useToaster.d.ts +1 -0
  90. package/dist/composables/useToaster.js +37 -0
  91. package/dist/composables/useTranslations.d.ts +1 -3
  92. package/dist/composables/useTranslations.js +18 -0
  93. package/dist/composables/useVersionHistoryApi.d.ts +8 -0
  94. package/dist/composables/useVersionHistoryApi.js +53 -0
  95. package/dist/config/compiler/htmlCompilerRules.d.ts +2 -0
  96. package/dist/config/compiler/htmlCompilerRules.js +145 -0
  97. package/dist/config/compiler/outlookCompilerRules.d.ts +0 -0
  98. package/dist/enums/defaults.d.ts +4 -0
  99. package/dist/enums/defaults.js +8 -0
  100. package/dist/enums/displayConditions.d.ts +2 -0
  101. package/dist/enums/displayConditions.js +80 -0
  102. package/dist/extensions/DynamicContent/dynamic-content-modal.d.ts +6 -0
  103. package/dist/extensions/DynamicContent/dynamic-content-modal.js +27 -0
  104. package/dist/extensions/DynamicContent/dynamic-content.css.js +24 -0
  105. package/dist/extensions/DynamicContent/dynamic-content.d.ts +16 -0
  106. package/dist/extensions/DynamicContent/dynamic-content.js +63 -0
  107. package/dist/extensions/DynamicContent/extension.d.ts +2 -0
  108. package/dist/extensions/DynamicContent/extension.js +11 -0
  109. package/dist/guido.css +1 -1
  110. package/dist/guido.png +0 -0
  111. package/dist/library.d.ts +1 -0
  112. package/dist/mock/api/custom-fonts.d.ts +2 -0
  113. package/dist/mock/api/default-template.d.ts +2 -0
  114. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +51 -0
  115. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +52 -0
  116. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +41 -0
  117. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlockRenderer.js +18 -0
  118. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlocksPanel.js +32 -0
  119. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/ContextAction.js +18 -0
  120. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AddCustomFont.js +8 -0
  121. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +13 -0
  122. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockAttributes.js +34 -0
  123. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +13 -0
  124. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +13 -0
  125. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +104 -0
  126. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +13 -0
  127. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +13 -0
  128. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +13 -0
  129. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +13 -0
  130. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +13 -0
  131. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +13 -0
  132. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +45 -0
  133. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundColorBuiltInControl.js +43 -0
  134. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundImageBuiltInControl.js +46 -0
  135. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BlockPaddingsBuiltInControl.js +44 -0
  136. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BuiltInControl.js +22 -0
  137. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonBorderBuiltInControl.js +46 -0
  138. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonColorBuiltInControl.js +46 -0
  139. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonFontColorBuiltInControl.js +45 -0
  140. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonInternalIndentsBuiltInControl.js +45 -0
  141. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonTextBuiltInControl.js +45 -0
  142. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +20 -0
  143. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/FontFamilyBuiltInControl.js +43 -0
  144. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/LinkColorBuiltInControl.js +45 -0
  145. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +18 -0
  146. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +32 -0
  147. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructureBorderBuiltInControl.js +46 -0
  148. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructurePaddingsBuiltInControl.js +44 -0
  149. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextColorBuiltInControl.js +43 -0
  150. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextLineSpacingBuiltInControl.js +43 -0
  151. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextSizeBuiltInControl.js +45 -0
  152. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextStyleBuiltInControl.js +43 -0
  153. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/index.js +266 -0
  154. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +26 -0
  155. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +22 -0
  156. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +18 -0
  157. package/dist/node_modules/lodash-es/_Hash.js +20 -0
  158. package/dist/node_modules/lodash-es/_ListCache.js +20 -0
  159. package/dist/node_modules/lodash-es/_Map.js +6 -0
  160. package/dist/node_modules/lodash-es/_MapCache.js +20 -0
  161. package/dist/node_modules/lodash-es/_Symbol.js +5 -0
  162. package/dist/node_modules/lodash-es/_assocIndexOf.js +10 -0
  163. package/dist/node_modules/lodash-es/_baseGetTag.js +10 -0
  164. package/dist/node_modules/lodash-es/_baseIsNative.js +16 -0
  165. package/dist/node_modules/lodash-es/_coreJsData.js +5 -0
  166. package/dist/node_modules/lodash-es/_freeGlobal.js +4 -0
  167. package/dist/node_modules/lodash-es/_getMapData.js +8 -0
  168. package/dist/node_modules/lodash-es/_getNative.js +9 -0
  169. package/dist/node_modules/lodash-es/_getRawTag.js +15 -0
  170. package/dist/node_modules/lodash-es/_getValue.js +6 -0
  171. package/dist/node_modules/lodash-es/_hashClear.js +7 -0
  172. package/dist/node_modules/lodash-es/_hashDelete.js +7 -0
  173. package/dist/node_modules/lodash-es/_hashGet.js +13 -0
  174. package/dist/node_modules/lodash-es/_hashHas.js +9 -0
  175. package/dist/node_modules/lodash-es/_hashSet.js +9 -0
  176. package/dist/node_modules/lodash-es/_isKeyable.js +7 -0
  177. package/dist/node_modules/lodash-es/_isMasked.js +11 -0
  178. package/dist/node_modules/lodash-es/_listCacheClear.js +6 -0
  179. package/dist/node_modules/lodash-es/_listCacheDelete.js +12 -0
  180. package/dist/node_modules/lodash-es/_listCacheGet.js +8 -0
  181. package/dist/node_modules/lodash-es/_listCacheHas.js +7 -0
  182. package/dist/node_modules/lodash-es/_listCacheSet.js +8 -0
  183. package/dist/node_modules/lodash-es/_mapCacheClear.js +13 -0
  184. package/dist/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  185. package/dist/node_modules/lodash-es/_mapCacheGet.js +7 -0
  186. package/dist/node_modules/lodash-es/_mapCacheHas.js +7 -0
  187. package/dist/node_modules/lodash-es/_mapCacheSet.js +8 -0
  188. package/dist/node_modules/lodash-es/_nativeCreate.js +5 -0
  189. package/dist/node_modules/lodash-es/_objectToString.js +7 -0
  190. package/dist/node_modules/lodash-es/_root.js +5 -0
  191. package/dist/node_modules/lodash-es/_toSource.js +17 -0
  192. package/dist/node_modules/lodash-es/eq.js +6 -0
  193. package/dist/node_modules/lodash-es/isFunction.js +12 -0
  194. package/dist/node_modules/lodash-es/isObject.js +7 -0
  195. package/dist/node_modules/lodash-es/memoize.js +18 -0
  196. package/dist/services/stripoApi.d.ts +8 -0
  197. package/dist/services/stripoApi.js +40 -0
  198. package/dist/static/styles/base.css.js +11 -0
  199. package/dist/static/styles/components/alert-message.css.js +39 -0
  200. package/dist/static/styles/components/amp-block.css.js +18 -0
  201. package/dist/static/styles/components/base-input.css.js +47 -0
  202. package/dist/static/styles/components/button-group.css.js +54 -0
  203. package/dist/static/styles/components/button.css.js +106 -0
  204. package/dist/static/styles/components/combobox.css.js +49 -0
  205. package/dist/static/styles/components/counter.css.js +42 -0
  206. package/dist/static/styles/components/dropdown-menu.css.js +52 -0
  207. package/dist/static/styles/components/narrow-panel.css.js +38 -0
  208. package/dist/static/styles/components/switcher.css.js +11 -0
  209. package/dist/static/styles/components/tabs.css.js +97 -0
  210. package/dist/static/styles/components/tools.css.js +23 -0
  211. package/dist/static/styles/components/version-history.css.js +30 -0
  212. package/dist/static/styles/components/wide-panel.css.js +135 -0
  213. package/dist/static/styles/variables.css.js +23 -0
  214. package/dist/stores/editor.d.ts +5 -0
  215. package/dist/stores/editor.js +11 -0
  216. package/dist/stores/version-history.d.ts +80 -0
  217. package/dist/stores/version-history.js +28 -0
  218. package/dist/utils/dateUtil.d.ts +1 -0
  219. package/dist/utils/dateUtil.js +16 -0
  220. package/dist/utils/htmlCompiler.d.ts +12 -0
  221. package/dist/utils/htmlCompiler.js +70 -0
  222. package/package.json +6 -5
  223. package/dist/components/organisms/top-bar/Header.vue2.js +0 -14
  224. package/dist/components/organisms/top-bar/HeaderLeftSlot.vue.d.ts +0 -2
  225. package/dist/components/organisms/top-bar/HeaderLeftSlot.vue.js +0 -17
  226. package/dist/components/organisms/top-bar/HeaderLeftSlot.vue2.js +0 -11
  227. package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue.d.ts +0 -2
  228. package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue.js +0 -17
  229. package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue2.js +0 -11
  230. package/dist/components/organisms/top-bar/HeaderRightSlot.vue.d.ts +0 -2
  231. package/dist/components/organisms/top-bar/HeaderRightSlot.vue.js +0 -18
  232. package/dist/components/organisms/top-bar/HeaderRightSlot.vue2.js +0 -14
  233. package/dist/composables/useTemplates.d.ts +0 -5
  234. package/dist/composables/useTemplates.js +0 -27
  235. package/dist/enums/defaults.enum.d.ts +0 -18
  236. package/dist/static/editor.css.js +0 -182
  237. package/dist/static/templates/default/index.html.js +0 -5
  238. package/dist/static/templates/default/style.css.js +0 -119
  239. package/dist/stores/counter.d.ts +0 -12
  240. /package/dist/components/organisms/{top-bar/Header.vue.d.ts → header/HeaderWrapper.vue.d.ts} +0 -0
package/README.md CHANGED
@@ -1,25 +1,38 @@
1
- # @useinsider/guido-plugin
1
+ <p align="center">
2
+ <a href="https://www.youtube.com/shorts/Y0RwBeMezL4" target="_blank" rel="noopener noreferrer">
3
+ <img width="180" src="./public/guido.png" alt="Guido logo">
4
+ </a>
5
+ </p>
2
6
 
3
- Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.
7
+
8
+ # @useinsider/guido
9
+
10
+ Guido is a Vue 2 + TypeScript wrapper for the Stripo Email Editor plugin. Easily embed the professional email editor in your Vue applications with a clean, customizable interface.
4
11
 
5
12
  ## 📦 Install
13
+
6
14
  ```bash
7
15
  npm install @useinsider/guido
8
16
  ```
17
+ ### Prerequisites
18
+ 🍍 Your project should have `pinia`
19
+
20
+ ---
21
+ ## 🚀 Usage
22
+
23
+ ### Basic Usage
9
24
 
10
- ## 🚀 Usage (Vue 2)
11
- ```vue
25
+ ```html
12
26
  <template>
13
- <Guido
14
- email-id="abc123"
15
- :api="apiEndpoints"
16
- :extensions="extensions"
17
- :insider-stripo-config="insiderStripoConfig"
18
- @save="handleSave"
19
- @export:requested="onExportRequested"
20
- @export:ready="handleHtml"
21
- @close="onClose"
22
- />
27
+ <div>
28
+ <Guido
29
+ ref="guidoEditor"
30
+ :email-id="emailId"
31
+ :user-id="userId"
32
+ :guido-config="guidoConfig"
33
+ @dynamic-content:open="handleDynamicContentOpen"
34
+ />
35
+ </div>
23
36
  </template>
24
37
 
25
38
  <script lang="ts">
@@ -31,99 +44,427 @@ export default {
31
44
  },
32
45
  data() {
33
46
  return {
34
- apiEndpoints: {
35
- dynamicContent: '/api/dynamic-content',
36
- unsubPages: '/api/unsub-pages',
37
- header: '/api/header',
38
- footer: '/api/footer',
39
- productName: '/api/product-name',
40
- productVersion: '/api/product-version',
41
- token: '/api/stripo-token'
42
- },
43
- extensions: {
44
- dynamicContent: true,
45
- unsubPages: true,
46
- header: false,
47
- footer: false
47
+ emailId: 'abc123',
48
+ userId: '12345',
49
+ guidoConfig: {
50
+ translationsPath: 'window.trans.en',
51
+ htmlCompilerRules: [],
52
+ ignoreDefaultHtmlCompilerRules: false,
48
53
  }
54
+ dynamicContentModalVisible: false
49
55
  };
50
56
  },
57
+
51
58
  methods: {
52
- handleSave(data: any) {
53
- console.log('Saved:', data);
54
- },
55
- handleHtml({ html }: { html: string }) {
56
- console.log('HTML ready:', html);
57
- },
58
- onExportRequested() {
59
- console.log('Export started');
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;
60
71
  },
61
- onClose() {
62
- console.log('Closed');
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();
63
75
  }
76
+
64
77
  }
65
78
  };
66
79
  </script>
67
80
  ```
68
81
 
69
82
  ## 📚 API
70
- ### `<StripoEditor />` Props
71
- | Prop | Type | Required | Description |
72
- |-------------|----------|----------|----------------------------|
73
- | emailId | string | ✅ | Stripo email draft ID |
74
- | iframeId | string | ❌ | Custom iframe ID |
75
- | api | object | ❌ | Custom API endpoints |
76
- | extensions | object | ❌ | Enable/disable extensions |
77
- | insiderStripoConfig | object | ❌ | Insider Stripo configuration |
78
-
79
- ### Extensions
80
- | Extension | Type | Default | Description |
81
- |----------------|-----------|---------|--------------------------------|
82
- | dynamicContent | boolean | true | Dynamic content functionality |
83
- | unsubPages | boolean | true | Unsubscribe pages feature |
84
- | header | boolean | true | Header customization |
85
- | footer | boolean | true | Footer customization |
86
-
87
- ### Insider Stripo Configuration
88
- | Property | Type | Default | Description |
89
- |-------------------|----------|---------|--------------------------------|
90
- | translationsPath | string | 'window.trans.en | JS Path to translations file |
91
-
92
- ### API Endpoints
93
- | Endpoint | Default Path | Description |
94
- |-------------------|------------------------|--------------------------------|
95
- | dynamicContent | /api/dynamic-content | Dynamic content endpoint |
96
- | unsubPages | /api/unsub-pages | Unsubscribe pages endpoint |
97
- | header | /api/header | Header endpoint |
98
- | footer | /api/footer | Footer endpoint |
99
- | productName | /api/product-name | Product name endpoint |
100
- | productVersion | /api/product-version | Product version endpoint |
101
- | token | /api/stripo-token | Authentication token endpoint |
102
-
103
- ### Events
104
- | Event | Payload | Description |
105
- |-------------------|------------------------|--------------------------------|
106
- | `save` | any | Triggered on save |
107
- | `export:requested`| void | Triggered when export starts |
108
- | `export:ready` | { html: string } | Triggered when HTML is ready |
109
- | `close` | void | Triggered when editor closes |
110
83
 
84
+ ### Guido Component Props
85
+
86
+ | Prop | Type | Required | Default | Description |
87
+ |------|------|----------|---------|-------------|
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 |
93
+ | `guidoConfig` | `GuidoConfig` | ✅ | - | Configuration object for the editor |
94
+
95
+ ### Guido Exposed Methods
96
+ ```typescript
97
+ dynamicContent.insert(DynamicContent);
98
+ dynamicContent.close();
99
+ ```
100
+
101
+ ### Guido Interfaces
102
+
103
+ ```typescript
104
+ interface GuidoConfig {
105
+ translationsPath: string;
106
+ htmlCompilerRules: CompilerRule[];
107
+ ignoreDefaultHtmlCompilerRules: boolean;
108
+ }
109
+ ```
110
+
111
+ | Property | Type | Default | Description |
112
+ |----------|------|---------|-------------|
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` |
111
116
 
117
+ ```typescript
118
+ interface DynamicContent {
119
+ value: string;
120
+ text: string;
121
+ fallback?: string;
122
+ }
123
+ ```
112
124
  ---
113
125
 
114
- ## 🛠 Development
126
+ | Property | Type | Default | Description |
127
+ |----------|------|---------|-------------|
128
+ | `value` | `string` | '' | Value of the dynamic content |
129
+ | `text` | `string` | '' | Visible value of the dynamic content |
130
+ | `fallback?` | `string` | '' | Fallback value of the dynamic content. Optional |
131
+
132
+ ### TypeScript Types
133
+
134
+ The library exports the following TypeScript types:
135
+
136
+ ```typescript
137
+ // Main component
138
+ import { Guido } from '@useinsider/guido';
139
+
140
+ // Types
141
+ import type { GuidoConfig } from '@useinsider/guido';
142
+ import type { StripoEventType } from '@useinsider/guido';
143
+ ```
144
+
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.
155
+
156
+ ```typescript
157
+ {
158
+ id: 'fix-encoding',
159
+ description: 'Fix URL encoding issues',
160
+ type: 'replace',
161
+ search: '{%22', // String to find
162
+ replacement: '%7B%22', // String to replace with
163
+ replaceAll: true, // Replace all occurrences (default: true)
164
+ priority: 10 // Execution priority (lower = earlier)
165
+ }
166
+ ```
167
+
168
+ #### 2. Regex Rule
169
+ Use regular expressions for complex pattern matching and replacement.
170
+
171
+ ```typescript
172
+ {
173
+ id: 'remove-comments',
174
+ description: 'Remove HTML comments',
175
+ type: 'regex',
176
+ pattern: '<!--.*?-->', // Regex pattern
177
+ replacement: '', // Replacement string
178
+ flags: 'g', // Regex flags (default: 'g')
179
+ priority: 20
180
+ }
181
+ ```
182
+
183
+ #### 3. Remove Rule
184
+ Remove specific strings or patterns from HTML content.
185
+
186
+ ```typescript
187
+ {
188
+ id: 'cleanup-scripts',
189
+ description: 'Remove unwanted script tags',
190
+ type: 'remove',
191
+ targets: [ // Array of strings or RegExp objects
192
+ '<script src="unwanted.js"></script>',
193
+ /onclick="[^"]*"/g
194
+ ],
195
+ priority: 30
196
+ }
197
+ ```
198
+
199
+ #### 4. Custom Rule
200
+ Define complex transformation logic with a custom processor function.
201
+
202
+ ```typescript
203
+ {
204
+ id: 'add-meta-tags',
205
+ description: 'Add custom meta tags to head',
206
+ type: 'custom',
207
+ processor: (html: string): string => {
208
+ // Custom transformation logic
209
+ const metaTags = '<meta name="custom" content="value">';
210
+ return html.replace('</head>', `${metaTags}</head>`);
211
+ },
212
+ priority: 40
213
+ }
214
+ ```
215
+
216
+ ### Using HTML Compiler Rules
217
+
218
+ #### Basic Usage with Custom Rules
219
+
220
+ ```typescript
221
+ const guidoConfig = {
222
+ translationsPath: 'window.trans.en',
223
+ htmlCompilerRules: [
224
+ {
225
+ id: 'replace-domain',
226
+ description: 'Replace old domain with new one',
227
+ type: 'replace',
228
+ search: 'old-domain.com',
229
+ replacement: 'new-domain.com',
230
+ replaceAll: true,
231
+ priority: 10
232
+ },
233
+ {
234
+ id: 'remove-tracking',
235
+ description: 'Remove tracking pixels',
236
+ type: 'regex',
237
+ pattern: '<img[^>]*tracking[^>]*>',
238
+ replacement: '',
239
+ flags: 'gi',
240
+ priority: 20
241
+ }
242
+ ]
243
+ };
244
+ ```
245
+
246
+ #### Ignoring Default Rules
247
+
248
+ ```typescript
249
+ const guidoConfig = {
250
+ translationsPath: 'window.trans.en',
251
+ ignoreDefaultHtmlCompilerRules: true, // Skip all default rules
252
+ htmlCompilerRules: [
253
+ // Only your custom rules will be applied
254
+ {
255
+ id: 'custom-transformation',
256
+ type: 'replace',
257
+ search: 'old-text',
258
+ replacement: 'new-text',
259
+ priority: 1
260
+ }
261
+ ]
262
+ };
263
+ ```
264
+
265
+ ### Rule Execution Order
266
+
267
+ Rules are executed in priority order (lower numbers first). Rules with the same priority are executed in array order.
268
+
269
+ - **Priority 1-99**: Reserved for critical transformations
270
+ - **Priority 100-999**: Standard transformations
271
+ - **Priority 1000+**: Additional custom rules (automatically assigned)
272
+
273
+ ### Default Rules
274
+
275
+ Guido includes several default rules for common email HTML optimizations:
276
+
277
+ - **URL encoding fixes**: Fixes malformed URL encoding in dynamic content
278
+ - **Template tag restoration**: Restores `{{}}` template tags that got URL encoded
279
+ - **HTML entity decoding**: Converts `&lt;` and `&gt;` back to `<` and `>`
280
+ - **Cleanup rules**: Removes unwanted iframe and style elements
281
+ - **MSO conditions**: Manages Outlook-specific conditional comments
282
+ - **Domain replacement**: Updates old image domains to current ones
283
+
284
+ You can view all default rules in: `src/config/compiler/htmlCompilerRules.ts`
285
+
286
+ ### CompilerRule Interface
287
+
288
+ ```typescript
289
+ type CompilerRuleType = 'replace' | 'regex' | 'remove' | 'custom';
290
+
291
+ interface BaseCompilerRule {
292
+ id: string;
293
+ description?: string;
294
+ priority: number;
295
+ }
296
+
297
+ interface ReplaceRule extends BaseCompilerRule {
298
+ type: 'replace';
299
+ search: string;
300
+ replacement: string;
301
+ replaceAll?: boolean; // Default: true
302
+ }
303
+
304
+ interface RegexRule extends BaseCompilerRule {
305
+ type: 'regex';
306
+ pattern: string;
307
+ replacement: string;
308
+ flags?: string; // Default: 'g'
309
+ }
310
+
311
+ interface RemoveRule extends BaseCompilerRule {
312
+ type: 'remove';
313
+ targets: (string | RegExp)[]; // Array of strings or RegExp objects
314
+ }
315
+
316
+ interface CustomRule extends BaseCompilerRule {
317
+ type: 'custom';
318
+ processor: (html: string) => string;
319
+ }
320
+
321
+ type CompilerRule = ReplaceRule | RegexRule | RemoveRule | CustomRule;
322
+ ```
323
+
324
+ ---
325
+
326
+ ## 🔧 Development
327
+
328
+ ### Prerequisites
329
+
330
+ - 🧄 `Bun` (strongly recommended)
331
+ or
332
+ - NodeJS 18+ & `npm`
333
+
334
+ ### Setup
335
+
115
336
  ```bash
337
+ # Install dependencies
116
338
  bun install
339
+
340
+ # Start development server
117
341
  bun start
342
+
343
+ # Build for production
344
+ bun run build
345
+
346
+ # Type checking
347
+ bun run type-check
348
+
349
+ # Linting
350
+ bun run lint
118
351
  ```
119
352
 
120
- Build & types:
121
- ```bash
353
+ ### Environment Variables
354
+
355
+ Create a `.env` file with the following variables: (You can get env variables from your senior)
356
+
357
+ ```env
358
+ VITE_STRIPO_PLUGIN_ID=your_plugin_id
359
+ VITE_STRIPO_SECRET_KEY=your_secret_key
360
+ VITE_STRIPO_ROLE=your_role
361
+ ```
362
+
363
+ ### Project Structure
364
+
365
+ ```
366
+ src/
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
378
+ ```
379
+
380
+ ## 🌐 i18n
381
+ 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
+ It allows to use production or local translations on your code. 🚀
383
+ Example usage:
384
+ ```js
385
+ import { useTranslations } from '@@/Composables/useTranslations';
386
+
387
+ const trans = useTranslations();
388
+
389
+ // use everywhere like this:
390
+ trans('foo.bar')
391
+ ```
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
122
397
  bun run build
123
398
  ```
124
399
 
400
+ Since bun does not have packaging yet, use npm here: 🥲
401
+ ```sh
402
+ npm pack
403
+ ```
404
+
405
+ It'll crate like `useinsider-guido-1.0.0.tgz` file.
406
+
407
+ Move this file to your project path like: `email-fe` via:
408
+ ```sh
409
+ cp useinsider-guido-1.0.0.tgz ../email-fe
410
+ ```
411
+
412
+ Install the file to your project:
413
+ ```sh
414
+ npm i ./useinsider-guido-1.0.0.tgz
415
+ ```
416
+
417
+ Then you just need to rebuild to your project or restart the Container. 🎉
418
+
419
+ For Future, we can create a shell script for it. Feel free to help 🙃
420
+
421
+ ## 📦 Build Output
422
+
423
+ The library builds to multiple formats:
424
+
425
+ - **ES Module**: `dist/library.js` (recommended)
426
+ - **CSS**: `dist/guido.css` (custom styles)
427
+
428
+ ### Package Exports
429
+
430
+ ```json
431
+ {
432
+ "exports": {
433
+ ".": {
434
+ "import": "./dist/library.js",
435
+ "types": "./dist/components/Guido.vue.d.ts",
436
+ "require": "./dist/components/Guido.vue.js"
437
+ },
438
+ "./style": "./dist/guido.css"
439
+ }
440
+ }
441
+ ```
442
+
443
+ ## 🤝 Contributing
444
+ - PR Titles should be structured like `TASK-ID | 🔥 | Some Clear Task Descriptions`
445
+ - PR Labels should be filled.
446
+ - PR Assignee required.
447
+ - Tests should be covered.
448
+ - All required checks should be passed before sending review request.
449
+
450
+ ## 📄 License
451
+
452
+ ISC License
453
+
125
454
  ---
126
455
 
127
- TODO:
128
- [ ] - Default Template @edugencioglu
129
- [ ] - Using CSS variables into [editor.css](./src/static/editor.css) @berkansezer-useinsider
456
+ ## 🔗 Related
457
+
458
+ - [Stripo Email Editor](https://stripo.email/) - The underlying email editor
459
+ - [@useinsider/design-system-vue](https://github.com/useinsider/design-system-vue) - Insider's Vue design system
460
+
461
+ ## 🎯 TODO:
462
+ - CSS part should be optimized with variables & `sass-loader`.
463
+ - Master Version Generator should be fixed.
464
+ - Playwright integration
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
@@ -1,6 +1,11 @@
1
- export type Translations = {
2
- [key: string]: string;
3
- };
4
- export type InsiderStripoConfig = {
1
+ import type { CompilerRule } from './html-compiler';
2
+ export type GuidoConfig = {
5
3
  translationsPath: string;
4
+ htmlCompilerRules?: CompilerRule[];
5
+ ignoreDefaultHtmlCompilerRules?: boolean;
6
+ };
7
+ export type DynamicContent = {
8
+ value: string;
9
+ text: string;
10
+ fallback?: string;
6
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;
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var s = {};
2
+ export {
3
+ s as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var t = {};
2
+ export {
3
+ t as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var a = {};
2
+ export {
3
+ a as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var t = {};
2
+ export {
3
+ t as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var t = {};
2
+ export {
3
+ t as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var t = {};
2
+ export {
3
+ t as __exports
4
+ };