@useinsider/guido 3.22.0-beta.ce512a7 → 3.22.0-beta.d4e1d48

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 (65) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +10 -11
  3. package/dist/components/Guido.vue.js +2 -2
  4. package/dist/components/Guido.vue2.js +106 -117
  5. package/dist/components/organisms/AutoSaveController.vue2.js +10 -20
  6. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  7. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  9. package/dist/components/organisms/header/EditorActions.vue2.js +73 -58
  10. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  11. package/dist/components/organisms/header/HeaderWrapper.vue2.js +17 -9
  12. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  13. package/dist/components/organisms/header/LeftSlot.vue2.js +23 -28
  14. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  15. package/dist/components/organisms/header/MiddleSlot.vue2.js +7 -8
  16. package/dist/components/organisms/header/RightSlot.vue.js +10 -11
  17. package/dist/components/organisms/header/RightSlot.vue2.js +18 -13
  18. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +12 -12
  19. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +35 -60
  20. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +11 -11
  21. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  22. package/dist/composables/useCustomInterfaceAppearance.js +41 -42
  23. package/dist/config/i18n/en/labels.json.js +4 -36
  24. package/dist/config/i18n/en/tooltips.json.js +1 -2
  25. package/dist/guido.css +1 -1
  26. package/dist/sprite.svg +0 -10
  27. package/dist/src/@types/config/schemas.d.ts +0 -2
  28. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +1 -19
  29. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +19 -1
  30. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +19 -1
  31. package/dist/src/composables/useActionsApi.d.ts +2 -2
  32. package/dist/src/composables/useConfig.d.ts +0 -2
  33. package/dist/src/stores/autosave.d.ts +1 -73
  34. package/dist/src/stores/config.d.ts +0 -20
  35. package/dist/src/stores/editor.d.ts +0 -109
  36. package/dist/src/stores/onboarding.d.ts +33 -964
  37. package/dist/src/stores/unsubscribe.d.ts +10 -0
  38. package/dist/src/stores/version-history.d.ts +1 -1
  39. package/dist/src/utils/templatePreparation.d.ts +1 -1
  40. package/dist/src/utils/timeUtil.d.ts +8 -5
  41. package/dist/static/styles/variables.css.js +0 -2
  42. package/dist/stores/autosave.js +7 -12
  43. package/dist/stores/editor.js +3 -8
  44. package/dist/stores/onboarding.js +22 -48
  45. package/dist/stores/unsubscribe.js +33 -29
  46. package/dist/utils/timeUtil.js +17 -6
  47. package/package.json +1 -1
  48. package/dist/components/organisms/header/AutoSaveStatus.vue.js +0 -17
  49. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +0 -25
  50. package/dist/components/organisms/header/EditorActionsMenu.vue.js +0 -20
  51. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +0 -99
  52. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +0 -18
  53. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +0 -37
  54. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +0 -22
  55. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +0 -48
  56. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +0 -19
  57. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +0 -90
  58. package/dist/composables/useAccessibilityApi.js +0 -51
  59. package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +0 -2
  60. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +0 -2
  61. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +0 -2
  62. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +0 -2
  63. package/dist/src/composables/useAccessibilityApi.d.ts +0 -13
  64. package/dist/static/styles/components/accessibility.css.js +0 -234
  65. /package/dist/src/components/organisms/header/{AutoSaveStatus.vue.d.ts → AutoSaveToggle.vue.d.ts} +0 -0
@@ -26,6 +26,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
26
26
  createdAt: string;
27
27
  updatedAt: string;
28
28
  status: number;
29
+ isDefault?: boolean | undefined;
29
30
  }[];
30
31
  selectedTemplates: Record<number, number>;
31
32
  selectedUnsubscribePages: number[];
@@ -51,6 +52,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
51
52
  createdAt: string;
52
53
  updatedAt: string;
53
54
  status: number;
55
+ isDefault?: boolean | undefined;
54
56
  }[];
55
57
  selectedTemplates: Record<number, number>;
56
58
  selectedUnsubscribePages: number[];
@@ -76,6 +78,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
76
78
  createdAt: string;
77
79
  updatedAt: string;
78
80
  status: number;
81
+ isDefault?: boolean | undefined;
79
82
  }[];
80
83
  selectedTemplates: Record<number, number>;
81
84
  selectedUnsubscribePages: number[];
@@ -99,6 +102,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
99
102
  createdAt: string;
