@retailrocketgroup/retailrocket-create.transactional-vue-email-template-render 3.0.381747 → 5.0.384700

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 (42) hide show
  1. package/.turbo/turbo-build.log +25 -0
  2. package/dist/assets/index.css +1 -0
  3. package/dist/assets/index.js +379 -0
  4. package/dist/assets/index.js.map +1 -0
  5. package/dist/createTransactionalEmailTemplateApp.d.ts +0 -0
  6. package/dist/httpClient/TransactionalWysiwygTemplateEditorClient.d.ts +2 -0
  7. package/dist/implementation/AppSettingsModifierPlugin/transactionalDataAppSettingsModifierPluginFactory.d.ts +6 -0
  8. package/dist/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/transactionalComponentSectionItemFactory.d.ts +4 -0
  9. package/dist/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/transactionalEmailComponentFactory.d.ts +4 -0
  10. package/dist/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/transactionalComponentLibraryFactory.d.ts +4 -0
  11. package/dist/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/transactionalSectionFactory.d.ts +4 -0
  12. package/dist/implementation/DataSources/ListDataExpressionSource/transactionalListExpressionDataSourceEvaluatorFactory.d.ts +9 -0
  13. package/dist/implementation/DataSources/NumberExpressionDataSource/transactionalNumberExpressionDataSourceEvaluatorFactory.d.ts +5 -0
  14. package/dist/implementation/DataSources/StringExpressionDataSource/transactionalEvaluateStringExpressionDataSource.d.ts +9 -0
  15. package/dist/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/TransactionalProductShelfDataSourceExpressionBuilderModal/transactionalProductShelfDataSourceExpressionBuilderModalDepsFactory.d.ts +11 -0
  16. package/dist/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/transactionalProductShelfDataSourceExpressionBuilderDepsFactory.d.ts +11 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.html +38 -0
  19. package/env.d.ts +1 -0
  20. package/index.html +1 -2
  21. package/package.json +1 -1
  22. package/src/createTransactionalEmailTemplateApp.ts +321 -0
  23. package/src/httpClient/TransactionalWysiwygTemplateEditorClient.ts +5 -0
  24. package/src/implementation/AppSettingsModifierPlugin/transactionalDataAppSettingsModifierPluginFactory.ts +41 -0
  25. package/src/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/transactionalComponentSectionItemFactory.ts +30 -0
  26. package/src/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/transactionalEmailComponentFactory.ts +26 -0
  27. package/src/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/transactionalComponentLibraryFactory.ts +29 -0
  28. package/src/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/transactionalSectionFactory.ts +32 -0
  29. package/src/implementation/DataSources/ListDataExpressionSource/transactionalListExpressionDataSourceEvaluatorFactory.ts +115 -0
  30. package/src/implementation/DataSources/NumberExpressionDataSource/transactionalNumberExpressionDataSourceEvaluatorFactory.ts +35 -0
  31. package/src/implementation/DataSources/StringExpressionDataSource/transactionalEvaluateStringExpressionDataSource.ts +55 -0
  32. package/src/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/TransactionalProductShelfDataSourceExpressionBuilderModal/transactionalProductShelfDataSourceExpressionBuilderModalDepsFactory.ts +127 -0
  33. package/src/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/transactionalProductShelfDataSourceExpressionBuilderDepsFactory.ts +35 -0
  34. package/src/index.ts +0 -0
  35. package/tsconfig.app.json +19 -0
  36. package/tsconfig.json +14 -0
  37. package/tsconfig.node.json +11 -0
  38. package/tsconfig.test.json +11 -0
  39. package/vite.config.ts +36 -0
  40. package/assets/main.css +0 -1
  41. package/assets/main.js +0 -185
  42. package/favicon.ico +0 -0
