@telia-ace/alliance-internal-client-utilities 1.0.1-next.0 → 1.0.2-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @telia-ace/alliance-internal-client-utilities
2
2
 
3
+ ## 1.0.2-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 59f0d3f: Remove unnecessary scripts.
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - fd378fe: Move internal utilities from `@telia-ace/alliance-utilities` to `@telia-ace/alliance-internal-client-utilities` and `@telia-ace/alliance-internal-node-utilities`.
14
+
3
15
  ## 1.0.1-next.0
4
16
 
5
17
  ### Patch Changes
@@ -10,7 +10,8 @@ export declare enum FrameworkErrorCodes {
10
10
  CookieKeyNotDefined = 1008,
11
11
  CookieCategoryNotAllowed = 1009,
12
12
  StorageKeyNotDefined = 1010,
13
- StorageCategoryNotAllowed = 1011
13
+ StorageCategoryNotAllowed = 1011,
14
+ LocalizationTemplateNotDefined = 1012
14
15
  }
15
16
  export declare enum UtilitiesErrorCodes {
16
17
  CurrentUserMissingProvider = 2000,
package/dist/index.js CHANGED
@@ -1,105 +1,58 @@
1
- var f = Object.defineProperty;
2
- var v = (e, t, r) => t in e ? f(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
1
+ var g = Object.defineProperty;
2
+ var v = (e, t, r) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var a = (e, t, r) => (v(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- var N = /* @__PURE__ */ ((e) => (e[e.AlreadyInitialized = 1e3] = "AlreadyInitialized", e[e.NoAppNameOrKey = 1001] = "NoAppNameOrKey", e[e.MissingAppController = 1002] = "MissingAppController", e[e.MissingCapabilityOnApp = 1003] = "MissingCapabilityOnApp", e[e.MissingManagedObjectProvider = 1004] = "MissingManagedObjectProvider", e[e.NoManifest = 1005] = "NoManifest", e[e.NoRootElement = 1006] = "NoRootElement", e[e.NoView = 1007] = "NoView", e[e.CookieKeyNotDefined = 1008] = "CookieKeyNotDefined", e[e.CookieCategoryNotAllowed = 1009] = "CookieCategoryNotAllowed", e[e.StorageKeyNotDefined = 1010] = "StorageKeyNotDefined", e[e.StorageCategoryNotAllowed = 1011] = "StorageCategoryNotAllowed", e))(N || {}), A = /* @__PURE__ */ ((e) => (e[e.CurrentUserMissingProvider = 2e3] = "CurrentUserMissingProvider", e[e.CurrentUserGatewayNotStarted = 2001] = "CurrentUserGatewayNotStarted", e[e.CurrentUserMissingBackend = 2002] = "CurrentUserMissingBackend", e[e.CurrentUserMissingInDatabase = 2003] = "CurrentUserMissingInDatabase", e))(A || {});
4
+ var N = /* @__PURE__ */ ((e) => (e[e.AlreadyInitialized = 1e3] = "AlreadyInitialized", e[e.NoAppNameOrKey = 1001] = "NoAppNameOrKey", e[e.MissingAppController = 1002] = "MissingAppController", e[e.MissingCapabilityOnApp = 1003] = "MissingCapabilityOnApp", e[e.MissingManagedObjectProvider = 1004] = "MissingManagedObjectProvider", e[e.NoManifest = 1005] = "NoManifest", e[e.NoRootElement = 1006] = "NoRootElement", e[e.NoView = 1007] = "NoView", e[e.CookieKeyNotDefined = 1008] = "CookieKeyNotDefined", e[e.CookieCategoryNotAllowed = 1009] = "CookieCategoryNotAllowed", e[e.StorageKeyNotDefined = 1010] = "StorageKeyNotDefined", e[e.StorageCategoryNotAllowed = 1011] = "StorageCategoryNotAllowed", e[e.LocalizationTemplateNotDefined = 1012] = "LocalizationTemplateNotDefined", e))(N || {}), A = /* @__PURE__ */ ((e) => (e[e.CurrentUserMissingProvider = 2e3] = "CurrentUserMissingProvider", e[e.CurrentUserGatewayNotStarted = 2001] = "CurrentUserGatewayNotStarted", e[e.CurrentUserMissingBackend = 2002] = "CurrentUserMissingBackend", e[e.CurrentUserMissingInDatabase = 2003] = "CurrentUserMissingInDatabase", e))(A || {});
5
5
  function m(e, t) {
6
6
  return Object.entries(t).reduce((r, [i, n]) => r.replaceAll(`{{${i}}}`, n), e);
7
7
  }
8
8
  const S = {
9
9
  // framework
10
- [
11
- 1e3
12
- /* AlreadyInitialized */
13
- ]: "The runtime has already been initialized",
14
- [
15
- 1001
16
- /* NoAppNameOrKey */
17
- ]: "App name and/or app key is not defined on global scope",
18
- [
19
- 1002
20
- /* MissingAppController */
21
- ]: "No app controller registered for app '{{app}}'",
22
- [
23
- 1003
24
- /* MissingCapabilityOnApp */
25
- ]: "No capability '{{capability}}' enabled for app '{{app}}'",
26
- [
27
- 1004
28
- /* MissingManagedObjectProvider */
29
- ]: "No managed object provider registered for object '{{object}}'",
30
- [
31
- 1005
32
- /* NoManifest */
33
- ]: "The current apps manifest is not defined on global scope",
34
- [
35
- 1006
36
- /* NoRootElement */
37
- ]: "Could not find the root element in the DOM",
38
- [
39
- 1007
40
- /* NoView */
41
- ]: "Could not find view with id '{{id}}' on view controller for app '{{app}}'",
42
- [
43
- 1008
44
- /* CookieKeyNotDefined */
45
- ]: "Cookie key '{{key}}' not present in manifest, cookie has not been set",
46
- [
47
- 1009
48
- /* CookieCategoryNotAllowed */
49
- ]: "Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set",
50
- [
51
- 1010
52
- /* StorageKeyNotDefined */
53
- ]: "Storage key '{{key}}' not present in manifest, item has not been stored",
54
- [
55
- 1011
56
- /* StorageCategoryNotAllowed */
57
- ]: "Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored",
10
+ 1e3: "The runtime has already been initialized",
11
+ 1001: "App name and/or app key is not defined on global scope",
12
+ 1002: "No app controller registered for app '{{app}}'",
13
+ 1003: "No capability '{{capability}}' enabled for app '{{app}}'",
14
+ 1004: "No managed object provider registered for object '{{object}}'",
15
+ 1005: "The current apps manifest is not defined on global scope",
16
+ 1006: "Could not find the root element in the DOM",
17
+ 1007: "Could not find view with id '{{id}}' on view controller for app '{{app}}'",
18
+ 1008: "Cookie key '{{key}}' not present in manifest, cookie has not been set",
19
+ 1009: "Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set",
20
+ 1010: "Storage key '{{key}}' not present in manifest, item has not been stored",
21
+ 1011: "Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored",
22
+ 1012: "The translation template, referred by the key '{{key}}' is being used in app, but is not defined in the manifest.",
58
23
  // utilities
59
- [
60
- 2e3
61
- /* CurrentUserMissingProvider */
62
- ]: "No managed object provider registered for object 'currentUser'",
63
- [
64
- 2001
65
- /* CurrentUserGatewayNotStarted */
66
- ]: "Could not access the gateway when querying 'currentUser'",
67
- [
68
- 2002
69
- /* CurrentUserMissingBackend */
70
- ]: "Could not access the required backend when querying 'currentUser'",
71
- [
72
- 2003
73
- /* CurrentUserMissingInDatabase */
74
- ]: "Could not locate the authenticated user in the Alliance database"
24
+ 2e3: "No managed object provider registered for object 'currentUser'",
25
+ 2001: "Could not access the gateway when querying 'currentUser'",
26
+ 2002: "Could not access the required backend when querying 'currentUser'",
27
+ 2003: "Could not locate the authenticated user in the Alliance database"
75
28
  }, d = "AllianceError";
76
- class C extends Error {
29
+ class I extends Error {
77
30
  constructor(t, r = {}) {
78
31
  const i = m(S[t], r), n = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${t}`;
79
32
  super(i), this.code = t, this.name = d, this.stack = `[${t}] - ${i}
80
33
  ` + n;
81
34
  }
82
35
  }
83
- function I(e) {
36
+ function k(e) {
84
37
  return !!e.code && e.name === d;
85
38
  }
86
- function D(e) {
39
+ function b(e) {
87
40
  const r = Object.entries(e).reduce((i, n) => {
88
41
  const [o, p] = n;
89
42
  return typeof p > "u" || (typeof p == "object" && p !== null ? i[o] = JSON.stringify(p) : i[o] = p), i;
90
43
  }, {});
91
44
  return Object.keys(r).length ? `?${new URLSearchParams(r)}` : "";
92
45
  }
93
- function b() {
46
+ function D() {
94
47
  const e = l(), { href: t, search: r } = window.location;
95
48
  return t.replace(e, "").replace(r, "");
96
49
  }
97
- function k(e = "", t = "", r = {}) {
98
- const i = l().replace(location.origin, ""), n = D(r);
50
+ function C(e = "", t = "", r = {}) {
51
+ const i = l().replace(location.origin, ""), n = b(r);
99
52
  return e ? t ? `${i}/${e}/${t}${n}` : `${i}/${e}${n}` : `${i}${n}`;
100
53
  }
101
54
  function W() {
102
- const e = b(), [t = "", r = ""] = e.split("/").filter((i) => !!i);
55
+ const e = D(), [t = "", r = ""] = e.split("/").filter((i) => !!i);
103
56
  return {
104
57
  app: t,
105
58
  capability: r
@@ -118,184 +71,76 @@ function l() {
118
71
  }
119
72
  var s = /* @__PURE__ */ ((e) => (e[e.AlreadyExists = 0] = "AlreadyExists", e[e.ApiGatewayPortDescription = 1] = "ApiGatewayPortDescription", e[e.ApiServerModeDescription = 2] = "ApiServerModeDescription", e[e.AppConfigurationPath = 3] = "AppConfigurationPath", e[e.AppCreated = 4] = "AppCreated", e[e.AppEntryBuildOptionDescription = 5] = "AppEntryBuildOptionDescription", e[e.AppNameInquiry = 6] = "AppNameInquiry", e[e.BuildDescription = 7] = "BuildDescription", e[e.BuildModeOptionDescription = 8] = "BuildModeOptionDescription", e[e.BuildWatchDescription = 9] = "BuildWatchDescription", e[e.CreateAppDescription = 10] = "CreateAppDescription", e[e.CreateWorkspaceDescription = 11] = "CreateWorkspaceDescription", e[e.DevServerOpenDescription = 12] = "DevServerOpenDescription", e[e.DevServerPortDescription = 13] = "DevServerPortDescription", e[e.DevServerLoggingDescription = 14] = "DevServerLoggingDescription", e[e.Done = 15] = "Done", e[e.FetchPackageVersionError = 16] = "FetchPackageVersionError", e[e.ManifestEntryBuildOptionDescription = 17] = "ManifestEntryBuildOptionDescription", e[e.MissingTranslationKey = 18] = "MissingTranslationKey", e[e.NoAppName = 19] = "NoAppName", e[e.NoAppNameFound = 20] = "NoAppNameFound", e[e.NoAppOrWorkspaceInCurrentDirectory = 21] = "NoAppOrWorkspaceInCurrentDirectory", e[e.NoWorkspaceName = 22] = "NoWorkspaceName", e[e.OperationCancelled = 23] = "OperationCancelled", e[e.ServeDescription = 24] = "ServeDescription", e[e.ServedStopped = 25] = "ServedStopped", e[e.ServerGatewayMode = 26] = "ServerGatewayMode", e[e.ServerMode = 27] = "ServerMode", e[e.ServerModeInquiry = 28] = "ServerModeInquiry", e[e.ServerProxyMode = 29] = "ServerProxyMode", e[e.StopServerInstructions = 30] = "StopServerInstructions", e[e.TemplateFrameworkInquiry = 31] = "TemplateFrameworkInquiry", e[e.TemplateLanguageInquiry = 32] = "TemplateLanguageInquiry", e[e.UnrecognizedCommand = 33] = "UnrecognizedCommand", e[e.WorkspaceCreated = 34] = "WorkspaceCreated", e[e.WorkspaceNameInquiry = 35] = "WorkspaceNameInquiry", e))(s || {});
120
73
  const M = {
121
- [
122
- 15
123
- /* Done */
124
- ]: "Done",
125
- [
126
- 22
127
- /* NoWorkspaceName */
128
- ]: "No workspace name provided!",
129
- [
130
- 19
131
- /* NoAppName */
132
- ]: "No app name provided!",
133
- [
134
- 0
135
- /* AlreadyExists */
136
- ]: "File or directory '{0}' already exists!",
137
- [
138
- 21
139
- /* NoAppOrWorkspaceInCurrentDirectory */
140
- ]: "Could not find any app entry file at '{0}'!",
141
- [
142
- 33
143
- /* UnrecognizedCommand */
144
- ]: "Unrecognized command(s) {0}!",
145
- [
146
- 34
147
- /* WorkspaceCreated */
148
- ]: "Workspace was created at path '{0}'!",
149
- [
150
- 4
151
- /* AppCreated */
152
- ]: "App was created at path '{0}'!",
153
- [
154
- 25
155
- /* ServedStopped */
156
- ]: "Server stopped.",
157
- [
158
- 11
159
- /* CreateWorkspaceDescription */
160
- ]: "Creates an Alliance Workspace in the current directory.",
161
- [
162
- 10
163
- /* CreateAppDescription */
164
- ]: "Creates an Alliance Application in the current directory or Alliance Workspace.",
165
- [
166
- 24
167
- /* ServeDescription */
168
- ]: "Starts a Alliance development server using the current directory package.json.",
169
- [
170
- 7
171
- /* BuildDescription */
172
- ]: "Builds an Alliance Application using Vite.",
173
- [
174
- 35
175
- /* WorkspaceNameInquiry */
176
- ]: "Enter the name of your workspace",
177
- [
178
- 28
179
- /* ServerModeInquiry */
180
- ]: "Which server mode do you want to use?",
181
- [
182
- 6
183
- /* AppNameInquiry */
184
- ]: "Enter the name of your app",
185
- [
186
- 18
187
- /* MissingTranslationKey */
188
- ]: "No translation key provided!",
189
- [
190
- 23
191
- /* OperationCancelled */
192
- ]: "Operation cancelled.",
193
- [
194
- 30
195
- /* StopServerInstructions */
196
- ]: `Press CTRL + C to stop the server.
74
+ 15: "Done",
75
+ 22: "No workspace name provided!",
76
+ 19: "No app name provided!",
77
+ 0: "File or directory '{0}' already exists!",
78
+ 21: "Could not find any app entry file at '{0}'!",
79
+ 33: "Unrecognized command(s) {0}!",
80
+ 34: "Workspace was created at path '{0}'!",
81
+ 4: "App was created at path '{0}'!",
82
+ 25: "Server stopped.",
83
+ 11: "Creates an Alliance Workspace in the current directory.",
84
+ 10: "Creates an Alliance Application in the current directory or Alliance Workspace.",
85
+ 24: "Starts a Alliance development server using the current directory package.json.",
86
+ 7: "Builds an Alliance Application using Vite.",
87
+ 35: "Enter the name of your workspace",
88
+ 28: "Which server mode do you want to use?",
89
+ 6: "Enter the name of your app",
90
+ 18: "No translation key provided!",
91
+ 23: "Operation cancelled.",
92
+ 30: `Press CTRL + C to stop the server.
197
93
  `,
198
- [
199
- 32
200
- /* TemplateLanguageInquiry */
201
- ]: "Select preferred language",
202
- [
203
- 31
204
- /* TemplateFrameworkInquiry */
205
- ]: "Select preferred framework template",
206
- [
207
- 13
208
- /* DevServerPortDescription */
209
- ]: "The port that the dev server should use.",
210
- [
211
- 14
212
- /* DevServerLoggingDescription */
213
- ]: "Whether the dev server and browser console should output more log information or not (false).",
214
- [
215
- 1
216
- /* ApiGatewayPortDescription */
217
- ]: "The port that the api gateway should use.",
218
- [
219
- 2
220
- /* ApiServerModeDescription */
221
- ]: "Which components to start. [server|server-proxy|server-gateway].",
222
- [
223
- 12
224
- /* DevServerOpenDescription */
225
- ]: "Whether the dev server should automatically open in your browser or not.",
226
- [
227
- 9
228
- /* BuildWatchDescription */
229
- ]: "Whether the build should start watching and rebuild when files change or not.",
230
- [
231
- 5
232
- /* AppEntryBuildOptionDescription */
233
- ]: "The entry file for the app (./src/app).",
234
- [
235
- 17
236
- /* ManifestEntryBuildOptionDescription */
237
- ]: "The entry file for the app manifest (./src/manifest).",
238
- [
239
- 8
240
- /* BuildModeOptionDescription */
241
- ]: "Which mode to use when building the app.",
242
- [
243
- 16
244
- /* FetchPackageVersionError */
245
- ]: "Failed to fetch package info from the NPM registry for package '${0}'!",
246
- [
247
- 20
248
- /* NoAppNameFound */
249
- ]: "Could not find app name in manifest.",
250
- [
251
- 3
252
- /* AppConfigurationPath */
253
- ]: "The path to the app configuration file.",
254
- [
255
- 27
256
- /* ServerMode */
257
- ]: "Server",
258
- [
259
- 29
260
- /* ServerProxyMode */
261
- ]: "Server with proxy",
262
- [
263
- 26
264
- /* ServerGatewayMode */
265
- ]: "Server with gateway"
266
- }, u = class {
94
+ 32: "Select preferred language",
95
+ 31: "Select preferred framework template",
96
+ 13: "The port that the dev server should use.",
97
+ 14: "Whether the dev server and browser console should output more log information or not (false).",
98
+ 1: "The port that the api gateway should use.",
99
+ 2: "Which components to start. [server|server-proxy|server-gateway].",
100
+ 12: "Whether the dev server should automatically open in your browser or not.",
101
+ 9: "Whether the build should start watching and rebuild when files change or not.",
102
+ 5: "The entry file for the app (./src/app).",
103
+ 17: "The entry file for the app manifest (./src/manifest).",
104
+ 8: "Which mode to use when building the app.",
105
+ 16: "Failed to fetch package info from the NPM registry for package '${0}'!",
106
+ 20: "Could not find app name in manifest.",
107
+ 3: "The path to the app configuration file.",
108
+ 27: "Server",
109
+ 29: "Server with proxy",
110
+ 26: "Server with gateway"
111
+ }, c = class c {
267
112
  };
268
- let c = u;
269
113
  a(c, "getTranslations", () => M), a(c, "getTranslation", (t, ...r) => {
270
- const n = u.getTranslations()[t];
114
+ const n = c.getTranslations()[t];
271
115
  if (!n)
272
116
  throw new Error(`Could not find text with given key '${t}'.`);
273
117
  return r.reduce(
274
- (p, h, g) => p.toString().replace(`{${g}}`, h.toString()),
118
+ (p, h, f) => p.toString().replace(`{${f}}`, h.toString()),
275
119
  n
276
120
  ).toString();
277
- }), a(c, "get", (t = s.MissingTranslationKey, ...r) => u.getTranslation(t, ...r));
121
+ }), a(c, "get", (t = s.MissingTranslationKey, ...r) => c.getTranslation(t, ...r));
122
+ let u = c;
278
123
  function R(e, t) {
279
- return y(Object.values(e), ({ name: r }) => ({
124
+ return O(Object.values(e), ({ name: r }) => ({
280
125
  label: r,
281
126
  value: r,
282
127
  selected: t === r
283
128
  }));
284
129
  }
285
- var O = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e.Expressive = "expressive", e.Destructive = "destructive", e.Text = "text", e.PrimaryWhite = "primary-white", e.SecondaryWhite = "secondary-white", e.ExpressiveWhite = "expressive-white", e.TertiaryPurple = "tertiary-purple", e))(O || {});
130
+ var y = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e.Expressive = "expressive", e.Destructive = "destructive", e.Text = "text", e.PrimaryWhite = "primary-white", e.SecondaryWhite = "secondary-white", e.ExpressiveWhite = "expressive-white", e.TertiaryPurple = "tertiary-purple", e))(y || {});
286
131
  function $(e, t) {
287
132
  return Object.values(e).find((i) => i.name === t);
288
133
  }
289
- function y(e, t) {
134
+ function O(e, t, r = "Choose...") {
290
135
  return e.reduce(
291
- (r, i) => (r.push({
136
+ (i, n) => (i.push({
292
137
  disabled: !1,
293
138
  selected: !1,
294
- ...t(i)
295
- }), r),
139
+ ...t(n)
140
+ }), i),
296
141
  [
297
142
  {
298
- label: "Choose...",
143
+ label: r,
299
144
  value: "",
300
145
  disabled: !0,
301
146
  selected: !0
@@ -303,12 +148,12 @@ function y(e, t) {
303
148
  ]
304
149
  );
305
150
  }
306
- function U(e) {
151
+ function L(e) {
307
152
  return (t) => {
308
153
  t.key === "Enter" && e(t);
309
154
  };
310
155
  }
311
- function L(e, t = "all") {
156
+ function U(e, t = "all") {
312
157
  const { email: r, displayName: i } = e, n = i && i !== "unknown", o = !!r;
313
158
  switch (t) {
314
159
  case "all": {
@@ -331,22 +176,29 @@ function L(e, t = "all") {
331
176
  function j(...e) {
332
177
  return e.filter((t) => !!t).join(" ");
333
178
  }
179
+ function q(e) {
180
+ return Object.entries(e).reduce(
181
+ (t, [r, i]) => (typeof i != "object" && typeof i != "function" && (t[r] = i), t),
182
+ {}
183
+ );
184
+ }
334
185
  export {
335
- C as AllianceError,
186
+ I as AllianceError,
336
187
  N as FrameworkErrorCodes,
337
- c as Texts,
188
+ u as Texts,
338
189
  s as TranslationsKey,
339
190
  A as UtilitiesErrorCodes,
340
- O as VocaButtonVariant,
191
+ y as VocaButtonVariant,
341
192
  j as classNames,
342
- k as createCapabilityPath,
343
- L as friendlyUserName,
193
+ C as createCapabilityPath,
194
+ U as friendlyUserName,
344
195
  W as getCurrentLocationInfo,
345
196
  l as getRuntimeRootUrl,
346
197
  $ as getVocaIcon,
347
- I as isAllianceError,
348
- y as mapToVocaOptions,
349
- U as onEnter,
198
+ k as isAllianceError,
199
+ O as mapToVocaOptions,
200
+ L as onEnter,
201
+ q as props,
350
202
  P as setRuntimeRootUrl,
351
203
  R as vocaIconsToOptions
352
204
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/exceptions.ts","../src/routing.ts","../src/translations.ts","../src/texts.ts","../src/ui.ts"],"sourcesContent":["export enum FrameworkErrorCodes {\n AlreadyInitialized = 1000,\n NoAppNameOrKey = 1001,\n MissingAppController = 1002,\n MissingCapabilityOnApp = 1003,\n MissingManagedObjectProvider = 1004,\n NoManifest = 1005,\n NoRootElement = 1006,\n NoView = 1007,\n CookieKeyNotDefined = 1008,\n CookieCategoryNotAllowed = 1009,\n StorageKeyNotDefined = 1010,\n StorageCategoryNotAllowed = 1011,\n}\n\nexport enum UtilitiesErrorCodes {\n CurrentUserMissingProvider = 2000,\n CurrentUserGatewayNotStarted = 2001,\n CurrentUserMissingBackend = 2002,\n CurrentUserMissingInDatabase = 2003,\n}\n\ntype ErrorCodes = UtilitiesErrorCodes | FrameworkErrorCodes;\n\nfunction parseTemplates(message: string, variables: Record<string, string>) {\n return Object.entries(variables).reduce((acc, [key, value]) => {\n return acc.replaceAll(`{{${key}}}`, value);\n }, message);\n}\n\nconst allianceErrors: Record<ErrorCodes, string> = {\n // framework\n [FrameworkErrorCodes.AlreadyInitialized]: 'The runtime has already been initialized',\n [FrameworkErrorCodes.NoAppNameOrKey]: 'App name and/or app key is not defined on global scope',\n [FrameworkErrorCodes.MissingAppController]: \"No app controller registered for app '{{app}}'\",\n [FrameworkErrorCodes.MissingCapabilityOnApp]:\n \"No capability '{{capability}}' enabled for app '{{app}}'\",\n [FrameworkErrorCodes.MissingManagedObjectProvider]:\n \"No managed object provider registered for object '{{object}}'\",\n [FrameworkErrorCodes.NoManifest]: 'The current apps manifest is not defined on global scope',\n [FrameworkErrorCodes.NoRootElement]: 'Could not find the root element in the DOM',\n [FrameworkErrorCodes.NoView]:\n \"Could not find view with id '{{id}}' on view controller for app '{{app}}'\",\n [FrameworkErrorCodes.CookieKeyNotDefined]:\n \"Cookie key '{{key}}' not present in manifest, cookie has not been set\",\n [FrameworkErrorCodes.CookieCategoryNotAllowed]:\n \"Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set\",\n [FrameworkErrorCodes.StorageKeyNotDefined]:\n \"Storage key '{{key}}' not present in manifest, item has not been stored\",\n [FrameworkErrorCodes.StorageCategoryNotAllowed]:\n \"Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored\",\n\n // utilities\n [UtilitiesErrorCodes.CurrentUserMissingProvider]:\n \"No managed object provider registered for object 'currentUser'\",\n [UtilitiesErrorCodes.CurrentUserGatewayNotStarted]:\n \"Could not access the gateway when querying 'currentUser'\",\n [UtilitiesErrorCodes.CurrentUserMissingBackend]:\n \"Could not access the required backend when querying 'currentUser'\",\n [UtilitiesErrorCodes.CurrentUserMissingInDatabase]:\n 'Could not locate the authenticated user in the Alliance database',\n};\n\nconst ALLIANCE_ERROR_NAME = 'AllianceError';\n\nexport class AllianceError extends Error {\n constructor(public code: ErrorCodes, variables: Record<string, string> = {}) {\n const message = parseTemplates(allianceErrors[code], variables);\n const info = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${code}`;\n super(message);\n\n this.name = ALLIANCE_ERROR_NAME;\n this.stack = `[${code}] - ${message}` + '\\n' + info;\n }\n}\n\nexport function isAllianceError(error: any): error is AllianceError {\n return !!error.code && error.name === ALLIANCE_ERROR_NAME;\n}\n","import { SerializeableObject } from './types';\n\nfunction createQueryString(args: SerializeableObject) {\n const entries = Object.entries(args);\n\n const filteredArgs = entries.reduce<SerializeableObject>((acc, entry) => {\n const [key, value] = entry;\n\n if (typeof value === 'undefined') {\n return acc;\n } else if (typeof value === 'object' && value !== null) {\n acc[key] = JSON.stringify(value);\n } else {\n acc[key] = value;\n }\n\n return acc;\n }, {});\n\n if (!Object.keys(filteredArgs).length) {\n return '';\n }\n\n return `?${new URLSearchParams(filteredArgs as Record<string, any>)}`;\n}\n\nfunction getCurrentPath() {\n const runtimeRootUrl = getRuntimeRootUrl();\n const { href, search } = window.location;\n\n return href.replace(runtimeRootUrl, '').replace(search, '');\n}\n\nexport function createCapabilityPath(\n app: string = '',\n capability: string = '',\n args: SerializeableObject = {}\n) {\n const rootPath = getRuntimeRootUrl().replace(location.origin, '');\n const queryString = createQueryString(args);\n\n if (!app) {\n return `${rootPath}${queryString}`;\n }\n\n if (!capability) {\n return `${rootPath}/${app}${queryString}`;\n }\n\n return `${rootPath}/${app}/${capability}${queryString}`;\n}\n\nexport function getCurrentLocationInfo() {\n const currentPath = getCurrentPath();\n const [app = '', capability = ''] = currentPath.split('/').filter((part) => !!part);\n\n return {\n app,\n capability,\n };\n}\n\nexport function setRuntimeRootUrl(environment: 'production' | 'development') {\n const { origin, pathname } = window.location;\n\n // If on Alliance cloud environment - the first part of path is workspace\n if (environment === 'production') {\n const [workspace] = pathname.split('/').filter((part) => !!part);\n\n return (globalThis.__ALLIANCE_RUNTIME_ROOT_URL = `${origin}/${workspace}`);\n }\n\n return (globalThis.__ALLIANCE_RUNTIME_ROOT_URL = origin);\n}\n\nexport function getRuntimeRootUrl() {\n return globalThis.__ALLIANCE_RUNTIME_ROOT_URL;\n}\n","export type Translations = {\n [key in TranslationsKey]: string;\n};\n\nexport enum TranslationsKey {\n AlreadyExists,\n ApiGatewayPortDescription,\n ApiServerModeDescription,\n AppConfigurationPath,\n AppCreated,\n AppEntryBuildOptionDescription,\n AppNameInquiry,\n BuildDescription,\n BuildModeOptionDescription,\n BuildWatchDescription,\n CreateAppDescription,\n CreateWorkspaceDescription,\n DevServerOpenDescription,\n DevServerPortDescription,\n DevServerLoggingDescription,\n Done,\n FetchPackageVersionError,\n ManifestEntryBuildOptionDescription,\n MissingTranslationKey,\n NoAppName,\n NoAppNameFound,\n NoAppOrWorkspaceInCurrentDirectory,\n NoWorkspaceName,\n OperationCancelled,\n ServeDescription,\n ServedStopped,\n ServerGatewayMode,\n ServerMode,\n ServerModeInquiry,\n ServerProxyMode,\n StopServerInstructions,\n TemplateFrameworkInquiry,\n TemplateLanguageInquiry,\n UnrecognizedCommand,\n WorkspaceCreated,\n WorkspaceNameInquiry,\n}\n\nexport const en: Translations = {\n [TranslationsKey.Done]: 'Done',\n [TranslationsKey.NoWorkspaceName]: 'No workspace name provided!',\n [TranslationsKey.NoAppName]: 'No app name provided!',\n [TranslationsKey.AlreadyExists]: \"File or directory '{0}' already exists!\",\n [TranslationsKey.NoAppOrWorkspaceInCurrentDirectory]:\n \"Could not find any app entry file at '{0}'!\",\n [TranslationsKey.UnrecognizedCommand]: 'Unrecognized command(s) {0}!',\n [TranslationsKey.WorkspaceCreated]: \"Workspace was created at path '{0}'!\",\n [TranslationsKey.AppCreated]: \"App was created at path '{0}'!\",\n [TranslationsKey.ServedStopped]: 'Server stopped.',\n [TranslationsKey.CreateWorkspaceDescription]:\n 'Creates an Alliance Workspace in the current directory.',\n [TranslationsKey.CreateAppDescription]:\n 'Creates an Alliance Application in the current directory or Alliance Workspace.',\n [TranslationsKey.ServeDescription]:\n 'Starts a Alliance development server using the current directory package.json.',\n [TranslationsKey.BuildDescription]: 'Builds an Alliance Application using Vite.',\n [TranslationsKey.WorkspaceNameInquiry]: 'Enter the name of your workspace',\n [TranslationsKey.ServerModeInquiry]: 'Which server mode do you want to use?',\n [TranslationsKey.AppNameInquiry]: 'Enter the name of your app',\n [TranslationsKey.MissingTranslationKey]: 'No translation key provided!',\n [TranslationsKey.OperationCancelled]: 'Operation cancelled.',\n [TranslationsKey.StopServerInstructions]: 'Press CTRL + C to stop the server.\\n',\n [TranslationsKey.TemplateLanguageInquiry]: 'Select preferred language',\n [TranslationsKey.TemplateFrameworkInquiry]: 'Select preferred framework template',\n [TranslationsKey.DevServerPortDescription]: 'The port that the dev server should use.',\n [TranslationsKey.DevServerLoggingDescription]: `Whether the dev server and browser console should output more log information or not (false).`,\n [TranslationsKey.ApiGatewayPortDescription]: 'The port that the api gateway should use.',\n [TranslationsKey.ApiServerModeDescription]:\n 'Which components to start. [server|server-proxy|server-gateway].',\n [TranslationsKey.DevServerOpenDescription]:\n 'Whether the dev server should automatically open in your browser or not.',\n [TranslationsKey.BuildWatchDescription]:\n 'Whether the build should start watching and rebuild when files change or not.',\n [TranslationsKey.AppEntryBuildOptionDescription]: 'The entry file for the app (./src/app).',\n [TranslationsKey.ManifestEntryBuildOptionDescription]:\n 'The entry file for the app manifest (./src/manifest).',\n [TranslationsKey.BuildModeOptionDescription]: 'Which mode to use when building the app.',\n [TranslationsKey.FetchPackageVersionError]:\n \"Failed to fetch package info from the NPM registry for package '${0}'!\",\n [TranslationsKey.NoAppNameFound]: 'Could not find app name in manifest.',\n [TranslationsKey.AppConfigurationPath]: 'The path to the app configuration file.',\n [TranslationsKey.ServerMode]: 'Server',\n [TranslationsKey.ServerProxyMode]: 'Server with proxy',\n [TranslationsKey.ServerGatewayMode]: 'Server with gateway',\n};\n","import { en, TranslationsKey, type Translations } from './translations';\n\nexport type TextArgs = (string | number)[];\n\nexport class Texts {\n protected static getTranslations = (): Translations => {\n return en;\n };\n\n protected static getTranslation = (key: TranslationsKey, ...args: TextArgs): string => {\n const translations = Texts.getTranslations();\n const translation = translations[key];\n\n if (!translation) throw new Error(`Could not find text with given key '${key}'.`);\n\n const formattedTranslation = args.reduce(\n (acc, curr, index) => acc.toString().replace(`{${index}}`, curr.toString()),\n translation\n );\n\n return formattedTranslation.toString();\n };\n\n public static get = (\n key: TranslationsKey = TranslationsKey.MissingTranslationKey,\n ...args: TextArgs\n ) => this.getTranslation(key, ...args);\n}\n\nexport default Texts;\n","export function vocaIconsToOptions(vocaIcons: any, selected: string) {\n return mapToVocaOptions(Object.values(vocaIcons), ({ name }: any) => ({\n label: name,\n value: name,\n selected: selected === name,\n }));\n}\n\nexport type VocaIcon = { name: string; svg: string };\n\nexport enum VocaButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n Expressive = 'expressive',\n Destructive = 'destructive',\n Text = 'text',\n PrimaryWhite = 'primary-white',\n SecondaryWhite = 'secondary-white',\n ExpressiveWhite = 'expressive-white',\n TertiaryPurple = 'tertiary-purple',\n}\n\nexport type VocaOption = { label: string; value: string; disabled?: boolean; selected?: boolean };\n\nexport function getVocaIcon(vocaIcons: any, name: string) {\n const icon = Object.values(vocaIcons).find((icon: any) => icon.name === name);\n return icon as VocaIcon;\n}\n\nexport type Unpacked<T> = T extends (infer U)[] ? U : T;\n\nexport function mapToVocaOptions<T>(\n items: T,\n mapper: (item: Unpacked<T>) => VocaOption\n): VocaOption[] {\n return (items as []).reduce<VocaOption[]>(\n (acc, item) => {\n acc.push({\n disabled: false,\n selected: false,\n ...mapper(item),\n });\n\n return acc;\n },\n [\n {\n label: 'Choose...',\n value: '',\n disabled: true,\n selected: true,\n },\n ]\n );\n}\n\nexport function onEnter(fn: Function) {\n return (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n fn(e);\n }\n };\n}\n\nexport function friendlyUserName(\n user: { email: string; displayName: string },\n format: 'single' | 'all' = 'all'\n) {\n const { email, displayName } = user;\n\n const hasDisplayName = displayName && displayName !== 'unknown';\n const hasEmail = !!email;\n\n switch (format) {\n case 'all': {\n if (hasDisplayName && hasEmail) {\n return `${displayName} (${email})`;\n } else if (hasDisplayName) {\n return displayName;\n } else if (hasEmail) {\n return email;\n }\n }\n case 'single': {\n if (hasDisplayName) {\n return displayName;\n } else if (hasEmail) {\n return email;\n }\n }\n }\n\n return '<UNKNOWN USER>';\n}\n\nexport function classNames(...classes: string[]) {\n return classes.filter((c) => !!c).join(' ');\n}\n"],"names":["FrameworkErrorCodes","UtilitiesErrorCodes","parseTemplates","message","variables","acc","key","value","allianceErrors","ALLIANCE_ERROR_NAME","AllianceError","code","info","isAllianceError","error","createQueryString","args","filteredArgs","entry","getCurrentPath","runtimeRootUrl","getRuntimeRootUrl","href","search","createCapabilityPath","app","capability","rootPath","queryString","getCurrentLocationInfo","currentPath","part","setRuntimeRootUrl","environment","origin","pathname","workspace","TranslationsKey","TranslationsKey2","en","_Texts","Texts","__publicField","translation","curr","index","vocaIconsToOptions","vocaIcons","selected","mapToVocaOptions","name","VocaButtonVariant","getVocaIcon","icon","items","mapper","item","onEnter","fn","e","friendlyUserName","user","format","email","displayName","hasDisplayName","hasEmail","classNames","classes","c"],"mappings":";;;AAAY,IAAAA,sBAAAA,OACRA,EAAAA,EAAA,qBAAqB,GAArB,IAAA,sBACAA,EAAAA,EAAA,iBAAiB,IAAjB,IAAA,kBACAA,EAAAA,EAAA,uBAAuB,IAAvB,IAAA,wBACAA,EAAAA,EAAA,yBAAyB,IAAzB,IAAA,0BACAA,EAAAA,EAAA,+BAA+B,IAA/B,IAAA,gCACAA,EAAAA,EAAA,aAAa,IAAb,IAAA,cACAA,EAAAA,EAAA,gBAA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;AAAA,MACI;AAAA,QACI,OAAO;AAAA,QACP,OAAO;AAAA,QACP,UAAU;AAAA,QACV,UAAU;AAAA,MACd;AAAA,IACJ;AAAA,EAAA;AAER;AAEO,SAASoD,EAAQC,GAAc;AAClC,SAAO,CAACC,MAAqB;AACrB,IAAAA,EAAE,QAAQ,WACVD,EAAGC,CAAC;AAAA,EACR;AAER;AAEgB,SAAAC,EACZC,GACAC,IAA2B,OAC7B;AACQ,QAAA,EAAE,OAAAC,GAAO,aAAAC,EAAgB,IAAAH,GAEzBI,IAAiBD,KAAeA,MAAgB,WAChDE,IAAW,CAAC,CAACH;AAEnB,UAAQD,GAAQ;AAAA,IACZ,KAAK,OAAO;AACR,UAAIG,KAAkBC;AAClB,eAAO,GAAGF,MAAgBD;UACnBE;AACA,eAAAD;UACAE;AACA,eAAAH;AAAA,IAEf;AAAA,IACA,KAAK,UAAU;AACX,UAAIE;AACO,eAAAD;UACAE;AACA,eAAAH;AAAA,IAEf;AAAA,EACJ;AAEO,SAAA;AACX;AAEO,SAASI,KAAcC,GAAmB;AACtC,SAAAA,EAAQ,OAAO,CAACC,MAAM,CAAC,CAACA,CAAC,EAAE,KAAK,GAAG;AAC9C;"}
1
+ {"version":3,"file":"index.js","sources":["../src/exceptions.ts","../src/routing.ts","../src/translations.ts","../src/texts.ts","../src/ui.ts"],"sourcesContent":["export enum FrameworkErrorCodes {\n AlreadyInitialized = 1000,\n NoAppNameOrKey = 1001,\n MissingAppController = 1002,\n MissingCapabilityOnApp = 1003,\n MissingManagedObjectProvider = 1004,\n NoManifest = 1005,\n NoRootElement = 1006,\n NoView = 1007,\n CookieKeyNotDefined = 1008,\n CookieCategoryNotAllowed = 1009,\n StorageKeyNotDefined = 1010,\n StorageCategoryNotAllowed = 1011,\n LocalizationTemplateNotDefined = 1012,\n}\n\nexport enum UtilitiesErrorCodes {\n CurrentUserMissingProvider = 2000,\n CurrentUserGatewayNotStarted = 2001,\n CurrentUserMissingBackend = 2002,\n CurrentUserMissingInDatabase = 2003,\n}\n\ntype ErrorCodes = UtilitiesErrorCodes | FrameworkErrorCodes;\n\nfunction parseTemplates(message: string, variables: Record<string, string>) {\n return Object.entries(variables).reduce((acc, [key, value]) => {\n return acc.replaceAll(`{{${key}}}`, value);\n }, message);\n}\n\nconst allianceErrors: Record<ErrorCodes, string> = {\n // framework\n [FrameworkErrorCodes.AlreadyInitialized]: 'The runtime has already been initialized',\n [FrameworkErrorCodes.NoAppNameOrKey]: 'App name and/or app key is not defined on global scope',\n [FrameworkErrorCodes.MissingAppController]: \"No app controller registered for app '{{app}}'\",\n [FrameworkErrorCodes.MissingCapabilityOnApp]:\n \"No capability '{{capability}}' enabled for app '{{app}}'\",\n [FrameworkErrorCodes.MissingManagedObjectProvider]:\n \"No managed object provider registered for object '{{object}}'\",\n [FrameworkErrorCodes.NoManifest]: 'The current apps manifest is not defined on global scope',\n [FrameworkErrorCodes.NoRootElement]: 'Could not find the root element in the DOM',\n [FrameworkErrorCodes.NoView]:\n \"Could not find view with id '{{id}}' on view controller for app '{{app}}'\",\n [FrameworkErrorCodes.CookieKeyNotDefined]:\n \"Cookie key '{{key}}' not present in manifest, cookie has not been set\",\n [FrameworkErrorCodes.CookieCategoryNotAllowed]:\n \"Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set\",\n [FrameworkErrorCodes.StorageKeyNotDefined]:\n \"Storage key '{{key}}' not present in manifest, item has not been stored\",\n [FrameworkErrorCodes.StorageCategoryNotAllowed]:\n \"Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored\",\n [FrameworkErrorCodes.LocalizationTemplateNotDefined]:\n \"The translation template, referred by the key '{{key}}' is being used in app, but is not defined in the manifest.\",\n\n // utilities\n [UtilitiesErrorCodes.CurrentUserMissingProvider]:\n \"No managed object provider registered for object 'currentUser'\",\n [UtilitiesErrorCodes.CurrentUserGatewayNotStarted]:\n \"Could not access the gateway when querying 'currentUser'\",\n [UtilitiesErrorCodes.CurrentUserMissingBackend]:\n \"Could not access the required backend when querying 'currentUser'\",\n [UtilitiesErrorCodes.CurrentUserMissingInDatabase]:\n 'Could not locate the authenticated user in the Alliance database',\n};\n\nconst ALLIANCE_ERROR_NAME = 'AllianceError';\n\nexport class AllianceError extends Error {\n constructor(public code: ErrorCodes, variables: Record<string, string> = {}) {\n const message = parseTemplates(allianceErrors[code], variables);\n const info = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${code}`;\n super(message);\n\n this.name = ALLIANCE_ERROR_NAME;\n this.stack = `[${code}] - ${message}` + '\\n' + info;\n }\n}\n\nexport function isAllianceError(error: any): error is AllianceError {\n return !!error.code && error.name === ALLIANCE_ERROR_NAME;\n}\n","import { SerializeableObject } from './types';\n\nfunction createQueryString(args: SerializeableObject) {\n const entries = Object.entries(args);\n\n const filteredArgs = entries.reduce<SerializeableObject>((acc, entry) => {\n const [key, value] = entry;\n\n if (typeof value === 'undefined') {\n return acc;\n } else if (typeof value === 'object' && value !== null) {\n acc[key] = JSON.stringify(value);\n } else {\n acc[key] = value;\n }\n\n return acc;\n }, {});\n\n if (!Object.keys(filteredArgs).length) {\n return '';\n }\n\n return `?${new URLSearchParams(filteredArgs as Record<string, any>)}`;\n}\n\nfunction getCurrentPath() {\n const runtimeRootUrl = getRuntimeRootUrl();\n const { href, search } = window.location;\n\n return href.replace(runtimeRootUrl, '').replace(search, '');\n}\n\nexport function createCapabilityPath(\n app: string = '',\n capability: string = '',\n args: SerializeableObject = {}\n) {\n const rootPath = getRuntimeRootUrl().replace(location.origin, '');\n const queryString = createQueryString(args);\n\n if (!app) {\n return `${rootPath}${queryString}`;\n }\n\n if (!capability) {\n return `${rootPath}/${app}${queryString}`;\n }\n\n return `${rootPath}/${app}/${capability}${queryString}`;\n}\n\nexport function getCurrentLocationInfo() {\n const currentPath = getCurrentPath();\n const [app = '', capability = ''] = currentPath.split('/').filter((part) => !!part);\n\n return {\n app,\n capability,\n };\n}\n\nexport function setRuntimeRootUrl(environment: 'production' | 'development') {\n const { origin, pathname } = window.location;\n\n // If on Alliance cloud environment - the first part of path is workspace\n if (environment === 'production') {\n const [workspace] = pathname.split('/').filter((part) => !!part);\n\n return (globalThis.__ALLIANCE_RUNTIME_ROOT_URL = `${origin}/${workspace}`);\n }\n\n return (globalThis.__ALLIANCE_RUNTIME_ROOT_URL = origin);\n}\n\nexport function getRuntimeRootUrl() {\n return globalThis.__ALLIANCE_RUNTIME_ROOT_URL;\n}\n","export type Translations = {\n [key in TranslationsKey]: string;\n};\n\nexport enum TranslationsKey {\n AlreadyExists,\n ApiGatewayPortDescription,\n ApiServerModeDescription,\n AppConfigurationPath,\n AppCreated,\n AppEntryBuildOptionDescription,\n AppNameInquiry,\n BuildDescription,\n BuildModeOptionDescription,\n BuildWatchDescription,\n CreateAppDescription,\n CreateWorkspaceDescription,\n DevServerOpenDescription,\n DevServerPortDescription,\n DevServerLoggingDescription,\n Done,\n FetchPackageVersionError,\n ManifestEntryBuildOptionDescription,\n MissingTranslationKey,\n NoAppName,\n NoAppNameFound,\n NoAppOrWorkspaceInCurrentDirectory,\n NoWorkspaceName,\n OperationCancelled,\n ServeDescription,\n ServedStopped,\n ServerGatewayMode,\n ServerMode,\n ServerModeInquiry,\n ServerProxyMode,\n StopServerInstructions,\n TemplateFrameworkInquiry,\n TemplateLanguageInquiry,\n UnrecognizedCommand,\n WorkspaceCreated,\n WorkspaceNameInquiry,\n}\n\nexport const en: Translations = {\n [TranslationsKey.Done]: 'Done',\n [TranslationsKey.NoWorkspaceName]: 'No workspace name provided!',\n [TranslationsKey.NoAppName]: 'No app name provided!',\n [TranslationsKey.AlreadyExists]: \"File or directory '{0}' already exists!\",\n [TranslationsKey.NoAppOrWorkspaceInCurrentDirectory]:\n \"Could not find any app entry file at '{0}'!\",\n [TranslationsKey.UnrecognizedCommand]: 'Unrecognized command(s) {0}!',\n [TranslationsKey.WorkspaceCreated]: \"Workspace was created at path '{0}'!\",\n [TranslationsKey.AppCreated]: \"App was created at path '{0}'!\",\n [TranslationsKey.ServedStopped]: 'Server stopped.',\n [TranslationsKey.CreateWorkspaceDescription]:\n 'Creates an Alliance Workspace in the current directory.',\n [TranslationsKey.CreateAppDescription]:\n 'Creates an Alliance Application in the current directory or Alliance Workspace.',\n [TranslationsKey.ServeDescription]:\n 'Starts a Alliance development server using the current directory package.json.',\n [TranslationsKey.BuildDescription]: 'Builds an Alliance Application using Vite.',\n [TranslationsKey.WorkspaceNameInquiry]: 'Enter the name of your workspace',\n [TranslationsKey.ServerModeInquiry]: 'Which server mode do you want to use?',\n [TranslationsKey.AppNameInquiry]: 'Enter the name of your app',\n [TranslationsKey.MissingTranslationKey]: 'No translation key provided!',\n [TranslationsKey.OperationCancelled]: 'Operation cancelled.',\n [TranslationsKey.StopServerInstructions]: 'Press CTRL + C to stop the server.\\n',\n [TranslationsKey.TemplateLanguageInquiry]: 'Select preferred language',\n [TranslationsKey.TemplateFrameworkInquiry]: 'Select preferred framework template',\n [TranslationsKey.DevServerPortDescription]: 'The port that the dev server should use.',\n [TranslationsKey.DevServerLoggingDescription]: `Whether the dev server and browser console should output more log information or not (false).`,\n [TranslationsKey.ApiGatewayPortDescription]: 'The port that the api gateway should use.',\n [TranslationsKey.ApiServerModeDescription]:\n 'Which components to start. [server|server-proxy|server-gateway].',\n [TranslationsKey.DevServerOpenDescription]:\n 'Whether the dev server should automatically open in your browser or not.',\n [TranslationsKey.BuildWatchDescription]:\n 'Whether the build should start watching and rebuild when files change or not.',\n [TranslationsKey.AppEntryBuildOptionDescription]: 'The entry file for the app (./src/app).',\n [TranslationsKey.ManifestEntryBuildOptionDescription]:\n 'The entry file for the app manifest (./src/manifest).',\n [TranslationsKey.BuildModeOptionDescription]: 'Which mode to use when building the app.',\n [TranslationsKey.FetchPackageVersionError]:\n \"Failed to fetch package info from the NPM registry for package '${0}'!\",\n [TranslationsKey.NoAppNameFound]: 'Could not find app name in manifest.',\n [TranslationsKey.AppConfigurationPath]: 'The path to the app configuration file.',\n [TranslationsKey.ServerMode]: 'Server',\n [TranslationsKey.ServerProxyMode]: 'Server with proxy',\n [TranslationsKey.ServerGatewayMode]: 'Server with gateway',\n};\n","import { en, TranslationsKey, type Translations } from './translations';\n\nexport type TextArgs = (string | number)[];\n\nexport class Texts {\n protected static getTranslations = (): Translations => {\n return en;\n };\n\n protected static getTranslation = (key: TranslationsKey, ...args: TextArgs): string => {\n const translations = Texts.getTranslations();\n const translation = translations[key];\n\n if (!translation) throw new Error(`Could not find text with given key '${key}'.`);\n\n const formattedTranslation = args.reduce(\n (acc, curr, index) => acc.toString().replace(`{${index}}`, curr.toString()),\n translation\n );\n\n return formattedTranslation.toString();\n };\n\n public static get = (\n key: TranslationsKey = TranslationsKey.MissingTranslationKey,\n ...args: TextArgs\n ) => this.getTranslation(key, ...args);\n}\n\nexport default Texts;\n","export function vocaIconsToOptions(vocaIcons: any, selected: string) {\n return mapToVocaOptions(Object.values(vocaIcons), ({ name }: any) => ({\n label: name,\n value: name,\n selected: selected === name,\n }));\n}\n\nexport type VocaIcon = { name: string; svg: string };\n\nexport enum VocaButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n Expressive = 'expressive',\n Destructive = 'destructive',\n Text = 'text',\n PrimaryWhite = 'primary-white',\n SecondaryWhite = 'secondary-white',\n ExpressiveWhite = 'expressive-white',\n TertiaryPurple = 'tertiary-purple',\n}\n\nexport type VocaOption = { label: string; value: string; disabled?: boolean; selected?: boolean };\n\nexport function getVocaIcon(vocaIcons: any, name: string) {\n const icon = Object.values(vocaIcons).find((icon: any) => icon.name === name);\n return icon as VocaIcon;\n}\n\nexport type Unpacked<T> = T extends (infer U)[] ? U : T;\n\nexport function mapToVocaOptions<T>(\n items: T,\n mapper: (item: Unpacked<T>) => VocaOption,\n label: string = 'Choose...'\n): VocaOption[] {\n return (items as []).reduce<VocaOption[]>(\n (acc, item) => {\n acc.push({\n disabled: false,\n selected: false,\n ...mapper(item),\n });\n\n return acc;\n },\n [\n {\n label,\n value: '',\n disabled: true,\n selected: true,\n },\n ]\n );\n}\n\nexport function onEnter(fn: Function) {\n return (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n fn(e);\n }\n };\n}\n\nexport function friendlyUserName(\n user: { email: string; displayName: string },\n format: 'single' | 'all' = 'all'\n) {\n const { email, displayName } = user;\n\n const hasDisplayName = displayName && displayName !== 'unknown';\n const hasEmail = !!email;\n\n switch (format) {\n case 'all': {\n if (hasDisplayName && hasEmail) {\n return `${displayName} (${email})`;\n } else if (hasDisplayName) {\n return displayName;\n } else if (hasEmail) {\n return email;\n }\n }\n case 'single': {\n if (hasDisplayName) {\n return displayName;\n } else if (hasEmail) {\n return email;\n }\n }\n }\n\n return '<UNKNOWN USER>';\n}\n\nexport function classNames(...classes: string[]) {\n return classes.filter((c) => !!c).join(' ');\n}\n\nexport function props(properties: Object) {\n return Object.entries(properties).reduce<Record<string, string | boolean | number>>(\n (acc, [key, value]) => {\n if (typeof value !== 'object' && typeof value !== 'function') {\n acc[key] = value;\n }\n\n return acc;\n },\n {}\n );\n}\n"],"names":["FrameworkErrorCodes","UtilitiesErrorCodes","parseTemplates","message","variables","acc","key","value","allianceErrors","ALLIANCE_ERROR_NAME","AllianceError","code","info","isAllianceError","error","createQueryString","args","filteredArgs","entry","getCurrentPath","runtimeRootUrl","getRuntimeRootUrl","href","search","createCapabilityPath","app","capability","rootPath","queryString","getCurrentLocationInfo","currentPath","part","setRuntimeRootUrl","environment","origin","pathname","workspace","TranslationsKey","TranslationsKey2","en","_Texts","__publicField","translation","curr","index","Texts","vocaIconsToOptions","vocaIcons","selected","mapToVocaOptions","name","VocaButtonVariant","getVocaIcon","icon","items","mapper","label","item","onEnter","fn","e","friendlyUserName","user","format","email","displayName","hasDisplayName","hasEmail","classNames","classes","c","props","properties"],"mappings":";;;AAAY,IAAAA,sBAAAA,OACRA,EAAAA,EAAA,qBAAqB,GAArB,IAAA,sBACAA,EAAAA,EAAA,iBAAiB,IAAjB,IAAA,kBACAA,EAAAA,EAAA,uBAAuB,IAAvB,IAAA,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X,CAAC;AAAA,EAAA;AAET;"}
package/dist/ui.d.ts CHANGED
@@ -22,10 +22,11 @@ export type VocaOption = {
22
22
  };
23
23
  export declare function getVocaIcon(vocaIcons: any, name: string): VocaIcon;
24
24
  export type Unpacked<T> = T extends (infer U)[] ? U : T;
25
- export declare function mapToVocaOptions<T>(items: T, mapper: (item: Unpacked<T>) => VocaOption): VocaOption[];
25
+ export declare function mapToVocaOptions<T>(items: T, mapper: (item: Unpacked<T>) => VocaOption, label?: string): VocaOption[];
26
26
  export declare function onEnter(fn: Function): (e: KeyboardEvent) => void;
27
27
  export declare function friendlyUserName(user: {
28
28
  email: string;
29
29
  displayName: string;
30
30
  }, format?: 'single' | 'all'): string;
31
31
  export declare function classNames(...classes: string[]): string;
32
+ export declare function props(properties: Object): Record<string, string | number | boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/alliance-internal-client-utilities",
3
- "version": "1.0.1-next.0",
3
+ "version": "1.0.2-next.0",
4
4
  "description": "Utilities used internally by packages developed by team Alliance.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -14,16 +14,14 @@
14
14
  "dist"
15
15
  ],
16
16
  "devDependencies": {
17
- "vite": "^4.3.5"
17
+ "vite": "^4.4.6"
18
18
  },
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
22
  "scripts": {
23
23
  "build:dev": "tsc && vite build --mode development",
24
- "build:prod": "rimraf dist && tsc && vite build --mode prod",
25
- "build:test": "rimraf dist && tsc && vite build --mode test",
26
- "build:docker": "vite build",
24
+ "build:prod": "rimraf dist && tsc && vite build",
27
25
  "dev": "tsc && vite build --mode development --watch"
28
26
  }
29
27
  }