@acmekit/dashboard 2.13.3 → 2.13.5

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/app.css CHANGED
@@ -1796,9 +1796,6 @@ video {
1796
1796
  .w-\[116px\] {
1797
1797
  width: 116px;
1798
1798
  }
1799
- .w-\[120px\] {
1800
- width: 120px;
1801
- }
1802
1799
  .w-\[128px\] {
1803
1800
  width: 128px;
1804
1801
  }
package/dist/app.js CHANGED
@@ -329,46 +329,12 @@ var init_auth = __esm({
329
329
  }
330
330
  });
331
331
 
332
- // src/hooks/api/store.tsx
333
- async function retrieveActiveStore(query) {
334
- const response = await sdk.admin.store.list(query);
335
- const activeStore = response.stores?.[0];
336
- if (!activeStore) {
337
- throw new import_js_sdk2.FetchError("No active store found", "Not Found", 404);
338
- }
339
- return { store: activeStore };
340
- }
341
- var import_react_query6, import_js_sdk2, STORE_QUERY_KEY, storeQueryKeys, useStore;
342
- var init_store = __esm({
343
- "src/hooks/api/store.tsx"() {
344
- "use strict";
345
- import_react_query6 = require("@tanstack/react-query");
346
- import_js_sdk2 = require("@acmekit/js-sdk");
347
- init_client2();
348
- init_query_client();
349
- init_query_key_factory();
350
- STORE_QUERY_KEY = "store";
351
- storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
352
- useStore = (query, options) => {
353
- const { data, ...rest } = (0, import_react_query6.useQuery)({
354
- queryFn: () => retrieveActiveStore(query),
355
- queryKey: storeQueryKeys.details(),
356
- ...options
357
- });
358
- return {
359
- ...data,
360
- ...rest
361
- };
362
- };
363
- }
364
- });
365
-
366
332
  // src/hooks/api/inventory.tsx
