@useinsider/guido 3.23.0-beta.86bed27 → 3.23.0-beta.95eb6bb

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 (111) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +41 -39
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/components/Guido.vue.js +6 -6
  5. package/dist/components/Guido.vue2.js +84 -82
  6. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +20 -0
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +30 -0
  8. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +71 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +34 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +57 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  14. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +11 -11
  15. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  16. package/dist/composables/useBlocksConfig.js +32 -24
  17. package/dist/composables/useDisplayConditions.js +109 -0
  18. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  19. package/dist/config/compiler/utils/recommendationCompilerUtils.js +78 -75
  20. package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
  21. package/dist/config/migrator/recommendation/extractors.js +100 -40
  22. package/dist/config/migrator/recommendation/htmlBuilder.js +285 -207
  23. package/dist/config/migrator/recommendation/settingsMapper.js +37 -36
  24. package/dist/config/migrator/recommendation/themeMapper.js +53 -41
  25. package/dist/config/migrator/recommendationMigrator.js +68 -61
  26. package/dist/enums/academy.js +1 -0
  27. package/dist/enums/display-condition.js +12 -0
  28. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -17
  29. package/dist/extensions/Blocks/Items/controls/cardComposition.js +14 -17
  30. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -17
  31. package/dist/extensions/Blocks/Items/controls/name/trimming.js +9 -10
  32. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
  33. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -13
  34. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +29 -30
  35. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -16
  36. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +25 -26
  37. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +27 -28
  38. package/dist/extensions/Blocks/Items/controls/settingsControl.js +75 -80
  39. package/dist/extensions/Blocks/Recommendation/block.js +33 -24
  40. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  41. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +27 -26
  42. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  43. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +165 -175
  44. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  45. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  46. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  47. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  48. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  49. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  50. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
  51. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
  52. package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
  53. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
  54. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +3 -2
  55. package/dist/extensions/Blocks/common-control.js +62 -55
  56. package/dist/extensions/DisplayConditions/bridge.js +18 -0
  57. package/dist/extensions/DisplayConditions/constants.js +17 -0
  58. package/dist/extensions/DisplayConditions/control.js +182 -0
  59. package/dist/extensions/DisplayConditions/display-conditions.css.js +201 -0
  60. package/dist/extensions/DisplayConditions/extension.js +28 -0
  61. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  62. package/dist/extensions/DisplayConditions/library.js +27 -0
  63. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  64. package/dist/guido.css +1 -1
  65. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  66. package/dist/node_modules/valibot/dist/index.js +297 -261
  67. package/dist/package.json.js +1 -1
  68. package/dist/services/displayConditionApi.js +39 -0
  69. package/dist/src/@types/config/schemas.d.ts +4 -0
  70. package/dist/src/@types/display-condition.d.ts +60 -0
  71. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  72. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
  73. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  74. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  75. package/dist/src/composables/useConfig.d.ts +2 -0
  76. package/dist/src/composables/useDisplayConditions.d.ts +16 -0
  77. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
  78. package/dist/src/config/migrator/recommendation/extractors.d.ts +35 -6
  79. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +3 -1
  80. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +3 -1
  81. package/dist/src/config/migrator/recommendation/types.d.ts +11 -1
  82. package/dist/src/enums/academy.d.ts +1 -0
  83. package/dist/src/enums/display-condition.d.ts +15 -0
  84. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -1
  85. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  86. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -10
  87. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
  88. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
  89. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -19
  90. package/dist/src/extensions/Blocks/common-control.d.ts +2 -0
  91. package/dist/src/extensions/DisplayConditions/bridge.d.ts +6 -0
  92. package/dist/src/extensions/DisplayConditions/constants.d.ts +14 -0
  93. package/dist/src/extensions/DisplayConditions/control.d.ts +23 -0
  94. package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
  95. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
  96. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  97. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  98. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  99. package/dist/src/services/displayConditionApi.d.ts +8 -0
  100. package/dist/src/stores/config.d.ts +166 -0
  101. package/dist/src/stores/display-condition.d.ts +84 -0
  102. package/dist/src/stores/unsubscribe.d.ts +10 -0
  103. package/dist/src/utils/displayCondition.d.ts +10 -0
  104. package/dist/src/utils/protectTableText.d.ts +2 -0
  105. package/dist/stores/config.js +13 -6
  106. package/dist/stores/display-condition.js +29 -0
  107. package/dist/stores/unsubscribe.js +33 -29
  108. package/dist/utils/displayCondition.js +26 -0
  109. package/dist/utils/pairProductVariables.js +30 -29
  110. package/dist/utils/protectTableText.js +22 -0
  111. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- const o = "3.23.0-beta.86bed27", s = { stripo: { version: "2.81.1" } }, e = {
1
+ const o = "3.23.0-beta.95eb6bb", s = { stripo: { version: "2.81.1" } }, e = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
@@ -0,0 +1,39 @@
1
+ import { useHttp as p } from "../composables/useHttp.js";
2
+ import { SavedDisplayConditionSchema as y, DisplayConditionListResponseSchema as S } from "../@types/display-condition.js";
3
+ import { parse as r } from "../node_modules/valibot/dist/index.js";
4
+ const s = "/email-proxy/v1/display-conditions", u = 100, P = () => {
5
+ const { get: c, post: m, delete: l } = p(), i = async (t, e) => {
6
+ const o = new URLSearchParams({
7
+ page: String(e),
8
+ limit: String(u),
9
+ sortColumn: "id",
10
+ sortDirection: "desc",
11
+ "filter[syntax]": t
12
+ }), { data: n } = await c(`${s}?${o.toString()}`);
13
+ return r(S, n);
14
+ };
15
+ return { list: async (t) => {
16
+ const e = await i(t, 1), o = await Promise.all(Array.from(
17
+ { length: Math.max(e.meta.lastPage - 1, 0) },
18
+ (a, d) => i(t, d + 2)
19
+ )), n = [e, ...o].flatMap((a) => a.data);
20
+ return [...new Map(n.map((a) => [a.id, a])).values()];
21
+ }, create: async (t, e) => {
22
+ const { data: o } = await m(s, {
23
+ name: t.name.trim(),
24
+ description: t.description.trim() || null,
25
+ syntax: e,
26
+ method: "codeOnly",
27
+ codeBefore: t.codeBefore,
28
+ codeAfter: t.codeAfter
29
+ });
30
+ return r(y, o.data);
31
+ }, remove: async (t) => {
32
+ await l(`${s}/${t}`);
33
+ } };
34
+ };
35
+ export {
36
+ u as DISPLAY_CONDITIONS_PAGE_LIMIT,
37
+ s as DISPLAY_CONDITIONS_URL,
38
+ P as useDisplayConditionApi
39
+ };
@@ -384,6 +384,8 @@ export declare const UISchema: v.ObjectSchema<{
384
384
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
385
385
  /** Custom label for back button (if shown) */
386
386
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
387
+ /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
388
+ readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
387
389
  }, undefined>;
388
390
  /**
389
391
  * Features configuration - enable/disable editor features
@@ -804,6 +806,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
804
806
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
805
807
  /** Custom label for back button (if shown) */
806
808
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
809
+ /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
810
+ readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
807
811
  }, undefined>, {}>;
