@useinsider/guido 3.19.0 → 3.20.0-beta.0849ec7

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 (148) hide show
  1. package/README.md +22 -3
  2. package/dist/@types/config/schemas.js +76 -53
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +102 -86
  5. package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
  6. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  7. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  8. package/dist/components/organisms/base/Toaster.vue2.js +13 -12
  9. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  10. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
  11. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  12. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  13. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -42
  14. package/dist/components/organisms/header/EditorActions.vue.js +5 -5
  15. package/dist/components/organisms/header/EditorActions.vue2.js +90 -57
  16. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  17. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
  18. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
  19. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  20. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  21. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  22. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  23. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  24. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +49 -0
  25. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  26. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  27. package/dist/components/wrappers/WpModal.vue.js +1 -1
  28. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  29. package/dist/composables/useActionsApi.js +52 -47
  30. package/dist/composables/useAuthError.js +52 -0
  31. package/dist/composables/useAutoSave.js +11 -11
  32. package/dist/composables/useCodeEditorApi.js +23 -9
  33. package/dist/composables/useCortexBlueprintBridge.js +122 -54
  34. package/dist/composables/useCustomInterfaceAppearance.js +65 -51
  35. package/dist/composables/useEmailTemplateApplier.js +111 -50
  36. package/dist/composables/useHtmlCompiler.js +37 -26
  37. package/dist/composables/useHtmlValidator.js +89 -82
  38. package/dist/composables/useHttp.js +64 -54
  39. package/dist/composables/useLegacyStrategyConversion.js +65 -0
  40. package/dist/composables/useRecommendation.js +40 -35
  41. package/dist/composables/useSave.js +90 -45
  42. package/dist/composables/useSaveValidation.js +282 -0
  43. package/dist/composables/useSaveValidationRollout.js +9 -0
  44. package/dist/composables/useStripo.js +43 -39
  45. package/dist/composables/useToaster.js +18 -22
  46. package/dist/composables/useTranslations.js +3 -2
  47. package/dist/composables/useVersionHistoryApi.js +33 -24
  48. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  49. package/dist/composables/validators/useLiquidValidator.js +15 -15
  50. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  51. package/dist/config/migrator/index.js +14 -13
  52. package/dist/config/migrator/itemsBlockMigrator.js +236 -248
  53. package/dist/config/migrator/recommendationMigrator.js +28 -21
  54. package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
  55. package/dist/enums/extensions/recommendationBlock.js +51 -34
  56. package/dist/enums/save-validation.js +4 -0
  57. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  58. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  59. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  60. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  61. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  62. package/dist/extensions/Blocks/Items/template.js +219 -204
  63. package/dist/extensions/Blocks/Recommendation/block.js +65 -45
  64. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  65. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -90
  66. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +150 -52
  67. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
  68. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +274 -92
  69. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
  70. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
  71. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
  72. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  73. package/dist/extensions/Blocks/Recommendation/utils/productIds.js +5 -3
  74. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
  75. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  76. package/dist/guido.css +1 -1
  77. package/dist/services/recommendationApi.js +46 -37
  78. package/dist/src/@types/config/schemas.d.ts +36 -0
  79. package/dist/src/@types/save-validation.d.ts +19 -0
  80. package/dist/src/components/Guido.vue.d.ts +17 -1
  81. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  82. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  83. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  84. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  85. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  86. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  87. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  88. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  89. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  90. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  91. package/dist/src/composables/useAuthError.d.ts +12 -0
  92. package/dist/src/composables/useConfig.d.ts +8 -0
  93. package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
  94. package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
  95. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  96. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  97. package/dist/src/composables/useHttp.d.ts +2 -0
  98. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  99. package/dist/src/composables/useSave.d.ts +6 -1
  100. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  101. package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
  102. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  103. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  104. package/dist/src/config/migrator/index.d.ts +2 -1
  105. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  106. package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
  107. package/dist/src/enums/save-validation.d.ts +27 -0
  108. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  109. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  110. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  111. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  112. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  113. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  114. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  115. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +10 -0
  116. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
  117. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
  118. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  119. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
  120. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  121. package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +2 -0
  122. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
  123. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  124. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  125. package/dist/src/services/recommendationApi.d.ts +2 -1
  126. package/dist/src/stores/config.d.ts +374 -0
  127. package/dist/src/stores/guido-email-editor.d.ts +20 -10
  128. package/dist/src/stores/onboarding.d.ts +812 -10
  129. package/dist/src/stores/recommendation.d.ts +5 -0
  130. package/dist/src/stores/save-validation.d.ts +22 -0
  131. package/dist/src/utils/dateUtil.d.ts +10 -0
  132. package/dist/src/utils/genericUtil.d.ts +3 -0
  133. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  134. package/dist/src/utils/templatePreparation.d.ts +30 -0
  135. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  136. package/dist/static/assets/icons/line-info.svg.js +5 -0
  137. package/dist/static/styles/components/recommendation-strategy.css.js +113 -9
  138. package/dist/static/styles/components/skeleton.css.js +23 -0
  139. package/dist/static/styles/components/version-history.css.js +2 -6
  140. package/dist/stores/config.js +55 -24
  141. package/dist/stores/guido-email-editor.js +3 -1
  142. package/dist/stores/onboarding.js +50 -36
  143. package/dist/stores/save-validation.js +30 -0
  144. package/dist/stores/unsubscribe.js +3 -3
  145. package/dist/utils/pairProductVariables.js +71 -71
  146. package/dist/utils/stripoEditorApi.js +11 -0
  147. package/dist/utils/templatePreparation.js +54 -51
  148. package/package.json +2 -1
