@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.
- package/README.md +425 -84
- package/dist/@types/generic.d.ts +9 -4
- package/dist/App.vue.d.ts +1 -1
- package/dist/_virtual/AddCustomFont.js +4 -0
- package/dist/_virtual/AiAssistantValueType.js +4 -0
- package/dist/_virtual/BackgroundColorBuiltInControl.js +4 -0
- package/dist/_virtual/BackgroundImageBuiltInControl.js +4 -0
- package/dist/_virtual/Block.js +4 -0
- package/dist/_virtual/BlockAttributes.js +4 -0
- package/dist/_virtual/BlockCompositionType.js +4 -0
- package/dist/_virtual/BlockPaddingsBuiltInControl.js +4 -0
- package/dist/_virtual/BlockRenderer.js +4 -0
- package/dist/_virtual/BlockType.js +4 -0
- package/dist/_virtual/BlocksPanel.js +4 -0
- package/dist/_virtual/BuiltInControl.js +4 -0
- package/dist/_virtual/BuiltInControlTypes.js +4 -0
- package/dist/_virtual/ButtonBorderBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonColorBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonFontColorBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonInternalIndentsBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonTextBuiltInControl.js +4 -0
- package/dist/_virtual/ContextAction.js +4 -0
- package/dist/_virtual/ContextActionType.js +4 -0
- package/dist/_virtual/Control.js +4 -0
- package/dist/_virtual/EditorStatePropertyType.js +4 -0
- package/dist/_virtual/Extension.js +4 -0
- package/dist/_virtual/ExtensionBuilder.js +4 -0
- package/dist/_virtual/FontFamilyBuiltInControl.js +4 -0
- package/dist/_virtual/LinkColorBuiltInControl.js +4 -0
- package/dist/_virtual/ModificationDescription.js +4 -0
- package/dist/_virtual/PanelPosition.js +4 -0
- package/dist/_virtual/PreviewDeviceMode.js +4 -0
- package/dist/_virtual/SettingsPanelRegistry.js +4 -0
- package/dist/_virtual/SettingsPanelTab.js +4 -0
- package/dist/_virtual/SettingsTab.js +4 -0
- package/dist/_virtual/StructureBorderBuiltInControl.js +4 -0
- package/dist/_virtual/StructurePaddingsBuiltInControl.js +4 -0
- package/dist/_virtual/TextColorBuiltInControl.js +4 -0
- package/dist/_virtual/TextLineSpacingBuiltInControl.js +4 -0
- package/dist/_virtual/TextSizeBuiltInControl.js +4 -0
- package/dist/_virtual/TextStyleBuiltInControl.js +4 -0
- package/dist/_virtual/UIElement.js +4 -0
- package/dist/_virtual/UIElementTagRegistry.js +4 -0
- package/dist/_virtual/UIElementType.js +4 -0
- package/dist/_virtual/UIElementsAttributes.js +4 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/components/Guido.vue.d.ts +16 -1
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +56 -15
- package/dist/components/organisms/{top-bar/Header.vue.js → header/HeaderWrapper.vue.js} +7 -7
- package/dist/components/organisms/header/HeaderWrapper.vue2.js +14 -0
- package/dist/components/organisms/header/LeftSlot.vue.d.ts +2 -0
- package/dist/components/organisms/header/LeftSlot.vue.js +17 -0
- package/dist/components/organisms/header/LeftSlot.vue2.js +13 -0
- package/dist/components/organisms/header/MiddleSlot.vue.d.ts +2 -0
- package/dist/components/organisms/header/MiddleSlot.vue.js +17 -0
- package/dist/components/organisms/header/MiddleSlot.vue2.js +22 -0
- package/dist/components/organisms/header/RightSlot.vue.d.ts +2 -0
- package/dist/components/organisms/header/RightSlot.vue.js +17 -0
- package/dist/components/organisms/header/RightSlot.vue2.js +21 -0
- package/dist/components/organisms/header/ViewOptions.vue.d.ts +2 -0
- package/dist/components/organisms/header/ViewOptions.vue.js +18 -0
- package/dist/components/organisms/header/ViewOptions.vue2.js +15 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue.d.ts +2 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue.js +19 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue2.js +14 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +14 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue.js +22 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +18 -0
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.d.ts +16 -0
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.js +18 -0
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue2.js +16 -0
- package/dist/components/organisms/header/version-history/ViewOptions.vue.d.ts +2 -0
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +18 -0
- package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +23 -0
- package/dist/composables/useActionsApi.d.ts +5 -0
- package/dist/composables/useActionsApi.js +38 -0
- package/dist/composables/useCustomInterfaceAppearance.js +45 -9
- package/dist/composables/useExport.d.ts +3 -0
- package/dist/composables/useExport.js +45 -0
- package/dist/composables/useHtmlCompiler.d.ts +4 -0
- package/dist/composables/useHtmlCompiler.js +16 -0
- package/dist/composables/useHttp.js +84 -0
- package/dist/composables/usePartner.d.ts +4 -0
- package/dist/composables/usePartner.js +16 -0
- package/dist/composables/useStripo.d.ts +2 -2
- package/dist/composables/useStripo.js +73 -50
- package/dist/composables/useToaster.d.ts +1 -0
- package/dist/composables/useToaster.js +37 -0
- package/dist/composables/useTranslations.d.ts +1 -3
- package/dist/composables/useTranslations.js +18 -0
- package/dist/composables/useVersionHistoryApi.d.ts +8 -0
- package/dist/composables/useVersionHistoryApi.js +53 -0
- package/dist/config/compiler/htmlCompilerRules.d.ts +2 -0
- package/dist/config/compiler/htmlCompilerRules.js +145 -0
- package/dist/config/compiler/outlookCompilerRules.d.ts +0 -0
- package/dist/enums/defaults.d.ts +4 -0
- package/dist/enums/defaults.js +8 -0
- package/dist/enums/displayConditions.d.ts +2 -0
- package/dist/enums/displayConditions.js +80 -0
- package/dist/extensions/DynamicContent/dynamic-content-modal.d.ts +6 -0
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +27 -0
- package/dist/extensions/DynamicContent/dynamic-content.css.js +24 -0
- package/dist/extensions/DynamicContent/dynamic-content.d.ts +16 -0
- package/dist/extensions/DynamicContent/dynamic-content.js +63 -0
- package/dist/extensions/DynamicContent/extension.d.ts +2 -0
- package/dist/extensions/DynamicContent/extension.js +11 -0
- package/dist/guido.css +1 -1
- package/dist/guido.png +0 -0
- package/dist/library.d.ts +1 -0
- package/dist/mock/api/custom-fonts.d.ts +2 -0
- package/dist/mock/api/default-template.d.ts +2 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +51 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +52 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +41 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlockRenderer.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlocksPanel.js +32 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/ContextAction.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AddCustomFont.js +8 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockAttributes.js +34 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +104 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundColorBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundImageBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BlockPaddingsBuiltInControl.js +44 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BuiltInControl.js +22 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonBorderBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonColorBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonFontColorBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonInternalIndentsBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonTextBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +20 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/FontFamilyBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/LinkColorBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +32 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructureBorderBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructurePaddingsBuiltInControl.js +44 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextColorBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextLineSpacingBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextSizeBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextStyleBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/index.js +266 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +26 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +22 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +18 -0
- package/dist/node_modules/lodash-es/_Hash.js +20 -0
- package/dist/node_modules/lodash-es/_ListCache.js +20 -0
- package/dist/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/lodash-es/_MapCache.js +20 -0
- package/dist/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/lodash-es/_assocIndexOf.js +10 -0
- package/dist/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/lodash-es/_baseIsNative.js +16 -0
- package/dist/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/lodash-es/_getRawTag.js +15 -0
- package/dist/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/lodash-es/_listCacheDelete.js +12 -0
- package/dist/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/lodash-es/_toSource.js +17 -0
- package/dist/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/lodash-es/isFunction.js +12 -0
- package/dist/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/lodash-es/memoize.js +18 -0
- package/dist/services/stripoApi.d.ts +8 -0
- package/dist/services/stripoApi.js +40 -0
- package/dist/static/styles/base.css.js +11 -0
- package/dist/static/styles/components/alert-message.css.js +39 -0
- package/dist/static/styles/components/amp-block.css.js +18 -0
- package/dist/static/styles/components/base-input.css.js +47 -0
- package/dist/static/styles/components/button-group.css.js +54 -0
- package/dist/static/styles/components/button.css.js +106 -0
- package/dist/static/styles/components/combobox.css.js +49 -0
- package/dist/static/styles/components/counter.css.js +42 -0
- package/dist/static/styles/components/dropdown-menu.css.js +52 -0
- package/dist/static/styles/components/narrow-panel.css.js +38 -0
- package/dist/static/styles/components/switcher.css.js +11 -0
- package/dist/static/styles/components/tabs.css.js +97 -0
- package/dist/static/styles/components/tools.css.js +23 -0
- package/dist/static/styles/components/version-history.css.js +30 -0
- package/dist/static/styles/components/wide-panel.css.js +135 -0
- package/dist/static/styles/variables.css.js +23 -0
- package/dist/stores/editor.d.ts +5 -0
- package/dist/stores/editor.js +11 -0
- package/dist/stores/version-history.d.ts +80 -0
- package/dist/stores/version-history.js +28 -0
- package/dist/utils/dateUtil.d.ts +1 -0
- package/dist/utils/dateUtil.js +16 -0
- package/dist/utils/htmlCompiler.d.ts +12 -0
- package/dist/utils/htmlCompiler.js +70 -0
- package/package.json +6 -5
- package/dist/components/organisms/top-bar/Header.vue2.js +0 -14
- package/dist/components/organisms/top-bar/HeaderLeftSlot.vue.d.ts +0 -2
- package/dist/components/organisms/top-bar/HeaderLeftSlot.vue.js +0 -17
- package/dist/components/organisms/top-bar/HeaderLeftSlot.vue2.js +0 -11
- package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue.d.ts +0 -2
- package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue.js +0 -17
- package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue2.js +0 -11
- package/dist/components/organisms/top-bar/HeaderRightSlot.vue.d.ts +0 -2
- package/dist/components/organisms/top-bar/HeaderRightSlot.vue.js +0 -18
- package/dist/components/organisms/top-bar/HeaderRightSlot.vue2.js +0 -14
- package/dist/composables/useTemplates.d.ts +0 -5
- package/dist/composables/useTemplates.js +0 -27
- package/dist/enums/defaults.enum.d.ts +0 -18
- package/dist/static/editor.css.js +0 -182
- package/dist/static/templates/default/index.html.js +0 -5
- package/dist/static/templates/default/style.css.js +0 -119
- package/dist/stores/counter.d.ts +0 -12
- /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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
11
|
-
```vue
|
|
25
|
+
```html
|
|
12
26
|
<template>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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 `<` and `>` back to `<` and `>`
|
|
280
|
+
- **Cleanup rules**: Removes unwanted iframe and style elements
|
|
281
|
+
- **MSO conditions**: Manages Outlook-specific conditional comments
|
|
282
|
+
- **Domain replacement**: Updates old image domains to current ones
|
|
283
|
+
|
|
284
|
+
You can view all default rules in: `src/config/compiler/htmlCompilerRules.ts`
|
|
285
|
+
|
|
286
|
+
### CompilerRule Interface
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
type CompilerRuleType = 'replace' | 'regex' | 'remove' | 'custom';
|
|
290
|
+
|
|
291
|
+
interface BaseCompilerRule {
|
|
292
|
+
id: string;
|
|
293
|
+
description?: string;
|
|
294
|
+
priority: number;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
interface ReplaceRule extends BaseCompilerRule {
|
|
298
|
+
type: 'replace';
|
|
299
|
+
search: string;
|
|
300
|
+
replacement: string;
|
|
301
|
+
replaceAll?: boolean; // Default: true
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
interface RegexRule extends BaseCompilerRule {
|
|
305
|
+
type: 'regex';
|
|
306
|
+
pattern: string;
|
|
307
|
+
replacement: string;
|
|
308
|
+
flags?: string; // Default: 'g'
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface RemoveRule extends BaseCompilerRule {
|
|
312
|
+
type: 'remove';
|
|
313
|
+
targets: (string | RegExp)[]; // Array of strings or RegExp objects
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
interface CustomRule extends BaseCompilerRule {
|
|
317
|
+
type: 'custom';
|
|
318
|
+
processor: (html: string) => string;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
type CompilerRule = ReplaceRule | RegexRule | RemoveRule | CustomRule;
|
|
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
|
-
|
|
121
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
[ ] -
|
|
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
|
package/dist/@types/generic.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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;
|