367
- var import_react_query7, INVENTORY_ITEMS_QUERY_KEY, inventoryItemsQueryKeys, INVENTORY_ITEM_LEVELS_QUERY_KEY, inventoryItemLevelsQueryKeys;
333
+ var import_react_query6, INVENTORY_ITEMS_QUERY_KEY, inventoryItemsQueryKeys, INVENTORY_ITEM_LEVELS_QUERY_KEY, inventoryItemLevelsQueryKeys;
368
334
  var init_inventory = __esm({
369
335
  "src/hooks/api/inventory.tsx"() {
370
336
  "use strict";
371
- import_react_query7 = require("@tanstack/react-query");
337
+ import_react_query6 = require("@tanstack/react-query");
372
338
  init_client2();
373
339
  init_query_client();
374
340
  init_query_key_factory();
@@ -385,20 +351,20 @@ var init_inventory = __esm({
385
351
  });
386
352
 
387
353
  // src/hooks/use-infinite-list.tsx
388
- var import_react_query8;
354
+ var import_react_query7;
389
355
  var init_use_infinite_list = __esm({
390
356
  "src/hooks/use-infinite-list.tsx"() {
391
357
  "use strict";
392
- import_react_query8 = require("@tanstack/react-query");
358
+ import_react_query7 = require("@tanstack/react-query");
393
359
  }
394
360
  });
395
361
 
396
362
  // src/hooks/api/products.tsx
397
- var import_react_query9, PRODUCTS_QUERY_KEY, productsQueryKeys, VARIANTS_QUERY_KEY, variantsQueryKeys, OPTIONS_QUERY_KEY, optionsQueryKeys;
363
+ var import_react_query8, PRODUCTS_QUERY_KEY, productsQueryKeys, VARIANTS_QUERY_KEY, variantsQueryKeys, OPTIONS_QUERY_KEY, optionsQueryKeys;
398
364
  var init_products = __esm({
399
365
  "src/hooks/api/products.tsx"() {
400
366
  "use strict";
401
- import_react_query9 = require("@tanstack/react-query");
367
+ import_react_query8 = require("@tanstack/react-query");
402
368
  init_client2();
403
369
  init_query_client();
404
370
  init_query_key_factory();
@@ -414,11 +380,11 @@ var init_products = __esm({
414
380
  });
415
381
 
416
382
  // src/hooks/api/sales-channels.tsx
417
- var import_react_query10, SALES_CHANNELS_QUERY_KEY, salesChannelsQueryKeys;
383
+ var import_react_query9, SALES_CHANNELS_QUERY_KEY, salesChannelsQueryKeys;
418
384
  var init_sales_channels = __esm({
419
385
  "src/hooks/api/sales-channels.tsx"() {
420
386
  "use strict";
421
- import_react_query10 = require("@tanstack/react-query");
387
+ import_react_query9 = require("@tanstack/react-query");
422
388
  init_client2();
423
389
  init_query_client();
424
390
  init_query_key_factory();
@@ -429,11 +395,11 @@ var init_sales_channels = __esm({
429
395
  });
430
396
 
431
397
  // src/hooks/api/api-keys.tsx
432
- var import_react_query11, API_KEYS_QUERY_KEY, apiKeysQueryKeys;
398
+ var import_react_query10, API_KEYS_QUERY_KEY, apiKeysQueryKeys;
433
399
  var init_api_keys = __esm({
434
400
  "src/hooks/api/api-keys.tsx"() {
435
401
  "use strict";
436
- import_react_query11 = require("@tanstack/react-query");
402
+ import_react_query10 = require("@tanstack/react-query");
437
403
  init_client2();
438
404
  init_query_client();
439
405
  init_query_key_factory();
@@ -444,18 +410,18 @@ var init_api_keys = __esm({
444
410
  });
445
411
 
446
412
  // src/hooks/api/cloud.tsx
447
- var import_react_query12, cloudQueryKeys, useCloudAuthEnabled, useCreateCloudAuthUser;
413
+ var import_react_query11, cloudQueryKeys, useCloudAuthEnabled, useCreateCloudAuthUser;
448
414
  var init_cloud = __esm({
449
415
  "src/hooks/api/cloud.tsx"() {
450
416
  "use strict";
451
- import_react_query12 = require("@tanstack/react-query");
417
+ import_react_query11 = require("@tanstack/react-query");
452
418
  init_client2();
453
419
  cloudQueryKeys = {
454
420
  all: ["cloud"],
455
421
  auth: () => [...cloudQueryKeys.all, "auth"]
456
422
  };
457
423
  useCloudAuthEnabled = (options) => {
458
- return (0, import_react_query12.useQuery)({
424
+ return (0, import_react_query11.useQuery)({
459
425
  queryKey: cloudQueryKeys.auth(),
460
426
  queryFn: async () => {
461
427
  return await sdk.client.fetch("/cloud/auth");
@@ -464,7 +430,7 @@ var init_cloud = __esm({
464
430
  });
465
431
  };
466
432
  useCreateCloudAuthUser = (options) => {
467
- return (0, import_react_query12.useMutation)({
433
+ return (0, import_react_query11.useMutation)({
468
434
  mutationFn: async () => {
469
435
  await sdk.client.fetch("/cloud/auth/users", {
470
436
  method: "POST"
@@ -477,18 +443,18 @@ var init_cloud = __esm({
477
443
  });
478
444
 
479
445
  // src/hooks/api/invites.tsx
480
- var import_react_query13, INVITES_QUERY_KEY, invitesQueryKeys, useAcceptInvite;
446
+ var import_react_query12, INVITES_QUERY_KEY, invitesQueryKeys, useAcceptInvite;
481
447
  var init_invites = __esm({
482
448
  "src/hooks/api/invites.tsx"() {
483
449
  "use strict";
484
- import_react_query13 = require("@tanstack/react-query");
450
+ import_react_query12 = require("@tanstack/react-query");
485
451
  init_client2();
486
452
  init_query_client();
487
453
  init_query_key_factory();
488
454
  INVITES_QUERY_KEY = "invites";
489
455
  invitesQueryKeys = queryKeysFactory(INVITES_QUERY_KEY);
490
456
  useAcceptInvite = (inviteToken, options) => {
491
- return (0, import_react_query13.useMutation)({
457
+ return (0, import_react_query12.useMutation)({
492
458
  mutationFn: (payload) => {
493
459
  const { auth_token, ...rest } = payload;
494
460
  return sdk.admin.invite.accept(
@@ -509,11 +475,11 @@ var init_invites = __esm({
509
475
  });
510
476
 
511
477
  // src/hooks/api/locales.tsx
512
- var import_react_query14, LOCALES_QUERY_KEY, localesQueryKeys;
478
+ var import_react_query13, LOCALES_QUERY_KEY, localesQueryKeys;
513
479
  var init_locales = __esm({
514
480
  "src/hooks/api/locales.tsx"() {
515
481
  "use strict";
516
- import_react_query14 = require("@tanstack/react-query");
482
+ import_react_query13 = require("@tanstack/react-query");
517
483
  init_client2();
518
484
  init_query_key_factory();
519
485
  LOCALES_QUERY_KEY = "locales";
@@ -522,17 +488,17 @@ var init_locales = __esm({
522
488
  });
523
489
 
524
490
  // src/hooks/api/notification.tsx
525
- var import_react_query15, NOTIFICATION_QUERY_KEY, notificationQueryKeys, useNotifications;
491
+ var import_react_query14, NOTIFICATION_QUERY_KEY, notificationQueryKeys, useNotifications;
526
492
  var init_notification = __esm({
527
493
  "src/hooks/api/notification.tsx"() {
528
494
  "use strict";
529
- import_react_query15 = require("@tanstack/react-query");
495
+ import_react_query14 = require("@tanstack/react-query");
530
496
  init_client2();
531
497
  init_query_key_factory();
532
498
  NOTIFICATION_QUERY_KEY = "notification";
533
499
  notificationQueryKeys = queryKeysFactory(NOTIFICATION_QUERY_KEY);
534
500
  useNotifications = (query, options) => {
535
- const { data, ...rest } = (0, import_react_query15.useQuery)({
501
+ const { data, ...rest } = (0, import_react_query14.useQuery)({
536
502
  queryFn: () => sdk.admin.notification.list(query),
537
503
  queryKey: notificationQueryKeys.list(query),
538
504
  ...options
@@ -543,11 +509,11 @@ var init_notification = __esm({
543
509
  });
544
510
 
545
511
  // src/hooks/api/plugins.tsx
546
- var import_react_query16, PLUGINS_QUERY_KEY, pluginsQueryKeys;
512
+ var import_react_query15, PLUGINS_QUERY_KEY, pluginsQueryKeys;
547
513
  var init_plugins = __esm({
548
514
  "src/hooks/api/plugins.tsx"() {
549
515
  "use strict";
550
- import_react_query16 = require("@tanstack/react-query");
516
+ import_react_query15 = require("@tanstack/react-query");
551
517
  init_client2();
552
518
  init_query_key_factory();
553
519
  PLUGINS_QUERY_KEY = "plugins";
@@ -555,6 +521,21 @@ var init_plugins = __esm({
555
521
  }
556
522
  });
557
523
 
524
+ // src/hooks/api/store.tsx
525
+ var import_react_query16, import_js_sdk2, STORE_QUERY_KEY, storeQueryKeys;
526
+ var init_store = __esm({
527
+ "src/hooks/api/store.tsx"() {
528
+ "use strict";
529
+ import_react_query16 = require("@tanstack/react-query");
530
+ import_js_sdk2 = require("@acmekit/js-sdk");
531
+ init_client2();
532
+ init_query_client();
533
+ init_query_key_factory();
534
+ STORE_QUERY_KEY = "store";
535
+ storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
536
+ }
537
+ });
538
+
558
539
  // src/hooks/api/translations.tsx
559
540
  var import_react_query17, TRANSLATIONS_QUERY_KEY, translationsQueryKeys, TRANSLATION_SETTINGS_QUERY_KEY, translationSettingsQueryKeys, TRANSLATION_STATISTICS_QUERY_KEY, translationStatisticsQueryKeys, TRANSLATION_ENTITIES_QUERY_KEY, translationEntitiesQueryKeys;
560
541
  var init_translations = __esm({
@@ -96263,7 +96244,6 @@ var import_icons10 = require("@acmekit/icons");
96263
96244
  var import_ui14 = require("@acmekit/ui");
96264
96245
  var import_radix_ui5 = require("radix-ui");
96265
96246
  var import_react_i18next9 = require("react-i18next");
96266
- init_store();
96267
96247
 
96268
96248
  // src/components/layout/nav-item/nav-item.tsx
96269
96249
  var import_ui7 = require("@acmekit/ui");
@@ -97471,81 +97451,43 @@ var Logout2 = () => {
97471
97451
  };
97472
97452
  var Header = () => {
97473
97453
  const { t: t2 } = (0, import_react_i18next9.useTranslation)();
97474
- const { store, isPending, isError, error } = useStore();
97475
97454
  const direction = useDocumentDirection();
97476
- const name = store?.name;
97477
- const fallback = store?.name?.slice(0, 1).toUpperCase();
97478
- const isLoaded = !isPending && !!store && !!name && !!fallback;
97479
- if (isError) {
97480
- throw error;
97481
- }
97482
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-full p-3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
97483
- import_ui14.DropdownMenu,
97484
- {
97485
- dir: direction,
97486
- children: [
97487
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
97488
- import_ui14.DropdownMenu.Trigger,
97489
- {
97490
- disabled: !isLoaded,
97491
- className: (0, import_ui14.clx)(
97492
- "bg-ui-bg-subtle transition-fg grid w-full grid-cols-[24px_1fr_15px] items-center gap-x-3 rounded-md p-0.5 pe-2 outline-none",
97493
- "hover:bg-ui-bg-subtle-hover",
97494
- "data-[state=open]:bg-ui-bg-subtle-hover",
97495
- "focus-visible:shadow-borders-focus"
97496
- ),
97497
- children: [
97498
- fallback ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.Avatar, { variant: "squared", size: "xsmall", fallback }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Skeleton, { className: "h-6 w-6 rounded-md" }),
97499
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "block overflow-hidden text-start", children: name ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
97500
- import_ui14.Text,
97501
- {
97502
- size: "small",
97503
- weight: "plus",
97504
- leading: "compact",
97505
- className: "truncate",
97506
- children: store.name
97507
- }
97508
- ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Skeleton, { className: "h-[9px] w-[120px]" }) }),
97509
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.EllipsisHorizontal, { className: "text-ui-fg-muted" })
97510
- ]
97511
- }
97455
+ const fallback = "A";
97456
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-full p-3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_ui14.DropdownMenu, { dir: direction, children: [
97457
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
97458
+ import_ui14.DropdownMenu.Trigger,
97459
+ {
97460
+ className: (0, import_ui14.clx)(
97461
+ "bg-ui-bg-subtle transition-fg grid w-full grid-cols-[24px_1fr_15px] items-center gap-x-3 rounded-md p-0.5 pe-2 outline-none",
97462
+ "hover:bg-ui-bg-subtle-hover",
97463
+ "data-[state=open]:bg-ui-bg-subtle-hover",
97464
+ "focus-visible:shadow-borders-focus"
97512
97465
  ),
97513
- isLoaded && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_ui14.DropdownMenu.Content, { className: "w-[var(--radix-dropdown-menu-trigger-width)] min-w-0", children: [
97514
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-x-3 px-2 py-1", children: [
97515
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.Avatar, { variant: "squared", size: "small", fallback }),
97516
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col overflow-hidden", children: [
97517
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
97518
- import_ui14.Text,
97519
- {
97520
- size: "small",
97521
- weight: "plus",
97522
- leading: "compact",
97523
- className: "truncate",
97524
- children: name
97525
- }
97526
- ),
97527
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
97528
- import_ui14.Text,
97529
- {
97530
- size: "xsmall",
97531
- leading: "compact",
97532
- className: "text-ui-fg-subtle",
97533
- children: t2("app.nav.main.store")
97534
- }
97535
- )
97536
- ] })
97537
- ] }),
97538
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.DropdownMenu.Separator, {}),
97539
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.DropdownMenu.Item, { className: "gap-x-2", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_router_dom9.Link, { to: "/settings", children: [
97540
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.BuildingStorefront, { className: "text-ui-fg-subtle" }),
97541
- t2("app.nav.main.storeSettings")
97542
- ] }) }),
97543
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.DropdownMenu.Separator, {}),
97544
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Logout2, {})
97545
- ] })
97546
- ]
97547
- }
97548
- ) });
97466
+ children: [
97467
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.Avatar, { variant: "squared", size: "xsmall", fallback }),
97468
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "block overflow-hidden text-start", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
97469
+ import_ui14.Text,
97470
+ {
97471
+ size: "small",
97472
+ weight: "plus",
97473
+ leading: "compact",
97474
+ className: "truncate",
97475
+ children: t2("app.nav.main.store", "Admin")
97476
+ }
97477
+ ) }),
97478
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.EllipsisHorizontal, { className: "text-ui-fg-muted" })
97479
+ ]
97480
+ }
97481
+ ),
97482
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_ui14.DropdownMenu.Content, { className: "w-[var(--radix-dropdown-menu-trigger-width)] min-w-0", children: [
97483
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.DropdownMenu.Item, { className: "gap-x-2", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_router_dom9.Link, { to: "/settings", children: [
97484
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons10.CogSixTooth, { className: "text-ui-fg-subtle" }),
97485
+ t2("app.nav.main.storeSettings", "Settings")
97486
+ ] }) }),
97487
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui14.DropdownMenu.Separator, {}),
97488
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Logout2, {})
97489
+ ] })
97490
+ ] }) });
97549
97491
  };
97550
97492
  var useCoreRoutes = () => {
97551
97493
  return [];
package/dist/app.mjs CHANGED
@@ -2,9 +2,8 @@ import {
2
2
  notificationQueryKeys,
3
3
  useFeatureFlags,
4
4
  useMe,
5
- useNotifications,
6
- useStore
7
- } from "./chunk-XMP5T5AD.mjs";
5
+ useNotifications
6
+ } from "./chunk-FBTP4AJM.mjs";
8
7
  import {
9
8
  I18n
10
9
  } from "./chunk-W3WS3HKB.mjs";
@@ -94185,7 +94184,6 @@ var ProtectedRoute = () => {
94185
94184
 
94186
94185
  // src/components/layout/main-layout/main-layout.tsx
94187
94186
  import {
94188
- BuildingStorefront,
94189
94187
  ChevronDownMini,
94190
94188
  CogSixTooth,
94191
94189
  EllipsisHorizontal as EllipsisHorizontal3,
@@ -95428,81 +95426,43 @@ var Logout2 = () => {
95428
95426
  };
95429
95427
  var Header = () => {
95430
95428
  const { t: t2 } = useTranslation8();
95431
- const { store, isPending, isError, error } = useStore();
95432
95429
  const direction = useDocumentDirection();
95433
- const name = store?.name;
95434
- const fallback = store?.name?.slice(0, 1).toUpperCase();
95435
- const isLoaded = !isPending && !!store && !!name && !!fallback;
95436
- if (isError) {
95437
- throw error;
95438
- }
95439
- return /* @__PURE__ */ jsx21("div", { className: "w-full p-3", children: /* @__PURE__ */ jsxs12(
95440
- DropdownMenu4,
95441
- {
95442
- dir: direction,
95443
- children: [
95444
- /* @__PURE__ */ jsxs12(
95445
- DropdownMenu4.Trigger,
95446
- {
95447
- disabled: !isLoaded,
95448
- className: clx9(
95449
- "bg-ui-bg-subtle transition-fg grid w-full grid-cols-[24px_1fr_15px] items-center gap-x-3 rounded-md p-0.5 pe-2 outline-none",
95450
- "hover:bg-ui-bg-subtle-hover",
95451
- "data-[state=open]:bg-ui-bg-subtle-hover",
95452
- "focus-visible:shadow-borders-focus"
95453
- ),
95454
- children: [
95455
- fallback ? /* @__PURE__ */ jsx21(Avatar2, { variant: "squared", size: "xsmall", fallback }) : /* @__PURE__ */ jsx21(Skeleton, { className: "h-6 w-6 rounded-md" }),
95456
- /* @__PURE__ */ jsx21("div", { className: "block overflow-hidden text-start", children: name ? /* @__PURE__ */ jsx21(
95457
- Text7,
95458
- {
95459
- size: "small",
95460
- weight: "plus",
95461
- leading: "compact",
95462
- className: "truncate",
95463
- children: store.name
95464
- }
95465
- ) : /* @__PURE__ */ jsx21(Skeleton, { className: "h-[9px] w-[120px]" }) }),
95466
- /* @__PURE__ */ jsx21(EllipsisHorizontal3, { className: "text-ui-fg-muted" })
95467
- ]
95468
- }
95430
+ const fallback = "A";
95431
+ return /* @__PURE__ */ jsx21("div", { className: "w-full p-3", children: /* @__PURE__ */ jsxs12(DropdownMenu4, { dir: direction, children: [
95432
+ /* @__PURE__ */ jsxs12(
95433
+ DropdownMenu4.Trigger,
95434
+ {
95435
+ className: clx9(
95436
+ "bg-ui-bg-subtle transition-fg grid w-full grid-cols-[24px_1fr_15px] items-center gap-x-3 rounded-md p-0.5 pe-2 outline-none",
95437
+ "hover:bg-ui-bg-subtle-hover",
95438
+ "data-[state=open]:bg-ui-bg-subtle-hover",
95439
+ "focus-visible:shadow-borders-focus"
95469
95440
  ),
95470
- isLoaded && /* @__PURE__ */ jsxs12(DropdownMenu4.Content, { className: "w-[var(--radix-dropdown-menu-trigger-width)] min-w-0", children: [
95471
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-x-3 px-2 py-1", children: [
95472
- /* @__PURE__ */ jsx21(Avatar2, { variant: "squared", size: "small", fallback }),
95473
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-col overflow-hidden", children: [
95474
- /* @__PURE__ */ jsx21(
95475
- Text7,
95476
- {
95477
- size: "small",
95478
- weight: "plus",
95479
- leading: "compact",
95480
- className: "truncate",
95481
- children: name
95482
- }
95483
- ),
95484
- /* @__PURE__ */ jsx21(
95485
- Text7,
95486
- {
95487
- size: "xsmall",
95488
- leading: "compact",
95489
- className: "text-ui-fg-subtle",
95490
- children: t2("app.nav.main.store")
95491
- }
95492
- )
95493
- ] })
95494
- ] }),
95495
- /* @__PURE__ */ jsx21(DropdownMenu4.Separator, {}),
95496
- /* @__PURE__ */ jsx21(DropdownMenu4.Item, { className: "gap-x-2", asChild: true, children: /* @__PURE__ */ jsxs12(Link4, { to: "/settings", children: [
95497
- /* @__PURE__ */ jsx21(BuildingStorefront, { className: "text-ui-fg-subtle" }),
95498
- t2("app.nav.main.storeSettings")
95499
- ] }) }),
95500
- /* @__PURE__ */ jsx21(DropdownMenu4.Separator, {}),
95501
- /* @__PURE__ */ jsx21(Logout2, {})
95502
- ] })
95503
- ]
95504
- }
95505
- ) });
95441
+ children: [
95442
+ /* @__PURE__ */ jsx21(Avatar2, { variant: "squared", size: "xsmall", fallback }),
95443
+ /* @__PURE__ */ jsx21("div", { className: "block overflow-hidden text-start", children: /* @__PURE__ */ jsx21(
95444
+ Text7,
95445
+ {
95446
+ size: "small",
95447
+ weight: "plus",
95448
+ leading: "compact",
95449
+ className: "truncate",
95450
+ children: t2("app.nav.main.store", "Admin")
95451
+ }
95452
+ ) }),
95453
+ /* @__PURE__ */ jsx21(EllipsisHorizontal3, { className: "text-ui-fg-muted" })
95454
+ ]
95455
+ }
95456
+ ),
95457
+ /* @__PURE__ */ jsxs12(DropdownMenu4.Content, { className: "w-[var(--radix-dropdown-menu-trigger-width)] min-w-0", children: [
95458
+ /* @__PURE__ */ jsx21(DropdownMenu4.Item, { className: "gap-x-2", asChild: true, children: /* @__PURE__ */ jsxs12(Link4, { to: "/settings", children: [
95459
+ /* @__PURE__ */ jsx21(CogSixTooth, { className: "text-ui-fg-subtle" }),
95460
+ t2("app.nav.main.storeSettings", "Settings")
95461
+ ] }) }),
95462
+ /* @__PURE__ */ jsx21(DropdownMenu4.Separator, {}),
95463
+ /* @__PURE__ */ jsx21(Logout2, {})
95464
+ ] })
95465
+ ] }) });
95506
95466
  };
95507
95467
  var useCoreRoutes = () => {
95508
95468
  return [];
@@ -95797,7 +95757,7 @@ function getRouteMap({
95797
95757
  children: [
95798
95758
  {
95799
95759
  path: "/login",
95800
- lazy: () => import("./login-WATHQNWI.mjs")
95760
+ lazy: () => import("./login-AIMR26AL.mjs")
95801
95761
  },
95802
95762
  {
95803
95763
  path: "/reset-password",
@@ -139,25 +139,6 @@ import {
139
139
  import { FetchError } from "@acmekit/js-sdk";
140
140
  var STORE_QUERY_KEY = "store";
141
141
  var storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
142
- async function retrieveActiveStore(query) {
143
- const response = await sdk.admin.store.list(query);
144
- const activeStore = response.stores?.[0];
145
- if (!activeStore) {
146
- throw new FetchError("No active store found", "Not Found", 404);
147
- }
148
- return { store: activeStore };
149
- }
150
- var useStore = (query, options) => {
151
- const { data, ...rest } = useQuery10({
152
- queryFn: () => retrieveActiveStore(query),
153
- queryKey: storeQueryKeys.details(),
154
- ...options
155
- });
156
- return {
157
- ...data,
158
- ...rest
159
- };
160
- };
161
142
 
162
143
  // src/hooks/api/translations.tsx
163
144
  import {
@@ -233,7 +214,6 @@ var workflowExecutionsQueryKeys = queryKeysFactory(
233
214
  export {
234
215
  useFeatureFlags,
235
216
  useMe,
236
- useStore,
237
217
  useCloudAuthEnabled,
238
218
  useCreateCloudAuthUser,
239
219
  notificationQueryKeys,
@@ -0,0 +1,159 @@
1
+ import {
2
+ queryKeysFactory
3
+ } from "./chunk-QYOO4QR6.mjs";
4
+ import {
5
+ sdk
6
+ } from "./chunk-4VYJHIB3.mjs";
7
+
8
+ // src/hooks/api/cloud.tsx
9
+ import {
10
+ useMutation,
11
+ useQuery
12
+ } from "@tanstack/react-query";
13
+ var cloudQueryKeys = {
14
+ all: ["cloud"],
15
+ auth: () => [...cloudQueryKeys.all, "auth"]
16
+ };
17
+ var useCloudAuthEnabled = (options) => {
18
+ return useQuery({
19
+ queryKey: cloudQueryKeys.auth(),
20
+ queryFn: async () => {
21
+ return await sdk.client.fetch("/cloud/auth");
22
+ },
23
+ ...options
24
+ });
25
+ };
26
+ var useCreateCloudAuthUser = (options) => {
27
+ return useMutation({
28
+ mutationFn: async () => {
29
+ await sdk.client.fetch("/cloud/auth/users", {
30
+ method: "POST"
31
+ });
32
+ },
33
+ ...options
34
+ });
35
+ };
36
+
37
+ // src/hooks/api/feature-flags.tsx
38
+ import { useQuery as useQuery2 } from "@tanstack/react-query";
39
+ var useFeatureFlags = () => {
40
+ return useQuery2({
41
+ queryKey: ["admin", "feature-flags"],
42
+ queryFn: async () => {
43
+ const response = await sdk.client.fetch(
44
+ "/admin/feature-flags",
45
+ {
46
+ method: "GET"
47
+ }
48
+ );
49
+ return response.feature_flags;
50
+ },
51
+ staleTime: 5 * 60 * 1e3,
52
+ // Cache for 5 minutes
53
+ cacheTime: 10 * 60 * 1e3
54
+ // Keep in cache for 10 minutes
55
+ });
56
+ };
57
+
58
+ // src/hooks/api/locales.tsx
59
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
60
+ var LOCALES_QUERY_KEY = "locales";
61
+ var localesQueryKeys = queryKeysFactory(LOCALES_QUERY_KEY);
62
+
63
+ // src/hooks/api/notification.tsx
64
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
65
+ var NOTIFICATION_QUERY_KEY = "notification";
66
+ var notificationQueryKeys = queryKeysFactory(NOTIFICATION_QUERY_KEY);
67
+ var useNotifications = (query, options) => {
68
+ const { data, ...rest } = useQuery4({
69
+ queryFn: () => sdk.admin.notification.list(query),
70
+ queryKey: notificationQueryKeys.list(query),
71
+ ...options
72
+ });
73
+ return { ...data, ...rest };
74
+ };
75
+
76
+ // src/hooks/api/plugins.tsx
77
+ import { useQuery as useQuery5 } from "@tanstack/react-query";
78
+ var PLUGINS_QUERY_KEY = "plugins";
79
+ var pluginsQueryKeys = queryKeysFactory(PLUGINS_QUERY_KEY);
80
+
81
+ // src/hooks/api/translations.tsx
82
+ import {
83
+ useInfiniteQuery,
84
+ useMutation as useMutation2,
85
+ useQuery as useQuery6
86
+ } from "@tanstack/react-query";
87
+ var TRANSLATIONS_QUERY_KEY = "translations";
88
+ var translationsQueryKeys = queryKeysFactory(TRANSLATIONS_QUERY_KEY);
89
+ var TRANSLATION_SETTINGS_QUERY_KEY = "translation_settings";
90
+ var translationSettingsQueryKeys = queryKeysFactory(
91
+ TRANSLATION_SETTINGS_QUERY_KEY
92
+ );
93
+ var TRANSLATION_STATISTICS_QUERY_KEY = "translation_statistics";
94
+ var translationStatisticsQueryKeys = queryKeysFactory(
95
+ TRANSLATION_STATISTICS_QUERY_KEY
96
+ );
97
+ var TRANSLATION_ENTITIES_QUERY_KEY = "translation_entities";
98
+ var translationEntitiesQueryKeys = queryKeysFactory(
99
+ TRANSLATION_ENTITIES_QUERY_KEY
100
+ );
101
+
102
+ // src/hooks/api/users.tsx
103
+ import {
104
+ useMutation as useMutation3,
105
+ useQuery as useQuery7
106
+ } from "@tanstack/react-query";
107
+ var USERS_QUERY_KEY = "users";
108
+ var usersQueryKeys = {
109
+ ...queryKeysFactory(USERS_QUERY_KEY),
110
+ me: () => [USERS_QUERY_KEY, "me"]
111
+ };
112
+ var useMe = (query, options) => {
113
+ const { data, ...rest } = useQuery7({
114
+ queryFn: () => sdk.admin.user.me(query),
115
+ queryKey: usersQueryKeys.me(),
116
+ ...options
117
+ });
118
+ return {
119
+ ...data,
120
+ ...rest
121
+ };
122
+ };
123
+
124
+ // src/hooks/api/views.tsx
125
+ import {
126
+ useMutation as useMutation4,
127
+ useQuery as useQuery8
128
+ } from "@tanstack/react-query";
129
+ var VIEWS_QUERY_KEY = "views";
130
+ var _viewsKeys = queryKeysFactory(VIEWS_QUERY_KEY);
131
+ _viewsKeys.columns = function(entity) {
132
+ return [this.all, "columns", entity];
133
+ };
134
+ _viewsKeys.active = function(entity) {
135
+ return [this.detail(entity), "active"];
136
+ };
137
+ _viewsKeys.configurations = function(entity, query) {
138
+ const key = [this.all, "configurations", entity];
139
+ if (query !== void 0) {
140
+ key.push(query);
141
+ }
142
+ return key;
143
+ };
144
+
145
+ // src/hooks/api/workflow-executions.tsx
146
+ import { useQuery as useQuery9 } from "@tanstack/react-query";
147
+ var WORKFLOW_EXECUTIONS_QUERY_KEY = "workflow_executions";
148
+ var workflowExecutionsQueryKeys = queryKeysFactory(
149
+ WORKFLOW_EXECUTIONS_QUERY_KEY
150
+ );
151
+
152
+ export {
153
+ useFeatureFlags,
154
+ useMe,
155
+ useCloudAuthEnabled,
156
+ useCreateCloudAuthUser,
157
+ notificationQueryKeys,
158
+ useNotifications
159
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useCloudAuthEnabled,
3
3
  useCreateCloudAuthUser
4
- } from "./chunk-XMP5T5AD.mjs";
4
+ } from "./chunk-FBTP4AJM.mjs";
5
5
  import {
6
6
  useExtension
7
7
  } from "./chunk-C5P5PL3E.mjs";
@@ -0,0 +1,291 @@
1
+ import {
2
+ useCloudAuthEnabled,
3
+ useCreateCloudAuthUser
4
+ } from "./chunk-NQEMGMWU.mjs";
5
+ import {
6
+ useExtension
7
+ } from "./chunk-C5P5PL3E.mjs";
8
+ import {
9
+ isFetchError
10
+ } from "./chunk-QYOO4QR6.mjs";
11
+ import {
12
+ AvatarBox
13
+ } from "./chunk-JSJZMTQG.mjs";
14
+ import {
15
+ Form,
16
+ sdk,
17
+ useSignInWithEmailPass
18
+ } from "./chunk-4VYJHIB3.mjs";
19
+ import "./chunk-QZ7TP4HQ.mjs";
20
+
21
+ // src/routes/login/login.tsx
22
+ import { zodResolver } from "@hookform/resolvers/zod";
23
+ import { Alert, Button as Button2, Heading, Hint, Input, Text } from "@acmekit/ui";
24
+ import { useForm } from "react-hook-form";
25
+ import { Trans, useTranslation as useTranslation2 } from "react-i18next";
26
+ import { Link, useLocation, useNavigate as useNavigate2 } from "react-router-dom";
27
+ import * as z from "zod";
28
+
29
+ // src/routes/login/components/cloud-auth-login.tsx
30
+ import { Spinner } from "@acmekit/icons";
31
+ import { Button, toast } from "@acmekit/ui";
32
+ import { useCallback, useEffect, useRef, useState } from "react";
33
+ import { useTranslation } from "react-i18next";
34
+ import { decodeToken } from "react-jwt";
35
+ import { useNavigate, useSearchParams } from "react-router-dom";
36
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
37
+ var CLOUD_AUTH_PROVIDER = "cloud";
38
+ var CloudAuthLogin = () => {
39
+ const { t } = useTranslation();
40
+ const [searchParams] = useSearchParams();
41
+ const { data: cloudAuth } = useCloudAuthEnabled();
42
+ const isAutoLogin = searchParams.get("auth_provider") === CLOUD_AUTH_PROVIDER && searchParams.get("auto") === "true";
43
+ const isCallback = searchParams.get("auth_provider") === CLOUD_AUTH_PROVIDER && (searchParams.has("code") || searchParams.has("error"));
44
+ const { handleLogin, isLoginPending } = useHandleLogin(isAutoLogin);
45
+ const { handleCallback, isCallbackPending } = useAuthCallback(searchParams);
46
+ const actionInitiated = useRef(false);
47
+ useEffect(() => {
48
+ if (actionInitiated.current) {
49
+ return;
50
+ }
51
+ if (isAutoLogin) {
52
+ actionInitiated.current = true;
53
+ handleLogin();
54
+ } else if (isCallback) {
55
+ actionInitiated.current = true;
56
+ handleCallback();
57
+ }
58
+ }, [isAutoLogin, isCallback, handleLogin, handleCallback]);
59
+ if (isAutoLogin || isCallback) {
60
+ return /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle fixed inset-0 z-50 flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, { className: "text-ui-fg-subtle animate-spin" }) });
61
+ }
62
+ if (!cloudAuth?.enabled) {
63
+ return null;
64
+ }
65
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
66
+ /* @__PURE__ */ jsx("hr", { className: "bg-ui-border-base my-4" }),
67
+ /* @__PURE__ */ jsx(
68
+ Button,
69
+ {
70
+ variant: "secondary",
71
+ onClick: handleLogin,
72
+ className: "w-full",
73
+ disabled: isLoginPending || isCallbackPending,
74
+ isLoading: isLoginPending || isCallbackPending,
75
+ children: t("auth.login.cloud")
76
+ }
77
+ )
78
+ ] });
79
+ };
80
+ var useHandleLogin = (isAutoLogin) => {
81
+ const { t } = useTranslation();
82
+ const navigate = useNavigate();
83
+ const [isPending, setIsPending] = useState(false);
84
+ const handleLogin = useCallback(async () => {
85
+ setIsPending(true);
86
+ try {
87
+ const result = await sdk.auth.login("user", CLOUD_AUTH_PROVIDER, {
88
+ // setting callback_url in case the admin is on a different domain, or the backend URL is set to just "/" which won't work for the callback
89
+ callback_url: `${window.location.origin}${window.location.pathname}?auth_provider=${CLOUD_AUTH_PROVIDER}`
90
+ });
91
+ if (typeof result === "object" && result.location) {
92
+ window.location.href = result.location;
93
+ return;
94
+ }
95
+ throw new Error("Unexpected login response");
96
+ } catch {
97
+ toast.error(t("auth.login.authenticationFailed"));
98
+ if (isAutoLogin) {
99
+ navigate("/login");
100
+ }
101
+ }
102
+ setIsPending(false);
103
+ }, [t, navigate, isAutoLogin]);
104
+ return { handleLogin, isLoginPending: isPending };
105
+ };
106
+ var useAuthCallback = (searchParams) => {
107
+ const { t } = useTranslation();
108
+ const navigate = useNavigate();
109
+ const { mutateAsync: createCloudAuthUser } = useCreateCloudAuthUser();
110
+ const [isPending, setIsPending] = useState(false);
111
+ const handleCallback = useCallback(async () => {
112
+ setIsPending(true);
113
+ try {
114
+ let token;
115
+ try {
116
+ const query = Object.fromEntries(searchParams);
117
+ delete query.auth_provider;
118
+ token = await sdk.auth.callback("user", CLOUD_AUTH_PROVIDER, query);
119
+ } catch (error) {
120
+ throw new Error("Authentication callback failed");
121
+ }
122
+ const decodedToken = decodeToken(token);
123
+ if (!decodedToken?.actor_id) {
124
+ await createCloudAuthUser();
125
+ const refreshedToken = await sdk.auth.refresh({
126
+ Authorization: `Bearer ${token}`
127
+ // passing it manually in case the auth type is session
128
+ });
129
+ if (!refreshedToken) {
130
+ throw new Error("Failed to refresh token after user creation");
131
+ }
132
+ }
133
+ navigate("/");
134
+ } catch (error) {
135
+ toast.error(t("auth.login.authenticationFailed"));
136
+ navigate("/login");
137
+ }
138
+ setIsPending(false);
139
+ }, [searchParams, t, createCloudAuthUser, navigate]);
140
+ return { handleCallback, isCallbackPending: isPending };
141
+ };
142
+
143
+ // src/routes/login/login.tsx
144
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
145
+ var LoginSchema = z.object({
146
+ email: z.string().email(),
147
+ password: z.string()
148
+ });
149
+ var Login = () => {
150
+ const { t } = useTranslation2();
151
+ const location = useLocation();
152
+ const navigate = useNavigate2();
153
+ const { getWidgets } = useExtension();
154
+ const from = location.state?.from?.pathname || "/orders";
155
+ const form = useForm({
156
+ resolver: zodResolver(LoginSchema),
157
+ defaultValues: {
158
+ email: "",
159
+ password: ""
160
+ }
161
+ });
162
+ const { mutateAsync, isPending } = useSignInWithEmailPass();
163
+ const handleSubmit = form.handleSubmit(async ({ email, password }) => {
164
+ await mutateAsync(
165
+ {
166
+ email,
167
+ password
168
+ },
169
+ {
170
+ onError: (error) => {
171
+ if (isFetchError(error)) {
172
+ if (error.status === 401) {
173
+ form.setError("email", {
174
+ type: "manual",
175
+ message: error.message
176
+ });
177
+ return;
178
+ }
179
+ }
180
+ form.setError("root.serverError", {
181
+ type: "manual",
182
+ message: error.message
183
+ });
184
+ },
185
+ onSuccess: () => {
186
+ navigate(from, { replace: true });
187
+ }
188
+ }
189
+ );
190
+ });
191
+ const serverError = form.formState.errors?.root?.serverError?.message;
192
+ const validationError = form.formState.errors.email?.message || form.formState.errors.password?.message;
193
+ return /* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-subtle flex min-h-dvh w-dvw items-center justify-center", children: /* @__PURE__ */ jsxs2("div", { className: "m-4 flex w-full max-w-[280px] flex-col items-center", children: [
194
+ /* @__PURE__ */ jsx2(AvatarBox, {}),
195
+ /* @__PURE__ */ jsxs2("div", { className: "mb-4 flex flex-col items-center", children: [
196
+ /* @__PURE__ */ jsx2(Heading, { children: t("login.title") }),
197
+ /* @__PURE__ */ jsx2(Text, { size: "small", className: "text-ui-fg-subtle text-center", children: t("login.hint") })
198
+ ] }),
199
+ /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col gap-y-3", children: [
200
+ getWidgets("login.before").map((Component, i) => {
201
+ return /* @__PURE__ */ jsx2(Component, {}, i);
202
+ }),
203
+ /* @__PURE__ */ jsx2(Form, { ...form, children: /* @__PURE__ */ jsxs2(
204
+ "form",
205
+ {
206
+ onSubmit: handleSubmit,
207
+ className: "flex w-full flex-col gap-y-6",
208
+ children: [
209
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-1", children: [
210
+ /* @__PURE__ */ jsx2(
211
+ Form.Field,
212
+ {
213
+ control: form.control,
214
+ name: "email",
215
+ render: ({ field }) => {
216
+ return /* @__PURE__ */ jsx2(Form.Item, { children: /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
217
+ Input,
218
+ {
219
+ autoComplete: "email",
220
+ ...field,
221
+ className: "bg-ui-bg-field-component",
222
+ placeholder: t("fields.email")
223
+ }
224
+ ) }) });
225
+ }
226
+ }
227
+ ),
228
+ /* @__PURE__ */ jsx2(
229
+ Form.Field,
230
+ {
231
+ control: form.control,
232
+ name: "password",
233
+ render: ({ field }) => {
234
+ return /* @__PURE__ */ jsxs2(Form.Item, { children: [
235
+ /* @__PURE__ */ jsx2(Form.Label, {}),
236
+ /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
237
+ Input,
238
+ {
239
+ type: "password",
240
+ autoComplete: "current-password",
241
+ ...field,
242
+ className: "bg-ui-bg-field-component",
243
+ placeholder: t("fields.password")
244
+ }
245
+ ) })
246
+ ] });
247
+ }
248
+ }
249
+ )
250
+ ] }),
251
+ validationError && /* @__PURE__ */ jsx2("div", { className: "text-center", children: /* @__PURE__ */ jsx2(Hint, { className: "inline-flex", variant: "error", children: validationError }) }),
252
+ serverError && /* @__PURE__ */ jsx2(
253
+ Alert,
254
+ {
255
+ className: "bg-ui-bg-base items-center p-2",
256
+ dismissible: true,
257
+ variant: "error",
258
+ children: serverError
259
+ }
260
+ ),
261
+ /* @__PURE__ */ jsx2(Button2, { className: "w-full", type: "submit", isLoading: isPending, children: t("actions.continueWithEmail") })
262
+ ]
263
+ }
264
+ ) }),
265
+ [...getWidgets("login.after"), CloudAuthLogin].map(
266
+ (Component, i) => {
267
+ return /* @__PURE__ */ jsx2(Component, {}, i);
268
+ }
269
+ )
270
+ ] }),
271
+ /* @__PURE__ */ jsx2("span", { className: "text-ui-fg-muted txt-small my-6", children: /* @__PURE__ */ jsx2(
272
+ Trans,
273
+ {
274
+ i18nKey: "login.forgotPassword",
275
+ components: [
276
+ /* @__PURE__ */ jsx2(
277
+ Link,
278
+ {
279
+ to: "/reset-password",
280
+ className: "text-ui-fg-interactive transition-fg hover:text-ui-fg-interactive-hover focus-visible:text-ui-fg-interactive-hover font-medium outline-none"
281
+ },
282
+ "reset-password-link"
283
+ )
284
+ ]
285
+ }
286
+ ) })
287
+ ] }) });
288
+ };
289
+ export {
290
+ Login as Component
291
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acmekit/dashboard",
3
- "version": "2.13.3",
3
+ "version": "2.13.5",
4
4
  "scripts": {
5
5
  "generate:static": "node ./scripts/generate-currencies.js && prettier --write ./src/lib/currencies.ts",
6
6
  "dev": "../../../node_modules/.bin/vite",
@@ -39,10 +39,10 @@
39
39
  "dist"
40
40
  ],
41
41
  "dependencies": {
42
- "@acmekit/admin-shared": "2.13.3",
43
- "@acmekit/icons": "2.13.3",
44
- "@acmekit/js-sdk": "2.13.3",
45
- "@acmekit/ui": "4.1.3",
42
+ "@acmekit/admin-shared": "2.13.5",
43
+ "@acmekit/icons": "2.13.5",
44
+ "@acmekit/js-sdk": "2.13.5",
45
+ "@acmekit/ui": "4.1.5",
46
46
  "@ariakit/react": "^0.4.15",
47
47
  "@babel/runtime": "^7.26.10",
48
48
  "@dnd-kit/core": "^6.1.0",
@@ -80,10 +80,10 @@
80
80
  "zod": "3.25.76"
81
81
  },
82
82
  "devDependencies": {
83
- "@acmekit/admin-shared": "2.13.3",
84
- "@acmekit/admin-vite-plugin": "2.13.3",
85
- "@acmekit/types": "2.13.3",
86
- "@acmekit/ui-preset": "2.13.3"
83
+ "@acmekit/admin-shared": "2.13.5",
84
+ "@acmekit/admin-vite-plugin": "2.13.5",
85
+ "@acmekit/types": "2.13.5",
86
+ "@acmekit/ui-preset": "2.13.5"
87
87
  },
88
88
  "packageManager": "yarn@3.2.1"
89
89
  }
