@useinsider/guido 3.12.0-beta.975e966 → 3.12.0-beta.aa6f9ba
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/dist/@types/config/schemas.js +13 -8
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +50 -49
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.js +36 -0
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue2.js +244 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue2.js +42 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue2.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue2.js +60 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue2.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.js +22 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue2.js +29 -0
- package/dist/components/organisms/header/ViewOptions.vue.js +3 -3
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
- package/dist/composables/useRecommendation.js +82 -51
- package/dist/composables/useStrategyFilters.js +16 -0
- package/dist/config/migrator/recommendationMigrator.js +7 -4
- package/dist/enums/date.js +4 -3
- package/dist/enums/extensions/filteringV2.js +8 -0
- package/dist/enums/extensions/recommendationBlock.js +28 -22
- package/dist/enums/extensions/strategyDetail.js +148 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +12 -11
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +123 -109
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +146 -0
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +1 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +256 -102
- package/dist/extensions/Blocks/Recommendation/utils/strategyHumanizer.js +97 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategySummary.js +10 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +24 -12
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +72 -29
- package/dist/src/@types/config/schemas.d.ts +10 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.d.ts +43 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.d.ts +29 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.d.ts +40 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.d.ts +38 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.d.ts +51 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useRecommendation.d.ts +2 -0
- package/dist/src/composables/useStrategyFilters.d.ts +24 -0
- package/dist/src/enums/extensions/filteringV2.d.ts +72 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +10 -0
- package/dist/src/enums/extensions/strategyDetail.d.ts +90 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +61 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +606 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyHumanizer.d.ts +50 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategySummary.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +3 -1
- package/dist/src/services/recommendationApi.d.ts +7 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/utils/genericUtil.d.ts +9 -0
- package/dist/static/styles/base.css.js +15 -0
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +10 -1
- package/dist/utils/templatePreparation.js +62 -58
- package/package.json +2 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filtering enums for Reusable Recommendation Strategies (RRS).
|
|
3
|
+
*
|
|
4
|
+
* Ported verbatim from discovery-strategies-fe `src/enums/FilteringEnumsV2.js`
|
|
5
|
+
* (branch `develop`). Only the subset the strategy info-box / humanizer needs is
|
|
6
|
+
* carried over: `Operators`, `OperatorAbbreviations`, `DataTypes`,
|
|
7
|
+
* `MultiSelectDataTypes`, `OperatorNames`, `TimeAbbreviations`.
|
|
8
|
+
*
|
|
9
|
+
* Guido has no equivalent — `utils/filterUtil.ts` and `validation/filterSchema.ts`
|
|
10
|
+
* serve the recommendation block's filters, which are a different shape from a
|
|
11
|
+
* strategy's filters. Do not merge the two.
|
|
12
|
+
*
|
|
13
|
+
* The `text` values are translation keys, not literals; resolve them through
|
|
14
|
+
* `useTranslations().trans()`.
|
|
15
|
+
*
|
|
16
|
+
* ponytail: kept as a literal copy rather than a re-derivation so it stays easy
|
|
17
|
+
* to diff against the source when Smart Recommender adds an operator.
|
|
18
|
+
*/
|
|
19
|
+
/** A single operator option, keyed under its attribute data type. */
|
|
20
|
+
export interface OperatorDefinition {
|
|
21
|
+
value: string;
|
|
22
|
+
text: string;
|
|
23
|
+
operator: string;
|
|
24
|
+
/** Alternative label used when the strategy targets the cart page. */
|
|
25
|
+
cartPageText?: string;
|
|
26
|
+
/** Absent on the `Object` data type in the source. */
|
|
27
|
+
filterType?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const Operators: Record<string, OperatorDefinition[]>;
|
|
30
|
+
export declare const TimeAbbreviations: {
|
|
31
|
+
readonly WEEK: "w";
|
|
32
|
+
readonly DAY: "d";
|
|
33
|
+
readonly HOUR: "h";
|
|
34
|
+
};
|
|
35
|
+
export declare const OperatorAbbreviations: {
|
|
36
|
+
readonly OPERATOR: {
|
|
37
|
+
readonly IN_LAST: "in-last";
|
|
38
|
+
readonly IS_EMPTY: "is-empty";
|
|
39
|
+
readonly IS_NOT_EMPTY: "is-not-empty";
|
|
40
|
+
readonly IN_BETWEEN: "is-between";
|
|
41
|
+
readonly IS_TRUE: "true";
|
|
42
|
+
readonly IS_FALSE: "false";
|
|
43
|
+
};
|
|
44
|
+
readonly OPERATOR_EXPRESSION: {
|
|
45
|
+
readonly IS_EMPTY: "?";
|
|
46
|
+
readonly IS_NOT_EMPTY: "!?";
|
|
47
|
+
};
|
|
48
|
+
readonly DATE_PICKER_OPERATORS: readonly ["after", "before", "is", "is-not"];
|
|
49
|
+
readonly NON_INPUT_OPERATORS: readonly ["in", "not-in", "after", "before", "is", "is-not", "is-empty", "is-not-empty"];
|
|
50
|
+
readonly CHIPS_WIDGET_OPERATORS: readonly ["in", "not-in"];
|
|
51
|
+
};
|
|
52
|
+
export declare const DataTypes: {
|
|
53
|
+
readonly STRING: "String";
|
|
54
|
+
readonly BOOLEAN: "Boolean";
|
|
55
|
+
readonly DATE: "Date";
|
|
56
|
+
readonly NUMBER: "Number";
|
|
57
|
+
readonly TEXT: "Text";
|
|
58
|
+
readonly URL: "Image";
|
|
59
|
+
readonly NUMBERS: "Numbers";
|
|
60
|
+
readonly DATES: "Dates";
|
|
61
|
+
readonly BOOLEANS: "Booleans";
|
|
62
|
+
readonly STRINGS: "Strings";
|
|
63
|
+
};
|
|
64
|
+
export declare const MultiSelectDataTypes: readonly ["Strings", "String", "Array"];
|
|
65
|
+
export declare const OperatorNames: {
|
|
66
|
+
readonly IS_EXACTLY: "is-exactly";
|
|
67
|
+
readonly IS_NOT_EXACTLY: "is-not-exactly";
|
|
68
|
+
readonly CONTAINS: "contains";
|
|
69
|
+
readonly NOT_CONTAINS: "does-not-contain";
|
|
70
|
+
readonly IN: "in";
|
|
71
|
+
readonly NOT_IN: "not-in";
|
|
72
|
+
};
|
|
@@ -3,10 +3,20 @@ import type { RecommendationFeedItem } from '@@/Types/recommendation';
|
|
|
3
3
|
export declare const URLS: {
|
|
4
4
|
RECOMMENDATION_API_URL: string;
|
|
5
5
|
PRODUCT_ATTRIBUTES_PATH: string;
|
|
6
|
+
RECOMMENDATION_STRATEGIES_PATH: string;
|
|
7
|
+
STRATEGY_RECOMMENDATION_URL_PATH: string;
|
|
6
8
|
};
|
|
7
9
|
export declare const QUERY_PARAMS: {
|
|
8
10
|
CLIENT_ID: string;
|
|
11
|
+
STRATEGY_ID: string;
|
|
12
|
+
FILTERS: string;
|
|
9
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Smart Recommender's filter grammar: `[table.field][operator][value]`, ANDed with `*`.
|
|
16
|
+
* `~` means "contains" — required because `suitable_channels` is a comma-separated
|
|
17
|
+
* column, so `=` would only ever match single-channel strategies.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RRS_EMAIL_ACTIVE_FILTER = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]";
|
|
10
20
|
/**
|
|
11
21
|
* Get recommendation feed source maps lazily so translated names resolve at access time.
|
|
12
22
|
* Must be called within a Vue component context or after Pinia is initialized.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enums for the Reusable Recommendation Strategy (RRS) detail drawer.
|
|
3
|
+
*
|
|
4
|
+
* Ported from design-system-organisms
|
|
5
|
+
* `src/organisms/OrgStrategyDetailModal/enums/details-modal.enum.ts` (branch `develop`).
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT — this is NOT the same operator table as `@@/Enums/extensions/filteringV2`.
|
|
8
|
+
* The detail modal carries its own, deliberately: it uses different operator values
|
|
9
|
+
* (a `-page-context` suffix where FilteringEnumsV2 uses `_dynamic`) and a different
|
|
10
|
+
* label per operator. The two tables humanize the same JSON for different surfaces —
|
|
11
|
+
* filteringV2 backs the four-row panel summary, this one backs the drawer's filter
|
|
12
|
+
* humanizer. Do not merge them or the drawer starts rendering the wrong operator names.
|
|
13
|
+
*
|
|
14
|
+
* One deliberate deviation from the source: the source resolves `translations[...]` at
|
|
15
|
+
* module-evaluation time. Guido loads translations from editor config after module init,
|
|
16
|
+
* so every `text` here stays a translation KEY and is resolved at render through
|
|
17
|
+
* `useTranslations()`. Resolving eagerly would freeze every label to `undefined`.
|
|
18
|
+
*/
|
|
19
|
+
/** Discriminates a duration-based exclusion from a count-based one. */
|
|
20
|
+
export declare const TIME = "TIME";
|
|
21
|
+
export declare const COUNT = "COUNT";
|
|
22
|
+
export declare const OperatorAbbreviations: {
|
|
23
|
+
readonly OPERATOR: {
|
|
24
|
+
readonly IN_LAST: "in-last";
|
|
25
|
+
readonly IS_EMPTY: "is-empty";
|
|
26
|
+
readonly IS_NOT_EMPTY: "is-not-empty";
|
|
27
|
+
readonly IN_BETWEEN: "is-between";
|
|
28
|
+
readonly IS_TRUE: "true";
|
|
29
|
+
readonly IS_FALSE: "false";
|
|
30
|
+
readonly IN: "in";
|
|
31
|
+
readonly NOT_IN: "not-in";
|
|
32
|
+
};
|
|
33
|
+
readonly OPERATOR_EXPRESSION: {
|
|
34
|
+
readonly IS_EMPTY: "?";
|
|
35
|
+
readonly IS_NOT_EMPTY: "!?";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/** One operator option; `text` is a translation key, not a label. */
|
|
39
|
+
export interface DetailOperator {
|
|
40
|
+
value: string;
|
|
41
|
+
text: string;
|
|
42
|
+
operator: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const Operators: Record<string, DetailOperator[]>;
|
|
45
|
+
export declare const DataTypes: {
|
|
46
|
+
readonly STRING: "String";
|
|
47
|
+
readonly BOOLEAN: "Boolean";
|
|
48
|
+
readonly DATE: "Date";
|
|
49
|
+
readonly NUMBER: "Number";
|
|
50
|
+
readonly TEXT: "Text";
|
|
51
|
+
readonly URL: "Image";
|
|
52
|
+
readonly NUMBERS: "Numbers";
|
|
53
|
+
readonly DATES: "Dates";
|
|
54
|
+
readonly BOOLEANS: "Booleans";
|
|
55
|
+
readonly STRINGS: "Strings";
|
|
56
|
+
};
|
|
57
|
+
export declare const MultiSelectDataTypes: string[];
|
|
58
|
+
export declare const OperatorNames: {
|
|
59
|
+
readonly IS_EXACTLY: "is-exactly";
|
|
60
|
+
readonly IS_NOT_EXACTLY: "is-not-exactly";
|
|
61
|
+
readonly CONTAINS: "contains";
|
|
62
|
+
readonly NOT_CONTAINS: "does-not-contain";
|
|
63
|
+
readonly IN: "in";
|
|
64
|
+
readonly NOT_IN: "not-in";
|
|
65
|
+
};
|
|
66
|
+
export declare const FilterTypeNames: {
|
|
67
|
+
readonly STANDARD_FILTER: "standardFilter";
|
|
68
|
+
readonly DYNAMIC_FILTER: "dynamicFilter";
|
|
69
|
+
readonly USER_CONTEXT_FILTER: "userContextFilter";
|
|
70
|
+
readonly USER_ATTRIBUTE_FILTER: "userAttributeFilter";
|
|
71
|
+
readonly USER_EVENT_FILTER: "userEventFilter";
|
|
72
|
+
readonly EVENT_BASED_FILTER: "eventBasedFilter";
|
|
73
|
+
};
|
|
74
|
+
export declare const UserEventKeys: {
|
|
75
|
+
readonly CURRENTLY_VIEWED_ITEM: "page";
|
|
76
|
+
readonly LEGACY_CURRENTLY_VIEWED_ITEM: "currentlyViewedItem";
|
|
77
|
+
};
|
|
78
|
+
/** `text` is a translation key, resolved at render. */
|
|
79
|
+
export declare const UserEvents: {
|
|
80
|
+
value: string;
|
|
81
|
+
text: string;
|
|
82
|
+
}[];
|
|
83
|
+
/** Channel value that must render as the email product's own label. */
|
|
84
|
+
export declare const EMAIL_CHANNEL = "email";
|
|
85
|
+
export declare const PageTypeTranslationKeys: Record<string, string>;
|
|
86
|
+
/** Drawer tab identifiers. */
|
|
87
|
+
export declare const DetailTabs: {
|
|
88
|
+
readonly GENERAL: "general";
|
|
89
|
+
readonly OTHER: "other";
|
|
90
|
+
};
|
|
@@ -9,8 +9,9 @@ import { PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID } from './pricePlacem
|
|
|
9
9
|
import { ProductCountControl, PRODUCT_COUNT_CONTROL_ID } from './productCount';
|
|
10
10
|
import { ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID } from './productLayout';
|
|
11
11
|
import { ShuffleControl, SHUFFLE_CONTROL_ID } from './shuffle';
|
|
12
|
+
import { StrategyControl, STRATEGY_CONTROL_ID } from './strategy';
|
|
12
13
|
export declare const CONTROL_BLOCK_ID = "ui-elements-recommendation-block";
|
|
13
|
-
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, };
|
|
14
|
+
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, StrategyControl, STRATEGY_CONTROL_ID, };
|
|
14
15
|
export * from './utils';
|
|
15
16
|
/**
|
|
16
17
|
* Main recommendation block control that composes all sub-controls
|
|
@@ -21,6 +22,7 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
21
22
|
private storeUnsubscription;
|
|
22
23
|
private syncedBlockIds;
|
|
23
24
|
private algorithmControl;
|
|
25
|
+
private strategyControl;
|
|
24
26
|
private localeControl;
|
|
25
27
|
private currencyControl;
|
|
26
28
|
private productCountControl;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable Recommendation Strategy (RRS) Selection Control
|
|
3
|
+
*
|
|
4
|
+
* Lets the marketer pick a named strategy defined in Smart Recommender instead
|
|
5
|
+
* of configuring an algorithm per block. The selected strategy id is stored in
|
|
6
|
+
* node config (persists with the template) and decides the block's
|
|
7
|
+
* recommendation URL at compile time.
|
|
8
|
+
*
|
|
9
|
+
* Rendered only when the `reusableRecommendationStrategy` feature is enabled;
|
|
10
|
+
* otherwise the block keeps using AlgorithmControl.
|
|
11
|
+
*
|
|
12
|
+
* Beside the dropdown sits an icon button that opens the strategy detail drawer.
|
|
13
|
+
* The RRS listing page shows these details in an `InSelect` hover card, which
|
|
14
|
+
* cannot be reproduced here — `_GuSelect` has no `infoBoxProps` equivalent — so
|
|
15
|
+
* the details move out of the 425px panel and over the editor instead.
|
|
16
|
+
*
|
|
17
|
+
* ponytail: selecting a strategy only drives the URL — Number of Products,
|
|
18
|
+
* Locale, Currency and Filters stay independently editable in the panel. The
|
|
19
|
+
* product decision on which of those become strategy-owned is still open
|
|
20
|
+
* (see the Figma "which settings stay in the editor" note), so nothing is
|
|
21
|
+
* locked or overwritten here. Add that only once the decision lands.
|
|
22
|
+
*/
|
|
23
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
24
|
+
import { CommonControl } from '../../../common-control';
|
|
25
|
+
export declare const STRATEGY_CONTROL_ID = "recommendation-strategy-control";
|
|
26
|
+
/**
|
|
27
|
+
* Control for selecting a Reusable Recommendation Strategy
|
|
28
|
+
*/
|
|
29
|
+
export declare class StrategyControl extends CommonControl {
|
|
30
|
+
private store;
|
|
31
|
+
private detailsListener;
|
|
32
|
+
private detailsButton;
|
|
33
|
+
getId(): string;
|
|
34
|
+
getTemplate(): string;
|
|
35
|
+
onRender(): void;
|
|
36
|
+
onDestroy(): void;
|
|
37
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
38
|
+
_setFormValues(): void;
|
|
39
|
+
_initializeSelectItems(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Reconciles the panel with the strategy listing: loading, empty, and
|
|
42
|
+
* deleted-strategy states.
|
|
43
|
+
*
|
|
44
|
+
* A strategy the partner deleted in Smart Recommender still lives in this
|
|
45
|
+
* block's saved config. The id is deliberately left in place and surfaced
|
|
46
|
+
* instead of being cleared — silently dropping it would make a template that
|
|
47
|
+
* compiles a broken feed URL look correctly configured.
|
|
48
|
+
*
|
|
49
|
+
* ponytail: one message element, three texts. Severity styling (warning vs
|
|
50
|
+
* info) is not drawn in Figma and pending design sign-off — see open question
|
|
51
|
+
* 4 in the handoff. Vary `type` once that lands.
|
|
52
|
+
*/
|
|
53
|
+
_refreshSelectionState(): void;
|
|
54
|
+
_setDisabled(element: string, disabled: boolean): void;
|
|
55
|
+
_showMessage(text: string): void;
|
|
56
|
+
_hideMessage(): void;
|
|
57
|
+
_onDetailsClick(): void;
|
|
58
|
+
_setupDetailsButtonListener(): void;
|
|
59
|
+
_onStrategyChange(value: string): void;
|
|
60
|
+
_listenToFormUpdates(): void;
|
|
61
|
+
}
|