@n8n/stores 2.33.0 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cloudPlan.store.cjs +5 -241
- package/dist/cloudPlan.store.d.cts +6 -0
- package/dist/cloudPlan.store.d.mts +72 -66
- package/dist/cloudPlan.store.mjs +5 -241
- package/dist/cloudPlan2.store.cjs +247 -0
- package/dist/cloudPlan2.store.cjs.map +1 -0
- package/dist/cloudPlan2.store.mjs +242 -0
- package/dist/cloudPlan2.store.mjs.map +1 -0
- package/dist/composables/useBasePageRedirectionHelper.cjs +87 -0
- package/dist/composables/useBasePageRedirectionHelper.cjs.map +1 -0
- package/dist/composables/useBasePageRedirectionHelper.d.cts +16 -0
- package/dist/composables/useBasePageRedirectionHelper.d.mts +16 -0
- package/dist/composables/useBasePageRedirectionHelper.mjs +87 -0
- package/dist/composables/useBasePageRedirectionHelper.mjs.map +1 -0
- package/dist/constants2.cjs +1 -0
- package/dist/constants2.cjs.map +1 -1
- package/dist/constants2.d.cts +1 -0
- package/dist/constants2.d.mts +1 -0
- package/dist/constants2.mjs +1 -0
- package/dist/constants2.mjs.map +1 -1
- package/dist/notifications.store.cjs +2 -8
- package/dist/notifications.store.cjs.map +1 -1
- package/dist/notifications.store.d.cts +3 -24
- package/dist/notifications.store.d.mts +3 -24
- package/dist/notifications.store.mjs +2 -8
- package/dist/notifications.store.mjs.map +1 -1
- package/dist/pageRedirection.d.cts +6 -0
- package/dist/pageRedirection.d.mts +6 -0
- package/dist/rbac.store.d.cts +123 -123
- package/dist/rbac.store.d.mts +123 -123
- package/dist/roles.store.d.cts +21 -21
- package/dist/roles.store.d.mts +19 -19
- package/dist/settings.store.d.cts +243 -237
- package/dist/settings.store.d.mts +243 -237
- package/dist/settings2.store.cjs +5 -5
- package/dist/settings2.store.cjs.map +1 -1
- package/dist/settings2.store.mjs +5 -5
- package/dist/settings2.store.mjs.map +1 -1
- package/dist/types/pageRedirection.cjs +0 -0
- package/dist/types/pageRedirection.d.cts +2 -0
- package/dist/types/pageRedirection.d.mts +2 -0
- package/dist/types/pageRedirection.mjs +1 -0
- package/dist/useAgentRequestStore.d.mts +6 -6
- package/dist/useRootStore.d.cts +72 -72
- package/dist/useRootStore.d.mts +70 -70
- package/dist/users.store.cjs +7 -352
- package/dist/users.store.d.cts +67 -55
- package/dist/users.store.d.mts +69 -57
- package/dist/users.store.mjs +7 -349
- package/dist/users2.store.cjs +362 -0
- package/dist/users2.store.cjs.map +1 -0
- package/dist/users2.store.mjs +353 -0
- package/dist/users2.store.mjs.map +1 -0
- package/dist/versions.store.cjs +11 -0
- package/dist/versions.store.d.cts +384 -0
- package/dist/versions.store.d.mts +384 -0
- package/dist/versions.store.mjs +10 -0
- package/dist/versions2.store.cjs +230 -0
- package/dist/versions2.store.cjs.map +1 -0
- package/dist/versions2.store.mjs +218 -0
- package/dist/versions2.store.mjs.map +1 -0
- package/package.json +14 -13
- package/dist/cloudPlan.store.cjs.map +0 -1
- package/dist/cloudPlan.store.mjs.map +0 -1
- package/dist/users.store.cjs.map +0 -1
- package/dist/users.store.mjs.map +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { t as STORES } from "./constants2.mjs";
|
|
2
|
+
import { t as useRootStore } from "./useRootStore2.mjs";
|
|
3
|
+
import { t as useSettingsStore } from "./settings2.store.mjs";
|
|
4
|
+
import { t as useUsersStore } from "./users2.store.mjs";
|
|
5
|
+
import { defineStore } from "pinia";
|
|
6
|
+
import { computed, ref } from "vue";
|
|
7
|
+
import { jsonParse } from "n8n-workflow";
|
|
8
|
+
import { useStorage } from "@n8n/composables/useStorage";
|
|
9
|
+
import { useTelemetry } from "@n8n/composables/useTelemetry";
|
|
10
|
+
import { useToast } from "@n8n/composables/useToast";
|
|
11
|
+
import { LOCAL_STORAGE_DISMISSED_WHATS_NEW_CALLOUT, LOCAL_STORAGE_READ_WHATS_NEW_ARTICLES, VERSIONS_MODAL_KEY, WHATS_NEW_MODAL_KEY } from "@n8n/frontend-constants/versions";
|
|
12
|
+
import * as versionsApi from "@n8n/rest-api-client/api/versions";
|
|
13
|
+
|
|
14
|
+
//#region src/versions.store.ts
|
|
15
|
+
/**
|
|
16
|
+
* Semantic versioning 2.0.0, Regex from https://semver.org/
|
|
17
|
+
* Capture groups: major, minor, patch, prerelease, buildmetadata
|
|
18
|
+
*/
|
|
19
|
+
const SEMVER_REGEX = /^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
20
|
+
const useVersionsStore = defineStore(STORES.VERSIONS, () => {
|
|
21
|
+
const versionNotificationSettings = ref({
|
|
22
|
+
enabled: false,
|
|
23
|
+
whatsNewEnabled: false,
|
|
24
|
+
endpoint: "",
|
|
25
|
+
whatsNewEndpoint: "",
|
|
26
|
+
infoUrl: ""
|
|
27
|
+
});
|
|
28
|
+
const nextVersions = ref([]);
|
|
29
|
+
const currentVersion = ref();
|
|
30
|
+
const whatsNew = ref({
|
|
31
|
+
title: "",
|
|
32
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
33
|
+
updatedAt: null,
|
|
34
|
+
calloutText: "",
|
|
35
|
+
footer: "",
|
|
36
|
+
items: []
|
|
37
|
+
});
|
|
38
|
+
const whatsNewCallout = ref();
|
|
39
|
+
const telemetry = useTelemetry();
|
|
40
|
+
const { showToast, showMessage } = useToast();
|
|
41
|
+
const settingsStore = useSettingsStore();
|
|
42
|
+
const usersStore = useUsersStore();
|
|
43
|
+
const warnModalOpenerMissing = (action) => {
|
|
44
|
+
if (import.meta.env.DEV) console.warn(`[versions.store] ${action} called before modal openers were registered; ignoring. Call registerModalOpeners() at app bootstrap.`);
|
|
45
|
+
};
|
|
46
|
+
const modalOpeners = ref({
|
|
47
|
+
openModal: (name) => warnModalOpenerMissing(`openModal(${String(name)})`),
|
|
48
|
+
openModalWithData: (payload) => warnModalOpenerMissing(`openModalWithData(${String(payload.name)})`)
|
|
49
|
+
});
|
|
50
|
+
const registerModalOpeners = (openers) => {
|
|
51
|
+
modalOpeners.value = openers;
|
|
52
|
+
};
|
|
53
|
+
const readWhatsNewArticlesStorage = useStorage(LOCAL_STORAGE_READ_WHATS_NEW_ARTICLES);
|
|
54
|
+
const lastDismissedWhatsNewCalloutStorage = useStorage(LOCAL_STORAGE_DISMISSED_WHATS_NEW_CALLOUT);
|
|
55
|
+
const hasVersionUpdates = computed(() => {
|
|
56
|
+
return settingsStore.settings.releaseChannel === "stable" && nextVersions.value.length > 0;
|
|
57
|
+
});
|
|
58
|
+
const hasSignificantUpdates = computed(() => {
|
|
59
|
+
if (!hasVersionUpdates.value || !currentVersion.value || !latestVersion.value) return false;
|
|
60
|
+
if (currentVersion.value.hasSecurityIssue) return true;
|
|
61
|
+
const current = currentVersion.value.name.match(SEMVER_REGEX);
|
|
62
|
+
const latest = latestVersion.value.name.match(SEMVER_REGEX);
|
|
63
|
+
if (!current?.groups || !latest?.groups) return false;
|
|
64
|
+
if (Number(current.groups.major) !== Number(latest.groups.major)) return true;
|
|
65
|
+
const currentMinor = Number(current.groups.minor);
|
|
66
|
+
return Number(latest.groups.minor) - currentMinor >= 2;
|
|
67
|
+
});
|
|
68
|
+
const latestVersion = computed(() => {
|
|
69
|
+
return nextVersions.value[0] ?? currentVersion.value;
|
|
70
|
+
});
|
|
71
|
+
const areNotificationsEnabled = computed(() => {
|
|
72
|
+
return versionNotificationSettings.value.enabled;
|
|
73
|
+
});
|
|
74
|
+
const infoUrl = computed(() => {
|
|
75
|
+
return versionNotificationSettings.value.infoUrl;
|
|
76
|
+
});
|
|
77
|
+
const readWhatsNewArticles = computed(() => {
|
|
78
|
+
return readWhatsNewArticlesStorage.value ? jsonParse(readWhatsNewArticlesStorage.value, { fallbackValue: [] }) : [];
|
|
79
|
+
});
|
|
80
|
+
const lastDismissedWhatsNewCallout = computed(() => {
|
|
81
|
+
return lastDismissedWhatsNewCalloutStorage.value ? jsonParse(lastDismissedWhatsNewCalloutStorage.value, { fallbackValue: [] }) : [];
|
|
82
|
+
});
|
|
83
|
+
const whatsNewArticles = computed(() => {
|
|
84
|
+
return whatsNew.value.items;
|
|
85
|
+
});
|
|
86
|
+
const fetchVersions = async () => {
|
|
87
|
+
try {
|
|
88
|
+
const { enabled, endpoint } = versionNotificationSettings.value;
|
|
89
|
+
if (enabled && endpoint) {
|
|
90
|
+
const rootStore = useRootStore();
|
|
91
|
+
const current = rootStore.versionCli;
|
|
92
|
+
const instanceId = rootStore.instanceId;
|
|
93
|
+
setVersions({
|
|
94
|
+
versions: await versionsApi.getNextVersions(endpoint, current, instanceId),
|
|
95
|
+
currentVersion: current
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {
|
|
99
|
+
console.error("Failed to fetch versions:", e);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const setVersions = (params) => {
|
|
103
|
+
nextVersions.value = params.versions.filter((v) => v.name !== params.currentVersion);
|
|
104
|
+
currentVersion.value = params.versions.find((v) => v.name === params.currentVersion);
|
|
105
|
+
};
|
|
106
|
+
const setWhatsNew = (section) => {
|
|
107
|
+
whatsNew.value = section;
|
|
108
|
+
};
|
|
109
|
+
const setWhatsNewArticleRead = (articleId) => {
|
|
110
|
+
if (!readWhatsNewArticles.value.includes(articleId)) readWhatsNewArticlesStorage.value = JSON.stringify([...readWhatsNewArticles.value, articleId]);
|
|
111
|
+
};
|
|
112
|
+
const isWhatsNewArticleRead = (articleId) => {
|
|
113
|
+
return readWhatsNewArticles.value.includes(articleId);
|
|
114
|
+
};
|
|
115
|
+
const closeWhatsNewCallout = () => {
|
|
116
|
+
whatsNewCallout.value?.close();
|
|
117
|
+
whatsNewCallout.value = void 0;
|
|
118
|
+
};
|
|
119
|
+
const dismissWhatsNewCallout = () => {
|
|
120
|
+
lastDismissedWhatsNewCalloutStorage.value = JSON.stringify(whatsNewArticles.value.map((item) => item.id));
|
|
121
|
+
};
|
|
122
|
+
const shouldShowWhatsNewCallout = () => {
|
|
123
|
+
const createdAt = usersStore.currentUser?.createdAt;
|
|
124
|
+
let hasNewArticle = false;
|
|
125
|
+
if (createdAt) {
|
|
126
|
+
const userCreatedAt = new Date(createdAt).getTime();
|
|
127
|
+
hasNewArticle = whatsNewArticles.value.some((item) => {
|
|
128
|
+
return (item.updatedAt ? new Date(item.updatedAt).getTime() : 0) > userCreatedAt;
|
|
129
|
+
});
|
|
130
|
+
} else hasNewArticle = true;
|
|
131
|
+
const allArticlesDismissed = whatsNewArticles.value.every((item) => lastDismissedWhatsNewCallout.value.includes(item.id));
|
|
132
|
+
return hasNewArticle && !allArticlesDismissed;
|
|
133
|
+
};
|
|
134
|
+
const fetchWhatsNew = async () => {
|
|
135
|
+
try {
|
|
136
|
+
const { enabled, whatsNewEnabled, whatsNewEndpoint } = versionNotificationSettings.value;
|
|
137
|
+
if (enabled && whatsNewEnabled && whatsNewEndpoint) {
|
|
138
|
+
const rootStore = useRootStore();
|
|
139
|
+
const current = rootStore.versionCli;
|
|
140
|
+
const instanceId = rootStore.instanceId;
|
|
141
|
+
const section = await versionsApi.getWhatsNewSection(whatsNewEndpoint, current, instanceId);
|
|
142
|
+
if (section.items?.length > 0) {
|
|
143
|
+
setWhatsNew(section);
|
|
144
|
+
if (shouldShowWhatsNewCallout()) {
|
|
145
|
+
whatsNewCallout.value = showMessage({
|
|
146
|
+
title: whatsNew.value.title,
|
|
147
|
+
message: whatsNew.value.calloutText,
|
|
148
|
+
duration: 0,
|
|
149
|
+
position: "bottom-left",
|
|
150
|
+
customClass: "clickable whats-new-notification",
|
|
151
|
+
onClick: () => {
|
|
152
|
+
const articleId = whatsNew.value.items[0]?.id ?? 0;
|
|
153
|
+
telemetry.track("User clicked on what's new notification", { article_id: articleId });
|
|
154
|
+
modalOpeners.value.openModalWithData({
|
|
155
|
+
name: WHATS_NEW_MODAL_KEY,
|
|
156
|
+
data: { articleId }
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
dismissWhatsNewCallout();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} catch (e) {
|
|
165
|
+
console.error("Failed to fetch Whats New section:", e);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const initialize = (settings) => {
|
|
169
|
+
versionNotificationSettings.value = settings;
|
|
170
|
+
};
|
|
171
|
+
const checkForNewVersions = async () => {
|
|
172
|
+
if (!areNotificationsEnabled.value) return;
|
|
173
|
+
await Promise.all([fetchVersions(), fetchWhatsNew()]);
|
|
174
|
+
if (currentVersion.value && currentVersion.value.hasSecurityIssue && nextVersions.value.length) {
|
|
175
|
+
const fixVersion = currentVersion.value.securityIssueFixVersion;
|
|
176
|
+
let message = "Please update to latest version.";
|
|
177
|
+
if (fixVersion) message = `Please update to version ${fixVersion} or higher.`;
|
|
178
|
+
message = `${message} <a class="primary-color">More info</a>`;
|
|
179
|
+
showToast({
|
|
180
|
+
title: "Critical update available",
|
|
181
|
+
message,
|
|
182
|
+
onClick: () => {
|
|
183
|
+
modalOpeners.value.openModal(VERSIONS_MODAL_KEY);
|
|
184
|
+
},
|
|
185
|
+
closeOnClick: true,
|
|
186
|
+
customClass: "clickable",
|
|
187
|
+
type: "warning",
|
|
188
|
+
duration: 0
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
return {
|
|
193
|
+
currentVersion,
|
|
194
|
+
latestVersion,
|
|
195
|
+
nextVersions,
|
|
196
|
+
hasVersionUpdates,
|
|
197
|
+
hasSignificantUpdates,
|
|
198
|
+
areNotificationsEnabled,
|
|
199
|
+
infoUrl,
|
|
200
|
+
fetchVersions,
|
|
201
|
+
setVersions,
|
|
202
|
+
initialize,
|
|
203
|
+
registerModalOpeners,
|
|
204
|
+
checkForNewVersions,
|
|
205
|
+
fetchWhatsNew,
|
|
206
|
+
whatsNew,
|
|
207
|
+
whatsNewArticles,
|
|
208
|
+
isWhatsNewArticleRead,
|
|
209
|
+
setWhatsNewArticleRead,
|
|
210
|
+
closeWhatsNewCallout,
|
|
211
|
+
shouldShowWhatsNewCallout,
|
|
212
|
+
dismissWhatsNewCallout
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
//#endregion
|
|
217
|
+
export { useVersionsStore as n, SEMVER_REGEX as t };
|
|
218
|
+
//# sourceMappingURL=versions2.store.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions2.store.mjs","names":[],"sources":["../src/versions.store.ts"],"sourcesContent":["import type { IVersionNotificationSettings } from '@n8n/api-types';\nimport { useStorage } from '@n8n/composables/useStorage';\nimport { useTelemetry } from '@n8n/composables/useTelemetry';\nimport { useToast, type NotificationHandle } from '@n8n/composables/useToast';\nimport {\n\tLOCAL_STORAGE_DISMISSED_WHATS_NEW_CALLOUT,\n\tLOCAL_STORAGE_READ_WHATS_NEW_ARTICLES,\n\tVERSIONS_MODAL_KEY,\n\tWHATS_NEW_MODAL_KEY,\n} from '@n8n/frontend-constants/versions';\nimport * as versionsApi from '@n8n/rest-api-client/api/versions';\nimport type { Version, WhatsNewSection } from '@n8n/rest-api-client/api/versions';\nimport { jsonParse } from 'n8n-workflow';\nimport { defineStore } from 'pinia';\nimport { computed, ref } from 'vue';\n\nimport { STORES } from './constants';\nimport type { ModalOpeners } from './modalOpeners';\nimport { useSettingsStore } from './settings.store';\nimport { useRootStore } from './useRootStore';\nimport { useUsersStore } from './users.store';\n\ntype SetVersionParams = { versions: Version[]; currentVersion: string };\n\n/**\n * Semantic versioning 2.0.0, Regex from https://semver.org/\n * Capture groups: major, minor, patch, prerelease, buildmetadata\n */\nexport const SEMVER_REGEX =\n\t/^(?<major>0|[1-9]\\d*)\\.(?<minor>0|[1-9]\\d*)\\.(?<patch>0|[1-9]\\d*)(?:-(?<prerelease>(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\nexport const useVersionsStore = defineStore(STORES.VERSIONS, () => {\n\tconst versionNotificationSettings = ref<IVersionNotificationSettings>({\n\t\tenabled: false,\n\t\twhatsNewEnabled: false,\n\t\tendpoint: '',\n\t\twhatsNewEndpoint: '',\n\t\tinfoUrl: '',\n\t});\n\tconst nextVersions = ref<Version[]>([]);\n\tconst currentVersion = ref<Version | undefined>();\n\tconst whatsNew = ref<WhatsNewSection>({\n\t\ttitle: '',\n\t\tcreatedAt: new Date().toISOString(),\n\t\tupdatedAt: null,\n\t\tcalloutText: '',\n\t\tfooter: '',\n\t\titems: [],\n\t});\n\tconst whatsNewCallout = ref<NotificationHandle | undefined>();\n\n\tconst telemetry = useTelemetry();\n\tconst { showToast, showMessage } = useToast();\n\tconst settingsStore = useSettingsStore();\n\tconst usersStore = useUsersStore();\n\n\t// Modal-open actions, registered at app bootstrap (see app/init.ts). Until then\n\t// they no-op — warning in dev — so the store never reaches into `ui.store`.\n\tconst warnModalOpenerMissing = (action: string) => {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconsole.warn(\n\t\t\t\t`[versions.store] ${action} called before modal openers were registered; ignoring. Call registerModalOpeners() at app bootstrap.`,\n\t\t\t);\n\t\t}\n\t};\n\tconst modalOpeners = ref<ModalOpeners>({\n\t\topenModal: (name) => warnModalOpenerMissing(`openModal(${String(name)})`),\n\t\topenModalWithData: (payload) =>\n\t\t\twarnModalOpenerMissing(`openModalWithData(${String(payload.name)})`),\n\t});\n\tconst registerModalOpeners = (openers: ModalOpeners) => {\n\t\tmodalOpeners.value = openers;\n\t};\n\tconst readWhatsNewArticlesStorage = useStorage(LOCAL_STORAGE_READ_WHATS_NEW_ARTICLES);\n\tconst lastDismissedWhatsNewCalloutStorage = useStorage(LOCAL_STORAGE_DISMISSED_WHATS_NEW_CALLOUT);\n\n\t// ---------------------------------------------------------------------------\n\t// #region Computed\n\t// ---------------------------------------------------------------------------\n\n\tconst hasVersionUpdates = computed(() => {\n\t\treturn settingsStore.settings.releaseChannel === 'stable' && nextVersions.value.length > 0;\n\t});\n\n\tconst hasSignificantUpdates = computed(() => {\n\t\tif (!hasVersionUpdates.value || !currentVersion.value || !latestVersion.value) return false;\n\n\t\t// Always consider security issues as significant updates\n\t\tif (currentVersion.value.hasSecurityIssue) return true;\n\n\t\tconst current = currentVersion.value.name.match(SEMVER_REGEX);\n\t\tconst latest = latestVersion.value.name.match(SEMVER_REGEX);\n\n\t\tif (!current?.groups || !latest?.groups) return false;\n\n\t\t// Major change is always significant\n\t\tif (Number(current.groups.major) !== Number(latest.groups.major)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst currentMinor = Number(current.groups.minor);\n\t\tconst latestMinor = Number(latest.groups.minor);\n\n\t\t// Otherwise two minor versions is enough to be considered significant\n\t\treturn latestMinor - currentMinor >= 2;\n\t});\n\n\tconst latestVersion = computed(() => {\n\t\treturn nextVersions.value[0] ?? currentVersion.value;\n\t});\n\n\tconst areNotificationsEnabled = computed(() => {\n\t\treturn versionNotificationSettings.value.enabled;\n\t});\n\n\tconst infoUrl = computed(() => {\n\t\treturn versionNotificationSettings.value.infoUrl;\n\t});\n\n\tconst readWhatsNewArticles = computed((): number[] => {\n\t\treturn readWhatsNewArticlesStorage.value\n\t\t\t? jsonParse(readWhatsNewArticlesStorage.value, { fallbackValue: [] })\n\t\t\t: [];\n\t});\n\n\tconst lastDismissedWhatsNewCallout = computed((): number[] => {\n\t\treturn lastDismissedWhatsNewCalloutStorage.value\n\t\t\t? jsonParse(lastDismissedWhatsNewCalloutStorage.value, { fallbackValue: [] })\n\t\t\t: [];\n\t});\n\n\tconst whatsNewArticles = computed(() => {\n\t\treturn whatsNew.value.items;\n\t});\n\n\t// #endregion\n\n\t// ---------------------------------------------------------------------------\n\t// #region Methods\n\t// ---------------------------------------------------------------------------\n\n\tconst fetchVersions = async () => {\n\t\ttry {\n\t\t\tconst { enabled, endpoint } = versionNotificationSettings.value;\n\t\t\tif (enabled && endpoint) {\n\t\t\t\tconst rootStore = useRootStore();\n\t\t\t\tconst current = rootStore.versionCli;\n\t\t\t\tconst instanceId = rootStore.instanceId;\n\t\t\t\tconst versions = await versionsApi.getNextVersions(endpoint, current, instanceId);\n\t\t\t\tsetVersions({ versions, currentVersion: current });\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error('Failed to fetch versions:', e);\n\t\t}\n\t};\n\n\tconst setVersions = (params: SetVersionParams) => {\n\t\tnextVersions.value = params.versions.filter((v) => v.name !== params.currentVersion);\n\t\tcurrentVersion.value = params.versions.find((v) => v.name === params.currentVersion);\n\t};\n\n\tconst setWhatsNew = (section: WhatsNewSection) => {\n\t\twhatsNew.value = section;\n\t};\n\n\tconst setWhatsNewArticleRead = (articleId: number) => {\n\t\tif (!readWhatsNewArticles.value.includes(articleId)) {\n\t\t\treadWhatsNewArticlesStorage.value = JSON.stringify([\n\t\t\t\t...readWhatsNewArticles.value,\n\t\t\t\tarticleId,\n\t\t\t]);\n\t\t}\n\t};\n\n\tconst isWhatsNewArticleRead = (articleId: number): boolean => {\n\t\treturn readWhatsNewArticles.value.includes(articleId);\n\t};\n\n\tconst closeWhatsNewCallout = () => {\n\t\twhatsNewCallout.value?.close();\n\t\twhatsNewCallout.value = undefined;\n\t};\n\n\tconst dismissWhatsNewCallout = () => {\n\t\tlastDismissedWhatsNewCalloutStorage.value = JSON.stringify(\n\t\t\twhatsNewArticles.value.map((item) => item.id),\n\t\t);\n\t};\n\n\tconst shouldShowWhatsNewCallout = (): boolean => {\n\t\tconst createdAt = usersStore.currentUser?.createdAt;\n\t\tlet hasNewArticle = false;\n\t\tif (createdAt) {\n\t\t\tconst userCreatedAt = new Date(createdAt).getTime();\n\t\t\thasNewArticle = whatsNewArticles.value.some((item) => {\n\t\t\t\tconst updatedAt = item.updatedAt ? new Date(item.updatedAt).getTime() : 0;\n\t\t\t\treturn updatedAt > userCreatedAt;\n\t\t\t});\n\t\t} else {\n\t\t\thasNewArticle = true;\n\t\t}\n\t\tconst allArticlesDismissed = whatsNewArticles.value.every((item) =>\n\t\t\tlastDismissedWhatsNewCallout.value.includes(item.id),\n\t\t);\n\n\t\treturn hasNewArticle && !allArticlesDismissed;\n\t};\n\n\tconst fetchWhatsNew = async () => {\n\t\ttry {\n\t\t\tconst { enabled, whatsNewEnabled, whatsNewEndpoint } = versionNotificationSettings.value;\n\t\t\tif (enabled && whatsNewEnabled && whatsNewEndpoint) {\n\t\t\t\tconst rootStore = useRootStore();\n\t\t\t\tconst current = rootStore.versionCli;\n\t\t\t\tconst instanceId = rootStore.instanceId;\n\t\t\t\tconst section = await versionsApi.getWhatsNewSection(whatsNewEndpoint, current, instanceId);\n\n\t\t\t\tif (section.items?.length > 0) {\n\t\t\t\t\tsetWhatsNew(section);\n\n\t\t\t\t\tif (shouldShowWhatsNewCallout()) {\n\t\t\t\t\t\twhatsNewCallout.value = showMessage({\n\t\t\t\t\t\t\ttitle: whatsNew.value.title,\n\t\t\t\t\t\t\tmessage: whatsNew.value.calloutText,\n\t\t\t\t\t\t\tduration: 0,\n\t\t\t\t\t\t\tposition: 'bottom-left',\n\t\t\t\t\t\t\tcustomClass: 'clickable whats-new-notification',\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\tconst articleId = whatsNew.value.items[0]?.id ?? 0;\n\t\t\t\t\t\t\t\ttelemetry.track(\"User clicked on what's new notification\", {\n\t\t\t\t\t\t\t\t\tarticle_id: articleId,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tmodalOpeners.value.openModalWithData({\n\t\t\t\t\t\t\t\t\tname: WHATS_NEW_MODAL_KEY,\n\t\t\t\t\t\t\t\t\tdata: { articleId },\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// Mark the callout as dismissed as soon as it is shown, so it does not\n\t\t\t\t\t\t// keep reappearing on subsequent loads for users who simply ignore it.\n\t\t\t\t\t\tdismissWhatsNewCallout();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error('Failed to fetch Whats New section:', e);\n\t\t}\n\t};\n\n\tconst initialize = (settings: IVersionNotificationSettings) => {\n\t\tversionNotificationSettings.value = settings;\n\t};\n\n\tconst checkForNewVersions = async () => {\n\t\tconst enabled = areNotificationsEnabled.value;\n\t\tif (!enabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait Promise.all([fetchVersions(), fetchWhatsNew()]);\n\n\t\tif (\n\t\t\tcurrentVersion.value &&\n\t\t\tcurrentVersion.value.hasSecurityIssue &&\n\t\t\tnextVersions.value.length\n\t\t) {\n\t\t\tconst fixVersion = currentVersion.value.securityIssueFixVersion;\n\t\t\tlet message = 'Please update to latest version.';\n\t\t\tif (fixVersion) {\n\t\t\t\tmessage = `Please update to version ${fixVersion} or higher.`;\n\t\t\t}\n\n\t\t\tmessage = `${message} <a class=\"primary-color\">More info</a>`;\n\t\t\tshowToast({\n\t\t\t\ttitle: 'Critical update available',\n\t\t\t\tmessage,\n\t\t\t\tonClick: () => {\n\t\t\t\t\tmodalOpeners.value.openModal(VERSIONS_MODAL_KEY);\n\t\t\t\t},\n\t\t\t\tcloseOnClick: true,\n\t\t\t\tcustomClass: 'clickable',\n\t\t\t\ttype: 'warning',\n\t\t\t\tduration: 0,\n\t\t\t});\n\t\t}\n\t};\n\n\t// #endregion\n\n\treturn {\n\t\tcurrentVersion,\n\t\tlatestVersion,\n\t\tnextVersions,\n\t\thasVersionUpdates,\n\t\thasSignificantUpdates,\n\t\tareNotificationsEnabled,\n\t\tinfoUrl,\n\t\tfetchVersions,\n\t\tsetVersions,\n\t\tinitialize,\n\t\tregisterModalOpeners,\n\t\tcheckForNewVersions,\n\t\tfetchWhatsNew,\n\t\twhatsNew,\n\t\twhatsNewArticles,\n\t\tisWhatsNewArticleRead,\n\t\tsetWhatsNewArticleRead,\n\t\tcloseWhatsNewCallout,\n\t\tshouldShowWhatsNewCallout,\n\t\tdismissWhatsNewCallout,\n\t};\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAa,eACZ;AAED,MAAa,mBAAmB,YAAY,OAAO,gBAAgB;CAClE,MAAM,8BAA8B,IAAkC;EACrE,SAAS;EACT,iBAAiB;EACjB,UAAU;EACV,kBAAkB;EAClB,SAAS;EACT,CAAC;CACF,MAAM,eAAe,IAAe,EAAE,CAAC;CACvC,MAAM,iBAAiB,KAA0B;CACjD,MAAM,WAAW,IAAqB;EACrC,OAAO;EACP,4BAAW,IAAI,MAAM,EAAC,aAAa;EACnC,WAAW;EACX,aAAa;EACb,QAAQ;EACR,OAAO,EAAE;EACT,CAAC;CACF,MAAM,kBAAkB,KAAqC;CAE7D,MAAM,YAAY,cAAc;CAChC,MAAM,EAAE,WAAW,gBAAgB,UAAU;CAC7C,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,aAAa,eAAe;CAIlC,MAAM,0BAA0B,WAAmB;AAClD,MAAI,OAAO,KAAK,IAAI,IACnB,SAAQ,KACP,oBAAoB,OAAO,uGAC3B;;CAGH,MAAM,eAAe,IAAkB;EACtC,YAAY,SAAS,uBAAuB,aAAa,OAAO,KAAK,CAAC,GAAG;EACzE,oBAAoB,YACnB,uBAAuB,qBAAqB,OAAO,QAAQ,KAAK,CAAC,GAAG;EACrE,CAAC;CACF,MAAM,wBAAwB,YAA0B;AACvD,eAAa,QAAQ;;CAEtB,MAAM,8BAA8B,WAAW,sCAAsC;CACrF,MAAM,sCAAsC,WAAW,0CAA0C;CAMjG,MAAM,oBAAoB,eAAe;AACxC,SAAO,cAAc,SAAS,mBAAmB,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stores",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.34.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"LICENSE.md",
|
|
8
|
+
"LICENSE_EE.md"
|
|
9
9
|
],
|
|
10
10
|
"main": "dist/index.cjs",
|
|
11
11
|
"module": "dist/index.mjs",
|
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
"bowser": "2.11.0",
|
|
28
28
|
"pinia": "^2.2.4",
|
|
29
29
|
"vue": "^3.5.13",
|
|
30
|
-
"@n8n/api-types": "1.
|
|
31
|
-
"@n8n/
|
|
32
|
-
"@n8n/constants": "0.
|
|
33
|
-
"@n8n/
|
|
34
|
-
"@n8n/
|
|
35
|
-
"n8n
|
|
36
|
-
"@n8n/rest-api-client": "2.
|
|
30
|
+
"@n8n/api-types": "1.34.0",
|
|
31
|
+
"@n8n/composables": "1.24.0",
|
|
32
|
+
"@n8n/constants": "0.33.0",
|
|
33
|
+
"@n8n/frontend-constants": "0.3.0",
|
|
34
|
+
"@n8n/i18n": "2.34.0",
|
|
35
|
+
"@n8n/permissions": "0.71.0",
|
|
36
|
+
"@n8n/rest-api-client": "2.34.0",
|
|
37
|
+
"n8n-workflow": "2.34.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -48,10 +49,10 @@
|
|
|
48
49
|
"vitest": "^4.1.9",
|
|
49
50
|
"vitest-mock-extended": "^3.1.0",
|
|
50
51
|
"vue-tsc": "^2.2.8",
|
|
51
|
-
"@n8n/eslint-config": "0.0.1",
|
|
52
|
-
"@n8n/typescript-config": "1.9.0",
|
|
53
52
|
"@n8n/playwright-janitor": "0.1.0",
|
|
54
|
-
"@n8n/
|
|
53
|
+
"@n8n/eslint-config": "0.0.1",
|
|
54
|
+
"@n8n/vitest-config": "1.19.0",
|
|
55
|
+
"@n8n/typescript-config": "1.9.0"
|
|
55
56
|
},
|
|
56
57
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
57
58
|
"homepage": "https://n8n.io",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloudPlan.store.cjs","names":["DEFAULT_STATE: CloudPlanState","STORES","useRootStore","useSettingsStore","cloudUser: Cloud.UserAccount | null","cloudApi"],"sources":["../src/cloudPlan.store.ts"],"sourcesContent":["import type { Cloud, InstanceUsage } from '@n8n/rest-api-client/api/cloudPlans';\nimport {\n\tgetAdminPanelLoginCode,\n\tgetCurrentPlan,\n\tgetCurrentUsage,\n} from '@n8n/rest-api-client/api/cloudPlans';\nimport * as cloudApi from '@n8n/rest-api-client/api/cloudPlans';\nimport { defineStore } from 'pinia';\nimport { computed, reactive, ref } from 'vue';\n\nimport { STORES } from './constants';\nimport { useSettingsStore } from './settings.store';\nimport { useRootStore } from './useRootStore';\n\nexport interface CloudPlanState {\n\tinitialized: boolean;\n\tdata: Cloud.PlanData | null;\n\tusage: InstanceUsage | null;\n\tloadingPlan: boolean;\n}\n\nconst CLOUD_TRIAL_CHECK_INTERVAL = 5000;\n\nconst DEFAULT_STATE: CloudPlanState = {\n\tinitialized: false,\n\tdata: null,\n\tusage: null,\n\tloadingPlan: false,\n};\n\nexport const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {\n\tconst rootStore = useRootStore();\n\tconst settingsStore = useSettingsStore();\n\n\tconst state = reactive<CloudPlanState>(DEFAULT_STATE);\n\tconst currentUserCloudInfo = ref<Cloud.UserAccount | null>(null);\n\n\tconst now = ref<number>(Date.now());\n\n\t// Injected by the caller (e.g. editor-ui shim) — returns whether the\n\t// current user is the instance owner. Defaults to `false` so the store\n\t// is safe to use before injection.\n\tconst _isInstanceOwner = ref<() => boolean>(() => false);\n\n\tconst setIsInstanceOwner = (getter: () => boolean) => {\n\t\t_isInstanceOwner.value = getter;\n\t};\n\n\tconst reset = () => {\n\t\tcurrentUserCloudInfo.value = null;\n\t\tstate.data = null;\n\t\tstate.usage = null;\n\t};\n\n\tconst userIsTrialing = computed(() => state.data?.userIsTrialing ?? false);\n\n\tconst bannerConfig = computed(() => state.data?.bannerConfig);\n\n\t// Whether forceShow is enabled - shows banner even if previously dismissed\n\tconst bannerForceShow = computed(() => bannerConfig.value?.forceShow === true);\n\n\t// Check if TRIAL banner was previously dismissed\n\tconst isBannerDismissed = computed(() => {\n\t\tconst dismissed = settingsStore.permanentlyDismissedBanners as string[];\n\t\treturn dismissed.includes('TRIAL') || dismissed.includes('TRIAL_OVER');\n\t});\n\n\t// Whether to show trial banner:\n\t// - bannerConfig must exist (backend wants to show banner)\n\t// - If not dismissible, always show (regardless of previous dismissal)\n\t// - If dismissible: show if forceShow is true OR banner was not previously dismissed\n\tconst shouldShowBanner = computed(() => {\n\t\tif (!bannerConfig.value) return false;\n\t\tif (!bannerDismissible.value) return true;\n\t\treturn bannerForceShow.value || !isBannerDismissed.value;\n\t});\n\n\t// If timeLeft is set, show it; otherwise hide\n\tconst bannerTimeLeft = computed(() => ({\n\t\tshow: !!bannerConfig.value?.timeLeft,\n\t\ttext: bannerConfig.value?.timeLeft?.text,\n\t}));\n\n\t// If showExecutions is true, show the executions section\n\tconst showExecutions = computed(() => bannerConfig.value?.showExecutions === true);\n\n\tconst bannerCta = computed(() => ({\n\t\ttext: bannerConfig.value?.cta?.text ?? 'Upgrade Now',\n\t\ticon: bannerConfig.value?.cta?.icon ?? 'zap',\n\t\tsize: bannerConfig.value?.cta?.size ?? 'small',\n\t\tstyle: bannerConfig.value?.cta?.style ?? 'success',\n\t\tvariant: bannerConfig.value?.cta?.variant,\n\t\thref: bannerConfig.value?.cta?.href,\n\t}));\n\n\t// Banner icon (left side info icon) - undefined means no icon\n\tconst bannerIcon = computed(() => bannerConfig.value?.icon);\n\n\tconst bannerDismissible = computed(() => bannerConfig.value?.dismissible ?? true);\n\n\tconst currentPlanData = computed(() => state.data);\n\n\tconst currentUsageData = computed(() => state.usage);\n\n\tconst selectedApps = computed(() => currentUserCloudInfo.value?.selectedApps);\n\tconst codingSkill = computed(() => {\n\t\tconst information = currentUserCloudInfo.value?.information;\n\t\tif (!information) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (\n\t\t\t!(\n\t\t\t\t'which_of_these_do_you_feel_comfortable_doing' in information &&\n\t\t\t\tinformation.which_of_these_do_you_feel_comfortable_doing &&\n\t\t\t\tArray.isArray(information.which_of_these_do_you_feel_comfortable_doing)\n\t\t\t)\n\t\t) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn information.which_of_these_do_you_feel_comfortable_doing.length;\n\t});\n\n\tconst trialExpired = computed(\n\t\t() =>\n\t\t\tstate.data?.userIsTrialing && Date.now() >= new Date(state.data?.expirationDate).getTime(),\n\t);\n\n\tconst allExecutionsUsed = computed(() => {\n\t\tif (!state.usage?.executions || !state.data?.monthlyExecutionsLimit) return false;\n\t\treturn state.usage?.executions >= state.data?.monthlyExecutionsLimit;\n\t});\n\n\tconst hasCloudPlan = computed<boolean>(() => {\n\t\tconst { n8nMetadata } = settingsStore.settings as { n8nMetadata?: { userId?: string } };\n\t\tconst isCloud = Boolean(settingsStore.isCloudDeployment);\n\t\treturn _isInstanceOwner.value() && isCloud && !!n8nMetadata?.userId;\n\t});\n\n\tconst getUserCloudAccount = async () => {\n\t\tif (!hasCloudPlan.value) throw new Error('User does not have a cloud plan');\n\t\tlet cloudUser: Cloud.UserAccount | null = null;\n\t\ttry {\n\t\t\tcloudUser = await cloudApi.getCloudUserInfo(rootStore.restApiContext);\n\t\t\tcurrentUserCloudInfo.value = cloudUser;\n\t\t} catch (error) {\n\t\t\tthrow new Error((error as Error).message);\n\t\t}\n\t};\n\n\tconst getAutoLoginCode = async (): Promise<{ code: string }> => {\n\t\treturn await getAdminPanelLoginCode(rootStore.restApiContext);\n\t};\n\n\tconst getOwnerCurrentPlan = async () => {\n\t\tif (!hasCloudPlan.value) throw new Error('User does not have a cloud plan');\n\t\tstate.loadingPlan = true;\n\t\tlet plan;\n\t\ttry {\n\t\t\tplan = await getCurrentPlan(rootStore.restApiContext);\n\t\t\tstate.data = plan;\n\t\t\tstate.loadingPlan = false;\n\t\t} catch (error) {\n\t\t\tstate.loadingPlan = false;\n\t\t\tthrow new Error(error as string);\n\t\t}\n\n\t\treturn plan;\n\t};\n\n\tconst getInstanceCurrentUsage = async () => {\n\t\tconst usage = await getCurrentUsage({ baseUrl: rootStore.baseUrl, pushRef: '' });\n\t\tstate.usage = usage;\n\t\treturn usage;\n\t};\n\n\tconst usageLeft = computed(() => {\n\t\tif (!state.data || !state.usage) return { workflowsLeft: -1, executionsLeft: -1 };\n\n\t\treturn {\n\t\t\tworkflowsLeft: state.data.activeWorkflowsLimit - state.usage.activeWorkflows,\n\t\t\texecutionsLeft: state.data.monthlyExecutionsLimit - state.usage.executions,\n\t\t};\n\t});\n\n\tconst trialDaysLeft = computed(() => {\n\t\tif (!state.data?.expirationDate) return -1;\n\n\t\tconst differenceInMs = new Date().valueOf() - new Date(state.data.expirationDate).valueOf();\n\n\t\tconst differenceInDays = Math.floor(differenceInMs / (1000 * 60 * 60 * 24));\n\n\t\treturn Math.ceil(differenceInDays);\n\t});\n\n\tconst trialTimeLeft = computed((): { count: number; unit: 'days' | 'hours' | 'minutes' } => {\n\t\tif (!state.data?.expirationDate) {\n\t\t\treturn { count: 0, unit: 'days' };\n\t\t}\n\n\t\tconst msLeft = new Date(state.data.expirationDate).valueOf() - now.value;\n\t\tif (msLeft <= 0) {\n\t\t\treturn { count: 0, unit: 'minutes' };\n\t\t}\n\n\t\tconst hours = msLeft / (1000 * 60 * 60);\n\n\t\tif (hours < 1) {\n\t\t\treturn { count: Math.ceil(msLeft / (1000 * 60)), unit: 'minutes' };\n\t\t} else if (hours < 24) {\n\t\t\treturn { count: Math.ceil(hours), unit: 'hours' };\n\t\t} else {\n\t\t\treturn { count: Math.ceil(hours / 24), unit: 'days' };\n\t\t}\n\t});\n\n\tconst startPollingInstanceUsageData = () => {\n\t\tconst interval = setInterval(async () => {\n\t\t\tnow.value = Date.now();\n\t\t\ttry {\n\t\t\t\tawait getInstanceCurrentUsage();\n\t\t\t\tif (trialExpired.value || allExecutionsUsed.value) {\n\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Silently ignore polling errors — the next interval will retry\n\t\t\t}\n\t\t}, CLOUD_TRIAL_CHECK_INTERVAL);\n\t};\n\n\tconst checkForCloudPlanData = async (): Promise<void> => {\n\t\ttry {\n\t\t\tawait getOwnerCurrentPlan();\n\t\t\tif (!userIsTrialing.value) return;\n\t\t\tawait getInstanceCurrentUsage();\n\t\t\tstartPollingInstanceUsageData();\n\t\t} catch (e) {\n\t\t\tthrow new Error((e as Error).message);\n\t\t}\n\t};\n\n\tconst fetchUserCloudAccount = async () => {\n\t\ttry {\n\t\t\tawait getUserCloudAccount();\n\t\t} catch (e) {\n\t\t\tthrow new Error((e as Error).message);\n\t\t}\n\t};\n\n\tconst initialize = async () => {\n\t\tif (state.initialized) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait checkForCloudPlanData();\n\t\t} catch (error) {\n\t\t\tconsole.warn('Error checking for cloud plan data:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait fetchUserCloudAccount();\n\t\t} catch (error) {\n\t\t\tconsole.warn('Error fetching user cloud account:', error);\n\t\t}\n\n\t\tstate.initialized = true;\n\t};\n\n\tconst generateCloudDashboardAutoLoginLink = async (data: { redirectionPath: string }) => {\n\t\tconst searchParams = new URLSearchParams();\n\n\t\tconst adminPanelHost = new URL(window.location.href).host.split('.').slice(1).join('.');\n\t\tconst { code } = await getAutoLoginCode();\n\t\tconst linkUrl = `https://${adminPanelHost}/login`;\n\t\tsearchParams.set('code', code);\n\t\tsearchParams.set('returnPath', data.redirectionPath);\n\n\t\treturn `${linkUrl}?${searchParams.toString()}`;\n\t};\n\n\treturn {\n\t\tstate,\n\t\tusageLeft,\n\t\ttrialDaysLeft,\n\t\ttrialTimeLeft,\n\t\tuserIsTrialing,\n\t\tcurrentPlanData,\n\t\tcurrentUsageData,\n\t\ttrialExpired,\n\t\tallExecutionsUsed,\n\t\thasCloudPlan,\n\t\tcurrentUserCloudInfo,\n\t\tgenerateCloudDashboardAutoLoginLink,\n\t\tinitialize,\n\t\tgetOwnerCurrentPlan,\n\t\tgetInstanceCurrentUsage,\n\t\treset,\n\t\tcheckForCloudPlanData,\n\t\tfetchUserCloudAccount,\n\t\tgetAutoLoginCode,\n\t\tselectedApps,\n\t\tcodingSkill,\n\t\tshouldShowBanner,\n\t\tbannerConfig,\n\t\tbannerForceShow,\n\t\tisBannerDismissed,\n\t\tbannerTimeLeft,\n\t\tshowExecutions,\n\t\tbannerCta,\n\t\tbannerIcon,\n\t\tbannerDismissible,\n\t\tsetIsInstanceOwner,\n\t};\n});\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,6BAA6B;AAEnC,MAAMA,gBAAgC;CACrC,aAAa;CACb,MAAM;CACN,OAAO;CACP,aAAa;CACb;AAED,MAAa,2CAAgCC,yBAAO,kBAAkB;CACrE,MAAM,YAAYC,mCAAc;CAChC,MAAM,gBAAgBC,yCAAkB;CAExC,MAAM,0BAAiC,cAAc;CACrD,MAAM,oCAAqD,KAAK;CAEhE,MAAM,mBAAkB,KAAK,KAAK,CAAC;CAKnC,MAAM,sCAA4C,MAAM;CAExD,MAAM,sBAAsB,WAA0B;AACrD,mBAAiB,QAAQ;;CAG1B,MAAM,cAAc;AACnB,uBAAqB,QAAQ;AAC7B,QAAM,OAAO;AACb,QAAM,QAAQ;;CAGf,MAAM,yCAAgC,MAAM,MAAM,kBAAkB,MAAM;CAE1E,MAAM,uCAA8B,MAAM,MAAM,aAAa;CAG7D,MAAM,0CAAiC,aAAa,OAAO,cAAc,KAAK;CAG9E,MAAM,4CAAmC;EACxC,MAAM,YAAY,cAAc;AAChC,SAAO,UAAU,SAAS,QAAQ,IAAI,UAAU,SAAS,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ACf,WAAQ,KAAK,sCAAsC,MAAM;;AAG1D,QAAM,cAAc;;CAGrB,MAAM,sCAAsC,OAAO,SAAsC;EACxF,MAAM,eAAe,IAAI,iBAAiB;EAE1C,MAAM,iBAAiB,IAAI,IAAI,OAAO,SAAS,KAAK,CAAC,KAAK,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI;EACvF,MAAM,EAAE,SAAS,MAAM,kBAAkB;EACzC,MAAM,UAAU,WAAW,eAAe;AAC1C,eAAa,IAAI,QAAQ,KAAK;AAC9B,eAAa,IAAI,cAAc,KAAK,gBAAgB;AAEpD,SAAO,GAAG,QAAQ,GAAG,aAAa,UAAU;;AAG7C,QAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloudPlan.store.mjs","names":["DEFAULT_STATE: CloudPlanState","cloudUser: Cloud.UserAccount | null"],"sources":["../src/cloudPlan.store.ts"],"sourcesContent":["import type { Cloud, InstanceUsage } from '@n8n/rest-api-client/api/cloudPlans';\nimport {\n\tgetAdminPanelLoginCode,\n\tgetCurrentPlan,\n\tgetCurrentUsage,\n} from '@n8n/rest-api-client/api/cloudPlans';\nimport * as cloudApi from '@n8n/rest-api-client/api/cloudPlans';\nimport { defineStore } from 'pinia';\nimport { computed, reactive, ref } from 'vue';\n\nimport { STORES } from './constants';\nimport { useSettingsStore } from './settings.store';\nimport { useRootStore } from './useRootStore';\n\nexport interface CloudPlanState {\n\tinitialized: boolean;\n\tdata: Cloud.PlanData | null;\n\tusage: InstanceUsage | null;\n\tloadingPlan: boolean;\n}\n\nconst CLOUD_TRIAL_CHECK_INTERVAL = 5000;\n\nconst DEFAULT_STATE: CloudPlanState = {\n\tinitialized: false,\n\tdata: null,\n\tusage: null,\n\tloadingPlan: false,\n};\n\nexport const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {\n\tconst rootStore = useRootStore();\n\tconst settingsStore = useSettingsStore();\n\n\tconst state = reactive<CloudPlanState>(DEFAULT_STATE);\n\tconst currentUserCloudInfo = ref<Cloud.UserAccount | null>(null);\n\n\tconst now = ref<number>(Date.now());\n\n\t// Injected by the caller (e.g. editor-ui shim) — returns whether the\n\t// current user is the instance owner. Defaults to `false` so the store\n\t// is safe to use before injection.\n\tconst _isInstanceOwner = ref<() => boolean>(() => false);\n\n\tconst setIsInstanceOwner = (getter: () => boolean) => {\n\t\t_isInstanceOwner.value = getter;\n\t};\n\n\tconst reset = () => {\n\t\tcurrentUserCloudInfo.value = null;\n\t\tstate.data = null;\n\t\tstate.usage = null;\n\t};\n\n\tconst userIsTrialing = computed(() => state.data?.userIsTrialing ?? false);\n\n\tconst bannerConfig = computed(() => state.data?.bannerConfig);\n\n\t// Whether forceShow is enabled - shows banner even if previously dismissed\n\tconst bannerForceShow = computed(() => bannerConfig.value?.forceShow === true);\n\n\t// Check if TRIAL banner was previously dismissed\n\tconst isBannerDismissed = computed(() => {\n\t\tconst dismissed = settingsStore.permanentlyDismissedBanners as string[];\n\t\treturn dismissed.includes('TRIAL') || dismissed.includes('TRIAL_OVER');\n\t});\n\n\t// Whether to show trial banner:\n\t// - bannerConfig must exist (backend wants to show banner)\n\t// - If not dismissible, always show (regardless of previous dismissal)\n\t// - If dismissible: show if forceShow is true OR banner was not previously dismissed\n\tconst shouldShowBanner = computed(() => {\n\t\tif (!bannerConfig.value) return false;\n\t\tif (!bannerDismissible.value) return true;\n\t\treturn bannerForceShow.value || !isBannerDismissed.value;\n\t});\n\n\t// If timeLeft is set, show it; otherwise hide\n\tconst bannerTimeLeft = computed(() => ({\n\t\tshow: !!bannerConfig.value?.timeLeft,\n\t\ttext: bannerConfig.value?.timeLeft?.text,\n\t}));\n\n\t// If showExecutions is true, show the executions section\n\tconst showExecutions = computed(() => bannerConfig.value?.showExecutions === true);\n\n\tconst bannerCta = computed(() => ({\n\t\ttext: bannerConfig.value?.cta?.text ?? 'Upgrade Now',\n\t\ticon: bannerConfig.value?.cta?.icon ?? 'zap',\n\t\tsize: bannerConfig.value?.cta?.size ?? 'small',\n\t\tstyle: bannerConfig.value?.cta?.style ?? 'success',\n\t\tvariant: bannerConfig.value?.cta?.variant,\n\t\thref: bannerConfig.value?.cta?.href,\n\t}));\n\n\t// Banner icon (left side info icon) - undefined means no icon\n\tconst bannerIcon = computed(() => bannerConfig.value?.icon);\n\n\tconst bannerDismissible = computed(() => bannerConfig.value?.dismissible ?? true);\n\n\tconst currentPlanData = computed(() => state.data);\n\n\tconst currentUsageData = computed(() => state.usage);\n\n\tconst selectedApps = computed(() => currentUserCloudInfo.value?.selectedApps);\n\tconst codingSkill = computed(() => {\n\t\tconst information = currentUserCloudInfo.value?.information;\n\t\tif (!information) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (\n\t\t\t!(\n\t\t\t\t'which_of_these_do_you_feel_comfortable_doing' in information &&\n\t\t\t\tinformation.which_of_these_do_you_feel_comfortable_doing &&\n\t\t\t\tArray.isArray(information.which_of_these_do_you_feel_comfortable_doing)\n\t\t\t)\n\t\t) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn information.which_of_these_do_you_feel_comfortable_doing.length;\n\t});\n\n\tconst trialExpired = computed(\n\t\t() =>\n\t\t\tstate.data?.userIsTrialing && Date.now() >= new Date(state.data?.expirationDate).getTime(),\n\t);\n\n\tconst allExecutionsUsed = computed(() => {\n\t\tif (!state.usage?.executions || !state.data?.monthlyExecutionsLimit) return false;\n\t\treturn state.usage?.executions >= state.data?.monthlyExecutionsLimit;\n\t});\n\n\tconst hasCloudPlan = computed<boolean>(() => {\n\t\tconst { n8nMetadata } = settingsStore.settings as { n8nMetadata?: { userId?: string } };\n\t\tconst isCloud = Boolean(settingsStore.isCloudDeployment);\n\t\treturn _isInstanceOwner.value() && isCloud && !!n8nMetadata?.userId;\n\t});\n\n\tconst getUserCloudAccount = async () => {\n\t\tif (!hasCloudPlan.value) throw new Error('User does not have a cloud plan');\n\t\tlet cloudUser: Cloud.UserAccount | null = null;\n\t\ttry {\n\t\t\tcloudUser = await cloudApi.getCloudUserInfo(rootStore.restApiContext);\n\t\t\tcurrentUserCloudInfo.value = cloudUser;\n\t\t} catch (error) {\n\t\t\tthrow new Error((error as Error).message);\n\t\t}\n\t};\n\n\tconst getAutoLoginCode = async (): Promise<{ code: string }> => {\n\t\treturn await getAdminPanelLoginCode(rootStore.restApiContext);\n\t};\n\n\tconst getOwnerCurrentPlan = async () => {\n\t\tif (!hasCloudPlan.value) throw new Error('User does not have a cloud plan');\n\t\tstate.loadingPlan = true;\n\t\tlet plan;\n\t\ttry {\n\t\t\tplan = await getCurrentPlan(rootStore.restApiContext);\n\t\t\tstate.data = plan;\n\t\t\tstate.loadingPlan = false;\n\t\t} catch (error) {\n\t\t\tstate.loadingPlan = false;\n\t\t\tthrow new Error(error as string);\n\t\t}\n\n\t\treturn plan;\n\t};\n\n\tconst getInstanceCurrentUsage = async () => {\n\t\tconst usage = await getCurrentUsage({ baseUrl: rootStore.baseUrl, pushRef: '' });\n\t\tstate.usage = usage;\n\t\treturn usage;\n\t};\n\n\tconst usageLeft = computed(() => {\n\t\tif (!state.data || !state.usage) return { workflowsLeft: -1, executionsLeft: -1 };\n\n\t\treturn {\n\t\t\tworkflowsLeft: state.data.activeWorkflowsLimit - state.usage.activeWorkflows,\n\t\t\texecutionsLeft: state.data.monthlyExecutionsLimit - state.usage.executions,\n\t\t};\n\t});\n\n\tconst trialDaysLeft = computed(() => {\n\t\tif (!state.data?.expirationDate) return -1;\n\n\t\tconst differenceInMs = new Date().valueOf() - new Date(state.data.expirationDate).valueOf();\n\n\t\tconst differenceInDays = Math.floor(differenceInMs / (1000 * 60 * 60 * 24));\n\n\t\treturn Math.ceil(differenceInDays);\n\t});\n\n\tconst trialTimeLeft = computed((): { count: number; unit: 'days' | 'hours' | 'minutes' } => {\n\t\tif (!state.data?.expirationDate) {\n\t\t\treturn { count: 0, unit: 'days' };\n\t\t}\n\n\t\tconst msLeft = new Date(state.data.expirationDate).valueOf() - now.value;\n\t\tif (msLeft <= 0) {\n\t\t\treturn { count: 0, unit: 'minutes' };\n\t\t}\n\n\t\tconst hours = msLeft / (1000 * 60 * 60);\n\n\t\tif (hours < 1) {\n\t\t\treturn { count: Math.ceil(msLeft / (1000 * 60)), unit: 'minutes' };\n\t\t} else if (hours < 24) {\n\t\t\treturn { count: Math.ceil(hours), unit: 'hours' };\n\t\t} else {\n\t\t\treturn { count: Math.ceil(hours / 24), unit: 'days' };\n\t\t}\n\t});\n\n\tconst startPollingInstanceUsageData = () => {\n\t\tconst interval = setInterval(async () => {\n\t\t\tnow.value = Date.now();\n\t\t\ttry {\n\t\t\t\tawait getInstanceCurrentUsage();\n\t\t\t\tif (trialExpired.value || allExecutionsUsed.value) {\n\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Silently ignore polling errors — the next interval will retry\n\t\t\t}\n\t\t}, CLOUD_TRIAL_CHECK_INTERVAL);\n\t};\n\n\tconst checkForCloudPlanData = async (): Promise<void> => {\n\t\ttry {\n\t\t\tawait getOwnerCurrentPlan();\n\t\t\tif (!userIsTrialing.value) return;\n\t\t\tawait getInstanceCurrentUsage();\n\t\t\tstartPollingInstanceUsageData();\n\t\t} catch (e) {\n\t\t\tthrow new Error((e as Error).message);\n\t\t}\n\t};\n\n\tconst fetchUserCloudAccount = async () => {\n\t\ttry {\n\t\t\tawait getUserCloudAccount();\n\t\t} catch (e) {\n\t\t\tthrow new Error((e as Error).message);\n\t\t}\n\t};\n\n\tconst initialize = async () => {\n\t\tif (state.initialized) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait checkForCloudPlanData();\n\t\t} catch (error) {\n\t\t\tconsole.warn('Error checking for cloud plan data:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait fetchUserCloudAccount();\n\t\t} catch (error) {\n\t\t\tconsole.warn('Error fetching user cloud account:', error);\n\t\t}\n\n\t\tstate.initialized = true;\n\t};\n\n\tconst generateCloudDashboardAutoLoginLink = async (data: { redirectionPath: string }) => {\n\t\tconst searchParams = new URLSearchParams();\n\n\t\tconst adminPanelHost = new URL(window.location.href).host.split('.').slice(1).join('.');\n\t\tconst { code } = await getAutoLoginCode();\n\t\tconst linkUrl = `https://${adminPanelHost}/login`;\n\t\tsearchParams.set('code', code);\n\t\tsearchParams.set('returnPath', data.redirectionPath);\n\n\t\treturn `${linkUrl}?${searchParams.toString()}`;\n\t};\n\n\treturn {\n\t\tstate,\n\t\tusageLeft,\n\t\ttrialDaysLeft,\n\t\ttrialTimeLeft,\n\t\tuserIsTrialing,\n\t\tcurrentPlanData,\n\t\tcurrentUsageData,\n\t\ttrialExpired,\n\t\tallExecutionsUsed,\n\t\thasCloudPlan,\n\t\tcurrentUserCloudInfo,\n\t\tgenerateCloudDashboardAutoLoginLink,\n\t\tinitialize,\n\t\tgetOwnerCurrentPlan,\n\t\tgetInstanceCurrentUsage,\n\t\treset,\n\t\tcheckForCloudPlanData,\n\t\tfetchUserCloudAccount,\n\t\tgetAutoLoginCode,\n\t\tselectedApps,\n\t\tcodingSkill,\n\t\tshouldShowBanner,\n\t\tbannerConfig,\n\t\tbannerForceShow,\n\t\tisBannerDismissed,\n\t\tbannerTimeLeft,\n\t\tshowExecutions,\n\t\tbannerCta,\n\t\tbannerIcon,\n\t\tbannerDismissible,\n\t\tsetIsInstanceOwner,\n\t};\n});\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,6BAA6B;AAEnC,MAAMA,gBAAgC;CACrC,aAAa;CACb,MAAM;CACN,OAAO;CACP,aAAa;CACb;AAED,MAAa,oBAAoB,YAAY,OAAO,kBAAkB;CACrE,MAAM,YAAY,cAAc;CAChC,MAAM,gBAAgB,kBAAkB;CAExC,MAAM,QAAQ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 -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"users.store.cjs","names":["ROLE","STORES","useRootStore","useSettingsStore","user: IUser","usersApi","BROWSER_ID_STORAGE_KEY","acceptInvitation","inviteUsers","mfaApi","cloudApi"],"sources":["../src/users.store.ts"],"sourcesContent":["import {\n\ttype LoginRequestDto,\n\ttype PasswordUpdateRequestDto,\n\ttype SettingsUpdateRequestDto,\n\ttype UserSelfSettingsUpdateRequestDto,\n\ttype UserUpdateRequestDto,\n\ttype User,\n\tROLE,\n\ttype UsersListFilterDto,\n} from '@n8n/api-types';\nimport { BROWSER_ID_STORAGE_KEY } from '@n8n/constants';\nimport type { AssignableGlobalRole } from '@n8n/permissions';\nimport * as cloudApi from '@n8n/rest-api-client/api/cloudPlans';\nimport * as mfaApi from '@n8n/rest-api-client/api/mfa';\nimport type {\n\tUpdateGlobalRolePayload,\n\tIUserResponse,\n\tIUser,\n\tCurrentUserResponse,\n\tIPersonalizationLatestVersion,\n} from '@n8n/rest-api-client/api/users';\nimport * as usersApi from '@n8n/rest-api-client/api/users';\nimport { useAsyncState } from '@vueuse/core';\nimport { defineStore } from 'pinia';\nimport { computed, ref } from 'vue';\n\nimport { STORES } from './constants';\nimport * as invitationsApi from './invitation.api';\nimport type { ModalOpeners } from './modalOpeners';\nimport * as onboardingApi from './onboarding.api';\nimport { useSettingsStore } from './settings.store';\nimport { useRootStore } from './useRootStore';\n\n/**\n * Registration key of the app's personalization modal, passed to the injected\n * modal opener. Mirrors `PERSONALIZATION_MODAL_KEY` in editor-ui's\n * `users.constants`; kept as a literal so the store carries no `@/app` import.\n */\nconst PERSONALIZATION_MODAL_KEY = 'personalization';\n\nconst _isPendingUser = (user: IUserResponse | null) => !!user?.isPending;\nconst _isInstanceOwner = (user: IUserResponse | null) => user?.role === ROLE.Owner;\nconst _isDefaultUser = (user: IUserResponse | null) =>\n\t_isInstanceOwner(user) && _isPendingUser(user);\nconst _isAdmin = (user: IUserResponse | null) => user?.role === ROLE.Admin;\n\nexport type LoginHook = (user: CurrentUserResponse) => void | Promise<void>;\ntype LogoutHook = () => void | Promise<void>;\n\nexport const useUsersStore = defineStore(STORES.USERS, () => {\n\tconst initialized = ref(false);\n\tconst currentUserId = ref<string | null>(null);\n\tconst usersById = ref<Record<string, IUser>>({});\n\tconst userQuota = ref<number>(-1);\n\n\tconst loginHooks = ref<LoginHook[]>([]);\n\tconst logoutHooks = ref<LogoutHook[]>([]);\n\n\t// Modal-open actions, registered at app bootstrap (see app/init.ts). Until then\n\t// they no-op — warning in dev — so the store never reaches into `ui.store`. Shares\n\t// the `ModalOpeners` contract with the other decoupled stores; this store currently\n\t// uses only `openModal`.\n\tconst warnModalOpenerMissing = (action: string) => {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconsole.warn(\n\t\t\t\t`[users.store] ${action} called before modal openers were registered; ignoring. Call registerModalOpeners() at app bootstrap.`,\n\t\t\t);\n\t\t}\n\t};\n\tconst modalOpeners = ref<ModalOpeners>({\n\t\topenModal: (name) => warnModalOpenerMissing(`openModal(${String(name)})`),\n\t\topenModalWithData: (payload) =>\n\t\t\twarnModalOpenerMissing(`openModalWithData(${String(payload.name)})`),\n\t});\n\tconst registerModalOpeners = (openers: ModalOpeners) => {\n\t\tmodalOpeners.value = openers;\n\t};\n\n\t// App-provided capabilities, registered at bootstrap (see app/init.ts) so the store\n\t// carries no `@/app` dependency. Both fall back to safe no-ops before registration.\n\n\t// Permission checks, keyed by capability (app RBAC checks; extend the object as\n\t// more permissions need resolving). `listUsers` gates the `user:list` scope.\n\tconst canListUsers = ref<() => boolean>(() => false);\n\tconst setPermissionsResolvers = (resolvers: { listUsers: () => boolean }) => {\n\t\tcanListUsers.value = resolvers.listUsers;\n\t};\n\n\t// Stores\n\n\tconst rootStore = useRootStore();\n\tconst settingsStore = useSettingsStore();\n\n\t// Computed\n\n\tconst allUsers = computed(() => Object.values(usersById.value));\n\n\tconst currentUser = computed(() =>\n\t\tcurrentUserId.value ? usersById.value[currentUserId.value] : null,\n\t);\n\n\tconst userActivated = computed(() => Boolean(currentUser.value?.settings?.userActivated));\n\n\tconst isDefaultUser = computed(() => _isDefaultUser(currentUser.value));\n\n\tconst isInstanceOwner = computed(() => _isInstanceOwner(currentUser.value));\n\n\tconst isAdmin = computed(() => _isAdmin(currentUser.value));\n\n\tconst isAdminOrOwner = computed(() => isInstanceOwner.value || isAdmin.value);\n\n\tconst mfaEnabled = computed(() => currentUser.value?.mfaEnabled ?? false);\n\n\tconst globalRoleName = computed(() => currentUser.value?.role ?? 'default');\n\n\tconst userClaimedAiCredits = computed(() => currentUser.value?.settings?.userClaimedAiCredits);\n\n\tconst isEasyAIWorkflowOnboardingDone = computed(() =>\n\t\tBoolean(currentUser.value?.settings?.easyAIWorkflowOnboarded),\n\t);\n\n\tconst canUserUpdateVersion = computed(() => {\n\t\treturn isInstanceOwner.value;\n\t});\n\n\tconst setEasyAIWorkflowOnboardingDone = () => {\n\t\tif (currentUser.value?.settings) {\n\t\t\tcurrentUser.value.settings.easyAIWorkflowOnboarded = true;\n\t\t}\n\t};\n\n\tconst isCalloutDismissed = (callout: string) =>\n\t\tBoolean(currentUser.value?.settings?.dismissedCallouts?.[callout]);\n\n\tconst setCalloutDismissed = (callout: string) => {\n\t\tif (currentUser.value?.settings) {\n\t\t\tcurrentUser.value.settings.dismissedCallouts ??= {};\n\n\t\t\tcurrentUser.value.settings.dismissedCallouts[callout] = true;\n\t\t}\n\t};\n\n\tconst usersLimitNotReached = computed(\n\t\t(): boolean => userQuota.value === -1 || userQuota.value > allUsers.value.length,\n\t);\n\n\t// Methods\n\n\tconst addUsers = (newUsers: User[]) => {\n\t\tnewUsers.forEach((userResponse) => {\n\t\t\tconst prevUser = usersById.value[userResponse.id] || {};\n\t\t\tconst updatedUser = {\n\t\t\t\t...prevUser,\n\t\t\t\t...userResponse,\n\t\t\t};\n\t\t\tconst user: IUser = {\n\t\t\t\t...updatedUser,\n\t\t\t\tfullName: userResponse.firstName\n\t\t\t\t\t? `${updatedUser.firstName} ${updatedUser.lastName ?? ''}`\n\t\t\t\t\t: undefined,\n\t\t\t\tisDefaultUser: _isDefaultUser(updatedUser),\n\t\t\t\tisPendingUser: _isPendingUser(updatedUser),\n\t\t\t};\n\n\t\t\tusersById.value = {\n\t\t\t\t...usersById.value,\n\t\t\t\t[user.id]: user,\n\t\t\t};\n\t\t});\n\t};\n\n\tconst setCurrentUser = async (user: CurrentUserResponse) => {\n\t\taddUsers([user]);\n\t\tcurrentUserId.value = user.id;\n\n\t\tfor (const hook of loginHooks.value) {\n\t\t\ttry {\n\t\t\t\tawait hook(user);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Error executing login hook:', error);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst loginWithCookie = async () => {\n\t\tconst user = await usersApi.loginCurrentUser(rootStore.restApiContext);\n\t\tif (!user) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait setCurrentUser(user);\n\t};\n\n\tconst initialize = async () => {\n\t\tif (initialized.value) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait loginWithCookie();\n\t\t\tinitialized.value = true;\n\t\t} catch {\n\t\t\t// A missing or expired auth cookie before setup is expected; leave the store\n\t\t\t// uninitialized and let the caller proceed to the login/setup flow.\n\t\t}\n\t};\n\n\tconst unsetCurrentUser = () => {\n\t\tcurrentUserId.value = null;\n\t};\n\n\tconst deleteUserById = (userId: string) => {\n\t\tconst { [userId]: _, ...rest } = usersById.value;\n\t\tusersById.value = rest;\n\t};\n\n\tconst setPersonalizationAnswers = (answers: IPersonalizationLatestVersion) => {\n\t\tif (!currentUser.value) {\n\t\t\treturn;\n\t\t}\n\n\t\tusersById.value = {\n\t\t\t...usersById.value,\n\t\t\t[currentUser.value.id]: {\n\t\t\t\t...currentUser.value,\n\t\t\t\tpersonalizationAnswers: answers,\n\t\t\t},\n\t\t};\n\t};\n\n\tconst loginWithCreds = async (params: LoginRequestDto) => {\n\t\tconst user = await usersApi.login(rootStore.restApiContext, params);\n\t\tif (!user) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait setCurrentUser(user);\n\t};\n\n\tconst registerLoginHook = (hook: LoginHook) => {\n\t\tloginHooks.value.push(hook);\n\t};\n\n\tconst registerLogoutHook = (hook: LogoutHook) => {\n\t\tlogoutHooks.value.push(hook);\n\t};\n\n\tconst logout = async () => {\n\t\tawait usersApi.logout(rootStore.restApiContext);\n\n\t\tunsetCurrentUser();\n\n\t\tfor (const hook of logoutHooks.value) {\n\t\t\ttry {\n\t\t\t\tawait hook();\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Error executing logout hook:', error);\n\t\t\t}\n\t\t}\n\n\t\tlocalStorage.removeItem(BROWSER_ID_STORAGE_KEY);\n\t};\n\n\tconst createOwner = async (params: {\n\t\tfirstName: string;\n\t\tlastName: string;\n\t\temail: string;\n\t\tpassword: string;\n\t}) => {\n\t\tconst user = await usersApi.setupOwner(rootStore.restApiContext, params);\n\t\tif (user) {\n\t\t\tawait setCurrentUser(user);\n\t\t\tsettingsStore.stopShowingSetupPage();\n\t\t}\n\t};\n\n\tconst validateSignupToken = async (params: { token: string }) => {\n\t\treturn await usersApi.validateSignupToken(rootStore.restApiContext, params);\n\t};\n\n\tconst acceptInvitation = async (params: {\n\t\ttoken: string;\n\t\tfirstName: string;\n\t\tlastName: string;\n\t\tpassword: string;\n\t}) => {\n\t\tconst user = await invitationsApi.acceptInvitation(rootStore.restApiContext, params);\n\t\tif (user) {\n\t\t\tawait setCurrentUser(user);\n\t\t}\n\t};\n\n\tconst sendForgotPasswordEmail = async (params: { email: string }) => {\n\t\tawait usersApi.sendForgotPasswordEmail(rootStore.restApiContext, params);\n\t};\n\n\tconst validatePasswordToken = async (params: { token: string }) => {\n\t\tawait usersApi.validatePasswordToken(rootStore.restApiContext, params);\n\t};\n\n\tconst changePassword = async (params: { token: string; password: string; mfaCode?: string }) => {\n\t\tawait usersApi.changePassword(rootStore.restApiContext, params);\n\t};\n\n\tconst updateUser = async (params: UserUpdateRequestDto) => {\n\t\tconst user = await usersApi.updateCurrentUser(rootStore.restApiContext, params);\n\t\taddUsers([user]);\n\t\treturn user;\n\t};\n\n\tconst updateUserName = async (params: { firstName: string; lastName: string }) => {\n\t\tif (!currentUser.value) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn await updateUser({\n\t\t\temail: currentUser.value.email as string,\n\t\t\t...params,\n\t\t});\n\t};\n\n\tconst updateUserSettings = async (settings: UserSelfSettingsUpdateRequestDto) => {\n\t\tconst updatedSettings = await usersApi.updateCurrentUserSettings(\n\t\t\trootStore.restApiContext,\n\t\t\tsettings,\n\t\t);\n\t\tif (currentUser.value) {\n\t\t\tcurrentUser.value.settings = updatedSettings;\n\t\t\taddUsers([currentUser.value]);\n\t\t}\n\t};\n\n\tconst updateOtherUserSettings = async (userId: string, settings: SettingsUpdateRequestDto) => {\n\t\tawait usersApi.updateOtherUserSettings(rootStore.restApiContext, userId, settings);\n\t};\n\n\tconst updateCurrentUserPassword = async (params: PasswordUpdateRequestDto) => {\n\t\tawait usersApi.updateCurrentUserPassword(rootStore.restApiContext, params);\n\t};\n\n\tconst deleteUser = async (params: { id: string; transferId?: string }) => {\n\t\tawait usersApi.deleteUser(rootStore.restApiContext, params);\n\t\tdeleteUserById(params.id);\n\t};\n\n\tconst fetchUsers = async ({\n\t\ttake,\n\t\tskip,\n\t\tfilter,\n\t}: { take?: number; skip?: number; filter?: UsersListFilterDto['filter'] } = {}) => {\n\t\tif (!canListUsers.value()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { items } = await usersApi.getUsers(rootStore.restApiContext, {\n\t\t\ttake: take ?? 50,\n\t\t\tskip: skip ?? 0,\n\t\t\tfilter,\n\t\t});\n\t\taddUsers(items);\n\t};\n\n\tconst inviteUsers = async (params: Array<{ email: string; role: AssignableGlobalRole }>) => {\n\t\tconst invitedUsers = await invitationsApi.inviteUsers(rootStore.restApiContext, params);\n\t\taddUsers(\n\t\t\tinvitedUsers.map(({ user }) => ({\n\t\t\t\tisPending: true,\n\t\t\t\t...user,\n\t\t\t})),\n\t\t);\n\t\treturn invitedUsers;\n\t};\n\n\tconst reinviteUser = async ({ email, role }: { email: string; role: AssignableGlobalRole }) => {\n\t\tconst invitationResponse = await invitationsApi.inviteUsers(rootStore.restApiContext, [\n\t\t\t{ email, role },\n\t\t]);\n\t\tif (!invitationResponse[0].user.emailSent) {\n\t\t\tthrow Error(invitationResponse[0].error);\n\t\t}\n\t};\n\n\tconst getUserPasswordResetLink = async (params: { id: string }) => {\n\t\treturn await usersApi.getPasswordResetLink(rootStore.restApiContext, params);\n\t};\n\n\tconst generateInviteLink = async (params: { id: string }) => {\n\t\treturn await usersApi.generateInviteLink(rootStore.restApiContext, params);\n\t};\n\n\tconst submitPersonalizationSurvey = async (results: IPersonalizationLatestVersion) => {\n\t\tawait usersApi.submitPersonalizationSurvey(rootStore.restApiContext, results);\n\t\tsetPersonalizationAnswers(results);\n\t};\n\n\t// Synchronous: after the `ui.store` modal decoupling this only fires the injected\n\t// opener. All call sites invoke it fire-and-forget (`void ...`).\n\tconst showPersonalizationSurvey = () => {\n\t\tconst surveyEnabled = settingsStore.isPersonalizationSurveyEnabled;\n\t\tif (surveyEnabled && currentUser.value && !currentUser.value.personalizationAnswers) {\n\t\t\tmodalOpeners.value.openModal(PERSONALIZATION_MODAL_KEY);\n\t\t}\n\t};\n\n\tconst fetchMfaQR = async () => {\n\t\treturn await mfaApi.getMfaQR(rootStore.restApiContext);\n\t};\n\n\tconst verifyMfaCode = async (data: { mfaCode: string }) => {\n\t\treturn await mfaApi.verifyMfaCode(rootStore.restApiContext, data);\n\t};\n\n\tconst canEnableMFA = async () => {\n\t\treturn await mfaApi.canEnableMFA(rootStore.restApiContext);\n\t};\n\n\tconst enableMfa = async (data: { mfaCode: string }) => {\n\t\tawait mfaApi.enableMfa(rootStore.restApiContext, data);\n\t\tif (currentUser.value) {\n\t\t\tcurrentUser.value.mfaEnabled = true;\n\t\t}\n\t};\n\n\tconst disableMfa = async (data: mfaApi.DisableMfaParams) => {\n\t\tawait mfaApi.disableMfa(rootStore.restApiContext, data);\n\n\t\tif (currentUser.value) {\n\t\t\tcurrentUser.value.mfaEnabled = false;\n\t\t}\n\t};\n\n\tconst updateEnforceMfa = async (enforce: boolean) => {\n\t\tawait mfaApi.updateEnforceMfa(rootStore.restApiContext, enforce);\n\t\tsettingsStore.isMFAEnforced = enforce;\n\t};\n\n\tconst sendConfirmationEmail = async () => {\n\t\tawait cloudApi.sendConfirmationEmail(rootStore.restApiContext);\n\t};\n\n\tconst updateGlobalRole = async ({ id, newRoleName }: UpdateGlobalRolePayload) => {\n\t\tawait usersApi.updateGlobalRole(rootStore.restApiContext, { id, newRoleName });\n\t\tawait fetchUsers({ filter: { ids: [id] } });\n\t};\n\n\tconst submitContactEmail = async (email: string, agree: boolean) => {\n\t\tif (currentUser.value) {\n\t\t\treturn await onboardingApi.submitEmailOnSignup(\n\t\t\t\trootStore.instanceId,\n\t\t\t\tcurrentUser.value,\n\t\t\t\temail ?? currentUser.value.email,\n\t\t\t\tagree,\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t};\n\n\tconst usersList = useAsyncState(\n\t\tasync (filter?: UsersListFilterDto) =>\n\t\t\tawait usersApi.getUsers(rootStore.restApiContext, filter),\n\t\t{\n\t\t\tcount: 0,\n\t\t\titems: [],\n\t\t},\n\t\t{ immediate: false, resetOnExecute: false },\n\t);\n\n\tconst setUserQuota = (quota?: number) => {\n\t\tif (typeof quota !== 'undefined') {\n\t\t\tuserQuota.value = quota;\n\t\t}\n\t};\n\n\treturn {\n\t\tinitialized,\n\t\tcurrentUserId,\n\t\tusersById,\n\t\tallUsers,\n\t\tcurrentUser,\n\t\tuserActivated,\n\t\tisDefaultUser,\n\t\tisInstanceOwner,\n\t\tisAdmin,\n\t\tisAdminOrOwner,\n\t\tmfaEnabled,\n\t\tglobalRoleName,\n\t\tuserClaimedAiCredits,\n\t\tisEasyAIWorkflowOnboardingDone,\n\t\tcanUserUpdateVersion,\n\t\tusersLimitNotReached,\n\t\taddUsers,\n\t\tloginWithCookie,\n\t\tinitialize,\n\t\tsetPersonalizationAnswers,\n\t\tloginWithCreds,\n\t\tlogout,\n\t\tregisterLoginHook,\n\t\tregisterLogoutHook,\n\t\tregisterModalOpeners,\n\t\tsetPermissionsResolvers,\n\t\tcreateOwner,\n\t\tvalidateSignupToken,\n\t\tacceptInvitation,\n\t\tsendForgotPasswordEmail,\n\t\tvalidatePasswordToken,\n\t\tchangePassword,\n\t\tupdateUser,\n\t\tupdateUserName,\n\t\tupdateUserSettings,\n\t\tupdateOtherUserSettings,\n\t\tupdateCurrentUserPassword,\n\t\tdeleteUser,\n\t\tfetchUsers,\n\t\tinviteUsers,\n\t\treinviteUser,\n\t\tgetUserPasswordResetLink,\n\t\tgenerateInviteLink,\n\t\tsubmitPersonalizationSurvey,\n\t\tshowPersonalizationSurvey,\n\t\tfetchMfaQR,\n\t\tverifyMfaCode,\n\t\tenableMfa,\n\t\tdisableMfa,\n\t\tupdateEnforceMfa,\n\t\tcanEnableMFA,\n\t\tsendConfirmationEmail,\n\t\tupdateGlobalRole,\n\t\tsetEasyAIWorkflowOnboardingDone,\n\t\tisCalloutDismissed,\n\t\tsetCalloutDismissed,\n\t\tsubmitContactEmail,\n\t\tsetUserQuota,\n\t\tusersList,\n\t};\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,4BAA4B;AAElC,MAAM,kBAAkB,SAA+B,CAAC,CAAC,MAAM;AAC/D,MAAM,oBAAoB,SAA+B,MAAM,SAASA,qBAAK;AAC7E,MAAM,kBAAkB,SACvB,iBAAiB,KAAK,IAAI,eAAe,KAAK;AAC/C,MAAM,YAAY,SAA+B,MAAM,SAASA,qBAAK;AAKrE,MAAa,uCAA4BC,yBAAO,aAAa;CAC5D,MAAM,2BAAkB,MAAM;CAC9B,MAAM,6BAAmC,KAAK;CAC9C,MAAM,yBAAuC,EAAE,CAAC;CAChD,MAAM,yBAAwB,GAAG;CA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AE;GAAI;GAAa,CAAC;AAC9E,QAAM,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;;CAG5C,MAAM,qBAAqB,OAAO,OAAe,UAAmB;AACnE,MAAI,YAAY,MACf,QAAO,iDACN,UAAU,YACV,YAAY,OACZ,SAAS,YAAY,MAAM,OAC3B,MACA;AAEF,SAAO;;CAGR,MAAM,6CACL,OAAO,WACN,MAAMA,gCAAS,SAAS,UAAU,gBAAgB,OAAO,EAC1D;EACC,OAAO;EACP,OAAO,EAAE;EACT,EACD;EAAE,WAAW;EAAO,gBAAgB;EAAO,CAC3C;CAED,MAAM,gBAAgB,UAAmB;AACxC,MAAI,OAAO,UAAU,YACpB,WAAU,QAAQ;;AAIpB,QAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
|
package/dist/users.store.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"users.store.mjs","names":["user: IUser","acceptInvitation","invitationsApi.acceptInvitation","inviteUsers","invitationsApi.inviteUsers","onboardingApi.submitEmailOnSignup"],"sources":["../src/users.store.ts"],"sourcesContent":["import {\n\ttype LoginRequestDto,\n\ttype PasswordUpdateRequestDto,\n\ttype SettingsUpdateRequestDto,\n\ttype UserSelfSettingsUpdateRequestDto,\n\ttype UserUpdateRequestDto,\n\ttype User,\n\tROLE,\n\ttype UsersListFilterDto,\n} from '@n8n/api-types';\nimport { BROWSER_ID_STORAGE_KEY } from '@n8n/constants';\nimport type { AssignableGlobalRole } from '@n8n/permissions';\nimport * as cloudApi from '@n8n/rest-api-client/api/cloudPlans';\nimport * as mfaApi from '@n8n/rest-api-client/api/mfa';\nimport type {\n\tUpdateGlobalRolePayload,\n\tIUserResponse,\n\tIUser,\n\tCurrentUserResponse,\n\tIPersonalizationLatestVersion,\n} from '@n8n/rest-api-client/api/users';\nimport * as usersApi from '@n8n/rest-api-client/api/users';\nimport { useAsyncState } from '@vueuse/core';\nimport { defineStore } from 'pinia';\nimport { computed, ref } from 'vue';\n\nimport { STORES } from './constants';\nimport * as invitationsApi from './invitation.api';\nimport type { ModalOpeners } from './modalOpeners';\nimport * as onboardingApi from './onboarding.api';\nimport { useSettingsStore } from './settings.store';\nimport { useRootStore } from './useRootStore';\n\n/**\n * Registration key of the app's personalization modal, passed to the injected\n * modal opener. Mirrors `PERSONALIZATION_MODAL_KEY` in editor-ui's\n * `users.constants`; kept as a literal so the store carries no `@/app` import.\n */\nconst PERSONALIZATION_MODAL_KEY = 'personalization';\n\nconst _isPendingUser = (user: IUserResponse | null) => !!user?.isPending;\nconst _isInstanceOwner = (user: IUserResponse | null) => user?.role === ROLE.Owner;\nconst _isDefaultUser = (user: IUserResponse | null) =>\n\t_isInstanceOwner(user) && _isPendingUser(user);\nconst _isAdmin = (user: IUserResponse | null) => user?.role === ROLE.Admin;\n\nexport type LoginHook = (user: CurrentUserResponse) => void | Promise<void>;\ntype LogoutHook = () => void | Promise<void>;\n\nexport const useUsersStore = defineStore(STORES.USERS, () => {\n\tconst initialized = ref(false);\n\tconst currentUserId = ref<string | null>(null);\n\tconst usersById = ref<Record<string, IUser>>({});\n\tconst userQuota = ref<number>(-1);\n\n\tconst loginHooks = ref<LoginHook[]>([]);\n\tconst logoutHooks = ref<LogoutHook[]>([]);\n\n\t// Modal-open actions, registered at app bootstrap (see app/init.ts). Until then\n\t// they no-op — warning in dev — so the store never reaches into `ui.store`. Shares\n\t// the `ModalOpeners` contract with the other decoupled stores; this store currently\n\t// uses only `openModal`.\n\tconst warnModalOpenerMissing = (action: string) => {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconsole.warn(\n\t\t\t\t`[users.store] ${action} called before modal openers were registered; ignoring. Call registerModalOpeners() at app bootstrap.`,\n\t\t\t);\n\t\t}\n\t};\n\tconst modalOpeners = ref<ModalOpeners>({\n\t\topenModal: (name) => warnModalOpenerMissing(`openModal(${String(name)})`),\n\t\topenModalWithData: (payload) =>\n\t\t\twarnModalOpenerMissing(`openModalWithData(${String(payload.name)})`),\n\t});\n\tconst registerModalOpeners = (openers: ModalOpeners) => {\n\t\tmodalOpeners.value = openers;\n\t};\n\n\t// App-provided capabilities, registered at bootstrap (see app/init.ts) so the store\n\t// carries no `@/app` dependency. Both fall back to safe no-ops before registration.\n\n\t// Permission checks, keyed by capability (app RBAC checks; extend the object as\n\t// more permissions need resolving). `listUsers` gates the `user:list` scope.\n\tconst canListUsers = ref<() => boolean>(() => false);\n\tconst setPermissionsResolvers = (resolvers: { listUsers: () => boolean }) => {\n\t\tcanListUsers.value = resolvers.listUsers;\n\t};\n\n\t// Stores\n\n\tconst rootStore = useRootStore();\n\tconst settingsStore = useSettingsStore();\n\n\t// Computed\n\n\tconst allUsers = computed(() => Object.values(usersById.value));\n\n\tconst currentUser = computed(() =>\n\t\tcurrentUserId.value ? usersById.value[currentUserId.value] : null,\n\t);\n\n\tconst userActivated = computed(() => Boolean(currentUser.value?.settings?.userActivated));\n\n\tconst isDefaultUser = computed(() => _isDefaultUser(currentUser.value));\n\n\tconst isInstanceOwner = computed(() => _isInstanceOwner(currentUser.value));\n\n\tconst isAdmin = computed(() => _isAdmin(currentUser.value));\n\n\tconst isAdminOrOwner = computed(() => isInstanceOwner.value || isAdmin.value);\n\n\tconst mfaEnabled = computed(() => currentUser.value?.mfaEnabled ?? false);\n\n\tconst globalRoleName = computed(() => currentUser.value?.role ?? 'default');\n\n\tconst userClaimedAiCredits = computed(() => currentUser.value?.settings?.userClaimedAiCredits);\n\n\tconst isEasyAIWorkflowOnboardingDone = computed(() =>\n\t\tBoolean(currentUser.value?.settings?.easyAIWorkflowOnboarded),\n\t);\n\n\tconst canUserUpdateVersion = computed(() => {\n\t\treturn isInstanceOwner.value;\n\t});\n\n\tconst setEasyAIWorkflowOnboardingDone = () => {\n\t\tif (currentUser.value?.settings) {\n\t\t\tcurrentUser.value.settings.easyAIWorkflowOnboarded = true;\n\t\t}\n\t};\n\n\tconst isCalloutDismissed = (callout: string) =>\n\t\tBoolean(currentUser.value?.settings?.dismissedCallouts?.[callout]);\n\n\tconst setCalloutDismissed = (callout: string) => {\n\t\tif (currentUser.value?.settings) {\n\t\t\tcurrentUser.value.settings.dismissedCallouts ??= {};\n\n\t\t\tcurrentUser.value.settings.dismissedCallouts[callout] = true;\n\t\t}\n\t};\n\n\tconst usersLimitNotReached = computed(\n\t\t(): boolean => userQuota.value === -1 || userQuota.value > allUsers.value.length,\n\t);\n\n\t// Methods\n\n\tconst addUsers = (newUsers: User[]) => {\n\t\tnewUsers.forEach((userResponse) => {\n\t\t\tconst prevUser = usersById.value[userResponse.id] || {};\n\t\t\tconst updatedUser = {\n\t\t\t\t...prevUser,\n\t\t\t\t...userResponse,\n\t\t\t};\n\t\t\tconst user: IUser = {\n\t\t\t\t...updatedUser,\n\t\t\t\tfullName: userResponse.firstName\n\t\t\t\t\t? `${updatedUser.firstName} ${updatedUser.lastName ?? ''}`\n\t\t\t\t\t: undefined,\n\t\t\t\tisDefaultUser: _isDefaultUser(updatedUser),\n\t\t\t\tisPendingUser: _isPendingUser(updatedUser),\n\t\t\t};\n\n\t\t\tusersById.value = {\n\t\t\t\t...usersById.value,\n\t\t\t\t[user.id]: user,\n\t\t\t};\n\t\t});\n\t};\n\n\tconst setCurrentUser = async (user: CurrentUserResponse) => {\n\t\taddUsers([user]);\n\t\tcurrentUserId.value = user.id;\n\n\t\tfor (const hook of loginHooks.value) {\n\t\t\ttry {\n\t\t\t\tawait hook(user);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Error executing login hook:', error);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst loginWithCookie = async () => {\n\t\tconst user = await usersApi.loginCurrentUser(rootStore.restApiContext);\n\t\tif (!user) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait setCurrentUser(user);\n\t};\n\n\tconst initialize = async () => {\n\t\tif (initialized.value) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait loginWithCookie();\n\t\t\tinitialized.value = true;\n\t\t} catch {\n\t\t\t// A missing or expired auth cookie before setup is expected; leave the store\n\t\t\t// uninitialized and let the caller proceed to the login/setup flow.\n\t\t}\n\t};\n\n\tconst unsetCurrentUser = () => {\n\t\tcurrentUserId.value = null;\n\t};\n\n\tconst deleteUserById = (userId: string) => {\n\t\tconst { [userId]: _, ...rest } = usersById.value;\n\t\tusersById.value = rest;\n\t};\n\n\tconst setPersonalizationAnswers = (answers: IPersonalizationLatestVersion) => {\n\t\tif (!currentUser.value) {\n\t\t\treturn;\n\t\t}\n\n\t\tusersById.value = {\n\t\t\t...usersById.value,\n\t\t\t[currentUser.value.id]: {\n\t\t\t\t...currentUser.value,\n\t\t\t\tpersonalizationAnswers: answers,\n\t\t\t},\n\t\t};\n\t};\n\n\tconst loginWithCreds = async (params: LoginRequestDto) => {\n\t\tconst user = await usersApi.login(rootStore.restApiContext, params);\n\t\tif (!user) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait setCurrentUser(user);\n\t};\n\n\tconst registerLoginHook = (hook: LoginHook) => {\n\t\tloginHooks.value.push(hook);\n\t};\n\n\tconst registerLogoutHook = (hook: LogoutHook) => {\n\t\tlogoutHooks.value.push(hook);\n\t};\n\n\tconst logout = async () => {\n\t\tawait usersApi.logout(rootStore.restApiContext);\n\n\t\tunsetCurrentUser();\n\n\t\tfor (const hook of logoutHooks.value) {\n\t\t\ttry {\n\t\t\t\tawait hook();\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Error executing logout hook:', error);\n\t\t\t}\n\t\t}\n\n\t\tlocalStorage.removeItem(BROWSER_ID_STORAGE_KEY);\n\t};\n\n\tconst createOwner = async (params: {\n\t\tfirstName: string;\n\t\tlastName: string;\n\t\temail: string;\n\t\tpassword: string;\n\t}) => {\n\t\tconst user = await usersApi.setupOwner(rootStore.restApiContext, params);\n\t\tif (user) {\n\t\t\tawait setCurrentUser(user);\n\t\t\tsettingsStore.stopShowingSetupPage();\n\t\t}\n\t};\n\n\tconst validateSignupToken = async (params: { token: string }) => {\n\t\treturn await usersApi.validateSignupToken(rootStore.restApiContext, params);\n\t};\n\n\tconst acceptInvitation = async (params: {\n\t\ttoken: string;\n\t\tfirstName: string;\n\t\tlastName: string;\n\t\tpassword: string;\n\t}) => {\n\t\tconst user = await invitationsApi.acceptInvitation(rootStore.restApiContext, params);\n\t\tif (user) {\n\t\t\tawait setCurrentUser(user);\n\t\t}\n\t};\n\n\tconst sendForgotPasswordEmail = async (params: { email: string }) => {\n\t\tawait usersApi.sendForgotPasswordEmail(rootStore.restApiContext, params);\n\t};\n\n\tconst validatePasswordToken = async (params: { token: string }) => {\n\t\tawait usersApi.validatePasswordToken(rootStore.restApiContext, params);\n\t};\n\n\tconst changePassword = async (params: { token: string; password: string; mfaCode?: string }) => {\n\t\tawait usersApi.changePassword(rootStore.restApiContext, params);\n\t};\n\n\tconst updateUser = async (params: UserUpdateRequestDto) => {\n\t\tconst user = await usersApi.updateCurrentUser(rootStore.restApiContext, params);\n\t\taddUsers([user]);\n\t\treturn user;\n\t};\n\n\tconst updateUserName = async (params: { firstName: string; lastName: string }) => {\n\t\tif (!currentUser.value) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn await updateUser({\n\t\t\temail: currentUser.value.email as string,\n\t\t\t...params,\n\t\t});\n\t};\n\n\tconst updateUserSettings = async (settings: UserSelfSettingsUpdateRequestDto) => {\n\t\tconst updatedSettings = await usersApi.updateCurrentUserSettings(\n\t\t\trootStore.restApiContext,\n\t\t\tsettings,\n\t\t);\n\t\tif (currentUser.value) {\n\t\t\tcurrentUser.value.settings = updatedSettings;\n\t\t\taddUsers([currentUser.value]);\n\t\t}\n\t};\n\n\tconst updateOtherUserSettings = async (userId: string, settings: SettingsUpdateRequestDto) => {\n\t\tawait usersApi.updateOtherUserSettings(rootStore.restApiContext, userId, settings);\n\t};\n\n\tconst updateCurrentUserPassword = async (params: PasswordUpdateRequestDto) => {\n\t\tawait usersApi.updateCurrentUserPassword(rootStore.restApiContext, params);\n\t};\n\n\tconst deleteUser = async (params: { id: string; transferId?: string }) => {\n\t\tawait usersApi.deleteUser(rootStore.restApiContext, params);\n\t\tdeleteUserById(params.id);\n\t};\n\n\tconst fetchUsers = async ({\n\t\ttake,\n\t\tskip,\n\t\tfilter,\n\t}: { take?: number; skip?: number; filter?: UsersListFilterDto['filter'] } = {}) => {\n\t\tif (!canListUsers.value()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { items } = await usersApi.getUsers(rootStore.restApiContext, {\n\t\t\ttake: take ?? 50,\n\t\t\tskip: skip ?? 0,\n\t\t\tfilter,\n\t\t});\n\t\taddUsers(items);\n\t};\n\n\tconst inviteUsers = async (params: Array<{ email: string; role: AssignableGlobalRole }>) => {\n\t\tconst invitedUsers = await invitationsApi.inviteUsers(rootStore.restApiContext, params);\n\t\taddUsers(\n\t\t\tinvitedUsers.map(({ user }) => ({\n\t\t\t\tisPending: true,\n\t\t\t\t...user,\n\t\t\t})),\n\t\t);\n\t\treturn invitedUsers;\n\t};\n\n\tconst reinviteUser = async ({ email, role }: { email: string; role: AssignableGlobalRole }) => {\n\t\tconst invitationResponse = await invitationsApi.inviteUsers(rootStore.restApiContext, [\n\t\t\t{ email, role },\n\t\t]);\n\t\tif (!invitationResponse[0].user.emailSent) {\n\t\t\tthrow Error(invitationResponse[0].error);\n\t\t}\n\t};\n\n\tconst getUserPasswordResetLink = async (params: { id: string }) => {\n\t\treturn await usersApi.getPasswordResetLink(rootStore.restApiContext, params);\n\t};\n\n\tconst generateInviteLink = async (params: { id: string }) => {\n\t\treturn await usersApi.generateInviteLink(rootStore.restApiContext, params);\n\t};\n\n\tconst submitPersonalizationSurvey = async (results: IPersonalizationLatestVersion) => {\n\t\tawait usersApi.submitPersonalizationSurvey(rootStore.restApiContext, results);\n\t\tsetPersonalizationAnswers(results);\n\t};\n\n\t// Synchronous: after the `ui.store` modal decoupling this only fires the injected\n\t// opener. All call sites invoke it fire-and-forget (`void ...`).\n\tconst showPersonalizationSurvey = () => {\n\t\tconst surveyEnabled = settingsStore.isPersonalizationSurveyEnabled;\n\t\tif (surveyEnabled && currentUser.value && !currentUser.value.personalizationAnswers) {\n\t\t\tmodalOpeners.value.openModal(PERSONALIZATION_MODAL_KEY);\n\t\t}\n\t};\n\n\tconst fetchMfaQR = async () => {\n\t\treturn await mfaApi.getMfaQR(rootStore.restApiContext);\n\t};\n\n\tconst verifyMfaCode = async (data: { mfaCode: string }) => {\n\t\treturn await mfaApi.verifyMfaCode(rootStore.restApiContext, data);\n\t};\n\n\tconst canEnableMFA = async () => {\n\t\treturn await mfaApi.canEnableMFA(rootStore.restApiContext);\n\t};\n\n\tconst enableMfa = async (data: { mfaCode: string }) => {\n\t\tawait mfaApi.enableMfa(rootStore.restApiContext, data);\n\t\tif (currentUser.value) {\n\t\t\tcurrentUser.value.mfaEnabled = true;\n\t\t}\n\t};\n\n\tconst disableMfa = async (data: mfaApi.DisableMfaParams) => {\n\t\tawait mfaApi.disableMfa(rootStore.restApiContext, data);\n\n\t\tif (currentUser.value) {\n\t\t\tcurrentUser.value.mfaEnabled = false;\n\t\t}\n\t};\n\n\tconst updateEnforceMfa = async (enforce: boolean) => {\n\t\tawait mfaApi.updateEnforceMfa(rootStore.restApiContext, enforce);\n\t\tsettingsStore.isMFAEnforced = enforce;\n\t};\n\n\tconst sendConfirmationEmail = async () => {\n\t\tawait cloudApi.sendConfirmationEmail(rootStore.restApiContext);\n\t};\n\n\tconst updateGlobalRole = async ({ id, newRoleName }: UpdateGlobalRolePayload) => {\n\t\tawait usersApi.updateGlobalRole(rootStore.restApiContext, { id, newRoleName });\n\t\tawait fetchUsers({ filter: { ids: [id] } });\n\t};\n\n\tconst submitContactEmail = async (email: string, agree: boolean) => {\n\t\tif (currentUser.value) {\n\t\t\treturn await onboardingApi.submitEmailOnSignup(\n\t\t\t\trootStore.instanceId,\n\t\t\t\tcurrentUser.value,\n\t\t\t\temail ?? currentUser.value.email,\n\t\t\t\tagree,\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t};\n\n\tconst usersList = useAsyncState(\n\t\tasync (filter?: UsersListFilterDto) =>\n\t\t\tawait usersApi.getUsers(rootStore.restApiContext, filter),\n\t\t{\n\t\t\tcount: 0,\n\t\t\titems: [],\n\t\t},\n\t\t{ immediate: false, resetOnExecute: false },\n\t);\n\n\tconst setUserQuota = (quota?: number) => {\n\t\tif (typeof quota !== 'undefined') {\n\t\t\tuserQuota.value = quota;\n\t\t}\n\t};\n\n\treturn {\n\t\tinitialized,\n\t\tcurrentUserId,\n\t\tusersById,\n\t\tallUsers,\n\t\tcurrentUser,\n\t\tuserActivated,\n\t\tisDefaultUser,\n\t\tisInstanceOwner,\n\t\tisAdmin,\n\t\tisAdminOrOwner,\n\t\tmfaEnabled,\n\t\tglobalRoleName,\n\t\tuserClaimedAiCredits,\n\t\tisEasyAIWorkflowOnboardingDone,\n\t\tcanUserUpdateVersion,\n\t\tusersLimitNotReached,\n\t\taddUsers,\n\t\tloginWithCookie,\n\t\tinitialize,\n\t\tsetPersonalizationAnswers,\n\t\tloginWithCreds,\n\t\tlogout,\n\t\tregisterLoginHook,\n\t\tregisterLogoutHook,\n\t\tregisterModalOpeners,\n\t\tsetPermissionsResolvers,\n\t\tcreateOwner,\n\t\tvalidateSignupToken,\n\t\tacceptInvitation,\n\t\tsendForgotPasswordEmail,\n\t\tvalidatePasswordToken,\n\t\tchangePassword,\n\t\tupdateUser,\n\t\tupdateUserName,\n\t\tupdateUserSettings,\n\t\tupdateOtherUserSettings,\n\t\tupdateCurrentUserPassword,\n\t\tdeleteUser,\n\t\tfetchUsers,\n\t\tinviteUsers,\n\t\treinviteUser,\n\t\tgetUserPasswordResetLink,\n\t\tgenerateInviteLink,\n\t\tsubmitPersonalizationSurvey,\n\t\tshowPersonalizationSurvey,\n\t\tfetchMfaQR,\n\t\tverifyMfaCode,\n\t\tenableMfa,\n\t\tdisableMfa,\n\t\tupdateEnforceMfa,\n\t\tcanEnableMFA,\n\t\tsendConfirmationEmail,\n\t\tupdateGlobalRole,\n\t\tsetEasyAIWorkflowOnboardingDone,\n\t\tisCalloutDismissed,\n\t\tsetCalloutDismissed,\n\t\tsubmitContactEmail,\n\t\tsetUserQuota,\n\t\tusersList,\n\t};\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,4BAA4B;AAElC,MAAM,kBAAkB,SAA+B,CAAC,CAAC,MAAM;AAC/D,MAAM,oBAAoB,SAA+B,MAAM,SAAS,KAAK;AAC7E,MAAM,kBAAkB,SACvB,iBAAiB,KAAK,IAAI,eAAe,KAAK;AAC/C,MAAM,YAAY,SAA+B,MAAM,SAAS,KAAK;AAKrE,MAAa,gBAAgB,YAAY,OAAO,aAAa;CAC5D,MAAM,cAAc,IAAI,MAAM;CAC9B,MAAM,gBAAgB,IAAmB,KAAK;CAC9C,MAAM,YAAY,IAA2B,EAAE,CAAC;CAChD,MAAM,YAAY,IAAY,GAAG;CAEjC,MAAM,aAAa,IAAiB,EAAE,CAAC;CACvC,MAAM,cAAc,IAAkB,EAAE,CAAC;CAMzC,MAAM,0BAA0B,WAAmB;AAClD,MAAI,OAAO,KAAK,IAAI,IACnB,SAAQ,KACP,iBAAiB,OAAO,uGACxB;;CAGH,MAAM,eAAe,IAAkB;EACtC,YAAY,SAAS,uBAAuB,aAAa,OAAO,KAAK,CAAC,GAAG;EACzE,oBAAoB,YACnB,uBAAuB,qBAAqB,OAAO,QAAQ,KAAK,CAAC,GAAG;EACrE,CAAC;CACF,MAAM,wBAAwB,YAA0B;AACvD,eAAa,QAAQ;;CAQtB,MAAM,eAAe,UAAyB,MAAM;CACpD,MAA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