@@ -1,5 +1,4 @@
1
1
  import {
2
- BuildingStorefront,
3
2
  ChevronDownMini,
4
3
  CogSixTooth,
5
4
  EllipsisHorizontal,
@@ -12,8 +11,6 @@ import { Avatar, Divider, DropdownMenu, Text, clx } from "@acmekit/ui"
12
11
  import { Collapsible as RadixCollapsible } from "radix-ui"
13
12
  import { useTranslation } from "react-i18next"
14
13
 
15
- import { useStore } from "../../../hooks/api/store"
16
- import { Skeleton } from "../../common/skeleton"
17
14
  import { INavItem, NavItem } from "../../layout/nav-item"
18
15
  import { Shell } from "../../layout/shell"
19
16
 
@@ -88,23 +85,13 @@ const Logout = () => {
88
85
 
89
86
  const Header = () => {
90
87
  const { t } = useTranslation()
91
- const { store, isPending, isError, error } = useStore()
92
88
  const direction = useDocumentDirection()
93
- const name = store?.name
94
- const fallback = store?.name?.slice(0, 1).toUpperCase()
95
-
96
- const isLoaded = !isPending && !!store && !!name && !!fallback
97
-
98
- if (isError) {
99
- throw error
100
- }
89
+ const fallback = "A"
101
90
 
102
91
  return (
103
92
  <div className="w-full p-3">
104
- <DropdownMenu
105
- dir={direction}>
93
+ <DropdownMenu dir={direction}>
106
94
  <DropdownMenu.Trigger
107
- disabled={!isLoaded}
108
95
  className={clx(
109
96
  "bg-ui-bg-subtle transition-fg grid w-full grid-cols-[24px_1fr_15px] items-center gap-x-3 rounded-md p-0.5 pe-2 outline-none",
110
97
  "hover:bg-ui-bg-subtle-hover",
@@ -112,60 +99,29 @@ const Header = () => {
112
99
  "focus-visible:shadow-borders-focus"
113
100
  )}
114
101
  >
115
- {fallback ? (
116
- <Avatar variant="squared" size="xsmall" fallback={fallback} />
117
- ) : (
118
- <Skeleton className="h-6 w-6 rounded-md" />
119
- )}
102
+ <Avatar variant="squared" size="xsmall" fallback={fallback} />
120
103
  <div className="block overflow-hidden text-start">
121
- {name ? (
122
- <Text
123
- size="small"
124
- weight="plus"
125
- leading="compact"
126
- className="truncate"
127
- >
128
- {store.name}
129
- </Text>
130
- ) : (
131
- <Skeleton className="h-[9px] w-[120px]" />
132
- )}
104
+ <Text
105
+ size="small"
106
+ weight="plus"
107
+ leading="compact"
108
+ className="truncate"
109
+ >
110
+ {t("app.nav.main.store", "Admin")}
111
+ </Text>
133
112
  </div>
134
113
  <EllipsisHorizontal className="text-ui-fg-muted" />
135
114
  </DropdownMenu.Trigger>
136
- {isLoaded && (
137
- <DropdownMenu.Content className="w-[var(--radix-dropdown-menu-trigger-width)] min-w-0">
138
- <div className="flex items-center gap-x-3 px-2 py-1">
139
- <Avatar variant="squared" size="small" fallback={fallback} />
140
- <div className="flex flex-col overflow-hidden">
141
- <Text
142
- size="small"
143
- weight="plus"
144
- leading="compact"
145
- className="truncate"
146
- >
147
- {name}
148
- </Text>
149
- <Text
150
- size="xsmall"
151
- leading="compact"
152
- className="text-ui-fg-subtle"
153
- >
154
- {t("app.nav.main.store")}
155
- </Text>
156
- </div>
157
- </div>
158
- <DropdownMenu.Separator />
159
- <DropdownMenu.Item className="gap-x-2" asChild>
160
- <Link to="/settings">
161
- <BuildingStorefront className="text-ui-fg-subtle" />
162
- {t("app.nav.main.storeSettings")}
163
- </Link>
164
- </DropdownMenu.Item>
165
- <DropdownMenu.Separator />
166
- <Logout />
167
- </DropdownMenu.Content>
168
- )}
115
+ <DropdownMenu.Content className="w-[var(--radix-dropdown-menu-trigger-width)] min-w-0">
116
+ <DropdownMenu.Item className="gap-x-2" asChild>
117
+ <Link to="/settings">
118
+ <CogSixTooth className="text-ui-fg-subtle" />
119
+ {t("app.nav.main.storeSettings", "Settings")}
120
+ </Link>
121
+ </DropdownMenu.Item>
122
+ <DropdownMenu.Separator />
123
+ <Logout />
124
+ </DropdownMenu.Content>
169
125
  </DropdownMenu>
170
126
  </div>
171
127
  )