100
103
  updatedAt: string;
101
104
  status: number;
105
+ isDefault?: boolean | undefined;
102
106
  }[];
103
107
  getThumbnailByTemplateId: (state: {
104
108
  templates: {
@@ -113,6 +117,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
113
117
  createdAt: string;
114
118
  updatedAt: string;
115
119
  status: number;
120
+ isDefault?: boolean | undefined;
116
121
  }[];
117
122
  selectedTemplates: Record<number, number>;
118
123
  selectedUnsubscribePages: number[];
@@ -138,6 +143,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
138
143
  createdAt: string;
139
144
  updatedAt: string;
140
145
  status: number;
146
+ isDefault?: boolean | undefined;
141
147
  }[];
142
148
  selectedTemplates: Record<number, number>;
143
149
  selectedUnsubscribePages: number[];
@@ -163,6 +169,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
163
169
  createdAt: string;
164
170
  updatedAt: string;
165
171
  status: number;
172
+ isDefault?: boolean | undefined;
166
173
  }[];
167
174
  selectedTemplates: Record<number, number>;
168
175
  selectedUnsubscribePages: number[];
@@ -188,6 +195,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
188
195
  createdAt: string;
189
196
  updatedAt: string;
190
197
  status: number;
198
+ isDefault?: boolean | undefined;
191
199
  }[];
192
200
  selectedTemplates: Record<number, number>;
193
201
  selectedUnsubscribePages: number[];
@@ -213,6 +221,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
213
221
  createdAt: string;
214
222
  updatedAt: string;
215
223
  status: number;
224
+ isDefault?: boolean | undefined;
216
225
  }[];
217
226
  selectedTemplates: Record<number, number>;
218
227
  selectedUnsubscribePages: number[];
@@ -238,6 +247,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
238
247
  createdAt: string;
239
248
  updatedAt: string;
240
249
  status: number;
250
+ isDefault?: boolean | undefined;
241
251
  }[];
242
252
  selectedTemplates: Record<number, number>;
243
253
  selectedUnsubscribePages: number[];
@@ -1,4 +1,4 @@
1
- import type { VersionHistoryState } from '@@/Types/api/version-history-api';
1
+ import type { VersionHistoryState } from '@@/Types/version-history-api';
2
2
  export interface StoreState extends VersionHistoryState {
3
3
  editorVisualMode: 'desktop' | 'mobile';
4
4
  }
@@ -1,4 +1,4 @@
1
- import type { TemplateData } from '@@/Types/api/actions-api';
1
+ import type { TemplateData } from '@@/Types/actions-api';
2
2
  import type { SavedTemplateDetails } from '@@/Types/stripo';