File without changes
@@ -0,0 +1,2 @@
1
+ import { createApi as createTransactionalwysiwygtemplateeditorClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.transactionalwysiwygtemplateeditor';
2
+ export type TransactionalWysiwygTemplateEditorClient = ReturnType<typeof createTransactionalwysiwygtemplateeditorClient>;
@@ -0,0 +1,6 @@
1
+ import { DataType, LocaleKey, AppSettingsModifierPlugin } from '@easy-wizzy/core';
2
+ export declare const transactionalDataAppSettingsModifierPluginFactory: (arg: {
3
+ localeKey: LocaleKey;
4
+ getTransactionTemplateData: () => DataType;
5
+ updateTransactionTemplateData: (data: DataType) => void;
6
+ }) => AppSettingsModifierPlugin;
@@ -0,0 +1,4 @@
1
+ import { ComponentLibrarySectionItem } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.componentlibrary/main';
2
+ import { TransactionalStringExpressionDataSource, TransactionalNumberExpressionDataSource, TransactionalListExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
3
+ import { CustomComponentSectionItemType } from '@easy-wizzy/core';
4
+ export declare const transactionalComponentSectionItemFactory: (componentLibrarySectionItem: ComponentLibrarySectionItem) => CustomComponentSectionItemType<TransactionalListExpressionDataSource, TransactionalNumberExpressionDataSource, TransactionalStringExpressionDataSource>;
@@ -0,0 +1,4 @@
1
+ import { EmailComponentType } from '@easy-wizzy/core';
2
+ import { Component } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.addcomponentlibrarysectionitemmodalwindow/main';
3
+ import { TransactionalStringExpressionDataSource, TransactionalListExpressionDataSource, TransactionalNumberExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
4
+ export declare const transactionalEmailComponentFactory: (component: Component) => EmailComponentType<TransactionalListExpressionDataSource, TransactionalNumberExpressionDataSource, TransactionalStringExpressionDataSource>;
@@ -0,0 +1,4 @@
1
+ import { ComponentLibrarySection } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.componentlibrary/main';
2
+ import { CustomComponentLibraryType } from '@easy-wizzy/core';
3
+ import { TransactionalListExpressionDataSource, TransactionalNumberExpressionDataSource, TransactionalStringExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
4
+ export declare const transactionalComponentLibraryFactory: (componentLibrary: Array<ComponentLibrarySection>) => CustomComponentLibraryType<TransactionalListExpressionDataSource, TransactionalNumberExpressionDataSource, TransactionalStringExpressionDataSource>;
@@ -0,0 +1,4 @@
1
+ import { ComponentLibrarySection } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.componentlibrary/main';
2
+ import { CustomComponentSectionType } from '@easy-wizzy/core';
3
+ import { TransactionalListExpressionDataSource, TransactionalNumberExpressionDataSource, TransactionalStringExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
4
+ export declare const transactionalSectionFactory: (section: ComponentLibrarySection) => CustomComponentSectionType<TransactionalListExpressionDataSource, TransactionalNumberExpressionDataSource, TransactionalStringExpressionDataSource>;
@@ -0,0 +1,9 @@
1
+ import { ListExpressionDataSourceBffClient } from '@easy-wizzy/common-app';
2
+ import { ListExpressionDataSourceEvaluatorDelegate, DataType } from '@easy-wizzy/core';
3
+ import { TransactionalListExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
4
+ export declare const transactionalListExpressionDataSourceEvaluatorFactory: (arg: {
5
+ partnerId: string;
6
+ getTransactionalTemplateData: () => DataType;
7
+ listExpressionDataSourceBffClient: ListExpressionDataSourceBffClient;
8
+ customerStockId: string | undefined;
9
+ }) => ListExpressionDataSourceEvaluatorDelegate<TransactionalListExpressionDataSource>;
@@ -0,0 +1,5 @@
1
+ import { TransactionalNumberExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
2
+ import { NumberExpressionDataSourceEvaluatorDelegate, DataType } from '@easy-wizzy/core';
3
+ export declare const transactionalNumberExpressionDataSourceEvaluatorFactory: (arg: {
4
+ getTransactionalTemplateData: () => DataType;
5
+ }) => NumberExpressionDataSourceEvaluatorDelegate<TransactionalNumberExpressionDataSource>;
@@ -0,0 +1,9 @@
1
+ import { DataType, StringExpressionDataSourceEvaluatorDelegate } from '@easy-wizzy/core';
2
+ import { TransactionalStringExpressionDataSource, TransactionalNumberExpressionDataSource, TransactionalListExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
3
+ import { ProductImageUrlBuilderExpressionEvaluatorDelegate } from '@easy-wizzy/common-app';
4
+ import { NextCouponFromBatchType } from '@easy-wizzy/retailrocket-common';
5
+ export declare const transactionalStringExpressionDataSourceEvaluatorFactory: (arg: {
6
+ getTransactionalTemplateData: () => DataType;
7
+ productImageUrlBuilderExpressionEvaluator: ProductImageUrlBuilderExpressionEvaluatorDelegate<TransactionalListExpressionDataSource, TransactionalNumberExpressionDataSource>;
8
+ nextCouponFromBatch: NextCouponFromBatchType;
9
+ }) => StringExpressionDataSourceEvaluatorDelegate<TransactionalStringExpressionDataSource>;
@@ -0,0 +1,11 @@
1
+ import { LocaleKey } from '@easy-wizzy/core';
2
+ import { TransactionalProductShelfDataSourceExpressionBuilderModalDeps } from '@easy-wizzy/retailrocket-transactional';
3
+ import { ProductShelfBuilderModalWindowBffClient, ProductPickerModalWindowBffClient, ProductCategoryPickerModalWindowBffClient } from '@easy-wizzy/common-app';
4
+ export declare const transactionalProductShelfDataSourceExpressionBuilderModalDepsFactory: (arg: {
5
+ localeKey: LocaleKey;
6
+ partnerId: string;
7
+ customerStockId: string | undefined;
8
+ productShelfBuilderModalWindowBffClient: ProductShelfBuilderModalWindowBffClient;
9
+ productCategoryPickerModalWindowBffClient: ProductCategoryPickerModalWindowBffClient;
10
+ productPickerModalWindowBffClient: ProductPickerModalWindowBffClient;
11
+ }) => TransactionalProductShelfDataSourceExpressionBuilderModalDeps;
@@ -0,0 +1,11 @@
1
+ import { LocaleKey } from '@easy-wizzy/core';
2
+ import { TransactionalProductShelfDataSourceExpressionBuilderDeps } from '@easy-wizzy/retailrocket-transactional';
3
+ import { ProductShelfBuilderModalWindowBffClient, ProductPickerModalWindowBffClient, ProductCategoryPickerModalWindowBffClient } from '@easy-wizzy/common-app';
4
+ export declare const transactionalProductShelfDataSourceExpressionBuilderDepsFactory: (arg: {
5
+ localeKey: LocaleKey;
6
+ partnerId: string;
7
+ customerStockId: string | undefined;
8
+ productShelfBuilderModalWindowBffClient: ProductShelfBuilderModalWindowBffClient;
9
+ productCategoryPickerModalWindowBffClient: ProductCategoryPickerModalWindowBffClient;
10
+ productPickerModalWindowBffClient: ProductPickerModalWindowBffClient;
11
+ }) => TransactionalProductShelfDataSourceExpressionBuilderDeps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" href="/favicon.ico">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link
10
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap"
11
+ rel="stylesheet"
12
+ />
13
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Lato:wght@100;300;400;700;900&family=Roboto:wght@400;700&display=swap" rel="stylesheet">
14
+ <title>Vite App</title>
15
+ <script type="module" crossorigin src="/assets/index.js"></script>
16
+ <link rel="stylesheet" crossorigin href="/assets/index.css">
17
+ </head>
18
+ <body>
19
+ <div
20
+ id="app"
21
+ data-partner-id="5df72bdc97a52507605e4cc1"
22
+ data-wysiwyg-template-editor-bff-base-url="https://my.retailrocket.ru/5db801c197a52821e86b0d45/TransactionalEmailCampaign/6757225a5520d1ae575e7f0e/CampaignWizard/Step2/WysiwygTemplateEditorBff"
23
+ data-wysiwyg-bff-proxy-base-url="https://k8s-b1.retailrocket.ru/"
24
+ data-create-email-template-submit-url="https://webhook.site/a85a171c-bb86-4693-9552-d209a59a7e6a"
25
+ data-anti-forgery-header-token-name="data-anti-forgery-header-token-name"
26
+ data-anti-forgery-header-token-value="data-anti-forgery-header-token-value"
27
+ data-anti-forgery-form-token-name="data-anti-forgery-form-token-name"
28
+ data-anti-forgery-form-token-value="data-anti-forgery-form-token-value"
29
+ data-initial-transactional-template=""
30
+ data-exit-link="#"
31
+ data-locale-key="en"
32
+ data-transactional-favorites-templates="[]"
33
+ data-common-favorites-templates="[]"
34
+ ></div>
35
+
36
+
37
+ </body>
38
+ </html>
package/env.d.ts ADDED
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
package/index.html CHANGED
@@ -12,8 +12,6 @@
12
12
  />
13
13
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Lato:wght@100;300;400;700;900&family=Roboto:wght@400;700&display=swap" rel="stylesheet">
14
14
  <title>Vite App</title>
15
- <script type="module" crossorigin src="/assets/main.js"></script>
16
- <link rel="stylesheet" crossorigin href="/assets/main.css">
17
15
  </head>
18
16
  <body>
19
17
  <div
@@ -34,5 +32,6 @@
34
32
  ></div>
35
33
 
36
34
 
35
+ <script type="module" src="/src/createTransactionalEmailTemplateApp.ts"></script>
37
36
  </body>
38
37
  </html>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@retailrocketgroup/retailrocket-create.transactional-vue-email-template-render",
3
- "version": "3.0.381747",
3
+ "version": "5.0.384700",
4
4
  "private": false
5
5
  }
@@ -0,0 +1,321 @@
1
+ import 'bootstrap';
2
+ import '@easy-wizzy/core/index.css';
3
+
4
+ import { createApp } from 'vue';
5
+ import { createVuetify } from 'vuetify';
6
+ import { ClickOutside } from 'vuetify/directives';
7
+
8
+ import { CreateEmailTemplateApp } from '@easy-wizzy/core';
9
+ import { createSimpleDataForm, matcherFactory } from '@easy-wizzy/core';
10
+ import type { GeneralStringExpressionDataSource } from '@easy-wizzy/retailrocket-common';
11
+ import { expressionEvaluatorFactory } from '@easy-wizzy/core';
12
+ import { listExpressionEvaluatorFactory } from '@easy-wizzy/core';
13
+ import { numberExpressionEvaluatorDelegate } from '@easy-wizzy/core';
14
+ import { stringExpressionEvaluatorFactory } from '@easy-wizzy/core';
15
+ import { dataStructBuilderExpressionEvaluatorFactory } from '@easy-wizzy/core';
16
+
17
+ import type { DataType } from '@easy-wizzy/core';
18
+ import type { EmailTemplateType } from '@easy-wizzy/core';
19
+ import type { EmailTemplatePreviewTileComponent } from '@easy-wizzy/core';
20
+ import type { LocaleKey } from '@easy-wizzy/core';
21
+ import type { StringExpressionEvaluatorDelegate } from '@easy-wizzy/core';
22
+
23
+ import { createEmailTemplateAppDepsFactory } from '@easy-wizzy/common-app';
24
+ import { emailTemplatePreviewTileComponentFactory } from '@easy-wizzy/common-app';
25
+ import { emailTemplatePreviewTileDepsFactory } from '@easy-wizzy/common-app';
26
+ import { productImageUrlBuilderExpressionEvaluatorFactory } from '@easy-wizzy/common-app';
27
+ import { defaultTemplateLibraryFactory } from '@easy-wizzy/common-app';
28
+ import { apiMachineFetchFactory } from '@easy-wizzy/common-app';
29
+ import { variableSelectorDepsFactory } from '@easy-wizzy/common-app';
30
+
31
+ import type { ApiMachineFetchDelegate } from '@easy-wizzy/common-app';
32
+
33
+ import { stringExpressionBuilderPluginFactory, richTextToolbarPluginFactory, VariableSelector } from '@easy-wizzy/retailrocket-common';
34
+
35
+ import type { NextCouponFromBatchType } from '@easy-wizzy/retailrocket-common';
36
+
37
+ import type { TransactionalListExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
38
+ import type { TransactionalNumberExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
39
+ import type { TransactionalStringExpressionDataSource } from '@easy-wizzy/retailrocket-transactional';
40
+
41
+ import { initialEmailTemplateRu } from '@easy-wizzy/template-library';
42
+ import { initialEmailTemplateEn } from '@easy-wizzy/template-library';
43
+
44
+ import { transactionalListExpressionDataSourceEvaluatorFactory } from '@/implementation/DataSources/ListDataExpressionSource/transactionalListExpressionDataSourceEvaluatorFactory';
45
+ import { transactionalNumberExpressionDataSourceEvaluatorFactory } from '@/implementation/DataSources/NumberExpressionDataSource/transactionalNumberExpressionDataSourceEvaluatorFactory';
46
+ import { transactionalStringExpressionDataSourceEvaluatorFactory } from '@/implementation/DataSources/StringExpressionDataSource/transactionalEvaluateStringExpressionDataSource';
47
+
48
+ import { createApi as listExpressionDataSourceBffClientFactory } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.listexpressiondatasource';
49
+
50
+ const appTagId = '#app';
51
+ const appTag = document.querySelector(appTagId);
52
+
53
+ const params = {
54
+ partnerId: appTag!.getAttribute('data-partner-id')!,
55
+ wysiwygTemplateEditorBffBaseUrl: appTag!.getAttribute('data-wysiwyg-template-editor-bff-base-url')!,
56
+ wysiwygBffProxyBaseUrl: appTag!.getAttribute('data-wysiwyg-bff-proxy-base-url')!,
57
+ antiForgeryHeaderTokenName: appTag!.getAttribute('data-anti-forgery-header-token-name')!,
58
+ antiForgeryHeaderTokenValue: appTag!.getAttribute('data-anti-forgery-header-token-value')!,
59
+ antiForgeryFormTokenName: appTag!.getAttribute('data-anti-forgery-form-token-name')!,
60
+ antiForgeryFormTokenValue: appTag!.getAttribute('data-anti-forgery-form-token-value')!,
61
+ createEmailTemplateSubmitUrl: appTag!.getAttribute('data-create-email-template-submit-url')!,
62
+ initialEmailTemplateJson: appTag!.getAttribute('data-initial-transactional-template')!,
63
+ transactionalFavoritesTemplates: JSON.parse(appTag!.getAttribute('data-transactional-favorites-templates')!) as [{
64
+ templateJson: string,
65
+ dataJson: string,
66
+ favoriteTemplateName: string
67
+ }],
68
+ commonFavoritesTemplates: JSON.parse(appTag!.getAttribute('data-common-favorites-templates')!) as [{
69
+ templateJson: string,
70
+ favoriteTemplateName: string
71
+ }],
72
+ exitLink: appTag!.getAttribute('data-exit-link')!,
73
+ localeKey: appTag!.getAttribute('data-locale-key') as LocaleKey || 'en'
74
+ };
75
+
76
+ const _apiMachineFetchFactory = (arg: {
77
+ baseUrl: string
78
+ }): ApiMachineFetchDelegate => apiMachineFetchFactory({
79
+ baseUrl: arg.baseUrl,
80
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
81
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
82
+ });
83
+
84
+ const listExpressionDataSourceBffClient = listExpressionDataSourceBffClientFactory(
85
+ _apiMachineFetchFactory({
86
+ baseUrl: params.wysiwygBffProxyBaseUrl
87
+ })
88
+ );
89
+
90
+ const createTemplate = <
91
+ TListExpressionDataSource,
92
+ TNumberExpressionDataSource,
93
+ TStringExpressionDataSource>(arg: {
94
+ template: EmailTemplateType<
95
+ TListExpressionDataSource,
96
+ TNumberExpressionDataSource,
97
+ TStringExpressionDataSource>,
98
+ previewData: unknown,
99
+ }): void => {
100
+ const formData = new FormData();
101
+ formData.append(
102
+ params.antiForgeryFormTokenName,
103
+ params.antiForgeryFormTokenValue);
104
+ formData.append(
105
+ 'template',
106
+ JSON.stringify(arg.template));
107
+ formData.append(
108
+ 'previewData',
109
+ JSON.stringify(arg.previewData));
110
+
111
+ const form = createSimpleDataForm({
112
+ method: 'POST',
113
+ action: params.createEmailTemplateSubmitUrl,
114
+ formData: formData
115
+ });
116
+
117
+ document.body.appendChild(form);
118
+ form.submit();
119
+ };
120
+
121
+ const nextCouponFromBatch: NextCouponFromBatchType = {
122
+ BatchId: ''
123
+ };
124
+
125
+ const createEmailTemplatePreviewTile = (arg: {
126
+ template: EmailTemplateType<
127
+ TransactionalListExpressionDataSource,
128
+ TransactionalNumberExpressionDataSource,
129
+ TransactionalStringExpressionDataSource
130
+ >;
131
+ templateData: DataType;
132
+ templateName: string;
133
+ }): EmailTemplatePreviewTileComponent => {
134
+
135
+ const listExpressionDataSourceEvaluator = transactionalListExpressionDataSourceEvaluatorFactory({
136
+ partnerId: params.partnerId,
137
+ getTransactionalTemplateData: () => arg.templateData,
138
+ listExpressionDataSourceBffClient: listExpressionDataSourceBffClient,
139
+ customerStockId: undefined
140
+ });
141
+
142
+ const listExpressionEvaluator = listExpressionEvaluatorFactory({
143
+ listExpressionDataSourceEvaluator: listExpressionDataSourceEvaluator
144
+ });
145
+
146
+ const numberExpressionDataSourceEvaluator = transactionalNumberExpressionDataSourceEvaluatorFactory({
147
+ getTransactionalTemplateData: () => arg.templateData
148
+ });
149
+
150
+ const numberExpressionEvaluator = numberExpressionEvaluatorDelegate({
151
+ listExpressionEvaluator: listExpressionEvaluator,
152
+ numberExpressionDataSourceEvaluator: numberExpressionDataSourceEvaluator
153
+ })
154
+
155
+ const stringExpressionEvaluator: StringExpressionEvaluatorDelegate<
156
+ TransactionalListExpressionDataSource,
157
+ TransactionalNumberExpressionDataSource,
158
+ TransactionalStringExpressionDataSource
159
+ > = stringExpressionEvaluatorFactory({
160
+ listExpressionEvaluator: listExpressionEvaluator,
161
+ numberExpressionEvaluator: numberExpressionEvaluator,
162
+ stringExpressionDataSourceEvaluatorFactory: () => transactionalStringExpressionDataSourceEvaluatorFactory({
163
+ getTransactionalTemplateData: () => arg.templateData,
164
+ productImageUrlBuilderExpressionEvaluator: productImageUrlBuilderExpressionEvaluatorFactory({
165
+ partnerId: params.partnerId,
166
+ numberExpressionEvaluator: numberExpressionEvaluator
167
+ }),
168
+ nextCouponFromBatch: nextCouponFromBatch
169
+ })
170
+ });
171
+
172
+ const expressionEvaluator = expressionEvaluatorFactory({
173
+ listExpressionEvaluator: listExpressionEvaluator,
174
+ numberExpressionEvaluator: numberExpressionEvaluator,
175
+ stringExpressionEvaluator: stringExpressionEvaluator,
176
+ dataStructBuilderExpressionEvaluatorFactory: expressionEvaluator => dataStructBuilderExpressionEvaluatorFactory({
177
+ expressionEvaluator: expressionEvaluator
178
+ })
179
+ });
180
+
181
+ const dataStructExpressionEvaluator = dataStructBuilderExpressionEvaluatorFactory({
182
+ expressionEvaluator: expressionEvaluator
183
+ });
184
+
185
+ const stringExpressionBuilderPlugin = stringExpressionBuilderPluginFactory({
186
+ localeKey: params.localeKey
187
+ });
188
+
189
+ return emailTemplatePreviewTileComponentFactory<
190
+ TransactionalListExpressionDataSource,
191
+ TransactionalNumberExpressionDataSource,
192
+ TransactionalStringExpressionDataSource
193
+ >({
194
+ template: arg.template,
195
+ templateName: arg.templateName,
196
+ emailTemplatePreviewTileDeps: emailTemplatePreviewTileDepsFactory<
197
+ TransactionalListExpressionDataSource,
198
+ TransactionalNumberExpressionDataSource,
199
+ TransactionalStringExpressionDataSource
200
+ >({
201
+ localeKey: params.localeKey,
202
+ dataSourceFieldNameDelegate: ({ dataSource }) => {
203
+ return matcherFactory(dataSource as GeneralStringExpressionDataSource).Match({
204
+ StringFromContactCustomData: (customData) => customData.FieldName,
205
+ StringFromContactCustomDataWithFallback: (customDataWithFallback) => customDataWithFallback.FallbackValue,
206
+ ProductImageUrlBuilderExpression: () => 'ImageResizer',
207
+ NextCouponFromBatch: () => 'Coupon'
208
+ });
209
+ },
210
+ richTextToolbarPlugins: [
211
+ richTextToolbarPluginFactory({
212
+ richTextToolbarPluginComponent: VariableSelector,
213
+ deps: variableSelectorDepsFactory({
214
+ localeKey: params.localeKey,
215
+ stringExpressionBuilderPlugin: stringExpressionBuilderPlugin
216
+ })
217
+ })
218
+ ],
219
+ listExpressionEvaluator: listExpressionEvaluator,
220
+ numberExpressionEvaluator: numberExpressionEvaluator,
221
+ stringExpressionEvaluator: stringExpressionEvaluator,
222
+ dataStructExpressionEvaluator: dataStructExpressionEvaluator!,
223
+ expressionEvaluator: expressionEvaluator,
224
+ stringExpressionBuilderPlugin: stringExpressionBuilderPlugin
225
+ }),
226
+ onFavoriteTemplateSelected: () => {
227
+ //eslint-disable-next-line no-console
228
+ console.log('onFavoriteTemplateSelected');
229
+ // create email template
230
+ createTemplate({
231
+ template: arg.template,
232
+ previewData: arg.templateData,
233
+ });
234
+ // redirect
235
+ },
236
+ });
237
+ };
238
+
239
+ const initialEmailTemplate = params.localeKey === 'ru'
240
+ ? initialEmailTemplateRu
241
+ : initialEmailTemplateEn;
242
+
243
+ const app = createApp(
244
+ CreateEmailTemplateApp,
245
+ {
246
+ onInitialTemplateSelected: () => {
247
+ //eslint-disable-next-line no-console
248
+ console.log('onInitialTemplateSelected');
249
+ createTemplate({
250
+ template: params.initialEmailTemplateJson.length
251
+ ? JSON.parse(params.initialEmailTemplateJson)
252
+ : initialEmailTemplate,
253
+ previewData: {}
254
+ });
255
+ },
256
+ exitLink: params.exitLink,
257
+ deps:
258
+ createEmailTemplateAppDepsFactory<
259
+ TransactionalListExpressionDataSource,
260
+ TransactionalNumberExpressionDataSource,
261
+ TransactionalStringExpressionDataSource
262
+ >({
263
+ partnerId: params.partnerId,
264
+ localeKey: params.localeKey,
265
+ emailTemplatePreviews:{
266
+ custom: [
267
+ ...params
268
+ .commonFavoritesTemplates
269
+ .map(o => ({
270
+ templateName: o.favoriteTemplateName,
271
+ previewTileComponent: createEmailTemplatePreviewTile({
272
+ template: JSON.parse(o.templateJson),
273
+ templateName: o.favoriteTemplateName,
274
+ templateData: {}
275
+ })
276
+ })),
277
+ ...params
278
+ .transactionalFavoritesTemplates
279
+ .map(o => ({
280
+ templateName: o.favoriteTemplateName,
281
+ previewTileComponent: createEmailTemplatePreviewTile({
282
+ template: JSON.parse(o.templateJson),
283
+ templateName: o.favoriteTemplateName,
284
+ templateData: {}
285
+ })
286
+ }))
287
+ ],
288
+ default: [
289
+ ...defaultTemplateLibraryFactory(params.localeKey)
290
+ .map(o => ({
291
+ templateName: o.favoriteTemplateName,
292
+ previewTileComponent: createEmailTemplatePreviewTile({
293
+ template: o.defaultTemplate as EmailTemplateType<
294
+ TransactionalListExpressionDataSource,
295
+ TransactionalNumberExpressionDataSource,
296
+ TransactionalStringExpressionDataSource
297
+ >,
298
+ templateName: o.favoriteTemplateName,
299
+ templateData: {}
300
+ })
301
+ }))
302
+ ]
303
+ }
304
+ ,
305
+ initialEmailTemplate: params.initialEmailTemplateJson.length
306
+ ? JSON.parse(params.initialEmailTemplateJson)
307
+ : initialEmailTemplate,
308
+ exitLink: params.exitLink
309
+ }
310
+ )
311
+ }
312
+ );
313
+
314
+ app.use(createVuetify({
315
+ theme: false,
316
+ directives: {
317
+ ClickOutside
318
+ }
319
+ }));
320
+
321
+ app.mount(appTagId);
@@ -0,0 +1,5 @@
1
+ import {
2
+ createApi as createTransactionalwysiwygtemplateeditorClient
3
+ } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.transactionalwysiwygtemplateeditor';
4
+
5
+ export type TransactionalWysiwygTemplateEditorClient = ReturnType<typeof createTransactionalwysiwygtemplateeditorClient>;
@@ -0,0 +1,41 @@
1
+ import { defineComponent, h } from 'vue';
2
+ import type {
3
+ DataType,
4
+ LocaleKey
5
+ } from '@easy-wizzy/core';
6
+ import type {
7
+ AppSettingsModifierPlugin, AppSettingsModifierPluginEmits, AppSettingsModifierPluginProps,
8
+ } from '@easy-wizzy/core';
9
+ import { TransactionalDataAppSettingsModifier } from '@easy-wizzy/retailrocket-transactional';
10
+
11
+ export const transactionalDataAppSettingsModifierPluginFactory = (
12
+ arg: {
13
+ localeKey: LocaleKey;
14
+ getTransactionTemplateData: () => DataType,
15
+ updateTransactionTemplateData: (data: DataType) => void
16
+ }
17
+ ): AppSettingsModifierPlugin => {
18
+ return defineComponent<
19
+ AppSettingsModifierPluginProps,
20
+ AppSettingsModifierPluginEmits
21
+ >(
22
+ (_, ctx) => {
23
+ return () => h(
24
+ TransactionalDataAppSettingsModifier,
25
+ {
26
+ localeKey: arg.localeKey,
27
+ getTransactionTemplateData: arg.getTransactionTemplateData,
28
+ onTransactionTemplateDataUpdated: (transactionTemplateData: DataType) => {
29
+ arg.updateTransactionTemplateData(transactionTemplateData);
30
+ ctx.emit('onSettingsUpdated');
31
+ }
32
+ },
33
+ )
34
+ },
35
+ {
36
+ emits: {
37
+ onSettingsUpdated: () => true
38
+ }
39
+ },
40
+ )
41
+ }
@@ -0,0 +1,30 @@
1
+ import type {
2
+ ComponentLibrarySectionItem,
3
+ } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.componentlibrary/main';
4
+ import {
5
+ transactionalEmailComponentFactory
6
+ } from '@/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/transactionalEmailComponentFactory';
7
+ import type {
8
+ TransactionalStringExpressionDataSource
9
+ } from '@easy-wizzy/retailrocket-transactional';
10
+ import type {
11
+ TransactionalNumberExpressionDataSource
12
+ } from '@easy-wizzy/retailrocket-transactional';
13
+ import type {
14
+ TransactionalListExpressionDataSource
15
+ } from '@easy-wizzy/retailrocket-transactional';
16
+ import type { CustomComponentSectionItemType } from '@easy-wizzy/core';
17
+
18
+ export const transactionalComponentSectionItemFactory = (
19
+ componentLibrarySectionItem: ComponentLibrarySectionItem,
20
+ ): CustomComponentSectionItemType<
21
+ TransactionalListExpressionDataSource,
22
+ TransactionalNumberExpressionDataSource,
23
+ TransactionalStringExpressionDataSource
24
+ > => {
25
+ return {
26
+ sectionItemId: componentLibrarySectionItem.sectionItemId,
27
+ sectionItemName: componentLibrarySectionItem.sectionItemName,
28
+ componentTemplate: transactionalEmailComponentFactory(componentLibrarySectionItem.component),
29
+ };
30
+ };
@@ -0,0 +1,26 @@
1
+ import type { EmailComponentType } from '@easy-wizzy/core';
2
+ import type {
3
+ Component,
4
+ } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.addcomponentlibrarysectionitemmodalwindow/main';
5
+ import type {
6
+ TransactionalStringExpressionDataSource
7
+ } from '@easy-wizzy/retailrocket-transactional';
8
+ import type {
9
+ TransactionalListExpressionDataSource
10
+ } from '@easy-wizzy/retailrocket-transactional';
11
+ import type {
12
+ TransactionalNumberExpressionDataSource
13
+ } from '@easy-wizzy/retailrocket-transactional';
14
+
15
+ export const transactionalEmailComponentFactory = (
16
+ component: Component
17
+ ): EmailComponentType<
18
+ TransactionalListExpressionDataSource,
19
+ TransactionalNumberExpressionDataSource,
20
+ TransactionalStringExpressionDataSource
21
+ > =>
22
+ {
23
+ return component.transactional
24
+ ? JSON.parse(component.transactional.componentJson)
25
+ : JSON.parse(component.common!.componentJson)
26
+ }
@@ -0,0 +1,29 @@
1
+ import type {
2
+ ComponentLibrarySection,
3
+ } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.componentlibrary/main';
4
+ import type {
5
+ CustomComponentLibraryType
6
+ } from '@easy-wizzy/core';
7
+ import type {
8
+ TransactionalListExpressionDataSource
9
+ } from '@easy-wizzy/retailrocket-transactional';
10
+ import type {
11
+ TransactionalNumberExpressionDataSource
12
+ } from '@easy-wizzy/retailrocket-transactional';
13
+ import type {
14
+ TransactionalStringExpressionDataSource
15
+ } from '@easy-wizzy/retailrocket-transactional';
16
+ import {
17
+ transactionalSectionFactory
18
+ } from '@/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/transactionalSectionFactory';
19
+
20
+ export const transactionalComponentLibraryFactory = (
21
+ componentLibrary: Array<ComponentLibrarySection>
22
+ ): CustomComponentLibraryType<
23
+ TransactionalListExpressionDataSource,
24
+ TransactionalNumberExpressionDataSource,
25
+ TransactionalStringExpressionDataSource
26
+ > => {
27
+ return componentLibrary
28
+ .map(section => transactionalSectionFactory(section))
29
+ }