@useinsider/guido 3.17.0-beta.668ca65 → 3.17.0-beta.a18fbda

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 (59) hide show
  1. package/README.md +5 -6
  2. package/dist/@types/config/schemas.js +6 -7
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +83 -83
  5. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  6. package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
  7. package/dist/composables/useActionsApi.js +82 -67
  8. package/dist/composables/useAutoSave.js +31 -26
  9. package/dist/composables/useCustomInterfaceAppearance.js +38 -52
  10. package/dist/composables/useEditorLock.js +20 -0
  11. package/dist/composables/useGuidoStateBridge.js +37 -31
  12. package/dist/composables/useRecommendation.js +34 -41
  13. package/dist/composables/useSave.js +39 -36
  14. package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
  15. package/dist/config/migrator/recommendationMigrator.js +4 -5
  16. package/dist/enums/academy.js +1 -2
  17. package/dist/enums/date.js +3 -5
  18. package/dist/enums/extensions/recommendationBlock.js +1 -3
  19. package/dist/extensions/Blocks/Recommendation/block.js +21 -26
  20. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -34
  21. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
  22. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +166 -162
  23. package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
  24. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +79 -165
  25. package/dist/extensions/Blocks/common-control.js +19 -22
  26. package/dist/guido.css +1 -1
  27. package/dist/services/recommendationApi.js +30 -69
  28. package/dist/src/@types/config/schemas.d.ts +0 -2
  29. package/dist/src/composables/useConfig.d.ts +0 -2
  30. package/dist/src/composables/useEditorLock.d.ts +10 -0
  31. package/dist/src/composables/useRecommendation.d.ts +0 -1
  32. package/dist/src/enums/academy.d.ts +0 -1
  33. package/dist/src/enums/date.d.ts +0 -1
  34. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
  35. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -2
  36. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  37. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +4 -10
  38. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -150
  39. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -1
  40. package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
  41. package/dist/src/services/recommendationApi.d.ts +1 -4
  42. package/dist/src/stores/config.d.ts +0 -18
  43. package/dist/src/stores/save-as-template.d.ts +3 -4
  44. package/dist/utils/dateUtil.js +10 -23
  45. package/dist/utils/templatePreparation.js +34 -35
  46. package/package.json +2 -3
  47. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -21
  48. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -105
  49. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +0 -19
  50. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +0 -62
  51. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -124
  52. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
  53. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +0 -15
  54. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -16
  55. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -2
  56. package/dist/static/assets/icons/line-change.svg.js +0 -5
  57. package/dist/static/assets/icons/line-delete.svg.js +0 -5
  58. package/dist/static/assets/icons/line-plus.svg.js +0 -5
  59. package/dist/static/styles/components/recommendation-strategy.css.js +0 -155