3
3
  /**
4
4
  * Collects every unsubscribe page id referenced by the unsubscribe blocks
@@ -1,5 +1,8 @@
1
- export declare const autoSaveTimestamp: (date: Date, now?: Date) => {
2
- isToday: boolean;
3
- time: string;
4
- date: string;
5
- };
1
+ /**
2
+ * Formats a Date as local time in 24-hour format.
3
+ * Pass `useTimezone = true` to append the UTC offset and city name — useful when the
4
+ * timestamp must clearly communicate the client's timezone.
5
+ * @example formatLocalTime(date) -> 12:20:02
6
+ * @example formatLocalTime(date, true) -> 12:20:02 (UTC+3 Istanbul)
7
+ */
8
+ export declare const formatLocalTime: (date: Date, useTimezone?: boolean) => string;
@@ -14,10 +14,8 @@ const o = `:host {
14
14
  --guido-color-gray-0: #F9F9F9;
15
15
  --guido-color-neutral-800: #222938;
16
16
  --guido-color-neutral-700: #2C3546;
17
- --guido-color-neutral-500: #5D6980;
18
17
  --guido-color-neutral-200: #DCDFE6;
19
18
  --guido-color-neutral-100: #EFF2F4;
20
- --guido-color-warning-500: #FFBF00;
21
19
  --guido-color-danger-300: #e84342;
22
20
  --guido-color-danger-500: #DC2A2A;
23
21
  --guido-box-shadow: 0 4px 12px 0 rgba(44,53,70,0.15);
@@ -1,22 +1,17 @@
1
- import { defineStore as e } from "pinia";
2
- const s = {
1
+ import { defineStore as t } from "pinia";
2
+ const e = {
3
3
  IDLE: "idle",
4
4
  SAVING: "saving",
5
5
  SAVED: "saved",
6
6
  ERROR: "error"
7
- }, S = e("guidoAutosave", {
7
+ }, o = t("guidoAutosave", {
8
8
  state: () => ({
9
9
  isOn: !0,
10
10
  lastSavedAt: null,
11
- status: s.IDLE
12
- }),
13
- getters: {
14
- // Whether the header actually renders autosave text: the divider beside it must not be
15
- // left hanging over empty space when it does not.
16
- hasStatusLabel: (t) => t.status === s.SAVING || t.status === s.SAVED && t.lastSavedAt !== null
17
- }
11
+ status: e.IDLE
12
+ })
18
13
  });
19
14
  export {
20
- s as AUTOSAVE_STATUS,
21
- S as useAutosaveStore
15
+ e as AUTOSAVE_STATUS,
16
+ o as useAutosaveStore
22
17
  };
@@ -6,9 +6,6 @@ const o = e("guidoEditor", {
6
6
  isSaveAsTemplateDrawerOpen: !1,
7
7
  isVersionHistoryOpen: !1,
8
8
  isPreviewModeOpen: !1,
9
- isAccessibilityTestingOpen: !1,
10
- imagesHidden: !1,
11
- colorVisionDeficiency: "",
12
9
  editorVisualMode: "desktop",
13
10
  hasChanges: !1,
14
11
  // Bumped on every Stripo document change. `hasChanges` is a latch that stays
@@ -24,21 +21,19 @@ const o = e("guidoEditor", {
24
21
  }),
25
22
  getters: {
26
23
  // Middle Slot
27
- isEditorToolbarVisible: (i) => !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isAccessibilityTestingOpen,
24
+ isEditorToolbarVisible: (i) => !i.isVersionHistoryOpen && !i.isPreviewModeOpen,
28
25
  isUndoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
29
26
  isRedoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
30
27
  isCodeEditorButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
31
28
  isPreviewButtonDisabled: (i) => i.loadingStatus,
32
29
  isViewOptionsDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
33
30
  // Right Slot
34
- isNormalMode: (i) => !i.isVersionHistoryOpen && !i.isAccessibilityTestingOpen,
35
31
  isVersionHistoryButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
36
32
  isExportButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
37
33
  isSaveAsButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
38
34
  isTestButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
39
- isSaveButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen || i.isPreviewModeOpen || i.isAccessibilityTestingOpen,
40
- // Accessibility Test is absent on purpose: it only simulates, but its Apply / Auto-tune
41
- // edit the document, so pausing autosave there would lose those fixes.
35
+ isSaveButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen || i.isPreviewModeOpen,
36
+ // Autosave
42
37
  isInSaveableState: (i) => !i.loadingStatus && !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isCodeEditorOpen
43
38
  }
44
39
  });
@@ -1,26 +1,23 @@
1
- import { useOnboardingApi as t } from "../services/onboardingApi.js";
1
+ import { useOnboardingApi as e } from "../services/onboardingApi.js";
2
2
  import { defineStore as s } from "pinia";
3
- const e = () => ({
3
+ const t = () => ({
4
4
  cardIndex: 0,
5
5
  isActive: !1,
6
- config: [],
7
- cardOffset: 0
6
+ config: []
8
7
  }), a = () => ({
9
8
  onboardings: {
10
- newVersionPopup: e(),
11
- genericOnboarding: e(),
12
- textBlockOnboarding: e(),
13
- versionHistoryOnboarding: e(),
14
- ampOnboarding: e(),
15
- itemsOnboarding: e(),
16
- editorTabBarOnboarding: e(),
17
- recommendationStrategyOnboarding: e(),
18
- recommendationLegacyStrategyOnboarding: e()
9
+ newVersionPopup: t(),
10
+ genericOnboarding: t(),
11
+ textBlockOnboarding: t(),
12
+ versionHistoryOnboarding: t(),
13
+ ampOnboarding: t(),
14
+ itemsOnboarding: t(),
15
+ recommendationStrategyOnboarding: t(),
16
+ recommendationLegacyStrategyOnboarding: t()
19
17
  },
20
18
  userModalState: {},
21
- isFetched: !1,
22
- closedThisSession: []
23
- }), g = s("guidoOnboarding", {
19
+ isFetched: !1
20
+ }), c = s("guidoOnboarding", {
24
21
  state: () => a(),
25
22
  getters: {
26
23
  /** @deprecated Components use the type-specific getters. Slated for deletion, see the SD-667788 dead-code ledger. */
@@ -51,14 +48,6 @@ const e = () => ({
51
48
  const { itemsOnboarding: o } = n.onboardings;
52
49
  return o.config[o.cardIndex];
53
50
  },
54
- getEditorTabBarCurrentCard: (n) => {
55
- const { editorTabBarOnboarding: o } = n.onboardings;
56
- return o.config[o.cardIndex];
57
- },
58
- isEditorActionsMenuPinned: (n) => {
59
- const { editorTabBarOnboarding: o } = n.onboardings, i = o.config[o.cardIndex];
60
- return o.isActive && !!(i != null && i.pinsMenu);
61
- },
62
51
  getRecommendationStrategyCurrentCard: (n) => {
63
52
  const { recommendationStrategyOnboarding: o } = n.onboardings;
64
53
  return o.config[o.cardIndex];
@@ -76,10 +65,7 @@ const e = () => ({
76
65
  closeOtherOnboardings(n) {
77
66
  Object.keys(this.onboardings).forEach((o) => {
78
67
  const i = o;
79
- if (i !== n && this.onboardings[i].isActive) {
80
- const r = this.onboardings[i];
81
- r.cardOffset += r.cardIndex, r.isActive = !1, r.cardIndex = 0, r.config = [];
82
- }
68
+ i !== n && this.onboardings[i].isActive && (this.onboardings[i].isActive = !1, this.onboardings[i].cardIndex = 0, this.onboardings[i].config = []);
83
69
  });
84
70
  },
85
71
  start(n) {
@@ -88,16 +74,8 @@ const e = () => ({
88
74
  startOnboarding(n) {
89
75
  this.shouldShowOnboarding(n) && !this.isActive(n) && this.start(n);
90
76
  },
91
- closeForSession(n) {
92
- this.closedThisSession.includes(n) || this.closedThisSession.push(n), this.onboardings[n].isActive = !1, this.onboardings[n].cardIndex = 0, this.onboardings[n].config = [], this.onboardings[n].cardOffset = 0;
93
- },
94
77
  async close(n) {
95
- this.closeForSession(n);
96
- try {
97
- await this.setUserModalState(n, "true", "Guido");
98
- } catch (o) {
99
- console.warn("guido:onboarding:close-not-persisted", n, o);
100
- }
78
+ await this.setUserModalState(n, "true", "Guido"), this.onboardings[n].isActive = !1, this.onboardings[n].cardIndex = 0, this.onboardings[n].config = [];
101
79
  },
102
80
  next(n) {
103
81
  this.onboardings[n].cardIndex < this.onboardings[n].config.length - 1 && this.onboardings[n].cardIndex++;
@@ -110,16 +88,11 @@ const e = () => ({
110
88
  const r = this.onboardings[n].config[o];
111
89
  r && (r.top = i.top, r.position = i.position);
112
90
  },
113
- // InOnboard always opens on its first slide, so a tour re-installing its config after a
114
- // Guido remount has to come back to the first card or the two point at different ones.
115
- resetCardIndex(n) {
116
- this.onboardings[n].cardIndex = 0;
117
- },
118
- setConfig(n, o, i = 0) {
119
- this.onboardings[n].config = o ?? [], this.onboardings[n].cardOffset = i, this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
91
+ setConfig(n, o) {
92
+ this.onboardings[n].config = o ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
120
93
  },
121
94
  async onDiscoverNowClicked() {
122
- this.start("genericOnboarding"), await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido");
95
+ await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido"), this.start("genericOnboarding");
123
96
  },
124
97
  onRemindMeLater() {
125
98
  sessionStorage.setItem("newVersionPopupDismissed", "true");
@@ -127,13 +100,14 @@ const e = () => ({
127
100
  async onNewVersionPopupClose() {
128
101
  await this.setUserModalState("newVersionPopup", "true", "Guido");
129
102
  },
103
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
130
104
  isOnboardingActive() {
131
105
  return Object.values(this.onboardings).some((n) => n.isActive);
132
106
  },
133
107
  async fetchUserModalState() {
134
108
  if (this.isFetched)
135
109
  return;
136
- const { fetchUserModalState: n } = t();
110
+ const { fetchUserModalState: n } = e();
137
111
  try {
138
112
  const o = await n();
139
113
  this.userModalState = o, this.isFetched = !0;
@@ -141,11 +115,11 @@ const e = () => ({
141
115
  }
142
116
  },
143
117
  async setUserModalState(n, o, i) {
144
- const { setUserModalState: r } = t();
118
+ const { setUserModalState: r } = e();
145
119
  await r(n, o, i), this.isFetched = !1, await this.fetchUserModalState();
146
120
  }
147
121
  }
148
122
  });
149
123
  export {
150
- g as useOnboardingStore
124
+ c as useOnboardingStore
151
125
  };
@@ -1,23 +1,27 @@
1
- import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
1
+ import { TYPE_COLLECTIONS as c, PAGE_TYPES as r } from "../enums/unsubscribe.js";
2
2
  import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
3
3
  import { defineStore as u } from "pinia";
4
- let o = null;
5
- const r = () => ({
4
+ let a = null;
5
+ const p = () => ({
6
6
  templates: [],
7
7
  selectedTemplates: {},
8
8
  selectedUnsubscribePages: [],
9
- selectedCollectionType: p.GLOBAL_UNSUBSCRIBE,
10
- activeType: p.GLOBAL_UNSUBSCRIBE,
9
+ selectedCollectionType: r.GLOBAL_UNSUBSCRIBE,
10
+ activeType: r.GLOBAL_UNSUBSCRIBE,
11
11
  pageSelectionUpdateStatus: !1,
12
12
  pageSelectionDrawerStatus: !1,
13
13
  typeSelectionDrawerStatus: !1,
14
14
  isGlobalUnsubscribeDisabled: !1,
15
15
  isSubscriptionPreferencesCenterDisabled: !1,
16
16
  pendingBlockId: null
17
- }), b = u("guidoUnsubscribe", {
18
- state: () => r(),
17
+ });
18
+ function h(e) {
19
+ return [...e].sort((t, l) => +!!l.isDefault - +!!t.isDefault);
20
+ }
21
+ const f = u("guidoUnsubscribe", {
22
+ state: () => p(),
19
23
  getters: {
20
- getSelectedCollection: (e) => i[e.selectedCollectionType],
24
+ getSelectedCollection: (e) => c[e.selectedCollectionType],
21
25
  getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
22
26
  getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
23
27
  getThumbnailByTemplateId: (e) => (t) => {
@@ -25,31 +29,31 @@ const r = () => ({
25
29
  return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
26
30
  },
27
31
  getSelectedUnsubscribePagesByCollection: (e) => (t) => {
28
- const l = i[t];
32
+ const l = c[t];
29
33
  if (!l)
30
34
  return [];
31
35
  const s = /* @__PURE__ */ new Map();
32
36
  e.templates.forEach((n) => {
33
37
  s.set(n.id, n.type);
34
38
  });
35
- const c = new Set(l);
39
+ const i = new Set(l);
36
40
  return e.selectedUnsubscribePages.filter((n) => {
37
- const a = s.get(n);
38
- return a !== void 0 && c.has(a);
41
+ const o = s.get(n);
42
+ return o !== void 0 && i.has(o);
39
43
  });
40
44
  },
41
45
  isActiveTypeFirstInCollection: (e) => {
42
- const t = i[e.selectedCollectionType] ?? [];
46
+ const t = c[e.selectedCollectionType] ?? [];
43
47
  return e.activeType === t[0];
44
48
  },
45
49
  isActiveTypeLastInCollection: (e) => {
46
- const t = i[e.selectedCollectionType] ?? [];
50
+ const t = c[e.selectedCollectionType] ?? [];
47
51
  return e.activeType === t[t.length - 1];
48
52
  },
49
53
  hasTemplatesByCollectionType: (e) => {
50
54
  const t = {};
51
- return (i[e.selectedCollectionType] ?? []).forEach((s) => {
52
- t[s] = e.templates.some((c) => c.type === s);
55
+ return (c[e.selectedCollectionType] ?? []).forEach((s) => {
56
+ t[s] = e.templates.some((i) => i.type === s);
53
57
  }), t;
54
58
  },
55
59
  unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
@@ -58,36 +62,36 @@ const r = () => ({
58
62
  $reset() {
59
63
  const { templates: e, selectedUnsubscribePages: t } = this;
60
64
  Object.assign(this, {
61
- ...r(),
65
+ ...p(),
62
66
  templates: e,
63
67
  selectedUnsubscribePages: t
64
68
  });
65
69
  },
66
70
  async fetchTemplates(e = !1) {
67
- !e && this.templates.length || ((e || !o) && (o = (async () => {
71
+ !e && this.templates.length || ((e || !a) && (a = (async () => {
68
72
  const { getUnsubscribePages: t } = d();
69
- this.templates = await t();
73
+ this.templates = h(await t());
70
74
  })().finally(() => {
71
- o = null;
72
- })), await o);
75
+ a = null;
76
+ })), await a);
73
77
  },
74
78
  setCollection(e) {
75
79
  this.selectedCollectionType = e;
76
- const t = i[e];
80
+ const t = c[e];
77
81
  if (t && t.length > 0) {
78
82
  [this.activeType] = t;
79
83
  const l = { ...this.selectedTemplates };
80
84
  t.forEach((s) => {
81
85
  if (!l[s]) {
82
- const c = this.templates.find((n) => n.type === s);
83
- c && (l[s] = c.id);
86
+ const i = this.templates.filter((o) => o.type === s), n = i.find((o) => o.isDefault) ?? i[0];
87
+ n && (l[s] = n.id);
84
88
  }
85
89
  }), this.selectedTemplates = l;
86
90
  }
87
91
  },
88
92
  setCollectionWithoutAutoSelection(e) {
89
93
  this.selectedCollectionType = e;
90
- const t = i[e];
94
+ const t = c[e];
91
95
  t && t.length > 0 && ([this.activeType] = t);
92
96
  },
93
97
  setSelectedTemplate(e) {
@@ -107,12 +111,12 @@ const r = () => ({
107
111
  loadSelectedTemplates(e) {
108
112
  const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
109
113
  e.forEach((s) => {
110
- const c = t.get(s);
111
- c !== void 0 && (l[c] = s);
114
+ const i = t.get(s);
115
+ i !== void 0 && (l[i] = s);
112
116
  }), this.selectedTemplates = l;
113
117
  },
114
118
  getSelectedTemplatesByCollection(e) {
115
- const t = i[e], l = [];
119
+ const t = c[e], l = [];
116
120
  return t.forEach((s) => {
117
121
  this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
118
122
  }), l;
@@ -129,5 +133,5 @@ const r = () => ({
129
133
  }
130
134
  });
131
135
  export {
132
- b as useUnsubscribeStore
136
+ f as useUnsubscribeStore
133
137
  };
@@ -1,8 +1,19 @@
1
- const g = (t) => String(t).padStart(2, "0"), a = (t, e) => t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate(), o = (t, e = /* @__PURE__ */ new Date()) => ({
2
- isToday: a(t, e),
3
- time: `${g(t.getHours())}:${g(t.getMinutes())}`,
4
- date: `${g(t.getDate())}.${g(t.getMonth() + 1)}.${t.getFullYear()}`
5
- });
1
+ const r = (t) => {
2
+ const e = -t.getTimezoneOffset(), o = e >= 0 ? "+" : "-", n = Math.abs(e), s = Math.floor(n / 60), i = n % 60;
3
+ return i === 0 ? `UTC${o}${s}` : `UTC${o}${s}:${String(i).padStart(2, "0")}`;
4
+ }, a = () => {
5
+ var e;
6
+ const { timeZone: t } = new Intl.DateTimeFormat().resolvedOptions();
7
+ return ((e = t.split("/").pop()) == null ? void 0 : e.replace(/_/g, " ")) ?? t;
8
+ }, c = (t, e = !1) => {
9
+ const o = t.toLocaleTimeString([], {
10
+ hour: "2-digit",
11
+ hour12: !1,
12
+ minute: "2-digit",
13
+ second: "2-digit"
14
+ });
15
+ return e ? `${o} (${r(t)} ${a()})` : o;
16
+ };
6
17
  export {
7
- o as autoSaveTimestamp
18
+ c as formatLocalTime
8
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.22.0-beta.ce512a7",
3
+ "version": "3.22.0-beta.d4e1d48",
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",
@@ -1,17 +0,0 @@
1
- import t from "./AutoSaveStatus.vue2.js";
2
- import r from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var _ = function() {
4
- var s = this, e = s._self._c, a = s._self._setupProxy;
5
- return a.isFeatureEnabled("autosave") ? e("div", { staticClass: "d-f a-i-c auto-save-status" }, [a.autosaveStore.status === a.AUTOSAVE_STATUS.SAVING ? e("span", { staticClass: "d-f a-i-c f-s-1" }, [e(a.InLoading, { attrs: { "color-class": "i-c-53", size: "16" } }), e("span", { staticClass: "ml-1 t-c-53" }, [s._v(s._s(a.trans("newsletter.saving")))])], 1) : a.savedLabel ? e("span", { staticClass: "f-s-1 t-c-53" }, [s._v(s._s(a.savedLabel.before)), a.savedLabel.word ? e("span", { staticClass: "f-w-600" }, [s._v(s._s(a.savedLabel.word))]) : s._e(), s._v(s._s(a.savedLabel.after))]) : s._e()]) : s._e();
6
- }, n = [], o = /* @__PURE__ */ r(
7
- t,
8
- _,
9
- n,
10
- !1,
11
- null,
12
- null
13
- );
14
- const v = o.exports;
15
- export {
16
- v as default
17
- };
@@ -1,25 +0,0 @@
1
- import { defineComponent as p, computed as S } from "vue";
2
- import { useConfig as A } from "../../../composables/useConfig.js";
3
- import { useTranslations as T } from "../../../composables/useTranslations.js";
4
- import { useAutosaveStore as v, AUTOSAVE_STATUS as m } from "../../../stores/autosave.js";
5
- import { autoSaveTimestamp as b } from "../../../utils/timeUtil.js";
6
- import { InLoading as D } from "@useinsider/design-system-vue";
7
- const j = /* @__PURE__ */ p({
8
- __name: "AutoSaveStatus",
9
- setup(O) {
10
- const { isFeatureEnabled: u } = A(), a = v(), n = T(), t = "__BOLD_START__", o = "__BOLD_END__", s = (i) => i.split(t).join("").split(o).join(""), _ = S(() => {
11
- if (a.status !== m.SAVED || !a.lastSavedAt)
12
- return null;
13
- const { isToday: i, time: c, date: f } = b(a.lastSavedAt), l = { boldStart: t, boldEnd: o }, e = i ? n("email-editor.autosaved-at-today", { ...l, time: c }) : n("email-editor.autosaved-at-date", { ...l, date: f }), r = e.indexOf(t), d = e.indexOf(o, r + t.length);
14
- return r === -1 || d === -1 ? { before: s(e), word: "", after: "" } : {
15
- before: s(e.slice(0, r)),
16
- word: s(e.slice(r + t.length, d)),
17
- after: s(e.slice(d + o.length))
18
- };
19
- });
20
- return { __sfc: !0, isFeatureEnabled: u, autosaveStore: a, trans: n, BOLD_START: t, BOLD_END: o, stripMarkers: s, savedLabel: _, AUTOSAVE_STATUS: m, InLoading: D };
21
- }
22
- });
23
- export {
24
- j as default
25
- };
@@ -1,20 +0,0 @@
1
- import i from "./EditorActionsMenu.vue2.js";
2
- /* empty css */
3
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
5
- var e = this, o = e._self._c, t = e._self._setupProxy;
6
- return o("div", { staticClass: "editor-actions-menu p-r" }, [o(t.InButtonV2, { attrs: { id: "guido__kebab-button", "data-testid": "Editor Actions Menu", "left-icon": "line-more-vertical", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.loadingStatus, "label-text-status": !1, "selected-status": t.isPanelOpen, "tooltip-options": t.getTooltipOptions("guido__kebab-button"), "tooltip-text": t.trans("email-editor.more-actions") }, on: { click: function(d) {
7
- t.isOpen = !t.isOpen;
8
- } } }), o(t.InDropdownMenu, { staticClass: "editor-actions-menu__dropdown", attrs: { id: "guido__kebab-menu", "box-width": "basedOnLongestItem", "static-position": "bottom right", "dynamic-position": !1, "max-height": 400, options: t.options, "select-all-option-status": !1, status: t.isPanelOpen }, on: { clickOutside: t.close, optionClick: t.handleOptionClick } })], 1);
9
- }, a = [], r = /* @__PURE__ */ s(
10
- i,
11
- n,
12
- a,
13
- !1,
14
- null,
15
- "bdb3b37a"
16
- );
17
- const _ = r.exports;
18
- export {
19
- _ as default
20
- };