@useinsider/guido 1.0.3-beta.d1ff593 → 1.0.3-beta.d574817

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 (135) hide show
  1. package/README.md +144 -3
  2. package/dist/components/Guido.vue.js +11 -9
  3. package/dist/components/Guido.vue2.js +76 -70
  4. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -15
  6. package/dist/components/organisms/header/RightSlot.vue.js +11 -11
  7. package/dist/components/organisms/header/RightSlot.vue2.js +23 -22
  8. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +9 -9
  9. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +30 -17
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +12 -10
  11. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +19 -18
  12. package/dist/composables/useBlocksConfig.js +49 -0
  13. package/dist/composables/useGuidoActions.js +19 -9
  14. package/dist/composables/useStripo.js +49 -58
  15. package/dist/config/compiler/unsubscribeCompilerRules.js +33 -28
  16. package/dist/config/migrator/recommendationMigrator.js +188 -98
  17. package/dist/enums/date.js +6 -0
  18. package/dist/enums/defaults.js +16 -8
  19. package/dist/enums/onboarding.js +2 -1
  20. package/dist/enums/unsubscribe.js +27 -25
  21. package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
  22. package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
  23. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  24. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +66 -298
  25. package/dist/extensions/Blocks/Recommendation/constants.js +5 -0
  26. package/dist/extensions/Blocks/Recommendation/control.js +5 -4
  27. package/dist/extensions/Blocks/Recommendation/controls/button/align.js +7 -6
  28. package/dist/extensions/Blocks/Recommendation/controls/button/border.js +7 -6
  29. package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +7 -6
  30. package/dist/extensions/Blocks/Recommendation/controls/button/color.js +5 -4
  31. package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +5 -4
  32. package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +5 -4
  33. package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +5 -4
  34. package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +5 -4
  35. package/dist/extensions/Blocks/Recommendation/controls/button/text.js +5 -4
  36. package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +5 -4
  37. package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +5 -4
  38. package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +13 -0
  39. package/dist/extensions/Blocks/Recommendation/controls/image/size.js +13 -0
  40. package/dist/extensions/Blocks/Recommendation/controls/name/align.js +5 -4
  41. package/dist/extensions/Blocks/Recommendation/controls/name/background.js +7 -6
  42. package/dist/extensions/Blocks/Recommendation/controls/name/color.js +5 -4
  43. package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +5 -4
  44. package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +5 -4
  45. package/dist/extensions/Blocks/Recommendation/controls/name/size.js +7 -6
  46. package/dist/extensions/Blocks/Recommendation/controls/name/style.js +7 -6
  47. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +13 -0
  48. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +13 -0
  49. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +13 -0
  50. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +13 -0
  51. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +13 -0
  52. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +13 -0
  53. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +13 -0
  54. package/dist/extensions/Blocks/Recommendation/controls/price/align.js +13 -0
  55. package/dist/extensions/Blocks/Recommendation/controls/price/background.js +13 -0
  56. package/dist/extensions/Blocks/Recommendation/controls/price/color.js +13 -0
  57. package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +13 -0
  58. package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +13 -0
  59. package/dist/extensions/Blocks/Recommendation/controls/price/size.js +13 -0
  60. package/dist/extensions/Blocks/Recommendation/controls/price/style.js +13 -0
  61. package/dist/extensions/Blocks/Recommendation/extension.js +37 -21
  62. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +90 -45
  63. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  64. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +160 -0
  65. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +152 -0
  66. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +180 -0
  67. package/dist/extensions/DynamicContent/dynamic-content-modal.js +25 -19
  68. package/dist/extensions/DynamicContent/dynamic-content.js +128 -33
  69. package/dist/guido.css +1 -1
  70. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +198 -176
  71. package/dist/package.json.js +1 -1
  72. package/dist/services/stripoApi.js +1 -1
  73. package/dist/src/@types/generic.d.ts +42 -6
  74. package/dist/src/components/Guido.vue.d.ts +4 -2
  75. package/dist/src/components/organisms/onboarding/NewVersionPopup.vue.d.ts +3 -1
  76. package/dist/src/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +3 -1
  77. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  78. package/dist/src/composables/useBlocksConfig.d.ts +11 -0
  79. package/dist/src/composables/useGuidoActions.d.ts +9 -0
  80. package/dist/src/enums/date.d.ts +4 -0
  81. package/dist/src/enums/onboarding.d.ts +1 -0
  82. package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +5 -42
  83. package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +51 -0
  84. package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +5 -0
  85. package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +5 -0
  86. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +5 -0
  87. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +5 -0
  88. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +5 -0
  89. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +5 -0
  90. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +5 -0
  91. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +5 -0
  92. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +5 -0
  93. package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +5 -0
  94. package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +5 -0
  95. package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +5 -0
  96. package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +5 -0
  97. package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +5 -0
  98. package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +5 -0
  99. package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +5 -0
  100. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  101. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +16 -0
  102. package/dist/src/extensions/Blocks/Recommendation/{template.d.ts → templates/migrationTemplate.d.ts} +7 -34
  103. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +44 -0
  104. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +9 -2
  105. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +52 -2
  106. package/dist/src/stores/config.d.ts +10 -2
  107. package/dist/src/stores/dynamic-content.d.ts +3 -3
  108. package/dist/src/stores/editor.d.ts +1 -1
  109. package/dist/src/stores/onboarding.d.ts +1 -1
  110. package/dist/src/stores/preview.d.ts +1 -1
  111. package/dist/src/stores/recommendation.d.ts +1 -1
  112. package/dist/src/stores/save-as-template.d.ts +1 -1
  113. package/dist/src/stores/toaster.d.ts +1 -1
  114. package/dist/src/stores/unsubscribe.d.ts +1 -1
  115. package/dist/src/stores/version-history.d.ts +1 -1
  116. package/dist/src/utils/dateUtil.d.ts +21 -0
  117. package/dist/src/utils/environmentUtil.d.ts +5 -0
  118. package/dist/src/utils/genericUtil.d.ts +1 -0
  119. package/dist/static/styles/components/narrow-panel.css.js +10 -0
  120. package/dist/static/styles/customEditorStyle.css.js +5 -0
  121. package/dist/stores/config.js +5 -5
  122. package/dist/stores/dynamic-content.js +2 -2
  123. package/dist/stores/editor.js +1 -1
  124. package/dist/stores/onboarding.js +27 -27
  125. package/dist/stores/preview.js +1 -1
  126. package/dist/stores/recommendation.js +3 -3
  127. package/dist/stores/save-as-template.js +2 -2
  128. package/dist/stores/toaster.js +1 -1
  129. package/dist/stores/unsubscribe.js +1 -1
  130. package/dist/stores/version-history.js +4 -4
  131. package/dist/utils/dateUtil.js +24 -3
  132. package/dist/utils/environmentUtil.js +4 -0
  133. package/dist/utils/genericUtil.js +20 -9
  134. package/package.json +2 -2
  135. package/dist/extensions/Blocks/Recommendation/template.js +0 -314