808
812
  /** Feature toggles */
809
813
  readonly features: v.OptionalSchema<v.ObjectSchema<{
@@ -0,0 +1,60 @@
1
+ import * as v from 'valibot';
2
+ export declare const DisplayConditionSyntaxSchema: v.PicklistSchema<["liquid", "pongo"], undefined>;
3
+ export declare const DisplayConditionMethodSchema: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
4
+ export declare const SavedDisplayConditionSchema: v.ObjectSchema<{
5
+ readonly id: v.NumberSchema<undefined>;
6
+ readonly name: v.StringSchema<undefined>;
7
+ readonly description: v.NullishSchema<v.StringSchema<undefined>, "">;
8
+ readonly syntax: v.PicklistSchema<["liquid", "pongo"], undefined>;
9
+ readonly method: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
10
+ readonly codeBefore: v.StringSchema<undefined>;
11
+ readonly codeAfter: v.NullishSchema<v.StringSchema<undefined>, "">;
12
+ readonly createdAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
13
+ }, undefined>;
14
+ export declare const DisplayConditionListResponseSchema: v.ObjectSchema<{
15
+ readonly data: v.ArraySchema<v.ObjectSchema<{
16
+ readonly id: v.NumberSchema<undefined>;
17
+ readonly name: v.StringSchema<undefined>;
18
+ readonly description: v.NullishSchema<v.StringSchema<undefined>, "">;
19
+ readonly syntax: v.PicklistSchema<["liquid", "pongo"], undefined>;
20
+ readonly method: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
21
+ readonly codeBefore: v.StringSchema<undefined>;
22
+ readonly codeAfter: v.NullishSchema<v.StringSchema<undefined>, "">;
23
+ readonly createdAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
24
+ }, undefined>, undefined>;
25
+ readonly meta: v.ObjectSchema<{
26
+ readonly totalCount: v.NumberSchema<undefined>;
27
+ readonly perPage: v.NumberSchema<undefined>;
28
+ readonly currentPage: v.NumberSchema<undefined>;
29
+ readonly lastPage: v.NumberSchema<undefined>;
30
+ }, undefined>;
31
+ }, undefined>;
32
+ export type DisplayConditionSyntax = v.InferOutput<typeof DisplayConditionSyntaxSchema>;
33
+ export type DisplayConditionMethod = v.InferOutput<typeof DisplayConditionMethodSchema>;
34
+ export type SavedDisplayCondition = v.InferOutput<typeof SavedDisplayConditionSchema>;
35
+ export type DisplayConditionListResponse = v.InferOutput<typeof DisplayConditionListResponseSchema>;
36
+ export interface DisplayConditionDraft {
37
+ name: string;
38
+ description: string;
39
+ codeBefore: string;
40
+ codeAfter: string;
41
+ }
42
+ export type DisplayConditionSource = 'inline' | 'saved';
43
+ /** Mirrors Stripo's `DisplayCondition`; kept local so Vue code does not import the Stripo package. */
44
+ export interface AppliedDisplayCondition {
45
+ id: number;
46
+ name: string;
47
+ description: string;
48
+ beforeScript: string;
49
+ afterScript: string;
50
+ extraData?: string;
51
+ }
52
+ export type DisplayConditionOpenMode = 'select' | 'create' | 'edit';
53
+ export interface DisplayConditionOpenDetail {
54
+ mode: DisplayConditionOpenMode;
55
+ current: AppliedDisplayCondition | null;
56
+ }
57
+ export interface DisplayConditionApplyDetail {
58
+ condition: AppliedDisplayCondition | null;
59
+ applied?: boolean;
60
+ }
@@ -0,0 +1,43 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ label: string;
4
+ value: string;
5
+ placeholder?: string;
6
+ error?: string;
7
+ disabled?: boolean;
8
+ };
9
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
10
+ placeholder: string;
11
+ error: string;
12
+ disabled: boolean;
13
+ }>, {
14
+ read: () => string;
15
+ }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
16
+ input: (value: string) => void;
17
+ }, string, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
18
+ placeholder: string;
19
+ error: string;
20
+ disabled: boolean;
21
+ }>>>, {
22
+ error: string;
23
+ placeholder: string;
24
+ disabled: boolean;
25
+ }>;
26
+ export default _default;
27
+ type __VLS_WithDefaults<P, D> = {
28
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
29
+ default: D[K];
30
+ }> : P[K];
31
+ };
32
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
33
+ type __VLS_TypePropsToOption<T> = {
34
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
35
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
36
+ } : {
37
+ type: import('vue').PropType<T[K]>;
38
+ required: true;
39
+ };
40
+ };
41
+ type __VLS_PrettifyLocal<T> = {
42
+ [K in keyof T]: T[K];
43
+ } & {};
@@ -0,0 +1,2 @@
1
+ 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<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ 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<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ 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<{}>>, {}>;
2
+ export default _default;
@@ -89,6 +89,7 @@ export declare const useConfig: () => {
89
89
  ui: {
90
90
  showHeader: boolean;
91
91
  backButtonLabel?: string | undefined;
92
+ externalDisplayConditions: boolean;
92
93
  };
93
94
  features: {
94
95
  dynamicContent: boolean;
@@ -228,6 +229,7 @@ export declare const useConfig: () => {
228
229
  ui: import("vue").ComputedRef<{
229
230
  showHeader: boolean;
230
231
  backButtonLabel?: string | undefined;
232
+ externalDisplayConditions: boolean;
231
233
  } | null>;
232
234
  features: import("vue").ComputedRef<{
233
235
  dynamicContent: boolean;
@@ -0,0 +1,16 @@
1
+ import type { DisplayConditionDraft, DisplayConditionOpenDetail, SavedDisplayCondition } from '@@/Types/display-condition';
2
+ export type DraftField = keyof DisplayConditionDraft;
3
+ export type DraftErrors = Partial<Record<DraftField, string>>;
4
+ export type CreateIntent = 'inline' | 'save';
5
+ export declare const useDisplayConditions: () => {
6
+ syntax: import("vue").ComputedRef<"liquid" | "pongo">;
7
+ handleOpen: (detail: DisplayConditionOpenDetail) => void;
8
+ cancel: () => void;
9
+ loadList: () => Promise<void>;
10
+ validate: (draft: DisplayConditionDraft) => DraftErrors;
11
+ notifyInvalid: () => void;
12
+ createInline: (draft: DisplayConditionDraft) => void;
13
+ createAndSave: (draft: DisplayConditionDraft) => Promise<DraftErrors | null>;
14
+ select: (row: SavedDisplayCondition) => void;
15
+ deleteSaved: (row: SavedDisplayCondition) => Promise<void>;
16
+ };
@@ -1,2 +1,4 @@
1
1
  import { type LegacyVariable, type MappedComposition } from './types';
2
- export declare function mapComposition(variables: LegacyVariable[] | undefined): MappedComposition;
2
+ export declare function mapComposition(variables: LegacyVariable[] | undefined, { oldPriceFirst }?: {
3
+ oldPriceFirst?: boolean;
4
+ }): MappedComposition;
@@ -1,3 +1,4 @@
1
+ import type { LegacyPaddingViewport, LegacyVariable } from './types';
1
2
  export declare function extractTitleText(block: Element): string;
2
3
  /**
3
4
  * Fallback for legacy configs that carry no `p_recommendation_title` variable:
@@ -7,6 +8,31 @@ export declare function extractTitleText(block: Element): string;
7
8
  * @returns True when the legacy block renders a visible title
8
9
  */
9
10
  export declare function hasVisibleTitle(block: Element): boolean;
11
+ /**
12
+ * A rendered title container with no text showed the user no title, whatever the config's `hidden` flag says.
13
+ * @param block - The legacy recommendation block element
14
+ * @returns True when the legacy block renders an empty title container
15
+ */
16
+ export declare function hasEmptyTitle(block: Element): boolean;
17
+ /**
18
+ * Reads which price the legacy card renders first. Prices sharing a `positionIdx` are ordered by this.
19
+ * @param block - The legacy recommendation block element
20
+ * @returns True only when both prices render and the original price comes first
21
+ */
22
+ export declare function isOldPriceFirst(block: Element): boolean;
23
+ /**
24
+ * Reads the legacy "Move to next line" state from the rendered card, for blocks whose config does not carry it.
25
+ * @param block - The legacy recommendation block element
26
+ * @returns True only when both prices render in separate rows and neither row is laid out inline (`table-cell`)
27
+ */
28
+ export declare function isPriceOnNextLine(block: Element): boolean;
29
+ /**
30
+ * Legacy keeps the text color and the name's trim toggle in the rendered `<p>`, not in the config theme.
31
+ * @param variables - The legacy composition variables
32
+ * @param block - The legacy recommendation block element
33
+ * @returns The variables, with `textColor` / `textTrimming` filled from the rendered HTML where the theme lacks them
34
+ */
35
+ export declare function withRenderedTextTheme(variables: LegacyVariable[] | undefined, block: Element): LegacyVariable[] | undefined;
10
36
  /**
11
37
  * Card background lives on either the block (`bgcolor`/`style`) or per-card
12
38
  * cells (`.product-card`). Returns empty string when no background is set —
@@ -14,13 +40,16 @@ export declare function hasVisibleTitle(block: Element): boolean;
14
40
  */
15
41
  export declare function extractCardBgColor(block: Element): string;
16
42
  /**
17
- * Reads the legacy block's own `currency-*` attributes into a
18
- * `currencySettings`-shaped object that `mapCurrency` understands. Used as a
19
- * fallback when the external recommendationConfigs map has no entry for this
20
- * block, so the migrated block keeps its real currency instead of defaulting.
21
- * Returns undefined when the block carries no `currency` attribute.
43
+ * `currencySettings` for a block whose legacy config has none: the code and symbol come from the block,
44
+ * the formatting from the legacy editor's defaults, which it rendered without reading the block's attributes.
45
+ */
46
+ export declare function extractCurrencyFromBlock(block: Element): Record<string, string | number>;
47
+ /**
48
+ * Block padding as the legacy product row renders it, for configs whose theme has no `blockPadding`.
49
+ * @param block - The legacy recommendation block element
50
+ * @returns The row's `es-p{n}{side}` padding, or undefined when the block has no product row
22
51
  */
23
- export declare function extractCurrencyFromBlock(block: Element): Record<string, string> | undefined;
52
+ export declare function extractRenderedBlockPadding(block: Element): LegacyPaddingViewport | undefined;
24
53
  /**
25
54
  * True when a PM has manually opted the legacy block out of content
26
55
  * regeneration by adding the `ins-skip-compile` class. Detected before rebuild
@@ -1,4 +1,4 @@
1
- import type { MappedComposition } from './types';
1
+ import type { MappedBlockPadding, MappedComposition } from './types';
2
2
  import type { RecommendationNodeConfig } from '@@/Extensions/Blocks/Recommendation/types/nodeConfig';
3
3
  export declare function buildBlockHtml(params: {
4
4
  nodeConfig: RecommendationNodeConfig;
@@ -16,4 +16,6 @@ export declare function buildBlockHtml(params: {
16
16
  preserveInnerHtml?: string;
17
17
  /** Adds the `ins-skip-compile` opt-out class to the migrated block. */
18
18
  skipCompile?: boolean;
19
+ /** Legacy desktop block padding; without it the block keeps the default `es-p20`. */
20
+ blockPadding?: MappedBlockPadding;
19
21
  }): string;
@@ -1,5 +1,7 @@
1
- import type { LegacyButtonTheme, LegacyImageTheme, LegacyTextTheme, MappedButtonStyle, MappedImageStyle, MappedTextStyle } from './types';
1
+ import type { LegacyButtonTheme, LegacyImageTheme, LegacyPaddingViewport, LegacyTextTheme, MappedBlockPadding, MappedButtonStyle, MappedImageStyle, MappedTextStyle } from './types';
2
2
  export declare function mapTextTheme(theme: LegacyTextTheme | undefined): MappedTextStyle;
3
3
  export declare function mapButtonTheme(theme: LegacyButtonTheme | undefined): MappedButtonStyle;
4
4
  export declare function mapImageTheme(theme: LegacyImageTheme | undefined): MappedImageStyle;
5
+ /** Stripo `es-p{n}{side}` classes where a step class exists, inline `padding-{side}` otherwise; 0 needs neither. */
6
+ export declare function mapBlockPadding(padding: LegacyPaddingViewport | undefined): MappedBlockPadding | undefined;
5
7
  export declare function appendStyle(existing: string | undefined, addition: string | undefined): string;
@@ -30,7 +30,9 @@ export interface LegacyPadding {
30
30
  /** Border-radius shape — observed in two flavours: shorthand or per-corner. */
31
31
  export interface LegacyBorderRadius {
32
32
  /** Single shorthand value (e.g. `radius: 4`). */
33
- radius?: number;
33
+ radius?: number | string;
34
+ /** Shorthand the legacy button theme stores under `theme.borderRadius` (e.g. `borderRadius: "4"`). */
35
+ borderRadius?: number | string;
34
36
  /** Per-corner: top-left / top-right / bottom-right / bottom-left (in px). */
35
37
  lt?: number;
36
38
  rt?: number;
@@ -96,6 +98,7 @@ export interface LegacyButtonTheme {
96
98
  color?: LegacySides<string>;
97
99
  };
98
100
  buttonBorderRadius?: LegacyBorderRadius;
101
+ borderRadius?: LegacyBorderRadius;
99
102
  buttonAlign?: {
100
103
  align?: string;
101
104
  };
@@ -167,6 +170,13 @@ export interface MappedTextStyle {
167
170
  /** True if `textTrimming: true` in theme. */
168
171
  textTrimming: boolean;
169
172
  }
173
+ /** Resolved block wrapper padding. */
174
+ export interface MappedBlockPadding {
175
+ /** Space-separated `es-p{n}{side}` classes. */
176
+ classes: string;
177
+ /** Inline `padding-{side}` declarations for values without a step class. */
178
+ style: string;
179
+ }
170
180
  /** Resolved button styles. */
171
181
  export interface MappedButtonStyle {
172
182
  /** Inline CSS for outer `<td>` (external padding). */
@@ -8,6 +8,7 @@ export declare const ACADEMY_LINKS: {
8
8
  readonly EMAIL_EDITOR: "https://academy.insiderone.com/docs/email-drag-and-drop-editor";
9
9
  readonly GLOBAL_UNSUBSCRIBE: "https://academy.insiderone.com/docs/global-unsubscribe-preference-center";
10
10
  readonly AMP_FOR_EMAILS: "https://academy.insiderone.com/docs/amp-for-emails";
11
+ readonly EMAIL_DISPLAY_CONDITIONS: "https://academy.insiderone.com/docs/new-editor-add-display-conditions-to-an-email";
11
12
  readonly EMAIL_RECOMMENDATION_BLOCK: "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
12
13
  };
13
14
  export type AcademyLinkKey = keyof typeof ACADEMY_LINKS;
@@ -0,0 +1,15 @@
1
+ export declare enum DisplayConditionEvent {
2
+ OPEN = "display-condition:open",
3
+ APPLY = "display-condition:apply",
4
+ CANCEL = "display-condition:cancel"
5
+ }
6
+ export declare enum DisplayConditionSourceType {
7
+ INLINE = "inline",
8
+ SAVED = "saved"
9
+ }
10
+ export declare const DISPLAY_CONDITION_LIMITS: {
11
+ readonly NAME_MIN: 2;
12
+ readonly NAME_MAX: 40;
13
+ readonly DESCRIPTION_MAX: 200;
14
+ readonly CODE_MAX: 65535;
15
+ };
@@ -11,7 +11,6 @@ export declare class ItemsBlockCardCompositionControl extends CommonControl {
11
11
  name: string;
12
12
  label: string;
13
13
  }): string;
14
- _initializeToggles(): void;
15
14
  _updateTogglesFromState(): void;
16
15
  _syncVisibilityFromAttributes(): void;
17
16
  /**
@@ -65,6 +65,7 @@ export declare class RecommendationBlock extends Block {
65
65
  */
66
66
  onDelete(node: ImmutableHtmlNode): void;
67
67
  private _ensureMobileFitRule;
68
+ private _ensureTextTrimCss;
68
69
  private _syncHeightBound;
69
70
  /**
70
71
  * Warns (dark advisory toaster) when the design holds more than one live
@@ -42,7 +42,7 @@ export declare class RecommendationBlockControl extends CommonControl {
42
42
  private get _subControls();
43
43
  getTemplate(): string;
44
44
  private _showControlsForBlock;
45
- onRender(): Promise<void>;
45
+ onRender(): void;
46
46
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
47
47
  onDestroy(): void;
48
48
  /**
@@ -50,6 +50,7 @@ export declare class RecommendationBlockControl extends CommonControl {
50
50
  * Each sub-control manages its own form values and event listeners
51
51
  */
52
52
  private _initializeSubControls;
53
+ private _renderWithPanelNode;
53
54
  /**
54
55
  * Syncs persisted node config into the Pinia store's block state.
55
56
  *
@@ -115,20 +116,14 @@ export declare class RecommendationBlockControl extends CommonControl {
115
116
  * 2. Smart defaults for new blocks (currency, algorithm) — sequential
116
117
  * 3. Product data with correct defaults — sequential
117
118
  *
118
- * Shared by onRender() and onTemplateNodeUpdated() to avoid duplication.
119
+ * Called from onTemplateNodeUpdated() once the node config is synced.
119
120
  * Marks the block as initialized to prevent redundant fetches on re-selection.
120
121
  */
121
122
  private _fetchBlockData;
122
123
  private _isPanelOn;
123
124
  /**
124
- * Applies smart defaults for newly dropped blocks.
125
- *
126
- * For new blocks (config still matches hardcoded defaults), validates that
127
- * the default currency and algorithm are available from the API response.
128
- * If not, falls back to the first available option.
129
- *
130
- * Saved templates with user-customized config are left unchanged because
131
- * their values won't match the hardcoded defaults.
125
+ * Falls back to the first available option when the block's currency or locale is not offered (a new block on
126
+ * the hard-coded default, or a block copied from another account). Only the default strategy gets an algorithm.
132
127
  */
133
128
  private _applySmartDefaults;
134
129
  /**
@@ -1,6 +1,7 @@
1
1
  import type { CurrencyConfig } from '../types/nodeConfig';
2
2
  import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
3
3
  import { ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON } from '../constants';
4
+ export { resolveInlinePriceOrder } from '../utils/inlinePriceOrder';
4
5
  type PriceKey = 'price' | 'original_price' | 'discount';
5
6
  /**
6
7
  * Current currency configuration from the store, in CurrencyConfig shape.
@@ -22,18 +23,6 @@ export declare function isSamePrice(product: RecommendationProduct): boolean;
22
23
  * e.g., "rating_star" → "Rating Star"
23
24
  */
24
25
  export declare function toDisplayName(attrName: string): string;
25
- /**
26
- * Resolves the inline (side-by-side) price layout from the composition order so
27
- * it matches the stacked order. `anchor` is whichever of price / original price
28
- * comes first in the composition (the merged cell renders there); `skip` is the
29
- * other (dropped, since it's merged in); `originalFirst` puts the original price
30
- * on the left when it precedes the sale price (the default composition order).
31
- */
32
- export declare function resolveInlinePriceOrder(composition: string[]): {
33
- originalFirst: boolean;
34
- anchor: string;
35
- skip: string;
36
- };
37
26
  /**
38
27
  * Reduces a raw product-attribute value to a displayable scalar string.
39
28
  * Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
@@ -328,4 +317,3 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
328
317
  * @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
329
318
  */
330
319
  export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
331
- export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Resolves the inline price layout from the composition order: `anchor` is whichever price comes first (the merged
3
+ * cell renders there), `skip` is the other; `originalFirst` puts the original price on the left.
4
+ */
5
+ export declare function resolveInlinePriceOrder(composition: string[]): {
6
+ originalFirst: boolean;
7
+ anchor: string;
8
+ skip: string;
9
+ };
@@ -1,22 +1,5 @@
1
1
  /**
2
- * Maps legacy algorithm strategy keys (used by templates authored against the
3
- * old recommendation system) to the new keys used by `RecommendationFeedSourceMaps`.
4
- *
5
- * Renames are matched by feed-source id:
6
- * - `viewedTogether` → `similarViewed` (id 11, path `viewed-together`)
7
- * - `purchasedTogether` → `similarBought` (id 12, path `purchased-together`)
8
- * - `trending` → `trendingProducts` (id 40, path `trending`)
9
- * - `mostValuable` → `mostValuableOfPartner` (id 46, path `most-valuable`)
10
- * - `topSellers` → `mostPurchased` (id 62, path `top-sellers`)
11
- * - `mostViewed` → `mostPopular` (id 61, path `most-popular`)
12
- *
13
- * Used at two boundaries:
14
- * 1. The migrator (`settingsMapper`), so freshly migrated node configs carry
15
- * the new key.
16
- * 2. The algorithm dropdown control, so already-saved blocks that still carry
17
- * a legacy key resolve to a matching dropdown option.
18
- *
19
- * Unknown values pass through untouched so a future-added algorithm doesn't
20
- * silently default.
2
+ * Maps legacy strategy keys to `RecommendationFeedSourceMaps` keys; product-bound ones (ids 11, 12, excluded from the
3
+ * dropdown) become `mostPopular`. Unknown keys pass through so a future algorithm is not silently defaulted.
21
4
  */
22
5
  export declare function mapLegacyStrategy(legacy: string | undefined): string | undefined;
@@ -67,12 +67,14 @@ interface ButtonProps {
67
67
  export declare abstract class CommonControl extends Control {
68
68
  currentNode?: ImmutableHtmlNode;
69
69
  protected lastBlockInstanceId: string | null;
70
+ protected isAwaitingPanelNode: boolean;
70
71
  abstract getId(): string;
71
72
  abstract getTemplate(): string;
72
73
  abstract onRender(): Promise<void> | void;
73
74
  getContainer(): ShadowRoot;
74
75
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
75
76
  onDestroy(): void;
77
+ protected forgetLastPanelNode(): void;
76
78
  /**
77
79
  * Gets the Items block container element from the current node.
78
80
  * @returns The container element or null if not found
@@ -0,0 +1,6 @@
1
+ import type { AppliedDisplayCondition, DisplayConditionOpenDetail } from '@@/Types/display-condition';
2
+ export interface ConditionRequestHandlers {
3
+ onApply: (condition: AppliedDisplayCondition | null) => boolean;
4
+ onCancel?: () => void;
5
+ }
6
+ export declare const requestDisplayCondition: (detail: DisplayConditionOpenDetail, handlers: ConditionRequestHandlers) => void;
@@ -0,0 +1,14 @@
1
+ import { BlockType } from '@stripoinc/ui-editor-extensions';
2
+ export declare const CONDITIONS_TAB_ID = "conditions";
3
+ export declare const CONDITIONS_CONTROL_ID = "guido-display-conditions-control";
4
+ export declare const MAX_COLLAPSED_LINES = 10;
5
+ export declare const CONDITION_BLOCK_TYPES: readonly [BlockType.STRIPE, BlockType.STRUCTURE, BlockType.CONTAINER];
6
+ export declare const CONDITION_ICONS: {
7
+ readonly PLUS: "guido-display-condition-plus";
8
+ readonly EDIT: "guido-display-condition-edit";
9
+ readonly TRASH: "guido-display-condition-trash";
10
+ readonly CHEVRON: "guido-display-condition-chevron";
11
+ };
12
+ export declare const BUILT_IN_CONDITION_CONTROLS: string[];
13
+ export declare const EMPTY_DESCRIPTION: string;
14
+ export declare const APPLIED_DESCRIPTION: string;
@@ -0,0 +1,23 @@
1
+ import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
+ import { CommonControl } from '@@/Extensions/Blocks/common-control';
3
+ export declare class DisplayConditionsControl extends CommonControl {
4
+ private expanded;
5
+ private listeners;
6
+ private resizeObserver;
7
+ private detachOutsideClick;
8
+ getId(): string;
9
+ getTemplate(): string;
10
+ onRender(): void;
11
+ onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
12
+ onDestroy(): void;
13
+ private getCondition;
14
+ private toggleMenu;
15
+ private listenOutsideClick;
16
+ private openDrawer;
17
+ private applyCondition;
18
+ private wire;
19
+ private teardown;
20
+ private observeCodeSize;
21
+ private paint;
22
+ private collapsedHeight;
23
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@stripoinc/ui-editor-extensions").Extension;
2
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { IconsRegistry } from '@stripoinc/ui-editor-extensions';
2
+ export declare class DisplayConditionsIconsRegistry extends IconsRegistry {
3
+ registerIconsSvg(iconsMap: Record<string, string>): void;
4
+ }
@@ -0,0 +1,8 @@
1
+ import type { DisplayCondition, ExternalDisplayConditionSelectedCB } from '@stripoinc/ui-editor-extensions';
2
+ import { ExternalDisplayConditionsLibrary } from '@stripoinc/ui-editor-extensions';
3
+ export declare class DisplayConditionsLibrary extends ExternalDisplayConditionsLibrary {
4
+ getCategoryName(): string;
5
+ openExternalDisplayConditionsDialog(currentCondition: DisplayCondition, successCallback: ExternalDisplayConditionSelectedCB, cancelCallback: () => void): void;
6
+ getIsContextActionEnabled(): boolean;
7
+ getContextActionIndex(): number;
8
+ }
@@ -0,0 +1,5 @@
1
+ import type { SettingsPanelTab as SettingsPanelTabType } from '@stripoinc/ui-editor-extensions';
2
+ import { SettingsPanelRegistry } from '@stripoinc/ui-editor-extensions';
3
+ export declare class DisplayConditionsSettingsPanel extends SettingsPanelRegistry {
4
+ registerBlockControls(blockControlsMap: Record<string, SettingsPanelTabType[]>): void;
5
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("msw").HttpHandler[];
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import type { DisplayConditionDraft, DisplayConditionSyntax, SavedDisplayCondition } from '@@/Types/display-condition';
2
+ export declare const DISPLAY_CONDITIONS_URL = "/email-proxy/v1/display-conditions";
3
+ export declare const DISPLAY_CONDITIONS_PAGE_LIMIT = 100;
4
+ export declare const useDisplayConditionApi: () => {
5
+ list: (syntax: DisplayConditionSyntax) => Promise<SavedDisplayCondition[]>;
6
+ create: (draft: DisplayConditionDraft, syntax: DisplayConditionSyntax) => Promise<SavedDisplayCondition>;
7
+ remove: (id: number) => Promise<void>;
8
+ };