@retailrocketgroup/retailrocket-edit.abandoned-basket-vue-email-template-render 3.0.381747 → 5.0.384530

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 (44) 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/editAbandonedBasketEmailTemplate.d.ts +0 -0
  6. package/dist/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/abandonedBasketComponentSectionItemFactory.d.ts +4 -0
  7. package/dist/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/abandonedBasketEmailComponentFactory.d.ts +4 -0
  8. package/dist/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/abandonedBasketComponentLibraryFactory.d.ts +4 -0
  9. package/dist/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/abandonedBasketSectionFactory.d.ts +4 -0
  10. package/dist/implementation/DataSources/ListDataExpressionSource/abandonedBasketEvaluateListExpressionDataSourceFactory.d.ts +8 -0
  11. package/dist/implementation/DataSources/NumberExpressionDataSource/abandonedBasketEvaluateNumberExpressionDataSourceFactory.d.ts +2 -0
  12. package/dist/implementation/DataSources/StringExpressionDataSource/abandonedBasketEvaluateStringExpressionDataSource.d.ts +9 -0
  13. package/dist/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/AbandonedBasketProductShelfDataSourceExpressionBuilderModal/ShelfBuilders/abandonedBasketProductListShelfBuilderDepsFactory.d.ts +8 -0
  14. package/dist/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/AbandonedBasketProductShelfDataSourceExpressionBuilderModal/ShelfBuilders/alternativeProductsForAbandonedBasketProductListShelfBuilderDepsFactory.d.ts +8 -0
  15. package/dist/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/AbandonedBasketProductShelfDataSourceExpressionBuilderModal/ShelfBuilders/relatedProductsForAbandonedBasketProductListShelfBuilderDepsFactory.d.ts +8 -0
  16. package/dist/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/AbandonedBasketProductShelfDataSourceExpressionBuilderModal/abandonedBasketProductShelfDataSourceExpressionBuilderModalDepsFactory.d.ts +11 -0
  17. package/dist/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/abandonedBasketProductShelfDataSourceExpressionBuilderDepsFactory.d.ts +11 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.html +37 -0
  20. package/env.d.ts +1 -0
  21. package/index.html +34 -33
  22. package/package.json +1 -1
  23. package/src/editAbandonedBasketEmailTemplate.ts +408 -0
  24. package/src/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/abandonedBasketComponentSectionItemFactory.ts +32 -0
  25. package/src/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/abandonedBasketEmailComponentFactory.ts +26 -0
  26. package/src/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/abandonedBasketComponentLibraryFactory.ts +29 -0
  27. package/src/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/abandonedBasketSectionFactory.ts +34 -0
  28. package/src/implementation/DataSources/ListDataExpressionSource/abandonedBasketEvaluateListExpressionDataSourceFactory.ts +132 -0
  29. package/src/implementation/DataSources/NumberExpressionDataSource/abandonedBasketEvaluateNumberExpressionDataSourceFactory.ts +10 -0
  30. package/src/implementation/DataSources/StringExpressionDataSource/abandonedBasketEvaluateStringExpressionDataSource.ts +54 -0
  31. package/src/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/AbandonedBasketProductShelfDataSourceExpressionBuilderModal/ShelfBuilders/abandonedBasketProductListShelfBuilderDepsFactory.ts +33 -0
  32. package/src/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/AbandonedBasketProductShelfDataSourceExpressionBuilderModal/ShelfBuilders/alternativeProductsForAbandonedBasketProductListShelfBuilderDepsFactory.ts +33 -0
  33. package/src/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/AbandonedBasketProductShelfDataSourceExpressionBuilderModal/ShelfBuilders/relatedProductsForAbandonedBasketProductListShelfBuilderDepsFactory.ts +33 -0
  34. package/src/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/AbandonedBasketProductShelfDataSourceExpressionBuilderModal/abandonedBasketProductShelfDataSourceExpressionBuilderModalDepsFactory.ts +150 -0
  35. package/src/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/abandonedBasketProductShelfDataSourceExpressionBuilderDepsFactory.ts +34 -0
  36. package/src/index.ts +0 -0
  37. package/tsconfig.app.json +19 -0
  38. package/tsconfig.json +14 -0
  39. package/tsconfig.node.json +11 -0
  40. package/tsconfig.test.json +11 -0
  41. package/vite.config.ts +37 -0
  42. package/assets/main.css +0 -1
  43. package/assets/main.js +0 -217
  44. package/favicon.ico +0 -0