@@ -1,16 +1,66 @@
1
+ import type { MergeTag } from '@@/Types/generic';
1
2
  import { UIElementType, UIElement, UIElementTagRegistry } from '@stripoinc/ui-editor-extensions';
2
3
  export declare class DynamicContentTagRegistry extends UIElementTagRegistry {
3
4
  registerUiElements(uiElementsTagsMap: Record<UIElementType, string>): void;
4
5
  }
5
6
  export declare class DynamicContentUiElementExtension extends UIElement {
6
7
  private mergeTagsButton;
7
- private listener;
8
8
  private mergeTagsLibrary;
9
- private selectedDynamicContent;
9
+ private clickListener;
10
+ private lastClickedElement;
11
+ private lastClickedFrame;
12
+ private mousedownListener;
10
13
  getId(): string;
11
14
  onRender(container: HTMLElement): void;
12
15
  onDestroy(): void;
13
16
  _onClick(): void;
17
+ /**
18
+ * Called when Stripo detects merge tag interactions
19
+ * This is the key method that receives notifications about merge tag clicks
20
+ * @param name - Attribute name (e.g., 'mergeTag')
21
+ * @param value - MergeTag object with label, value, selStart, selEnd, etc.
22
+ */
23
+ onAttributeUpdated(name: string, value: MergeTag | null | undefined): void;
14
24
  openMergeTagLibrary(): void;
25
+ /**
26
+ * Opens the dynamic content library for external apps
27
+ * Dispatches event with dynamic content data and position
28
+ */
29
+ private _openDynamicContentLibrary;
30
+ /**
31
+ * Gets the button's position on the screen
32
+ * Used to position the modal or anything else near the button
33
+ */
34
+ private _getButtonPosition;
35
+ /**
36
+ * Sets up coordinate tracking for merge tag clicks in the iframe
37
+ * Workaround from Stripo intercepting click events - tracks mousedown events instead
38
+ */
39
+ private _setupCoordinateTracking;
40
+ /**
41
+ * Gets the editor iframe element
42
+ */
43
+ private _getEditorFrame;
44
+ /**
45
+ * Finds merge tag element in the element tree
46
+ */
47
+ private _findMergeTagElement;
48
+ /**
49
+ * Gets the position of the last clicked element, calculated on-demand
50
+ * This ensures we always use the correct element's position even with rapid clicks
51
+ */
52
+ private _getLastClickedPosition;
53
+ /**
54
+ * Calculates absolute position of element relative to page
55
+ */
56
+ private _calculateAbsolutePosition;
57
+ /**
58
+ * Cleans up the coordinate tracking event listener
59
+ */
60
+ private _cleanupCoordinateTracking;
61
+ /**
62
+ * Returns the HTML template for the "Add Dynamic Content" button
63
+ * This button is placed in the merge tags selector UI
64
+ */
15
65
  getTemplate(): string;
16
66
  }