@@ -1,124 +0,0 @@
1
- var d = Object.defineProperty;
2
- var y = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
- var o = (r, s, t) => y(r, typeof s != "symbol" ? s + "" : s, t);
4
- import { ACADEMY_LINKS as m } from "../../../../../enums/academy.js";
5
- import { CommonControl as h } from "../../../common-control.js";
6
- import { useRecommendationExtensionStore as u } from "../../store/recommendation.js";
7
- const p = "recommendation-strategy-control";
8
- class f extends h {
9
- constructor() {
10
- super(...arguments);
11
- o(this, "store", u());
12
- o(this, "storeUnsubscription", () => {
13
- });
14
- o(this, "listeners", []);
15
- o(this, "lastPaintedState", null);
16
- }
17
- getId() {
18
- return p;
19
- }
20
- getTemplate() {
21
- const t = this.api.translate(
22
- "You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
23
- ), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
24
- return `
25
- <div class="strategy-control-container">
26
- <div class="strategy-control-header">
27
- <h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
28
- </div>
29
- <div class="strategy-control-description-row">
30
- <p class="strategy-control-description">
31
- ${t}
32
- ${e}
33
- <a
34
- href="${m.EMAIL_RECOMMENDATION_BLOCK}"
35
- target="_blank"
36
- rel="noopener noreferrer">${a}</a>.
37
- </p>
38
- </div>
39
- <div data-strategy-empty-state>
40
- ${this._GuTwoColumns([
41
- this._GuButton({
42
- name: "assignStrategy",
43
- label: this.api.translate("Assign Strategy"),
44
- id: "guido__btn-assign-strategy",
45
- className: "strategy-control-cta on"
46
- }),
47
- this._GuButton({
48
- name: "createStrategy",
49
- label: this.api.translate("Create New Strategy"),
50
- id: "guido__btn-create-strategy",
51
- className: "strategy-control-cta primary",
52
- disabled: !0
53
- })
54
- ], "strategy-control-cta-row")}
55
- </div>
56
- <div data-strategy-assigned-state style="display: none;">
57
- <div class="strategy-control-name-band">
58
- <span class="strategy-control-name" data-strategy-name></span>
59
- </div>
60
- <div class="strategy-control-actions">
61
- ${this._strategyAction({
62
- id: "guido__btn-change-strategy",
63
- label: this.api.translate("Change"),
64
- modifier: "change"
65
- })}
66
- ${this._strategyAction({
67
- id: "guido__btn-remove-strategy",
68
- label: this.api.translate("Remove"),
69
- modifier: "remove"
70
- })}
71
- </div>
72
- </div>
73
- </div>
74
- `;
75
- }
76
- _strategyAction({ id: t, label: e, modifier: a }) {
77
- return `
78
- <button
79
- id="${t}"
80
- type="button"
81
- class="strategy-control-action strategy-control-action--${a}">
82
- <span>${e}</span>
83
- </button>
84
- `;
85
- }
86
- onRender() {
87
- this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
88
- this._renderState();
89
- }), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
90
- });
91
- }
92
- onDestroy() {
93
- this._teardown();
94
- }
95
- _teardown() {
96
- this.storeUnsubscription(), this.storeUnsubscription = () => {
97
- }, this.lastPaintedState = null, this.listeners.forEach(({ element: t, handler: e }) => t.removeEventListener("click", e)), this.listeners = [];
98
- }
99
- _setupButtonListeners() {
100
- const t = this.getContainer();
101
- if (!t)
102
- return;
103
- const e = (a, n) => {
104
- const i = t.querySelector(a);
105
- i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
106
- };
107
- e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.removeStrategy());
108
- }
109
- _renderState() {
110
- var l;
111
- const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((l = this.store.assignedStrategy) == null ? void 0 : l.name) ?? "" : "", a = `${t}\0${e}`;
112
- if (a === this.lastPaintedState)
113
- return;
114
- const n = this.getContainer();
115
- if (!n)
116
- return;
117
- const i = n.querySelector("[data-strategy-empty-state]"), c = n.querySelector("[data-strategy-assigned-state]"), g = n.querySelector("[data-strategy-name]");
118
- !i || !c || (i.style.display = t ? "none" : "", c.style.display = t ? "" : "none", g && t && (g.textContent = e || `#${t}`), this.lastPaintedState = a);
119
- }
120
- }
121
- export {
122
- p as STRATEGY_CONTROL_ID,
123
- f as StrategyControl
124
- };
@@ -1,3 +0,0 @@
1
- import '@useinsider/design-system-organisms/style';
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
- export default _default;
@@ -1,15 +0,0 @@
1
- import type { RrsStrategy } from '@@/Types/recommendation';
2
- type __VLS_Props = {
3
- strategy: RrsStrategy;
4
- };
5
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
6
- export default _default;
7
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
8
- type __VLS_TypePropsToOption<T> = {
9
- [K in keyof T]-?: {} extends Pick<T, K> ? {
10
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
11
- } : {
12
- type: import('vue').PropType<T[K]>;
13
- required: true;
14
- };
15
- };
@@ -1,16 +0,0 @@
1
- import { CommonControl } from '../../../common-control';
2
- export declare const STRATEGY_CONTROL_ID = "recommendation-strategy-control";
3
- export declare class StrategyControl extends CommonControl {
4
- private store;
5
- private storeUnsubscription;
6
- private listeners;
7
- private lastPaintedState;
8
- getId(): string;
9
- getTemplate(): string;
10
- private _strategyAction;
11
- onRender(): void;
12
- onDestroy(): void;
13
- private _teardown;
14
- private _setupButtonListeners;
15
- private _renderState;
16
- }
@@ -1,2 +0,0 @@
1
- declare const _default: import("msw").HttpHandler[];
2
- export default _default;
@@ -1,5 +0,0 @@
1
- const l = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.768 11.694a1.03 1.03 0 0 1-1.465 0 1.051 1.051 0 0 1 0-1.478L17.51 9H9a1 1 0 1 1 0-2h8.509l-1.206-1.216a1.051 1.051 0 0 1 0-1.478 1.03 1.03 0 0 1 1.465 0l2.929 2.955c.404.408.404 1.07 0 1.478l-2.93 2.955zM3.303 15.261a1.051 1.051 0 0 0 0 1.478l2.93 2.955a1.03 1.03 0 0 0 1.464 0 1.051 1.051 0 0 0 0-1.478L6.49 17H15a1 1 0 1 0 0-2H6.491l1.206-1.216a1.051 1.051 0 0 0 0-1.478 1.03 1.03 0 0 0-1.465 0l-2.929 2.955z"/></svg>
2
- `;
3
- export {
4
- l as default
5
- };
@@ -1,5 +0,0 @@
1
- const a = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 3a2 2 0 0 0-2 2v2H5a1 1 0 0 0 0 2h1v10a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9h1a1 1 0 1 0 0-2h-3V5a2 2 0 0 0-2-2h-4zm4 4h-4V5h4v2zm-4 2h6v10H8V9h2zm2 2a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1z"></path></svg>
2
- `;
3
- export {
4
- a as default
5
- };
@@ -1,5 +0,0 @@
1
- const a = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 5a1 1 0 0 0-1 1v5H6a1 1 0 1 0 0 2h5v5a1 1 0 1 0 2 0v-5h5a1 1 0 1 0 0-2h-5V6a1 1 0 0 0-1-1z"></path></svg>
2
- `;
3
- export {
4
- a as default
5
- };
@@ -1,155 +0,0 @@
1
- const n = `.strategy-control-header {
2
- padding: 16px 16px 0;
3
- }
4
-
5
- .strategy-control-title {
6
- margin: 0;
7
- color: var(--guido-color-gray-800);
8
- font-size: 16px;
9
- font-weight: 600;
10
- line-height: 24px;
11
- }
12
-
13
- .strategy-control-description-row {
14
- padding: 8px 16px 16px;
15
- }
16
-
17
- .strategy-control-description {
18
- margin: 0;
19
- color: var(--guido-color-gray-600);
20
- font-size: 13px;
21
- line-height: 16px;
22
- }
23
-
24
- .strategy-control-description a {
25
- color: var(--guido-color-primary-500);
26
- text-decoration: underline;
27
- }
28
-
29
- .recommendation-controls-container .container.strategy-control-cta-row {
30
- grid-template-columns: repeat(2, minmax(0, 180px));
31
- justify-content: start;
32
- gap: 16px;
33
- padding: 0 16px 16px;
34
- }
35
-
36
- .strategy-control-cta {
37
- width: 100%;
38
- }
39
-
40
- .strategy-control-cta > .button {
41
- display: flex;
42
- gap: 8px;
43
- justify-content: center;
44
- width: 100%;
45
- border: none;
46
- font-size: 15px;
47
- font-weight: 400;
48
- line-height: 24px;
49
- white-space: nowrap;
50
- }
51
-
52
- .strategy-control-cta.primary > .button:disabled,
53
- .strategy-control-cta.primary > .button.disabled {
54
- opacity: 1;
55
- color: var(--guido-color-gray-800);
56
- cursor: default;
57
- }
58
-
59
- .strategy-control-name-band {
60
- display: flex;
61
- align-items: center;
62
- min-height: 48px;
63
- padding: 0 16px;
64
- background-color: var(--guido-color-gray-0);
65
- }
66
-
67
- .strategy-control-name {
68
- color: var(--guido-color-gray-800);
69
- font-size: 15px;
70
- font-weight: 600;
71
- line-height: 24px;
72
- }
73
-
74
- .strategy-control-actions {
75
- display: flex;
76
- align-items: center;
77
- padding: 16px;
78
- }
79
-
80
- .strategy-control-action {
81
- display: inline-flex;
82
- align-items: center;
83
- padding: 0;
84
- border: none;
85
- background: none;
86
- font-size: 15px;
87
- font-weight: 400;
88
- line-height: 24px;
89
- cursor: pointer;
90
- }
91
-
92
- .strategy-control-action > span {
93
- padding: 0 8px;
94
- }
95
-
96
- .strategy-control-action::before,
97
- .strategy-control-cta.on > .button::before {
98
- content: '';
99
- flex: none;
100
- width: 24px;
101
- height: 24px;
102
- background-color: currentcolor;
103
- mask-repeat: no-repeat;
104
- mask-position: center;
105
- mask-size: 24px 24px;
106
- }
107
-
108
- .strategy-control-action--change::before {
109
- mask-image: var(--guido-icon-line-change);
110
- }
111
-
112
- .strategy-control-action--remove::before {
113
- mask-image: var(--guido-icon-line-delete);
114
- }
115
-
116
- .strategy-control-cta.on > .button::before {
117
- mask-image: var(--guido-icon-line-plus);
118
- }
119
-
120
- .strategy-control-action--change {
121
- color: var(--guido-color-primary-500);
122
- }
123
-
124
- .strategy-control-action--remove {
125
- color: var(--guido-color-danger-500);
126
- }
127
-
128
- .strategy-control-action:hover {
129
- text-decoration: underline;
130
- }
131
-
132
- .recommendation-controls-container:not(.strategy-block) .strategy-control-container,
133
- .recommendation-controls-container.strategy-block .product-count-control-container,
134
- .recommendation-controls-container.strategy-block .algorithm-control-container,
135
- .recommendation-controls-container.strategy-block .filters-control-container,
136
- .recommendation-controls-container.strategy-block .shuffle-control-container {
137
- display: none;
138
- }
139
-
140
- .recommendation-controls-container.strategy-block {
141
- display: flex;
142
- flex-direction: column;
143
- }
144
-
145
- .recommendation-controls-container.strategy-block .price-placement-control-container {
146
- order: 1;
147
- }
148
-
149
- .recommendation-controls-container.strategy-block .product-layout-control-container {
150
- order: 2;
151
- }
152
- `;
153
- export {
154
- n as default
155
- };