@@ -0,0 +1,408 @@
1
+ import 'bootstrap';
2
+ import '@easy-wizzy/retailrocket-common/index.css';
3
+ import '@easy-wizzy/core/index.css';
4
+
5
+ import { createApp } from 'vue';
6
+ import { createVuetify } from 'vuetify';
7
+ import { ClickOutside } from 'vuetify/directives';
8
+
9
+ import { createSimpleDataForm, matcherFactory } from '@easy-wizzy/core';
10
+ import { EditEmailTemplateApp } from '@easy-wizzy/core';
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 { LocaleKey } from '@easy-wizzy/core';
18
+ import type { StringExpressionEvaluatorDelegate } from '@easy-wizzy/core';
19
+
20
+ import { defaultThemeLibraryFactory } from '@easy-wizzy/theme-library';
21
+ import { defaultComponentLibraryFactory } from '@easy-wizzy/component-library';
22
+
23
+ import type { ApiMachineFetchDelegate } from '@easy-wizzy/common-app';
24
+
25
+ import { apiMachineFetchFactory } from '@easy-wizzy/common-app';
26
+ import { editEmailTemplateAppDepsFactory } from '@easy-wizzy/common-app';
27
+ import { productImageUrlBuilderExpressionEvaluatorFactory } from '@easy-wizzy/common-app';
28
+ import { wysiwygTemplateEditorBffClientFactory } from '@easy-wizzy/common-app';
29
+ import { variableSelectorDepsFactory } from '@easy-wizzy/common-app';
30
+
31
+ import { productShelfDataSourceExpressionBuilderPluginFactory } from '@easy-wizzy/retailrocket-common';
32
+ import { stringExpressionBuilderPluginFactory, richTextToolbarPluginFactory, VariableSelector } from '@easy-wizzy/retailrocket-common';
33
+
34
+ import type { ContactCustomData, GeneralStringExpressionDataSource, NextCouponFromBatchType } from '@easy-wizzy/retailrocket-common';
35
+
36
+ import type { AbandonedBasketListExpressionDataSource } from '@easy-wizzy/retailrocket-abandoned-basket';
37
+ import type { AbandonedBasketNumberExpressionDataSource } from '@easy-wizzy/retailrocket-abandoned-basket';
38
+ import type { AbandonedBasketStringExpressionDataSource } from '@easy-wizzy/retailrocket-abandoned-basket';
39
+
40
+ import { AbandonedBasketProductShelfDataSourceExpressionBuilder } from '@easy-wizzy/retailrocket-abandoned-basket';
41
+
42
+ import { abandonedBasketEvaluateListExpressionDataSourceFactory } from '@/implementation/DataSources/ListDataExpressionSource/abandonedBasketEvaluateListExpressionDataSourceFactory';
43
+ import { abandonedBasketEvaluateNumberExpressionDataSourceFactory } from '@/implementation/DataSources/NumberExpressionDataSource/abandonedBasketEvaluateNumberExpressionDataSourceFactory';
44
+ import { abandonedBasketStringExpressionDataSourceEvaluatorFactory } from '@/implementation/DataSources/StringExpressionDataSource/abandonedBasketEvaluateStringExpressionDataSource';
45
+ import { abandonedBasketComponentLibraryFactory } from '@/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/abandonedBasketComponentLibraryFactory';
46
+ import { abandonedBasketProductShelfDataSourceExpressionBuilderDepsFactory } from '@/implementation/EmailComponentSettingsModifierPlugin/ProductShelfDataSourceExpressionBuilder/abandonedBasketProductShelfDataSourceExpressionBuilderDepsFactory.ts';
47
+
48
+ import { createApi as createTriggerAbandonedBasketWysiwygTemplateEditorClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.triggerabandonedbasketwysiwygtemplateeditor';
49
+ import {
50
+ type Component,
51
+ createApi as createAddComponentLibrarySectionItemModalWindowBffClient
52
+ } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.addcomponentlibrarysectionitemmodalwindow';
53
+ import { createApi as listExpressionDataSourceBffClientFactory } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.listexpressiondatasource';
54
+ import { createApi as createProductShelfBuilderModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.productshelfmodalwindow';
55
+ import { createApi as createThemeLibraryBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.themelibrary';
56
+ import { createApi as createComponentLibraryBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.componentlibrary';
57
+ import { createApi as createAddThemeLibrarySectionItemModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.addthemelibrarysectionitemmodalwindow';
58
+ import { createApi as createDeleteThemeLibrarySectionItemModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.deletethemelibrarysectionitemmodalwindow';
59
+ import { createApi as createDeleteThemeLibrarySectionModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.deletethemelibrarysectionmodalwindow';
60
+ import { createApi as createEditThemeLibrarySectionItemModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.editthemelibrarysectionitemmodalwindow';
61
+ import { createApi as createAddComponentLibrarySectionModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.addcomponentlibrarysectionmodalwindow';
62
+ import { createApi as createEditComponentLibrarySectionItemModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.editcomponentlibrarysectionitemmodalwindow';
63
+ import { createApi as createDeleteComponentLibrarySectionItemModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.deletecomponentlibrarysectionitemmodalwindow';
64
+ import { createApi as createThemeLibrarySectionModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.addthemelibrarysectionmodalwindow';
65
+ import { createApi as createDeleteComponentLibrarySectionModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.deletecomponentlibrarysectionmodalwindow';
66
+ import { createApi as createProductCategoryPickerModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.productcategorypickermodalwindow';
67
+ import { createApi as createProductPickerModalWindowBffClient } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.productpickermodalwindow';
68
+ import { createApi as saveFavoriteTemplate } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.savefavoritetemplatemodalwindow';
69
+
70
+ const appTagId = '#app';
71
+ const appTag = document.querySelector(appTagId);
72
+
73
+ const params = {
74
+ partnerId: appTag!.getAttribute('data-partner-id')!,
75
+ wysiwygBffProxyBaseUrl: appTag!.getAttribute('data-wysiwyg-bff-proxy-base-url')!,
76
+ wysiwygTemplateEditorBffBaseUrl: appTag!.getAttribute('data-wysiwyg-template-editor-bff-base-url')!,
77
+ antiForgeryHeaderTokenName: appTag!.getAttribute('data-anti-forgery-header-token-name')!,
78
+ antiForgeryHeaderTokenValue: appTag!.getAttribute('data-anti-forgery-header-token-value')!,
79
+ antiForgeryFormTokenName: appTag!.getAttribute('data-anti-forgery-form-token-name')!,
80
+ antiForgeryFormTokenValue: appTag!.getAttribute('data-anti-forgery-form-token-value')!,
81
+ emailTemplateJson: appTag!.getAttribute('data-email-template-json')!,
82
+ previewTemplateDataJson: appTag!.getAttribute('data-preview-template-data-json')!,
83
+ resetTemplateFormUrl: appTag!.getAttribute('data-reset-template-form-url')!,
84
+ exitLink: appTag!.getAttribute('data-exit-link')!,
85
+ localeKey: appTag!.getAttribute('data-locale-key') as LocaleKey || 'en'
86
+ };
87
+
88
+ const _apiMachineFetchFactory = (arg: {
89
+ baseUrl: string
90
+ }): ApiMachineFetchDelegate => apiMachineFetchFactory({
91
+ baseUrl: arg.baseUrl,
92
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
93
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
94
+ });
95
+
96
+ const abandonedBasketMainPageBffClient = createTriggerAbandonedBasketWysiwygTemplateEditorClient(
97
+ apiMachineFetchFactory({
98
+ baseUrl: params.wysiwygTemplateEditorBffBaseUrl,
99
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
100
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
101
+ })
102
+ );
103
+
104
+ const createFavoriteTemplateBffClient = saveFavoriteTemplate(
105
+ _apiMachineFetchFactory({
106
+ baseUrl: params.wysiwygBffProxyBaseUrl
107
+ })
108
+ );
109
+
110
+ const resetTemplate = (): void => {
111
+ const formData = new FormData();
112
+ formData.append(
113
+ params.antiForgeryFormTokenName,
114
+ params.antiForgeryFormTokenValue);
115
+
116
+ const form = createSimpleDataForm({
117
+ method: 'POST',
118
+ action: params.resetTemplateFormUrl,
119
+ formData: formData
120
+ });
121
+
122
+ document.body.appendChild(form);
123
+ form.submit();
124
+ };
125
+
126
+ let contactCustomData: ContactCustomData = {};
127
+ let nextCouponFromBatch: NextCouponFromBatchType = {
128
+ BatchId: '',
129
+ };
130
+
131
+
132
+ const listExpressionDataSourceBffClient = listExpressionDataSourceBffClientFactory(
133
+ _apiMachineFetchFactory({
134
+ baseUrl: params.wysiwygBffProxyBaseUrl
135
+ })
136
+ );
137
+
138
+ const listExpressionDataSourceEvaluator = abandonedBasketEvaluateListExpressionDataSourceFactory({
139
+ partnerId: params.partnerId,
140
+ listExpressionDataSourceBffClient: listExpressionDataSourceBffClient,
141
+ customerStockId: undefined
142
+ });
143
+
144
+ const listExpressionEvaluator = listExpressionEvaluatorFactory({
145
+ listExpressionDataSourceEvaluator: listExpressionDataSourceEvaluator
146
+ });
147
+
148
+ const numberExpressionDataSourceEvaluator = abandonedBasketEvaluateNumberExpressionDataSourceFactory();
149
+
150
+ const numberExpressionEvaluator = numberExpressionEvaluatorDelegate({
151
+ listExpressionEvaluator: listExpressionEvaluator,
152
+ numberExpressionDataSourceEvaluator: numberExpressionDataSourceEvaluator
153
+ })
154
+
155
+ const stringExpressionEvaluator: StringExpressionEvaluatorDelegate<
156
+ AbandonedBasketListExpressionDataSource,
157
+ AbandonedBasketNumberExpressionDataSource,
158
+ AbandonedBasketStringExpressionDataSource
159
+ > = stringExpressionEvaluatorFactory({
160
+ listExpressionEvaluator: listExpressionEvaluator,
161
+ numberExpressionEvaluator: numberExpressionEvaluator,
162
+ stringExpressionDataSourceEvaluatorFactory: () => abandonedBasketStringExpressionDataSourceEvaluatorFactory({
163
+ productImageUrlBuilderExpressionEvaluator: productImageUrlBuilderExpressionEvaluatorFactory({
164
+ partnerId: params.partnerId,
165
+ numberExpressionEvaluator: numberExpressionEvaluator
166
+ }),
167
+ contactCustomData: contactCustomData,
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 app = createApp(
186
+ EditEmailTemplateApp,
187
+ {
188
+ onTemplateReset: () => {
189
+ resetTemplate();
190
+ },
191
+ deps:
192
+ editEmailTemplateAppDepsFactory<
193
+ AbandonedBasketListExpressionDataSource,
194
+ AbandonedBasketNumberExpressionDataSource,
195
+ AbandonedBasketStringExpressionDataSource
196
+ >({
197
+ dataSourceFieldNameDelegate: ({ dataSource }) => {
198
+ return matcherFactory(dataSource as GeneralStringExpressionDataSource).Match({
199
+ StringFromContactCustomData: (customData) => customData.FieldName,
200
+ StringFromContactCustomDataWithFallback: (customDataWithFallback) => customDataWithFallback.FallbackValue,
201
+ ProductImageUrlBuilderExpression: () => 'ImageResizer',
202
+ NextCouponFromBatch: () => 'Coupon'
203
+ });
204
+ },
205
+ richTextToolbarPlugins: [
206
+ richTextToolbarPluginFactory({
207
+ richTextToolbarPluginComponent: VariableSelector,
208
+ deps: variableSelectorDepsFactory({
209
+ localeKey: params.localeKey,
210
+ stringExpressionBuilderPlugin: stringExpressionBuilderPluginFactory({
211
+ localeKey: params.localeKey
212
+ })
213
+ })
214
+ })
215
+ ],
216
+ partnerId: params.partnerId,
217
+ exitLink: params.exitLink,
218
+ localeKey: params.localeKey,
219
+ defaultThemeLibrary: defaultThemeLibraryFactory({
220
+ localeKey: params.localeKey
221
+ }),
222
+ defaultComponentLibrary: defaultComponentLibraryFactory({
223
+ localeKey: params.localeKey
224
+ }),
225
+ saveEmailTemplate: async arg => {
226
+ const result = await abandonedBasketMainPageBffClient
227
+ .postSaveTemplate({
228
+ body: {
229
+ partnerId: params.partnerId,
230
+ templateJson: JSON.stringify(arg.emailTemplate)
231
+ }
232
+ })
233
+
234
+ return result.status === 200
235
+ ? 'Success'
236
+ : 'Fail'
237
+ },
238
+ createFavoriteTemplate: async arg => {
239
+ const result = await createFavoriteTemplateBffClient
240
+ .postCreateFavoriteTriggerAbandonedBasketTemplate({
241
+ body: {
242
+ partnerId: params.partnerId,
243
+ templateJson: JSON.stringify(arg.emailTemplate),
244
+ favoriteTemplateName: 'Favorite template'
245
+ }
246
+ });
247
+
248
+ return result.status === 200
249
+ ? 'Success'
250
+ : 'Fail';
251
+ },
252
+ listExpressionEvaluator: listExpressionEvaluator,
253
+ numberExpressionEvaluator: numberExpressionEvaluator,
254
+ stringExpressionEvaluator: stringExpressionEvaluator,
255
+ dataStructExpressionEvaluator: dataStructExpressionEvaluator,
256
+ expressionEvaluator: expressionEvaluator,
257
+ getComponentLibraryFactory: x => () =>
258
+ x.getComponentLibraryHttpClient(
259
+ {
260
+ body: {
261
+ partnerId: x.partnerId,
262
+ componentTypes: [
263
+ { triggerAbandonedBasket: {} },
264
+ { common: {} }
265
+ ]
266
+ }
267
+ }
268
+ )
269
+ .then(x => abandonedBasketComponentLibraryFactory(x.body.sections)),
270
+ canProductShelfDataSourceBeConverted: () => false,
271
+ httpClientComponentFactoryDelegate: (emailComponent): Component => {
272
+ return {
273
+ triggerAbandonedBasket: {
274
+ componentJson: JSON.stringify(emailComponent)
275
+ }
276
+ }
277
+ },
278
+ stringExpressionBuilderPlugin: stringExpressionBuilderPluginFactory({
279
+ localeKey: params.localeKey
280
+ }),
281
+ emailComponentSettingsModifierPlugin: productShelfDataSourceExpressionBuilderPluginFactory({
282
+ productShelfDataSourceExpressionBuilderComponent: AbandonedBasketProductShelfDataSourceExpressionBuilder,
283
+ deps: abandonedBasketProductShelfDataSourceExpressionBuilderDepsFactory({
284
+ localeKey: params.localeKey,
285
+ partnerId: params.partnerId,
286
+ customerStockId: 'customerStockId',
287
+ productShelfBuilderModalWindowBffClient: createProductShelfBuilderModalWindowBffClient(
288
+ apiMachineFetchFactory({
289
+ baseUrl: params.wysiwygBffProxyBaseUrl,
290
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
291
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
292
+ })
293
+ ),
294
+ productCategoryPickerModalWindowBffClient: createProductCategoryPickerModalWindowBffClient(
295
+ apiMachineFetchFactory({
296
+ baseUrl: params.wysiwygBffProxyBaseUrl,
297
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
298
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
299
+ })
300
+ ),
301
+ productPickerModalWindowBffClient: createProductPickerModalWindowBffClient(
302
+ apiMachineFetchFactory({
303
+ baseUrl: params.wysiwygBffProxyBaseUrl,
304
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
305
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
306
+ })
307
+ )
308
+ })
309
+ }),
310
+ initialEmailTemplate: JSON.parse(params.emailTemplateJson),
311
+ wysiwygTemplateEditorBffClient: wysiwygTemplateEditorBffClientFactory({
312
+ themeLibraryBffClient: createThemeLibraryBffClient(
313
+ apiMachineFetchFactory({
314
+ baseUrl: params.wysiwygBffProxyBaseUrl,
315
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
316
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
317
+ })
318
+ ),
319
+ componentLibraryBffClient: createComponentLibraryBffClient(
320
+ apiMachineFetchFactory({
321
+ baseUrl: params.wysiwygBffProxyBaseUrl,
322
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
323
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
324
+ })
325
+ )
326
+ }),
327
+ addThemeLibrarySectionItemModalWindowBffClient: createAddThemeLibrarySectionItemModalWindowBffClient(
328
+ apiMachineFetchFactory({
329
+ baseUrl: params.wysiwygBffProxyBaseUrl,
330
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
331
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
332
+ })
333
+ ),
334
+ addComponentLibrarySectionItemModalWindowBffClient: createAddComponentLibrarySectionItemModalWindowBffClient(
335
+ apiMachineFetchFactory({
336
+ baseUrl: params.wysiwygBffProxyBaseUrl,
337
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
338
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
339
+ })
340
+ ),
341
+ deleteThemeLibrarySectionItemModalWindowBffClient: createDeleteThemeLibrarySectionItemModalWindowBffClient(
342
+ apiMachineFetchFactory({
343
+ baseUrl: params.wysiwygBffProxyBaseUrl,
344
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
345
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
346
+ })
347
+ ),
348
+ deleteThemeLibrarySectionModalWindowBffClient: createDeleteThemeLibrarySectionModalWindowBffClient(
349
+ apiMachineFetchFactory({
350
+ baseUrl: params.wysiwygBffProxyBaseUrl,
351
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
352
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
353
+ })
354
+ ),
355
+ editThemeLibrarySectionItemModalWindowBffClient: createEditThemeLibrarySectionItemModalWindowBffClient(
356
+ apiMachineFetchFactory({
357
+ baseUrl: params.wysiwygBffProxyBaseUrl,
358
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
359
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
360
+ })
361
+ ),
362
+ createComponentLibrarySectionModalWindowBffClient: createAddComponentLibrarySectionModalWindowBffClient(
363
+ apiMachineFetchFactory({
364
+ baseUrl: params.wysiwygBffProxyBaseUrl,
365
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
366
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
367
+ })
368
+ ),
369
+ editComponentLibrarySectionItemModalWindowBffClient: createEditComponentLibrarySectionItemModalWindowBffClient(
370
+ apiMachineFetchFactory({
371
+ baseUrl: params.wysiwygBffProxyBaseUrl,
372
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
373
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
374
+ })
375
+ ),
376
+ deleteComponentLibrarySectionItemModalWindowBffClient: createDeleteComponentLibrarySectionItemModalWindowBffClient(
377
+ apiMachineFetchFactory({
378
+ baseUrl: params.wysiwygBffProxyBaseUrl,
379
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
380
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
381
+ })
382
+ ),
383
+ createThemeLibrarySectionModalWindowBffClient: createThemeLibrarySectionModalWindowBffClient(
384
+ apiMachineFetchFactory({
385
+ baseUrl: params.wysiwygBffProxyBaseUrl,
386
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
387
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
388
+ })
389
+ ),
390
+ deleteComponentLibrarySectionModalWindowBffClient: createDeleteComponentLibrarySectionModalWindowBffClient(
391
+ apiMachineFetchFactory({
392
+ baseUrl: params.wysiwygBffProxyBaseUrl,
393
+ antiForgeryTokenHeaderName: params.antiForgeryHeaderTokenName,
394
+ antiForgeryTokenValue: params.antiForgeryHeaderTokenValue
395
+ })
396
+ )
397
+ })
398
+ }
399
+ );
400
+
401
+ app.use(createVuetify({
402
+ theme: false,
403
+ directives: {
404
+ ClickOutside
405
+ }
406
+ }));
407
+
408
+ app.mount(appTagId);
@@ -0,0 +1,32 @@
1
+ import type {
2
+ ComponentLibrarySectionItem,
3
+ } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.componentlibrary/main';
4
+ import type {
5
+ CustomComponentSectionItemType
6
+ } from '@easy-wizzy/core';
7
+ import type {
8
+ AbandonedBasketListExpressionDataSource
9
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
10
+ import type {
11
+ AbandonedBasketNumberExpressionDataSource
12
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
13
+ import type {
14
+ AbandonedBasketStringExpressionDataSource
15
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
16
+ import {
17
+ abandonedBasketEmailComponentFactory
18
+ } from '@/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/abandonedBasketEmailComponentFactory';
19
+
20
+ export const abandonedBasketComponentSectionItemFactory = (
21
+ componentLibrarySectionItem: ComponentLibrarySectionItem,
22
+ ): CustomComponentSectionItemType<
23
+ AbandonedBasketListExpressionDataSource,
24
+ AbandonedBasketNumberExpressionDataSource,
25
+ AbandonedBasketStringExpressionDataSource
26
+ > => {
27
+ return {
28
+ sectionItemId: componentLibrarySectionItem.sectionItemId,
29
+ sectionItemName: componentLibrarySectionItem.sectionItemName,
30
+ componentTemplate: abandonedBasketEmailComponentFactory(componentLibrarySectionItem.component),
31
+ };
32
+ };
@@ -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
+ AbandonedBasketListExpressionDataSource
7
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
8
+ import type {
9
+ AbandonedBasketNumberExpressionDataSource
10
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
11
+ import type {
12
+ AbandonedBasketStringExpressionDataSource
13
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
14
+
15
+ export const abandonedBasketEmailComponentFactory = (
16
+ component: Component
17
+ ): EmailComponentType<
18
+ AbandonedBasketListExpressionDataSource,
19
+ AbandonedBasketNumberExpressionDataSource,
20
+ AbandonedBasketStringExpressionDataSource
21
+ > =>
22
+ {
23
+ return component.triggerAbandonedBasket
24
+ ? JSON.parse(component.triggerAbandonedBasket.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
+ AbandonedBasketListExpressionDataSource
9
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
10
+ import type {
11
+ AbandonedBasketNumberExpressionDataSource
12
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
13
+ import type {
14
+ AbandonedBasketStringExpressionDataSource
15
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
16
+ import {
17
+ abandonedBasketSectionFactory
18
+ } from '@/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CustomComponentLibrary/abandonedBasketSectionFactory';
19
+
20
+ export const abandonedBasketComponentLibraryFactory = (
21
+ componentLibrary: Array<ComponentLibrarySection>
22
+ ): CustomComponentLibraryType<
23
+ AbandonedBasketListExpressionDataSource,
24
+ AbandonedBasketNumberExpressionDataSource,
25
+ AbandonedBasketStringExpressionDataSource
26
+ > => {
27
+ return componentLibrary
28
+ .map(section => abandonedBasketSectionFactory(section))
29
+ }
@@ -0,0 +1,34 @@
1
+ import type {
2
+ ComponentLibrarySection,
3
+ } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.componentlibrary/main';
4
+ import type {
5
+ CustomComponentSectionType
6
+ } from '@easy-wizzy/core';
7
+ import type {
8
+ AbandonedBasketListExpressionDataSource
9
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
10
+ import type {
11
+ AbandonedBasketNumberExpressionDataSource
12
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
13
+ import type {
14
+ AbandonedBasketStringExpressionDataSource
15
+ } from '@easy-wizzy/retailrocket-abandoned-basket';
16
+ import {
17
+ abandonedBasketComponentSectionItemFactory
18
+ } from '@/implementation/Apps/components/WysiwygTemplateEditor/AsideMenu/ComponentLibrary/CreateComponentLibrarySectionModalWindow/abandonedBasketComponentSectionItemFactory';
19
+
20
+ export const abandonedBasketSectionFactory = (
21
+ section: ComponentLibrarySection,
22
+ ): CustomComponentSectionType<
23
+ AbandonedBasketListExpressionDataSource,
24
+ AbandonedBasketNumberExpressionDataSource,
25
+ AbandonedBasketStringExpressionDataSource
26
+ > => {
27
+ return {
28
+ sectionId: section.sectionId,
29
+ sectionName: section.sectionName,
30
+ componentList: section
31
+ .sectionItems
32
+ .map(component => abandonedBasketComponentSectionItemFactory(component)),
33
+ };
34
+ };
@@ -0,0 +1,132 @@
1
+ import type { DataListType } from '@easy-wizzy/core';
2
+ import type { ListExpressionDataSourceBffClient } from '@easy-wizzy/common-app';
3
+ import type { ListExpressionDataSourceEvaluatorDelegate } from '@easy-wizzy/core';
4
+ import { getPopularProducts } from '@easy-wizzy/common-app';
5
+ import { stockIdFactory } from '@easy-wizzy/common-app';
6
+ import type { AbandonedBasketListExpressionDataSource } from '@easy-wizzy/retailrocket-abandoned-basket';
7
+ import { abandonedBasketListExpressionDataSourceMatcher } from '@easy-wizzy/retailrocket-abandoned-basket';
8
+ import { getProductList } from '@easy-wizzy/common-app';
9
+ import { getRelatedProducts } from '@easy-wizzy/common-app';
10
+ import { getAlternativeProducts } from '@easy-wizzy/common-app';
11
+ import { getPopularProductsInCategories } from '@easy-wizzy/common-app';
12
+ import type { Product } from '@retailrocket/retailrocket.wysiwyg.bff.v2.apiclients.listexpressiondatasource';
13
+ import { getLatestProducts } from '@easy-wizzy/common-app';
14
+ import { getSaleByPopularProducts } from '@easy-wizzy/common-app';
15
+ import { getSaleByLatestProducts } from '@easy-wizzy/common-app';
16
+ import { getSampleProductsForPreview } from '@easy-wizzy/common-app';
17
+
18
+ export const abandonedBasketEvaluateListExpressionDataSourceFactory = (arg: {
19
+ partnerId: string;
20
+ listExpressionDataSourceBffClient: ListExpressionDataSourceBffClient;
21
+ customerStockId: string | undefined;
22
+ }): ListExpressionDataSourceEvaluatorDelegate<AbandonedBasketListExpressionDataSource> => {
23
+ let productCache: { [key: string]: Product } = {};
24
+
25
+ return (asyncDataSource: AbandonedBasketListExpressionDataSource) =>
26
+ abandonedBasketListExpressionDataSourceMatcher(asyncDataSource).Match<Promise<DataListType>>({
27
+ AbandonedBasketProductList: ({ StockSource }) =>
28
+ getSampleProductsForPreview({
29
+ partnerId: arg.partnerId,
30
+ stockId: stockIdFactory({
31
+ stockSource: StockSource,
32
+ customerStockId: arg.customerStockId,
33
+ }),
34
+ getSampleProductsForPreviewHttpClient: arg.listExpressionDataSourceBffClient.postGetSampleProductsForPreview,
35
+ }),
36
+ RelatedProductsForAbandonedBasketProductList: ({ StockSource }) =>
37
+ getSampleProductsForPreview({
38
+ partnerId: arg.partnerId,
39
+ stockId: stockIdFactory({
40
+ stockSource: StockSource,
41
+ customerStockId: arg.customerStockId,
42
+ }),
43
+ getSampleProductsForPreviewHttpClient: arg.listExpressionDataSourceBffClient.postGetSampleProductsForPreview,
44
+ }),
45
+ AlternativeProductsForAbandonedBasketProductList: ({ StockSource }) =>
46
+ getSampleProductsForPreview({
47
+ partnerId: arg.partnerId,
48
+ stockId: stockIdFactory({
49
+ stockSource: StockSource,
50
+ customerStockId: arg.customerStockId,
51
+ }),
52
+ getSampleProductsForPreviewHttpClient: arg.listExpressionDataSourceBffClient.postGetSampleProductsForPreview,
53
+ }),
54
+ ProductList: ({ ProductIds, StockSource }) =>
55
+ getProductList({
56
+ partnerId: arg.partnerId,
57
+ productIDs: ProductIds,
58
+ stockId: stockIdFactory({
59
+ stockSource: StockSource,
60
+ customerStockId: arg.customerStockId,
61
+ }),
62
+ productCache: productCache,
63
+ getProductsByIDsHttpClient: arg.listExpressionDataSourceBffClient.postGetProductsByIds,
64
+ }),
65
+ RelatedProductsFor: ({ ProductIds, StockSource }) =>
66
+ getRelatedProducts({
67
+ partnerId: arg.partnerId,
68
+ productIDs: ProductIds,
69
+ stockId: stockIdFactory({
70
+ stockSource: StockSource,
71
+ customerStockId: arg.customerStockId
72
+ }),
73
+ getRelatedProducts: arg.listExpressionDataSourceBffClient.postGetRelatedRecommendations,
74
+ }),
75
+ AlternativeProductsFor: ({ ProductIds, StockSource }) =>
76
+ getAlternativeProducts({
77
+ partnerId: arg.partnerId,
78
+ productIDs: ProductIds,
79
+ stockId: stockIdFactory({
80
+ stockSource: StockSource,
81
+ customerStockId: arg.customerStockId,
82
+ }),
83
+ getAlternativeProductsHttpClient: arg.listExpressionDataSourceBffClient.postGetAlternativeRecommendations,
84
+ }),
85
+ PopularProductsInCategories: ({ CategoryIds, StockSource }) =>
86
+ getPopularProductsInCategories({
87
+ partnerId: arg.partnerId,
88
+ categoryIds: CategoryIds,
89
+ stockId: stockIdFactory({
90
+ stockSource: StockSource,
91
+ customerStockId: arg.customerStockId,
92
+ }),
93
+ getPopularProductsInCategoriesHttpClient: arg.listExpressionDataSourceBffClient.postGetPopularInCategoriesRecommendations,
94
+ }),
95
+ Popular: ({ StockSource }) =>
96
+ getPopularProducts({
97
+ partnerId: arg.partnerId,
98
+ stockId: stockIdFactory({
99
+ stockSource: StockSource,
100
+ customerStockId: arg.customerStockId,
101
+ }),
102
+ getPopularProductsHttpClient: arg.listExpressionDataSourceBffClient.postGetPopularRecommendations,
103
+ }),
104
+ Latest: ({ StockSource }) =>
105
+ getLatestProducts({
106
+ partnerId: arg.partnerId,
107
+ stockId: stockIdFactory({
108
+ stockSource: StockSource,
109
+ customerStockId: arg.customerStockId,
110
+ }),
111
+ getLatestProductsHttpClient: arg.listExpressionDataSourceBffClient.postGetLatestRecommendations,
112
+ }),
113
+ SaleByPopular: ({ StockSource }) =>
114
+ getSaleByPopularProducts({
115
+ partnerId: arg.partnerId,
116
+ stockId: stockIdFactory({
117
+ stockSource: StockSource,
118
+ customerStockId: arg.customerStockId,
119
+ }),
120
+ getSaleByPopularProductsHttpClient: arg.listExpressionDataSourceBffClient.postGetSaleByPopularRecommendations,
121
+ }),
122
+ SaleByLatest: ({ StockSource }) =>
123
+ getSaleByLatestProducts({
124
+ partnerId: arg.partnerId,
125
+ stockId: stockIdFactory({
126
+ stockSource: StockSource,
127
+ customerStockId: arg.customerStockId,
128
+ }),
129
+ getSaleByLatestProductsHttpClient: arg.listExpressionDataSourceBffClient.postGetSaleByLatestRecommendations,
130
+ }),
131
+ });
132
+ };