@@ -11,6 +11,8 @@ export declare const useConfig: () => {
11
11
  templateId: string;
12
12
  userId: string;
13
13
  variationId?: string | undefined;
14
+ campaignId?: string | undefined;
15
+ templateLibraryId?: string | undefined;
14
16
  };
15
17
  partner: {
16
18
  name: string;
@@ -41,6 +43,7 @@ export declare const useConfig: () => {
41
43
  selectedUnsubscribePages: number[];
42
44
  forceRecreate: boolean;
43
45
  trackIdCounter: number;
46
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
44
47
  migration: {
45
48
  recommendationConfigs: {
46
49
  [x: string]: {
@@ -99,6 +102,7 @@ export declare const useConfig: () => {
99
102
  autosave: boolean;
100
103
  allowlistEnabled: boolean;
101
104
  linkTrackingIds: boolean;
105
+ allowSaveWithErrors: boolean;
102
106
  reusableRecommendationStrategy: boolean;
103
107
  };
104
108
  blocks: {
@@ -146,6 +150,8 @@ export declare const useConfig: () => {
146
150
  templateId: string;
147
151
  userId: string;
148
152
  variationId?: string | undefined;
153
+ campaignId?: string | undefined;
154
+ templateLibraryId?: string | undefined;
149
155
  } | null>;
150
156
  partner: import("vue").ComputedRef<{
151
157
  name: string;
@@ -176,6 +182,7 @@ export declare const useConfig: () => {
176
182
  selectedUnsubscribePages: number[];
177
183
  forceRecreate: boolean;
178
184
  trackIdCounter: number;
185
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
179
186
  migration: {
180
187
  recommendationConfigs: {
181
188
  [x: string]: {
@@ -234,6 +241,7 @@ export declare const useConfig: () => {
234
241
  autosave: boolean;
235
242
  allowlistEnabled: boolean;
236
243
  linkTrackingIds: boolean;
244
+ allowSaveWithErrors: boolean;
237
245
  reusableRecommendationStrategy: boolean;
238
246
  } | null>;
239
247
  blocks: import("vue").ComputedRef<{
@@ -17,12 +17,11 @@
17
17
  * - `error` segments (and message-level `isError` / `isCancelled`) trigger
18
18
  * a localized toaster.
19
19
  *
20
+ * Every apply settles into a terminal `applyAcks` entry, so cortex moves its button on the write, not the click.
21
+ *
20
22
  * In dev (`import.meta.env.DEV`) every observed segment + message-level flag
21
23
  * change is also `console.debug`-logged with the prefix `[guido:cortex]` so a
22
24
  * developer can watch the agent stream in real time. In production this is
23
25
  * gated behind `localStorage.guido:debug:ai === '1'`.
24
- *
25
- * If cortex-fe isn't loaded the chat store is undefined and the bridge is a
26
- * no-op (intentional — Guido must still work standalone).
27
26
  */
28
27
  export declare const useCortexBlueprintBridge: () => void;
@@ -1,4 +1,16 @@
1
1
  type ApplyStatus = 'pending' | 'applying' | 'applied' | 'failed';
2
+ /**
3
+ * Terminal outcome of an apply; every promise here settles with one, since the bridge acks on it.
4
+ * `superseded`: a newer payload for the same key replaced this one and owns the ack.
5
+ */
6
+ export type ApplyOutcome = {
7
+ status: 'applied';
8
+ } | {
9
+ status: 'failed';
10
+ error: unknown;
11
+ } | {
12
+ status: 'superseded';
13
+ };
2
14
  /**
3
15
  * Applies email_template blueprints from the chat agent to the Stripo editor.
4
16
  *
@@ -9,18 +21,19 @@ type ApplyStatus = 'pending' | 'applying' | 'applied' | 'failed';
9
21
  * - manual Apply click (first apply): immediate.
10
22
  * - blueprint_update after the user has applied once: debounced 250 ms trailing
11
23
  * so rapid mid-stream updates don't thrash updateHtmlAndCss.
24
+ * - a click before Stripo is ready is queued and flushed when `isStripoInitialized` flips.
12
25
  */
13
26
  export declare const useEmailTemplateApplier: () => {
14
27
  applyStatus: import("vue").Ref<Record<string, ApplyStatus>>;
15
- markPending: (blueprintId: string) => void;
16
- applyTemplate: (blueprintId: string, data: {
28
+ markPending: (key: string) => void;
29
+ applyTemplate: (key: string, data: {
17
30
  html?: string;
18
31
  css?: string;
19
- }) => void;
20
- applyTemplateDebounced: (blueprintId: string, data: {
32
+ }) => Promise<ApplyOutcome>;
33
+ applyTemplateDebounced: (key: string, data: {
21
34
  html?: string;
22
35
  css?: string;
23
- }) => void;
36
+ }) => Promise<ApplyOutcome>;
24
37
  };
25
38
  export declare const resetEmailTemplateApplier: () => void;
26
39
  export {};
@@ -19,6 +19,8 @@ export declare const provideGuidoActions: (actions: {
19
19
  }) => void;
20
20
  /**
21
21
  * Provides individual Guido action handlers
22
+ * @deprecated No consumer in src/ and not exported from library.ts — provideGuidoActions
23
+ * provides all four keys itself. Slated for deletion, see the SD-667788 dead-code ledger.
22
24
  */
23
25
  export declare const provideBackHandler: (handler: BackHandler) => void;
24
26
  export declare const provideSaveStartHandler: (handler: SaveStartHandler) => void;
@@ -1,5 +1,12 @@
1
1
  import type { DynamicContent } from '@@/Types/generic';
2
2
  import type { FiltersResponse } from '@@/Types/recommendation';
3
+ /**
4
+ * Extracts recommendation block IDs directly from the HTML by parsing
5
+ * the recommendation-id attribute on block elements.
6
+ * This avoids depending on store state which may not be populated
7
+ * when the settings panel hasn't been opened yet (e.g., saved templates).
8
+ */
9
+ export declare function getRecommendationBlockIds(html: string): string[];
3
10
  /**
4
11
  * Parses a `{{recoId_index_attributeName}}` variable (already stripped of the
5
12
  * braces/whitespace) into its recommendation id and attribute name. Returns
@@ -27,6 +34,20 @@ export declare function buildPartnerAttributeNameSet(filterList: FiltersResponse
27
34
  * before, so flagging it would false-positive on merge tags like `{{user.name}}`.
28
35
  */
29
36
  export declare function findInvalidCustomFields(html: string, validCustomFields: string[], recommendationBlockIds: string[], ignoredIds: Set<string>, ignoredAttributeNames: Set<string> | null): string[];
37
+ /**
38
+ * Returns the invalid `{{ ... }}` dynamic-content tags found in the HTML.
39
+ *
40
+ * A tag's variable name is the part before the first `|` (everything after it is the fallback).
41
+ * Surrounding whitespace is always allowed (trimmed). A tag is valid only when the variable name
42
+ * is an allowed system token, or it is a clean identifier (`[A-Za-z0-9_.]`) and — when a `|` is
43
+ * present — the fallback after it is not empty. Otherwise the tag is invalid (e.g.
44
+ * `{{Api Response: OA1 Main Item Url}}` — spaces/`:` — or `{{bounce|}}` — empty fallback).
45
+ *
46
+ * `data-*` block-config attribute values are excluded from the scan: blocks such as Items/cart
47
+ * store product merge tags (`data-product_button_link="{{Abandoned Cart Item (1) Url}}"`) that the
48
+ * backend resolves through its own pipeline, so they must not be treated as user-authored tags.
49
+ */
50
+ export declare function getInvalidDynamicContentTags(html: string): string[];
30
51
  export declare const useHtmlValidator: () => {
31
52
  validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
32
53
  };
@@ -16,6 +16,7 @@ export interface HttpError {
16
16
  status?: number;
17
17
  statusText?: string;
18
18
  response?: Response;
19
+ authReported?: boolean;
19
20
  }
20
21
  export declare const useHttp: (defaultOptions?: HttpOptions) => {
21
22
  loading: import("vue").ComputedRef<boolean>;
@@ -65,6 +66,7 @@ export declare const useHttp: (defaultOptions?: HttpOptions) => {
65
66
  json: () => Promise<any>;
66
67
  text: () => Promise<string>;
67
68
  } | undefined;
69
+ authReported?: boolean | undefined;
68
70
  } | null>;
69
71
  hasError: import("vue").ComputedRef<boolean>;
70
72
  request: <T = unknown>(method: HttpMethod, url: string, data?: unknown, options?: HttpOptions) => Promise<HttpResponse<T>>;
@@ -0,0 +1,3 @@
1
+ export declare const useLegacyStrategyConversion: () => {
2
+ convertLegacyStrategy: () => Promise<string>;
3
+ };
@@ -1,4 +1,9 @@
1
1
  import type { SavedTemplateDetails } from '@@/Types/stripo';
2
+ type SaveDetails = Omit<SavedTemplateDetails, 'metadata' | 'silent'>;
3
+ type SaveResult = SaveDetails | undefined;
2
4
  export declare const useSave: () => {
3
- save: (suppressEmit?: boolean, silent?: boolean) => Promise<Omit<SavedTemplateDetails, "metadata" | "silent"> | undefined>;
5
+ save: (suppressEmit?: boolean, silent?: boolean) => Promise<SaveResult>;
6
+ saveWithErrors: () => Promise<SaveResult>;
7
+ saveRawOnly: () => Promise<SaveResult>;
4
8
  };
9
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { DynamicContent } from '@@/Types/generic';
2
+ import type { SaveValidationError } from '@@/Types/save-validation';
3
+ export declare const useSaveValidation: () => {
4
+ collectSaveValidationErrors: (compiledHtml: string, dynamicContentList: DynamicContent[]) => Promise<SaveValidationError[]>;
5
+ validateCurrentTemplate: () => Promise<SaveValidationError[]>;
6
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useSaveValidationRollout: () => {
2
+ isEnabled: import("vue").ComputedRef<boolean>;
3
+ };
@@ -1,3 +1,6 @@
1
+ export declare const COUPON_TAG_MODIFIED_KEY = "newsletter.coupon-tag-modified";
2
+ /** Pure core: the tag text of every coupon block whose code was modified. */
3
+ export declare function findInvalidCouponBlocks(html: string): string[];
1
4
  export declare const useCouponBlockValidator: () => {
2
5
  validateCouponBlockTags: (html: string) => boolean;
3
6
  };
@@ -1,4 +1,14 @@
1
+ declare const SINGLETON_BLOCK_RULES: {
2
+ pageType: number;
3
+ messageKey: string;
4
+ }[];
5
+ export declare const EMPTY_BLOCK_KEY = "unsubscription-preference.select-page-to-continue";
6
+ /** Pure core: the singleton rules whose page type appears more than once. */
7
+ export declare function findDuplicateUnsubPageTypes(html: string): typeof SINGLETON_BLOCK_RULES;
8
+ /** Pure core: count of unsubscribe blocks with no page type or page list chosen. */
9
+ export declare function countUnsubBlocksWithoutPage(html: string): number;
1
10
  export declare const useUnsubscribeBlockValidator: () => {
2
11
  validateUnsubscribeBlockUniqueness: (html: string) => boolean;
3
12
  validateUnsubscribeBlockHasTemplate: (html: string) => boolean;
4
13
  };
14
+ export {};
@@ -1,2 +1,3 @@
1
1
  import type { LegacyRecommendationConfig } from '@@/Types/config';
2
- export declare const migrate: (html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>) => Promise<string>;
2
+ import { type PartnerScopeMigrationOptions } from './recommendationPartnerMigrator';
3
+ export declare const migrate: (html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>, partnerScope?: PartnerScopeMigrationOptions) => Promise<string>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Empties recommendation blocks copied in from another account and stamps the
3
+ * current one, before the editor ever sees the template (SD-151945).
4
+ *
5
+ * Runs at load rather than on document change: the stamp makes it a one-time
6
+ * pass per template, the campaign-URL rule only ever applies to the loaded HTML,
7
+ * and Stripo takes the result as the original document, so nothing is dirtied.
8
+ */
9
+ export interface PartnerScopeMigrationOptions {
10
+ partnerName: string;
11
+ /** `undefined` when the host does not pass the map — the unstamped check is then off. */
12
+ campaignUrls?: Record<string, unknown>;
13
+ rrsEnabled: boolean;
14
+ }
15
+ /**
16
+ * @param html Template HTML, already normalized by `migrateRecommendation`.
17
+ * @returns Migrated HTML, or the original when no block needed a reset or a stamp.
18
+ */
19
+ export declare function migrateRecommendationPartnerScope(html: string, { partnerName, campaignUrls, rrsEnabled }: PartnerScopeMigrationOptions): string;
@@ -1,11 +1,17 @@
1
1
  import type { TextValueObject } from '@@/Types/generic';
2
- import type { RecommendationFeedItem } from '@@/Types/recommendation';
2
+ import type { RecommendationFeedItem, RrsMigrationTarget } from '@@/Types/recommendation';
3
3
  export declare const URLS: {
4
4
  RECOMMENDATION_API_URL: string;
5
5
  PRODUCT_ATTRIBUTES_PATH: string;
6
6
  RECOMMENDATION_STRATEGIES_PATH: string;
7
7
  RECOMMENDATION_STRATEGIES_PANEL_PATH: string;
8
+ NEWSLETTER_RECOMMENDATIONS_PATH: string;
9
+ MIGRATE_STRATEGIES_PATH: string;
10
+ TEMPLATE_MIGRATE_STRATEGIES_PATH: string;
8
11
  };
12
+ export declare const strategyCreatePath: () => string;
13
+ export declare const strategyEditPath: (strategyId: string | number) => string;
14
+ export declare const MIGRATION_PATHS: Record<RrsMigrationTarget['scope'], string>;
9
15
  export declare const QUERY_PARAMS: {
10
16
  CLIENT_ID: string;
11
17
  };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Stable discriminators for each save-validation rule site — one per rule that
3
+ * can produce a drawer row, kept in sync with the collector + legacy validator chains.
4
+ */
5
+ export declare enum SaveValidationRule {
6
+ CouponTagModified = "coupon-tag-modified",
7
+ DuplicateUnsubBlock = "duplicate-unsub-block",
8
+ UnsubBlockMissingTemplate = "unsub-block-missing-template",
9
+ LiquidSyntax = "liquid-syntax",
10
+ InvalidLinks = "invalid-links",
11
+ LinkCheckInProgress = "link-check-in-progress",
12
+ CustomFieldScript = "custom-field-script",
13
+ EmptyHtml = "empty-html",
14
+ MismatchedBraces = "mismatched-braces",
15
+ InvalidDynamicTag = "invalid-dynamic-tag",
16
+ InvalidCustomField = "invalid-custom-field",
17
+ ConditionsSyntax = "conditions-syntax",
18
+ WrongEqualityOperator = "wrong-equality-operator",
19
+ MissingIfEndif = "missing-if-endif",
20
+ ConditionTagSpacing = "condition-tag-spacing",
21
+ BracesInsideIfTag = "braces-inside-if-tag",
22
+ RecommendationRequiredFields = "recommendation-required-fields",
23
+ RecommendationFilters = "recommendation-filters",
24
+ InvalidImageType = "invalid-image-type",
25
+ CheckboxUnsubGroup = "checkbox-unsub-group",
26
+ RadioButtonUnsubGroup = "radio-button-unsub-group"
27
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Single owner for the Items card orientation-dependent layout contract (SD-149368).
3
+ *
4
+ * Two things depend on a card's orientation and are written across several layers:
5
+ *
6
+ * 1. Name column width — a horizontal card lays the name in a narrow side-by-side
7
+ * column, so it is capped; a vertical card gives it a full-width row.
8
+ * 2. Block-cell padding — the collapsible price / original-price block-cell carries its
9
+ * own inter-cell spacing (horizontal cards pad left/right, vertical cards pad
10
+ * top/bottom) so a hidden element removes its own spacing instead of leaving a gap.
11
+ *
12
+ * Every layer that writes these — template render, layouts/horizontal.html,
13
+ * NameTrimmingControl (trimming toggle) and settingsControl (orientation change) — MUST
14
+ * derive them here, or a migrated / re-toggled card silently drifts out of sync with
15
+ * freshly generated markup (convention B1: cross-layer literals live in one module).
16
+ */
17
+ export declare const NAME_HORIZONTAL_MAX_WIDTH = "130px";
18
+ export declare const NAME_VERTICAL_MAX_WIDTH = "100%";
19
+ /** Name max-width for a card orientation. Non-horizontal (incl. undefined) → full width. */
20
+ export declare const nameMaxWidthFor: (orientation?: string) => string;
21
+ /** Orientation-dependent inter-cell padding classes for a collapsible block-cell. */
22
+ export declare const BLOCK_CELL_PADDING: {
23
+ readonly VERTICAL: "es-p5b es-p5t";
24
+ readonly HORIZONTAL: "es-p5l es-p5r";
25
+ };
26
+ /**
27
+ * Attribute the block-cell carries to mark its LAYOUT-owned padding orientation ('v'|'h').
28
+ * The orientation toggle keys off this marker so it only ever rewrites the padding the
29
+ * layout itself baked — a user's own es-p* padding classes are never matched or clobbered
30
+ * (SD-149368 F1), and a cell without the marker is left untouched rather than mis-swapped.
31
+ */
32
+ export declare const BLOCK_CELL_PAD_ATTR = "data-items-cell-pad";
33
+ /** Marker attribute (`data-items-cell-pad="v|h"`) for a block-cell in the given orientation. */
34
+ export declare const blockCellPadMarker: (isVertical: boolean) => string;
35
+ /** Padding classes (leading space included) for a block-cell in the given orientation. */
36
+ export declare const blockCellPaddingFor: (isVertical: boolean) => string;
37
+ /**
38
+ * Rewrites a block-cell's LAYOUT-owned padding classes to the target orientation, keyed off
39
+ * the BLOCK_CELL_PAD_ATTR marker. The orientation-change rebuild re-injects existing cells
40
+ * via getOuterHTML(), which still carry the previous orientation's padding — swap only the
41
+ * layout pair (and flip the marker) so price/original-price cells stay padded after a toggle
42
+ * (SD-149368 F3), while a user's own padding and any unmarked cell are left alone (F1).
43
+ */
44
+ export declare const reorientBlockCellPadding: (html: string, toVertical: boolean) => string;
@@ -39,14 +39,17 @@ export declare const productPairs: {
39
39
  CART_ITEMS: {
40
40
  ATTR: string;
41
41
  DEFAULT: string;
42
+ LEGACY_DEFAULTS: readonly string[];
42
43
  };
43
44
  BROWSED_ITEMS: {
44
45
  ATTR: string;
45
46
  DEFAULT: string;
47
+ LEGACY_DEFAULTS: readonly string[];
46
48
  };
47
49
  PURCHASED_ITEMS: {
48
50
  ATTR: string;
49
51
  DEFAULT: string;
52
+ LEGACY_DEFAULTS: readonly string[];
50
53
  };
51
54
  };
52
55
  price: {
@@ -37,6 +37,25 @@ type TemplateParameters = {
37
37
  /** Price orientation within the card ('vertical' = stacked, 'horizontal' = side-by-side) */
38
38
  priceOrientation?: PriceOrientationType;
39
39
  };
40
+ /**
41
+ * Applies price orientation styles to the generated HTML template.
42
+ *
43
+ * For Vertical Layout:
44
+ * - vertical price orientation: both cells 100% (stacked)
45
+ * - horizontal price orientation with both visible: both cells 50% (side-by-side)
46
+ * - horizontal price orientation with one hidden: visible cell 100%
47
+ *
48
+ * For Horizontal Layout:
49
+ * - horizontal price orientation: .horizontal-price visible, .vertical-price hidden
50
+ * - vertical price orientation: .horizontal-price hidden, .vertical-price visible
51
+ * @param html - The HTML template string with placeholders replaced
52
+ * @param layoutOrientation - The card layout orientation ('vertical' or 'horizontal')
53
+ * @param priceOrientation - The price orientation within the card ('vertical' or 'horizontal')
54
+ * @param isPriceVisible - Whether the price element is visible
55
+ * @param isOriginalPriceVisible - Whether the original price element is visible
56
+ * @returns HTML string with price orientation styles applied
57
+ */
58
+ export declare const applyPriceOrientationStyles: (html: string, layoutOrientation: OrientationType, priceOrientation: PriceOrientationType, isPriceVisible?: boolean, isOriginalPriceVisible?: boolean) => string;
40
59
  /**
41
60
  * Generates the default template for the Items Block.
42
61
  * @param params - Template parameters including orientation, items type, item ID, and formatting options
@@ -15,6 +15,8 @@ export declare class RecommendationBlock extends Block {
15
15
  * This avoids generating a new (different) ID in onCreated().
16
16
  */
17
17
  private _pendingBlockId;
18
+ /** Ids already reset under their new name, so the deferred pass skips their stale snapshot. */
19
+ private _resetSourceIds;
18
20
  constructor();
19
21
  getId(): string;
20
22
  getIcon(): string;
@@ -73,6 +75,14 @@ export declare class RecommendationBlock extends Block {
73
75
  * in the document and finding the maximum existing ID + 1.
74
76
  */
75
77
  private _generateNextId;
78
+ /**
79
+ * Drops the "already fetched" claims of a block that arrived holding a baked id
80
+ * (saved module, paste, duplicate), so the settings panel reads its strategy again.
81
+ *
82
+ * Deferred a tick: the collision handlers rename a sibling first, and either sibling can be
83
+ * the renamed one depending on where the module was dropped (SD-149916).
84
+ */
85
+ private _scheduleArrivalReset;
76
86
  /**
77
87
  * Heals a duplicate that slipped past the create-time `_detectDuplicate`
78
88
  * scan (or that was persisted by an older template before SD-142352).
@@ -10,6 +10,7 @@
10
10
  import type { RecommendationNodeConfig, CurrencyConfig, OmnibusTextConfig } from '../types/nodeConfig';
11
11
  export declare const PRE_RRS_CONFIG_VERSION = 1;
12
12
  export declare const CURRENT_CONFIG_VERSION = 2;
13
+ export declare const RRS_CONFIG_VERSION = 2;
13
14
  /**
14
15
  * Default currency configuration
15
16
  * Uses USD as the base currency with standard formatting
@@ -10,4 +10,4 @@ export { RecommendationBlockId } from './blockIds';
10
10
  export { RecommendationControlId } from './controlIds';
11
11
  export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_RECOMMENDATION_TITLE, SELECTOR_TITLE_CELL, ATTR_CUSTOM_PREFIX, ATTR_DATA_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, CSS_CLASS_ATTRIBUTE_ROW, CSS_CLASS_SPACER, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, ATTR_DATA_VISIBILITY, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
12
12
  export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, DEFAULT_MOBILE_COLUMN_SPACING, DEFAULT_MOBILE_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
13
- export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, PRE_RRS_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
13
+ export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, PRE_RRS_CONFIG_VERSION, RRS_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
@@ -70,6 +70,8 @@ export declare class RecommendationBlockControl extends CommonControl {
70
70
  * state was rebuilt with (SD-150347).
71
71
  */
72
72
  private _syncNodeConfigIfChanged;
73
+ /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
74
+ private _isPendingStrategyIdChange;
73
75
  private _capturePendingNodeConfigWrite;
74
76
  /**
75
77
  * Accumulates the pending write into `documentModifier` without applying, so the
@@ -2,6 +2,8 @@ import { CommonControl } from '../../../common-control';
2
2
  export declare const STRATEGY_CONTROL_ID = "recommendation-strategy-control";
3
3
  export declare class StrategyControl extends CommonControl {
4
4
  private store;
5
+ private onboardingStore;
6
+ private legacyConversion;
5
7
  private storeUnsubscription;
6
8
  private listeners;
7
9
  private lastPaintedState;
@@ -9,6 +11,14 @@ export declare class StrategyControl extends CommonControl {
9
11
  getTemplate(): string;
10
12
  private _strategyAction;
11
13
  onRender(): void;
14
+ /**
15
+ * Whether the document itself says this block has no strategy.
16
+ *
17
+ * Read the node, not the store: when the main control cannot resolve the block id off the
18
+ * node it never syncs the persisted config, so the store still holds defaults (empty
19
+ * strategyId) for an assigned block.
20
+ */
21
+ private _isNodeUnassigned;
12
22
  onDestroy(): void;
13
23
  private _teardown;
14
24
  private _setupButtonListeners;
@@ -107,7 +107,7 @@ export interface RegenerateWithStylesOptions extends Omit<RegenerateProductRowsO
107
107
  * HTML removes the need for any post-rebuild reapply pass.
108
108
  * @param options - Configuration options for regeneration
109
109
  */
110
- export declare function regenerateProductRowsWithStyles(options: RegenerateWithStylesOptions): void;
110
+ export declare function regenerateProductRowsWithStyles(options: RegenerateWithStylesOptions): boolean;
111
111
  /**
112
112
  * Adjusts a products array to a target size.
113
113
  * Used by ProductLayoutControl to synchronously match products to the new size
@@ -151,6 +151,11 @@ export interface UpdateProductContentInPlaceOptions {
151
151
  currentNode: ImmutableHtmlNode | null | undefined;
152
152
  documentModifier: DocumentModifier;
153
153
  products: RecommendationProduct[];
154
+ /**
155
+ * Called when the batch was actually committed. Identical products commit nothing, which
156
+ * leaves anything a caller staged into the same batch unwritten unless it applies itself.
157
+ */
158
+ onApplied?: () => void;
154
159
  }
155
160
  /**
156
161
  * Updates product content in-place without regenerating HTML structure.
@@ -161,7 +166,7 @@ export interface UpdateProductContentInPlaceOptions {
161
166
  * After updating desktop, also updates mobile container to keep them in sync.
162
167
  *
163
168
  * Falls back to false when product count changed (need to add/remove elements).
164
- * @param options - Configuration options
169
+ * @param options - Configuration options; `onApplied` fires only when a batch was committed
165
170
  * @returns true if in-place update was successful, false to fall back to full regeneration
166
171
  */
167
172
  export declare function updateProductContentInPlace(options: UpdateProductContentInPlaceOptions): boolean;