@@ -3,7 +3,7 @@ interface StoreState {
3
3
  guidoConfig: GuidoConfig;
4
4
  templateConfig?: TemplateConfig;
5
5
  }
6
- export declare const useConfigStore: import("pinia").StoreDefinition<"config", StoreState, {
6
+ export declare const useConfigStore: import("pinia").StoreDefinition<"guidoConfig", StoreState, {
7
7
  getVariationId: (state: {
8
8
  guidoConfig: {
9
9
  translationsPath: string;
@@ -64,6 +64,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"config", S
64
64
  senderName: string;
65
65
  subject: string;
66
66
  };
67
+ migrationDate: number;
67
68
  partner?: {
68
69
  partnerName: string;
69
70
  productType: number;
@@ -76,17 +77,24 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"config", S
76
77
  dynamicContent?: boolean | undefined;
77
78
  saveAsTemplate?: boolean | undefined;
78
79
  versionHistory?: boolean | undefined;
80
+ testMessage?: boolean | undefined;
81
+ displayConditions?: boolean | undefined;
79
82
  } | undefined;
83
+ blocks?: {
84
+ excludeDefaults?: import("@@/Types/generic").GuidoBlockType[] | undefined;
85
+ includeCustoms?: import("@@/Types/generic").GuidoCustomBlockType[] | undefined;
86
+ } | undefined;
87
+ backButtonLabel?: string | undefined;
80
88
  };
81
89
  templateConfig?: {
82
90
  preselectedDynamicContentList?: {
83
91
  value: string;
84
- text: string;
85
92
  fallback?: string | undefined;
86
93
  format?: {
87
94
  key: string;
88
95
  value: string;
89
96
  } | undefined;
97
+ text: string;
90
98
  }[] | undefined;
91
99
  selectedUnsubscribePages?: number[] | undefined;
92
100
  variationId?: string | undefined;
@@ -1,26 +1,26 @@
1
1
  import type { DynamicContent } from '@@/Types/generic';
2
- export declare const useDynamicContentStore: import("pinia").StoreDefinition<"dynamicContent", {
2
+ export declare const useDynamicContentStore: import("pinia").StoreDefinition<"guidoDynamicContent", {
3
3
  selectedDynamicContent: DynamicContent;
4
4
  selectedDynamicContentList: DynamicContent[];
5
5
  }, {
6
6
  getSelectedDynamicContentList: (state: {
7
7
  selectedDynamicContent: {
8
8
  value: string;
9
- text: string;
10
9
  fallback?: string | undefined;
11
10
  format?: {
12
11
  key: string;
13
12
  value: string;
14
13
  } | undefined;
14
+ text: string;
15
15
  };
16
16
  selectedDynamicContentList: {
17
17
  value: string;
18
- text: string;
19
18
  fallback?: string | undefined;
20
19
  format?: {
21
20
  key: string;
22
21
  value: string;
23
22
  } | undefined;
23
+ text: string;
24
24
  }[];
25
25
  } & import("pinia").PiniaCustomStateProperties<{
26
26
  selectedDynamicContent: DynamicContent;
@@ -1,4 +1,4 @@
1
- export declare const useEditorStore: import("pinia").StoreDefinition<"editor", {
1
+ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEditor", {
2
2
  loadingStatus: boolean;
3
3
  isCodeEditorOpen: boolean;
4
4
  isSaveAsTemplateDrawerOpen: boolean;
@@ -1,5 +1,5 @@
1
1
  import type { OnboardingCardConfig, OnboardingType, OnboardingStoreState } from '@@/Types/onboarding';
2
- export declare const useOnboardingStore: import("pinia").StoreDefinition<"onboarding", OnboardingStoreState, {
2
+ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoOnboarding", OnboardingStoreState, {
3
3
  getOnboarding: (state: {
4
4
  onboardings: {
5
5
  newVersionPopup: {
@@ -1,5 +1,5 @@
1
1
  import type { PreviewState, EmailFormat } from '@@/Types/preview';
2
- export declare const usePreviewStore: import("pinia").StoreDefinition<"preview", PreviewState, {
2
+ export declare const usePreviewStore: import("pinia").StoreDefinition<"guidoPreview", PreviewState, {
3
3
  isAMPModeEnabled: (state: {
4
4
  emailFormat: EmailFormat;
5
5
  ampHtml: string;
@@ -6,5 +6,5 @@ type RecommendationConfig = {
6
6
  interface StoreState {
7
7
  recommendationConfigs: RecommendationConfig[];
8
8
  }
9
- export declare const useRecommendationStore: import("pinia").StoreDefinition<"recommendation", StoreState, {}, {}>;
9
+ export declare const useRecommendationStore: import("pinia").StoreDefinition<"guidoRecommendation", StoreState, {}, {}>;
10
10
  export {};
@@ -17,7 +17,7 @@ interface StoreState {
17
17
  message: number;
18
18
  };
19
19
  }
20
- export declare const useSaveAsTemplateStore: import("pinia").StoreDefinition<"saveAsTemplate", StoreState, {
20
+ export declare const useSaveAsTemplateStore: import("pinia").StoreDefinition<"guidoSaveAsTemplate", StoreState, {
21
21
  getTemplateName: (state: {
22
22
  templateName: string;
23
23
  categories: {
@@ -1,5 +1,5 @@
1
1
  import type { ToasterState, ToasterOptions } from '@@/Types/toaster';
2
- export declare const useToasterStore: import("pinia").StoreDefinition<"toaster", ToasterState, {
2
+ export declare const useToasterStore: import("pinia").StoreDefinition<"guidoToaster", ToasterState, {
3
3
  shouldAutoHide: (s: {
4
4
  status: boolean;
5
5
  type: import("@@/Types/toaster").ToasterType;
@@ -11,7 +11,7 @@ interface StoreState {
11
11
  isGlobalUnsubscribeDisabled: boolean;
12
12
  isSubscriptionPreferencesCenterDisabled: boolean;
13
13
  }
14
- export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"unsubscribe", StoreState, {
14
+ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guidoUnsubscribe", StoreState, {
15
15
  getSelectedCollection: (state: {
16
16
  templates: {
17
17
  id: number;
@@ -2,7 +2,7 @@ import type { VersionHistoryState } from '@@/Types/version-history-api';
2
2
  export interface StoreState extends VersionHistoryState {
3
3
  editorVisualMode: 'desktop' | 'mobile';
4
4
  }
5
- export declare const useVersionHistoryStore: import("pinia").StoreDefinition<"versionHistory", StoreState, {
5
+ export declare const useVersionHistoryStore: import("pinia").StoreDefinition<"guidoVersionHistory", StoreState, {
6
6
  hasPreviousPatch: (state: {
7
7
  editorVisualMode: "desktop" | "mobile";
8
8
  previousPatch: {
@@ -1 +1,22 @@
1
+ /**
2
+ * Locale List:
3
+ * en-US -> MM/DD/YYYY
4
+ * en-GB -> DD/MM/YYYY
5
+ * tr-TR -> DD.MM.YYYY
6
+ */
7
+ export declare const convertToDateObject: (date: string | number | Date | null | undefined) => Date;
8
+ export declare const locale: () => string;
9
+ export declare const localTz: string;
10
+ export declare const timezone: () => string;
11
+ export declare const hour12: () => boolean;
12
+ export declare const dateFormat: () => string;
13
+ /**
14
+ * @example 04/22/2024
15
+ * @param date - The date or timestamp input
16
+ * @param specificLocale - Locale to use for formatting
17
+ * @param tz - Timezone [window.l10n.timezone]
18
+ * @returns Formatted date string
19
+ */
20
+ export declare const formatShortDate: (date: string | number | Date, specificLocale?: string, tz?: string) => string;
1
21
  export declare const formatPatchDate: (timestamp: number) => string;
22
+ export declare const isAfterDate: (timestamp: number) => boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Gets the appropriate environment prefix by parsing from current hostname
3
+ * Extracts environment prefix from domains by splitting hostname
4
+ */
5
+ export declare const getEnvironmentPrefix: () => string;
@@ -1,4 +1,5 @@
1
1
  import type { DynamicContent, MergeTag } from '@@/Types/generic';
2
+ export declare const mergeTagToDynamicContent: (mergeTag: MergeTag) => DynamicContent;
2
3
  export declare const dynamicContentToMergeTags: (dynamicContentList: DynamicContent[]) => MergeTag[];
3
4
  export declare const getCsrfToken: () => string;
4
5
  /**
@@ -32,6 +32,16 @@ ue-stripe-thumb:hover:not(.disabled),
32
32
  padding: 0 16px 16px;
33
33
  grid-row-gap: 16px;
34
34
  }
35
+
36
+ /* TODO: will be removed after we find another way to hide stripo custom modules */
37
+ #moduleTab_tab1,
38
+ button[aria-label="Default Modules"],
39
+ button[aria-controls="moduleTab_tab1_content"],
40
+ #moduleTab_tab2,
41
+ button[aria-label="Pre-Built AMP"],
42
+ button[aria-controls="moduleTab_tab2_content"] {
43
+ display: none !important;
44
+ }
35
45
  `;
36
46
  export {
37
47
  o as default
@@ -18,6 +18,11 @@ const n = `.esd-x,
18
18
  border-radius: 0;
19
19
  box-shadow: none;
20
20
  }
21
+
22
+ .ins-recommendation-v3-block-v2 .product-attribute-cell ue-node-actions,
23
+ .ins-recommendation-v3-block-v2 .product-attribute-cell ue-node-panel {
24
+ display: none !important;
25
+ }
21
26
  `;
22
27
  export {
23
28
  n as default
@@ -1,8 +1,8 @@
1
- import { DefaultGuidoConfig as e } from "../enums/defaults.js";
2
- import { defineStore as i } from "pinia";
3
- const r = i("config", {
1
+ import { DefaultGuidoConfig as i } from "../enums/defaults.js";
2
+ import { defineStore as e } from "pinia";
3
+ const n = e("guidoConfig", {
4
4
  state: () => ({
5
- guidoConfig: e,
5
+ guidoConfig: i,
6
6
  templateConfig: {}
7
7
  }),
8
8
  getters: {
@@ -13,5 +13,5 @@ const r = i("config", {
13
13
  }
14
14
  });
15
15
  export {
16
- r as useConfigStore
16
+ n as useConfigStore
17
17
  };
@@ -1,8 +1,8 @@
1
1
  import { removeDuplicatesFromArray as n } from "../utils/arrayUtil.js";
2
2
  import { defineStore as a } from "pinia";
3
- const s = a("dynamicContent", {
3
+ const s = a("guidoDynamicContent", {
4
4
  state: () => ({
5
- selectedDynamicContent: { text: "", value: "", fallback: "" },
5
+ selectedDynamicContent: { text: "", value: "" },
6
6
  selectedDynamicContentList: []
7
7
  }),
8
8
  actions: {
@@ -1,5 +1,5 @@
1
1
  import { defineStore as e } from "pinia";
2
- const o = e("editor", {
2
+ const o = e("guidoEditor", {
3
3
  state: () => ({
4
4
  loadingStatus: !0,
5
5
  isCodeEditorOpen: !1,
@@ -14,41 +14,41 @@ const e = () => ({
14
14
  },
15
15
  userModalState: {},
16
16
  isFetched: !1
17
- }), g = s("onboarding", {
17
+ }), c = s("guidoOnboarding", {
18
18
  state: () => a(),
19
19
  getters: {
20
- getOnboarding: (n) => (o) => n.onboardings[o],
21
- isActive: (n) => (o) => n.onboardings[o].isActive,
22
- getCurrentCard: (n) => (o) => {
23
- const i = n.onboardings[o];
24
- return i.config[i.cardIndex];
20
+ getOnboarding: (n) => (i) => n.onboardings[i],
21
+ isActive: (n) => (i) => n.onboardings[i].isActive,
22
+ getCurrentCard: (n) => (i) => {
23
+ const o = n.onboardings[i];
24
+ return o.config[o.cardIndex];
25
25
  },
26
26
  getGenericCurrentCard: (n) => {
27
- const { genericOnboarding: o } = n.onboardings;
28
- return o.config[o.cardIndex];
27
+ const { genericOnboarding: i } = n.onboardings;
28
+ return i.config[i.cardIndex];
29
29
  },
30
30
  getTextBlockCurrentCard: (n) => {
31
- const { textBlockOnboarding: o } = n.onboardings;
32
- return o.config[o.cardIndex];
31
+ const { textBlockOnboarding: i } = n.onboardings;
32
+ return i.config[i.cardIndex];
33
33
  },
34
34
  getVersionHistoryCurrentCard: (n) => {
35
- const { versionHistoryOnboarding: o } = n.onboardings;
36
- return o.config[o.cardIndex];
35
+ const { versionHistoryOnboarding: i } = n.onboardings;
36
+ return i.config[i.cardIndex];
37
37
  },
38
38
  getAmpCurrentCard: (n) => {
39
- const { ampOnboarding: o } = n.onboardings;
40
- return o.config[o.cardIndex];
39
+ const { ampOnboarding: i } = n.onboardings;
40
+ return i.config[i.cardIndex];
41
41
  },
42
- shouldShowOnboarding: (n) => (o) => {
43
- const i = n.userModalState.Guido;
44
- return o === "newVersionPopup" && (i != null && i.genericOnboarding) ? !1 : i ? !i[o] : !0;
42
+ shouldShowOnboarding: (n) => (i) => {
43
+ const o = n.userModalState.Guido;
44
+ return i === "newVersionPopup" && (o != null && o.genericOnboarding) ? !1 : o ? !o[i] : !0;
45
45
  }
46
46
  },
47
47
  actions: {
48
48
  closeOtherOnboardings(n) {
49
- Object.keys(this.onboardings).forEach((o) => {
50
- const i = o;
51
- i !== n && this.onboardings[i].isActive && (this.onboardings[i].isActive = !1, this.onboardings[i].cardIndex = 0, this.onboardings[i].config = []);
49
+ Object.keys(this.onboardings).forEach((i) => {
50
+ const o = i;
51
+ o !== n && this.onboardings[o].isActive && (this.onboardings[o].isActive = !1, this.onboardings[o].cardIndex = 0, this.onboardings[o].config = []);
52
52
  });
53
53
  },
54
54
  start(n) {
@@ -63,8 +63,8 @@ const e = () => ({
63
63
  previous(n) {
64
64
  this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
65
65
  },
66
- setConfig(n, o) {
67
- this.onboardings[n].config = o ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
66
+ setConfig(n, i) {
67
+ this.onboardings[n].config = i ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
68
68
  },
69
69
  async onDiscoverNowClicked() {
70
70
  await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido"), this.start("genericOnboarding");
@@ -81,15 +81,15 @@ const e = () => ({
81
81
  async fetchUserModalState() {
82
82
  if (this.isFetched)
83
83
  return;
84
- const { fetchUserModalState: n } = t(), o = await n();
85
- this.userModalState = o, this.isFetched = !0;
84
+ const { fetchUserModalState: n } = t(), i = await n();
85
+ this.userModalState = i, this.isFetched = !0;
86
86
  },
87
- async setUserModalState(n, o, i) {
87
+ async setUserModalState(n, i, o) {
88
88
  const { setUserModalState: r } = t();
89
- await r(n, o, i), this.isFetched = !1, await this.fetchUserModalState();
89
+ await r(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
90
90
  }
91
91
  }
92
92
  });
93
93
  export {
94
- g as useOnboardingStore
94
+ c as useOnboardingStore
95
95
  };
@@ -6,7 +6,7 @@ const s = () => ({
6
6
  templateHtml: "",
7
7
  isLoaded: !1,
8
8
  isAMPErrorModalVisible: !1
9
- }), a = e("preview", {
9
+ }), a = e("guidoPreview", {
10
10
  state: () => s(),
11
11
  getters: {
12
12
  isAMPModeEnabled: (t) => t.emailFormat === "AMP",
@@ -1,8 +1,8 @@
1
1
  import { defineStore as e } from "pinia";
2
- const t = () => ({
2
+ const o = () => ({
3
3
  recommendationConfigs: []
4
- }), n = e("recommendation", {
5
- state: () => t()
4
+ }), n = e("guidoRecommendation", {
5
+ state: () => o()
6
6
  });
7
7
  export {
8
8
  n as useRecommendationStore
@@ -17,7 +17,7 @@ const r = () => ({
17
17
  editor: 2,
18
18
  message: 1
19
19
  }
20
- }), n = i("saveAsTemplate", {
20
+ }), g = i("guidoSaveAsTemplate", {
21
21
  state: () => r(),
22
22
  getters: {
23
23
  getTemplateName: (e) => e.templateName.trim(),
@@ -44,5 +44,5 @@ const r = () => ({
44
44
  }
45
45
  });
46
46
  export {
47
- n as useSaveAsTemplateStore
47
+ g as useSaveAsTemplateStore
48
48
  };
@@ -8,7 +8,7 @@ const a = () => ({
8
8
  withIcon: !0,
9
9
  withoutLeftMargin: !1,
10
10
  actionButton: void 0
11
- }), u = i("toaster", {
11
+ }), u = i("guidoToaster", {
12
12
  state: () => a(),
13
13
  getters: {
14
14
  shouldAutoHide: (t) => t.status && !!t.text
@@ -12,7 +12,7 @@ const p = () => ({
12
12
  typeSelectionDrawerStatus: !1,
13
13
  isGlobalUnsubscribeDisabled: !1,
14
14
  isSubscriptionPreferencesCenterDisabled: !1
15
- }), g = d("unsubscribe", {
15
+ }), g = d("guidoUnsubscribe", {
16
16
  state: () => p(),
17
17
  getters: {
18
18
  getSelectedCollection: (e) => i[e.selectedCollectionType],
@@ -5,13 +5,13 @@ const e = () => ({
5
5
  description: "",
6
6
  authorId: "",
7
7
  authorName: ""
8
- }), r = () => ({
8
+ }), i = () => ({
9
9
  previousPatch: e(),
10
10
  currentPatch: e(),
11
11
  nextPatch: e(),
12
12
  editorVisualMode: "desktop"
13
- }), o = a("versionHistory", {
14
- state: () => r(),
13
+ }), r = a("guidoVersionHistory", {
14
+ state: () => i(),
15
15
  getters: {
16
16
  hasPreviousPatch: (t) => !!t.previousPatch.id,
17
17
  hasCurrentPatch: (t) => !!t.currentPatch.id,
@@ -24,5 +24,5 @@ const e = () => ({
24
24
  }
25
25
  });
26
26
  export {
27
- o as useVersionHistoryStore
27
+ r as useVersionHistoryStore
28
28
  };
@@ -1,4 +1,19 @@
1
- const o = (t) => {
1
+ import { DEFAULT_LOCALE as r, DEFAULT as a, DEFAULT_TZ as c } from "../enums/date.js";
2
+ const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length === 10 ? new Date(Number(t) * 1e3) : new Date(t) : typeof t == "number" ? t.toString().length === 10 ? new Date(t * 1e3) : new Date(t) : /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(), s = () => {
3
+ const t = window.l10n;
4
+ return (t == null ? void 0 : t.locale) === a ? r : (t == null ? void 0 : t.locale) || r;
5
+ }, u = new Intl.DateTimeFormat().resolvedOptions().timeZone, f = () => {
6
+ const t = window.l10n;
7
+ return (t == null ? void 0 : t.timezone) || u || c;
8
+ }, D = (t, e = s(), n = f()) => {
9
+ const o = {
10
+ year: "numeric",
11
+ month: "2-digit",
12
+ day: "2-digit",
13
+ timeZone: n
14
+ }, i = m(t);
15
+ return new Intl.DateTimeFormat(e, o).format(i);
16
+ }, T = (t) => {
2
17
  if (!t)
3
18
  return "";
4
19
  const e = new Date(t);
@@ -10,7 +25,13 @@ const o = (t) => {
10
25
  second: "2-digit",
11
26
  hour12: !1
12
27
  }).format(e);
13
- };
28
+ }, h = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
14
29
  export {
15
- o as formatPatchDate
30
+ m as convertToDateObject,
31
+ T as formatPatchDate,
32
+ D as formatShortDate,
33
+ h as isAfterDate,
34
+ u as localTz,
35
+ s as locale,
36
+ f as timezone
16
37
  };
@@ -0,0 +1,4 @@
1
+ const n = () => window.location.hostname.split(".")[2];
2
+ export {
3
+ n as getEnvironmentPrefix
4
+ };
@@ -1,15 +1,26 @@
1
- const o = (e) => e.map((a) => a.format ? {
2
- label: `${a.text} | ${a.format.key}=${a.format.value}`,
3
- value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
1
+ const s = (e) => {
2
+ const n = e.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [r] = n, l = {
3
+ text: e.label,
4
+ value: r || ""
5
+ };
6
+ if (n.length >= 2) {
7
+ const [, a, c] = n, o = a.includes("=") ? { key: a.split("=")[0].trim(), value: a.split("=")[1].trim() } : null;
8
+ o ? l.format = o : c || (l.fallback = a), c && (l.fallback = c);
9
+ }
10
+ return l;
11
+ }, f = (e) => e.map((t) => t.format ? {
12
+ label: `${t.text} | ${t.format.key}=${t.format.value}`,
13
+ value: `{{${t.value}|${t.format.key}=${t.format.value}}}`
4
14
  } : {
5
- label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
6
- value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
7
- }), f = () => {
15
+ label: t.fallback ? `${t.text} | ${t.fallback}` : t.text,
16
+ value: t.fallback ? `{{${t.value}|${t.fallback}}}` : `{{${t.value}}}`
17
+ }), u = () => {
8
18
  var e;
9
19
  return ((e = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : e.getAttribute("content")) ?? "";
10
- }, $ = (e = "", a = {}, n = !1) => Object.entries(a).reduce((l, [t, r]) => n && (r === "" || r === null || r === void 0) ? l.replace(`&${t}={${t}}`, "") : l.replace(`{${t}}`, String(r)), e);
20
+ }, $ = (e = "", t = {}, n = !1) => Object.entries(t).reduce((r, [l, a]) => n && (a === "" || a === null || a === void 0) ? r.replace(`&${l}={${l}}`, "") : r.replace(`{${l}}`, String(a)), e);
11
21
  export {
12
- o as dynamicContentToMergeTags,
13
- f as getCsrfToken,
22
+ f as dynamicContentToMergeTags,
23
+ u as getCsrfToken,
24
+ s as mergeTagToDynamicContent,
14
25
  $ as replaceString
15
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.3-beta.d1ff593",
3
+ "version": "1.0.3-beta.d574817",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "guido": {
85
85
  "stripo": {
86
- "version": "2.42.0"
86
+ "version": "2.46.0"
87
87
  }
88
88
  }
89
89
  }