@deenruv/admin-dashboard 1.0.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.
Files changed (292) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +30 -0
  3. package/dist/@types/resources.js +51 -0
  4. package/dist/DeenruvAdminPanel.js +118 -0
  5. package/dist/DeenruvDeveloperIndicator.js +57 -0
  6. package/dist/components/Aexol.js +4 -0
  7. package/dist/components/BrandLogo.js +22 -0
  8. package/dist/components/CanLeaveRouteDialog.js +8 -0
  9. package/dist/components/DataTable.js +13 -0
  10. package/dist/components/DeleteDialog.js +6 -0
  11. package/dist/components/DuplicateEntry.js +46 -0
  12. package/dist/components/GlobalSearch.js +134 -0
  13. package/dist/components/History/AddEntryForm.js +29 -0
  14. package/dist/components/History/DeleteEntryDialog.js +25 -0
  15. package/dist/components/History/EditEntryDialog.js +32 -0
  16. package/dist/components/History/History.js +13 -0
  17. package/dist/components/History/ModifyHistoryInfo.js +6 -0
  18. package/dist/components/History/Timeline.js +53 -0
  19. package/dist/components/History/index.js +5 -0
  20. package/dist/components/Menu/ActiveAdmins.js +24 -0
  21. package/dist/components/Menu/ChannelSwitcher.js +20 -0
  22. package/dist/components/Menu/LanguagesDropdown.js +26 -0
  23. package/dist/components/Menu/Navigation.js +270 -0
  24. package/dist/components/Menu/NavigationFooter.js +12 -0
  25. package/dist/components/Menu/Notifications.js +90 -0
  26. package/dist/components/Menu/index.js +67 -0
  27. package/dist/components/index.js +6 -0
  28. package/dist/graphql/base.js +95 -0
  29. package/dist/graphql/collections.js +94 -0
  30. package/dist/graphql/draft_order.js +307 -0
  31. package/dist/graphql/orders.js +157 -0
  32. package/dist/graphql/products.js +230 -0
  33. package/dist/graphql/scalars.js +22 -0
  34. package/dist/i18.js +13 -0
  35. package/dist/index.css +161 -0
  36. package/dist/index.d.ts +11 -0
  37. package/dist/index.js +1 -0
  38. package/dist/locales/en/admins.json +57 -0
  39. package/dist/locales/en/assets.json +69 -0
  40. package/dist/locales/en/channels.json +66 -0
  41. package/dist/locales/en/collections.json +145 -0
  42. package/dist/locales/en/common.json +1127 -0
  43. package/dist/locales/en/countries.json +50 -0
  44. package/dist/locales/en/customerGroups.json +6 -0
  45. package/dist/locales/en/customers.json +109 -0
  46. package/dist/locales/en/dashboard.json +34 -0
  47. package/dist/locales/en/facets.json +78 -0
  48. package/dist/locales/en/globalSettings.json +15 -0
  49. package/dist/locales/en/index.js +52 -0
  50. package/dist/locales/en/orders.json +932 -0
  51. package/dist/locales/en/paymentMethods.json +59 -0
  52. package/dist/locales/en/permissions.json +94 -0
  53. package/dist/locales/en/products.json +194 -0
  54. package/dist/locales/en/promotions.json +65 -0
  55. package/dist/locales/en/roles.json +59 -0
  56. package/dist/locales/en/sellers.json +41 -0
  57. package/dist/locales/en/shippingMethods.json +84 -0
  58. package/dist/locales/en/stockLocations.json +40 -0
  59. package/dist/locales/en/system.json +41 -0
  60. package/dist/locales/en/table.json +201 -0
  61. package/dist/locales/en/taxCategories.json +47 -0
  62. package/dist/locales/en/taxRates.json +56 -0
  63. package/dist/locales/en/zones.json +47 -0
  64. package/dist/locales/index.js +2 -0
  65. package/dist/locales/pl/admins.json +57 -0
  66. package/dist/locales/pl/assets.json +69 -0
  67. package/dist/locales/pl/channels.json +66 -0
  68. package/dist/locales/pl/collections.json +145 -0
  69. package/dist/locales/pl/common.json +1128 -0
  70. package/dist/locales/pl/countries.json +50 -0
  71. package/dist/locales/pl/customerGroups.json +6 -0
  72. package/dist/locales/pl/customers.json +109 -0
  73. package/dist/locales/pl/dashboard.json +34 -0
  74. package/dist/locales/pl/facets.json +78 -0
  75. package/dist/locales/pl/globalSettings.json +15 -0
  76. package/dist/locales/pl/index.js +52 -0
  77. package/dist/locales/pl/orders.json +932 -0
  78. package/dist/locales/pl/paymentMethods.json +59 -0
  79. package/dist/locales/pl/permissions.json +94 -0
  80. package/dist/locales/pl/products.json +194 -0
  81. package/dist/locales/pl/promotions.json +65 -0
  82. package/dist/locales/pl/roles.json +59 -0
  83. package/dist/locales/pl/sellers.json +41 -0
  84. package/dist/locales/pl/shippingMethods.json +84 -0
  85. package/dist/locales/pl/stockLocations.json +40 -0
  86. package/dist/locales/pl/system.json +41 -0
  87. package/dist/locales/pl/table.json +201 -0
  88. package/dist/locales/pl/taxCategories.json +47 -0
  89. package/dist/locales/pl/taxRates.json +56 -0
  90. package/dist/locales/pl/zones.json +47 -0
  91. package/dist/notifications/OrderStatusNotification.js +47 -0
  92. package/dist/notifications/SystemStatusNotification.js +19 -0
  93. package/dist/pages/Custom404.js +5 -0
  94. package/dist/pages/LoginScreen.js +37 -0
  95. package/dist/pages/Root.js +252 -0
  96. package/dist/pages/admins/Detail.js +72 -0
  97. package/dist/pages/admins/List.js +56 -0
  98. package/dist/pages/admins/_components/AdminDetailView.js +34 -0
  99. package/dist/pages/admins/_components/RolesCard.js +31 -0
  100. package/dist/pages/admins/index.js +2 -0
  101. package/dist/pages/assets/List.js +82 -0
  102. package/dist/pages/assets/_components/Asset.js +114 -0
  103. package/dist/pages/assets/_components/AssetListView.js +29 -0
  104. package/dist/pages/assets/_components/EditAssetDialog.js +85 -0
  105. package/dist/pages/assets/_components/UploadAssetDialog.js +133 -0
  106. package/dist/pages/assets/_components/UploadProgress.js +20 -0
  107. package/dist/pages/assets/index.js +1 -0
  108. package/dist/pages/channels/Detail.js +149 -0
  109. package/dist/pages/channels/List.js +46 -0
  110. package/dist/pages/channels/_components/ChannelDetailView.js +51 -0
  111. package/dist/pages/channels/_components/DefaultsCard.js +25 -0
  112. package/dist/pages/channels/index.js +2 -0
  113. package/dist/pages/collections/Detail.js +61 -0
  114. package/dist/pages/collections/List.js +135 -0
  115. package/dist/pages/collections/_components/CollectionDetailView.js +52 -0
  116. package/dist/pages/collections/_components/CollectionProductVariantsDrawer.js +28 -0
  117. package/dist/pages/collections/_components/CombinationMode.js +6 -0
  118. package/dist/pages/collections/_components/ContentsCard.js +43 -0
  119. package/dist/pages/collections/_components/ContentsTable.js +102 -0
  120. package/dist/pages/collections/_components/DeleteCollectionsFromChannel.js +36 -0
  121. package/dist/pages/collections/_components/FacetsSelector.js +30 -0
  122. package/dist/pages/collections/_components/FiltersCard.js +101 -0
  123. package/dist/pages/collections/_components/MoveCollectionsToCollections.js +107 -0
  124. package/dist/pages/collections/_components/MoveEntityToChannels.js +115 -0
  125. package/dist/pages/collections/_components/PageHeader.js +11 -0
  126. package/dist/pages/collections/_components/SelectedCollectionsModal.js +22 -0
  127. package/dist/pages/collections/_components/VariantsSelector.js +43 -0
  128. package/dist/pages/collections/consts.js +7 -0
  129. package/dist/pages/collections/index.js +2 -0
  130. package/dist/pages/countries/Detail.js +57 -0
  131. package/dist/pages/countries/List.js +47 -0
  132. package/dist/pages/countries/_components/CountryDetailView.js +28 -0
  133. package/dist/pages/countries/index.js +2 -0
  134. package/dist/pages/customer-groups/Detail.js +76 -0
  135. package/dist/pages/customer-groups/List.js +41 -0
  136. package/dist/pages/customer-groups/_components/CustomerGroupsDetailView.js +21 -0
  137. package/dist/pages/customer-groups/index.js +2 -0
  138. package/dist/pages/customers/Detail.js +75 -0
  139. package/dist/pages/customers/List.js +60 -0
  140. package/dist/pages/customers/_components/Address.js +59 -0
  141. package/dist/pages/customers/_components/AddressDialog.js +56 -0
  142. package/dist/pages/customers/_components/AddressForm.js +77 -0
  143. package/dist/pages/customers/_components/AddressesCard.js +9 -0
  144. package/dist/pages/customers/_components/CustomerDetailSidebar.js +9 -0
  145. package/dist/pages/customers/_components/CustomerDetailView.js +41 -0
  146. package/dist/pages/customers/_components/CustomerGroupsCard.js +46 -0
  147. package/dist/pages/customers/_components/HistoryTab.js +65 -0
  148. package/dist/pages/customers/_components/OrdersTab.js +46 -0
  149. package/dist/pages/customers/_components/PersonalDataCard.js +6 -0
  150. package/dist/pages/customers/_components/VerifiedCard.js +6 -0
  151. package/dist/pages/customers/index.js +2 -0
  152. package/dist/pages/dashboard/Dashboard.js +10 -0
  153. package/dist/pages/dashboard/index.js +1 -0
  154. package/dist/pages/extensions/Extensions.js +74 -0
  155. package/dist/pages/extensions/index.js +1 -0
  156. package/dist/pages/facets/Detail.js +56 -0
  157. package/dist/pages/facets/List.js +48 -0
  158. package/dist/pages/facets/_components/AddFacetValueDialog.js +105 -0
  159. package/dist/pages/facets/_components/ColorSample.js +18 -0
  160. package/dist/pages/facets/_components/FacetDetailView.js +98 -0
  161. package/dist/pages/facets/index.js +2 -0
  162. package/dist/pages/global-settings/GlobalSettingsComponent.js +30 -0
  163. package/dist/pages/global-settings/index.js +71 -0
  164. package/dist/pages/index.js +25 -0
  165. package/dist/pages/orders/Detail.js +21 -0
  166. package/dist/pages/orders/List.js +132 -0
  167. package/dist/pages/orders/_components/AddPaymentDialog.js +50 -0
  168. package/dist/pages/orders/_components/AddressCard.js +260 -0
  169. package/dist/pages/orders/_components/CancelAndRefundDialog.js +29 -0
  170. package/dist/pages/orders/_components/ChangesRegister.js +68 -0
  171. package/dist/pages/orders/_components/ChangesRegisterTable.js +18 -0
  172. package/dist/pages/orders/_components/CouponCodesCard.js +85 -0
  173. package/dist/pages/orders/_components/CustomComponent.js +21 -0
  174. package/dist/pages/orders/_components/CustomerSelectCard.js +117 -0
  175. package/dist/pages/orders/_components/EditNoteButton.js +10 -0
  176. package/dist/pages/orders/_components/FulfillmentModal.js +85 -0
  177. package/dist/pages/orders/_components/LineItem.js +7 -0
  178. package/dist/pages/orders/_components/ManualOrderChangeModal.js +47 -0
  179. package/dist/pages/orders/_components/ModifyAcceptModal.js +22 -0
  180. package/dist/pages/orders/_components/ModifyingCard.js +77 -0
  181. package/dist/pages/orders/_components/OrderHistory.js +59 -0
  182. package/dist/pages/orders/_components/OrderLineActionModal/ActionQuantityPrice.js +58 -0
  183. package/dist/pages/orders/_components/OrderLineActionModal/index.js +7 -0
  184. package/dist/pages/orders/_components/OrderLineActionModal/types.js +1 -0
  185. package/dist/pages/orders/_components/OrderLineCustomFields.js +26 -0
  186. package/dist/pages/orders/_components/OrderSummary.js +10 -0
  187. package/dist/pages/orders/_components/PaymentMetadata.js +6 -0
  188. package/dist/pages/orders/_components/Payments.js +113 -0
  189. package/dist/pages/orders/_components/PossibleOrderStates.js +54 -0
  190. package/dist/pages/orders/_components/PriceChangedInfo.js +16 -0
  191. package/dist/pages/orders/_components/ProductsCard.js +308 -0
  192. package/dist/pages/orders/_components/ProductsTable.js +29 -0
  193. package/dist/pages/orders/_components/PromotionsList.js +73 -0
  194. package/dist/pages/orders/_components/RealizationCard.js +98 -0
  195. package/dist/pages/orders/_components/RefundCard.js +11 -0
  196. package/dist/pages/orders/_components/RefundPaymentCard.js +13 -0
  197. package/dist/pages/orders/_components/ShippingMethod.js +112 -0
  198. package/dist/pages/orders/_components/SpecialLineItem.js +7 -0
  199. package/dist/pages/orders/_components/SurchargeCard.js +99 -0
  200. package/dist/pages/orders/_components/SurchargeTable.js +8 -0
  201. package/dist/pages/orders/_components/TaxSummary.js +11 -0
  202. package/dist/pages/orders/_components/ToRealizationForm.js +64 -0
  203. package/dist/pages/orders/_components/TopActions.js +219 -0
  204. package/dist/pages/orders/_components/index.js +25 -0
  205. package/dist/pages/orders/index.js +2 -0
  206. package/dist/pages/payment-methods/Detail.js +67 -0
  207. package/dist/pages/payment-methods/List.js +41 -0
  208. package/dist/pages/payment-methods/_components/OptionsCard.js +60 -0
  209. package/dist/pages/payment-methods/_components/PaymentMethodDetailView.js +53 -0
  210. package/dist/pages/payment-methods/index.js +2 -0
  211. package/dist/pages/product-variants/Detail.js +4 -0
  212. package/dist/pages/product-variants/List.js +76 -0
  213. package/dist/pages/product-variants/index.js +2 -0
  214. package/dist/pages/products/Detail.js +75 -0
  215. package/dist/pages/products/List.js +79 -0
  216. package/dist/pages/products/_components/AddOptionGroupDialog.js +65 -0
  217. package/dist/pages/products/_components/AssetsCard.js +35 -0
  218. package/dist/pages/products/_components/BasicFieldsCard.js +6 -0
  219. package/dist/pages/products/_components/ChannelsCard.js +6 -0
  220. package/dist/pages/products/_components/CollectionsCard.js +6 -0
  221. package/dist/pages/products/_components/Container.js +4 -0
  222. package/dist/pages/products/_components/DiscountRatingCard.js +6 -0
  223. package/dist/pages/products/_components/FacetValuesCard.js +6 -0
  224. package/dist/pages/products/_components/ImagesCard.js +6 -0
  225. package/dist/pages/products/_components/OptionGroup.js +93 -0
  226. package/dist/pages/products/_components/OptionValueCard.js +59 -0
  227. package/dist/pages/products/_components/OptionsCard.js +38 -0
  228. package/dist/pages/products/_components/OptionsTab.js +40 -0
  229. package/dist/pages/products/_components/PriceCard.js +27 -0
  230. package/dist/pages/products/_components/ProductDetailSidebar.js +30 -0
  231. package/dist/pages/products/_components/ProductDetailView.js +54 -0
  232. package/dist/pages/products/_components/SettingsCard.js +6 -0
  233. package/dist/pages/products/_components/StockCard.js +40 -0
  234. package/dist/pages/products/_components/Variant.js +149 -0
  235. package/dist/pages/products/_components/VariantsTab.js +46 -0
  236. package/dist/pages/products/index.js +2 -0
  237. package/dist/pages/promotions/Detail.js +80 -0
  238. package/dist/pages/promotions/List.js +38 -0
  239. package/dist/pages/promotions/_components/ActionsCard.js +67 -0
  240. package/dist/pages/promotions/_components/BasicFieldsCard.js +6 -0
  241. package/dist/pages/promotions/_components/ConditionsCard.js +70 -0
  242. package/dist/pages/promotions/_components/CustomerGroupsSelector.js +25 -0
  243. package/dist/pages/promotions/_components/EnabledCard.js +6 -0
  244. package/dist/pages/promotions/_components/OptionsCard.js +6 -0
  245. package/dist/pages/promotions/_components/PromotionDetailSidebar.js +15 -0
  246. package/dist/pages/promotions/_components/PromotionDetailView.js +66 -0
  247. package/dist/pages/promotions/_components/PromotionFieldRender.js +4 -0
  248. package/dist/pages/promotions/index.js +2 -0
  249. package/dist/pages/roles/Detail.js +72 -0
  250. package/dist/pages/roles/List.js +70 -0
  251. package/dist/pages/roles/_components/PermissionsCard.js +7 -0
  252. package/dist/pages/roles/_components/PermissionsTable.js +42 -0
  253. package/dist/pages/roles/_components/RoleDetailView.js +49 -0
  254. package/dist/pages/roles/index.js +2 -0
  255. package/dist/pages/sellers/Detail.js +48 -0
  256. package/dist/pages/sellers/List.js +37 -0
  257. package/dist/pages/sellers/_components/SellerDetailView.js +20 -0
  258. package/dist/pages/sellers/index.js +2 -0
  259. package/dist/pages/shipping-methods/Detail.js +105 -0
  260. package/dist/pages/shipping-methods/List.js +40 -0
  261. package/dist/pages/shipping-methods/_components/CalculatorCard.js +79 -0
  262. package/dist/pages/shipping-methods/_components/CheckerCard.js +76 -0
  263. package/dist/pages/shipping-methods/_components/Lines.js +20 -0
  264. package/dist/pages/shipping-methods/_components/ShippingMethodDetailView.js +67 -0
  265. package/dist/pages/shipping-methods/_components/TestCard.js +62 -0
  266. package/dist/pages/shipping-methods/index.js +2 -0
  267. package/dist/pages/status/Status.js +6 -0
  268. package/dist/pages/status/_components/FilterToolbar.js +29 -0
  269. package/dist/pages/status/_components/Health.js +21 -0
  270. package/dist/pages/status/_components/JobResultPopover.js +8 -0
  271. package/dist/pages/status/_components/Jobs.js +199 -0
  272. package/dist/pages/status/_components/JsonExplorer.js +44 -0
  273. package/dist/pages/status/_components/JsonPopup.js +8 -0
  274. package/dist/pages/status/index.js +1 -0
  275. package/dist/pages/stock-locations/Detail.js +77 -0
  276. package/dist/pages/stock-locations/List.js +38 -0
  277. package/dist/pages/stock-locations/_components/StockLocationDetailView.js +22 -0
  278. package/dist/pages/stock-locations/index.js +2 -0
  279. package/dist/pages/tax-categories/Detail.js +85 -0
  280. package/dist/pages/tax-categories/List.js +46 -0
  281. package/dist/pages/tax-categories/_components/TaxCategoryDetailView.js +24 -0
  282. package/dist/pages/tax-categories/index.js +2 -0
  283. package/dist/pages/tax-rates/Detail.js +62 -0
  284. package/dist/pages/tax-rates/List.js +64 -0
  285. package/dist/pages/tax-rates/_components/TaxRateDetailView.js +64 -0
  286. package/dist/pages/tax-rates/index.js +2 -0
  287. package/dist/pages/zones/Detail.js +86 -0
  288. package/dist/pages/zones/List.js +52 -0
  289. package/dist/pages/zones/_components/ZoneDetailView.js +49 -0
  290. package/dist/pages/zones/index.js +2 -0
  291. package/dist/version.js +1 -0
  292. package/package.json +122 -0
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Label, Textarea, cn, Badge, useTranslation, } from '@deenruv/react-ui-devkit';
4
+ import { Checkbox } from '@radix-ui/react-checkbox';
5
+ import { useState } from 'react';
6
+ import { Pencil, MessageCircle, ShieldCheck, Save } from 'lucide-react';
7
+ export const EditEntryDialog = ({ isOpen, setIsOpen, selectedNote, onConfirm, setSelectedNote, }) => {
8
+ const { t } = useTranslation('common');
9
+ const [isUpdating, setIsUpdating] = useState(false);
10
+ const handleUpdate = async () => {
11
+ if (!selectedNote || selectedNote?.data.note === '')
12
+ return;
13
+ setIsUpdating(true);
14
+ try {
15
+ await onConfirm({
16
+ noteId: selectedNote.id,
17
+ isPublic: selectedNote.isPublic,
18
+ note: selectedNote.data.note,
19
+ });
20
+ setIsOpen(false);
21
+ }
22
+ finally {
23
+ setIsUpdating(false);
24
+ }
25
+ };
26
+ return (_jsx(AlertDialog, { open: isOpen, onOpenChange: setIsOpen, children: _jsxs(AlertDialogContent, { className: "min-w-min", children: [_jsx(AlertDialogHeader, { children: _jsxs(AlertDialogTitle, { className: "flex items-center gap-2", children: [_jsx(Pencil, { className: "size-5 text-blue-500" }), t('history.editNoteHeader', 'Edit Note')] }) }), _jsx("div", { className: "my-4", children: _jsx(Textarea, { onChange: (e) => setSelectedNote((p) => (p ? { ...p, data: { ...p?.data, note: e.currentTarget.value } } : undefined)), value: selectedNote?.data.note || '', className: "h-[200px] w-full min-w-[400px] resize-none overflow-auto rounded-md p-3", placeholder: t('history.notePlaceholder', 'Enter your note here...') }) }), _jsxs("div", { className: "mb-4 flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Checkbox, { id: "isPublicEdit", name: "isPublicEdit", checked: !selectedNote?.isPublic, onClick: () => setSelectedNote((p) => (p ? { ...p, isPublic: !p.isPublic } : undefined)) }), _jsxs(Label, { htmlFor: "isPublicEdit", className: "flex cursor-pointer items-center gap-1 text-sm", children: [_jsx(ShieldCheck, { className: cn('h-4 w-4', !selectedNote?.isPublic ? 'text-emerald-500' : 'text-muted-foreground') }), t('history.isPrivate', 'Private note'), _jsx("span", { className: "text-muted-foreground ml-1 text-xs", children: t('history.isPrivateDescription', '(visible only to admins)') })] })] }), _jsx(Badge, { variant: !selectedNote?.isPublic ? 'outline' : 'secondary', className: cn('gap-1', selectedNote?.isPublic
27
+ ? 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-300'
28
+ : 'border-emerald-200 text-emerald-800 dark:border-emerald-800 dark:text-emerald-300'), children: selectedNote?.isPublic ? (_jsxs(_Fragment, { children: [_jsx(MessageCircle, { className: "size-3" }), t('history.toAdminsAndCustomer', 'Visible to customer')] })) : (_jsxs(_Fragment, { children: [_jsx(ShieldCheck, { className: "size-3" }), t('history.toAdmins', 'Admin only')] })) })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: isUpdating, children: t('history.cancel', 'Cancel') }), _jsx(AlertDialogAction, { onClick: (e) => {
29
+ e.preventDefault();
30
+ handleUpdate();
31
+ }, disabled: selectedNote?.data.note === '' || isUpdating, className: "gap-2", children: isUpdating ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-current border-r-transparent" }), t('history.updating', 'Updating...')] })) : (_jsxs(_Fragment, { children: [_jsx(Save, { className: "size-4" }), t('history.save', 'Save Changes')] })) })] })] }) }));
32
+ };
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from 'react';
4
+ import { AddEntryForm, DeleteEntryDialog, EditEntryDialog, Timeline } from "./";
5
+ import { ClipboardList } from 'lucide-react';
6
+ export const History = ({ data, onNoteAdd, onNoteEdit, onNoteDelete }) => {
7
+ const [newNote, setNewNote] = useState('');
8
+ const [isPrivate, setIsPrivate] = useState(false);
9
+ const [isEditOpen, setIsEditOpen] = useState(false);
10
+ const [isDeleteOpen, setIsDeleteOpen] = useState(false);
11
+ const [selectedNote, setSelectedNote] = useState();
12
+ return (_jsxs("div", { className: "space-y-6", children: [_jsx(AddEntryForm, { isPrivate: isPrivate, newNote: newNote, onConfirm: onNoteAdd, setIsPrivate: setIsPrivate, setNewNote: setNewNote }), data && data.length > 0 ? (_jsx(Timeline, { setIsDeleteOpen: setIsDeleteOpen, setIsEditOpen: setIsEditOpen, setSelectedNote: setSelectedNote, data: data })) : (_jsxs("div", { className: "flex flex-col items-center justify-center gap-3 py-8 text-center", children: [_jsx("div", { className: "rounded-full bg-amber-100 p-3 dark:bg-amber-900/30", children: _jsx(ClipboardList, { className: "size-6 text-amber-500 dark:text-amber-400" }) }), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: "No history entries yet" }), _jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: "Add a note above to start building the order history" })] })] })), _jsx(DeleteEntryDialog, { isOpen: isDeleteOpen, setIsOpen: setIsDeleteOpen, selectedNote: selectedNote, onConfirm: onNoteDelete }), _jsx(EditEntryDialog, { isOpen: isEditOpen, setIsOpen: setIsEditOpen, selectedNote: selectedNote, setSelectedNote: setSelectedNote, onConfirm: onNoteEdit })] }));
13
+ };
@@ -0,0 +1,6 @@
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from '@deenruv/react-ui-devkit';
3
+ export const ModifyHistoryInfo = ({ modificationId }) => {
4
+ const { t } = useTranslation('orders');
5
+ return (_jsxs("div", { className: "text-muted-foreground flex gap-2 text-sm", children: [t('modifyInfo'), ": ", modificationId] }));
6
+ };
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Timeline as TimelineWrapper, TimelineContent, TimelineDot, TimelineHeading, TimelineItem, TimelineLine, OrderStateBadge, cn, Badge, useTranslation, useOrder, } from '@deenruv/react-ui-devkit';
4
+ import { format } from 'date-fns';
5
+ import { HistoryEntryType } from '@deenruv/admin-types';
6
+ import { EllipsisVerticalIcon, Pencil, Trash, MessageCircle, ShieldAlert, ShieldCheck, Clock, ArrowRightLeft, CreditCard, Package, User, } from 'lucide-react';
7
+ import { ModifyHistoryInfo } from './ModifyHistoryInfo.js';
8
+ // Helper function to get icon based on history entry type
9
+ const getEntryTypeIcon = (type, isPublic) => {
10
+ switch (type) {
11
+ case HistoryEntryType.ORDER_STATE_TRANSITION:
12
+ return _jsx(ArrowRightLeft, { className: "size-4 text-blue-500" });
13
+ case HistoryEntryType.ORDER_PAYMENT_TRANSITION:
14
+ return _jsx(CreditCard, { className: "size-4 text-purple-500" });
15
+ case HistoryEntryType.ORDER_FULFILLMENT:
16
+ return _jsx(Package, { className: "size-4 text-green-500" });
17
+ case HistoryEntryType.ORDER_NOTE:
18
+ return isPublic ? (_jsx(MessageCircle, { className: "size-4 text-amber-500" })) : (_jsx(ShieldAlert, { className: "size-4 text-emerald-500" }));
19
+ case HistoryEntryType.CUSTOMER_NOTE:
20
+ return _jsx(User, { className: "size-4 text-indigo-500" });
21
+ default:
22
+ return _jsx(Clock, { className: "size-4 text-gray-500" });
23
+ }
24
+ };
25
+ export const Timeline = ({ data, setIsEditOpen, setIsDeleteOpen, setSelectedNote, }) => {
26
+ const { t } = useTranslation('common');
27
+ const { order } = useOrder();
28
+ return (_jsxs("div", { className: "bg-card rounded-md border p-4", children: [_jsx("h3", { className: "mb-4 font-medium", children: t('history.timeline') }), _jsx(TimelineWrapper, { positions: "left", className: "w-full", children: data?.map((history) => {
29
+ const entryIcon = getEntryTypeIcon(history.type, history.isPublic);
30
+ const isNote = history.type === HistoryEntryType.ORDER_NOTE || history.type === HistoryEntryType.CUSTOMER_NOTE;
31
+ const modificationNote = history.type === HistoryEntryType.ORDER_MODIFIED
32
+ ? order?.modifications.find((m) => m.id === history.data.modificationId)?.note
33
+ : '';
34
+ return (_jsxs(TimelineItem, { status: "done", className: "w-full pb-6", children: [_jsx(TimelineHeading, { side: "right", className: "w-full", children: _jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsx("div", { className: "flex items-center gap-2", children: history.administrator ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "bg-muted flex size-8 items-center justify-center rounded-full", children: _jsxs("span", { className: "text-xs font-medium", children: [history.administrator.firstName?.[0], history.administrator.lastName?.[0]] }) }), _jsxs("div", { children: [_jsxs("div", { className: "font-medium", children: [history.administrator?.firstName, " ", history.administrator?.lastName] }), _jsxs("div", { className: "text-muted-foreground text-xs", children: [format(new Date(history.createdAt), 'MMM d, yyyy • h:mm a'), Math.floor(new Date(history.createdAt).getTime() / 1000) !==
35
+ Math.floor(new Date(history.updatedAt).getTime() / 1000) && (_jsx("span", { className: "ml-1 italic", children: t('history.edited') }))] })] })] })) : (_jsx("div", { className: "text-muted-foreground text-sm", children: format(new Date(history.createdAt), 'MMM d, yyyy • h:mm a') })) }), _jsxs("div", { className: "flex items-center gap-2", children: [isNote && (_jsx(Badge, { variant: history.isPublic ? 'secondary' : 'outline', className: cn('gap-1', history.isPublic
36
+ ? 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-300'
37
+ : 'border-emerald-200 text-emerald-800 dark:border-emerald-800 dark:text-emerald-300'), children: history.isPublic ? (_jsxs(_Fragment, { children: [_jsx(MessageCircle, { className: "size-3" }), t('history.public', 'Public')] })) : (_jsxs(_Fragment, { children: [_jsx(ShieldCheck, { className: "size-3" }), t('history.private', 'Private')] })) })), isNote ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "size-8", children: _jsx(EllipsisVerticalIcon, { className: "size-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => {
38
+ setIsEditOpen(true);
39
+ setSelectedNote(history);
40
+ }, className: "flex cursor-pointer items-center gap-2", children: [_jsx(Pencil, { className: "size-4" }), " ", t('history.edit', 'Edit')] }), _jsxs(DropdownMenuItem, { onClick: () => {
41
+ setIsDeleteOpen(true);
42
+ setSelectedNote(history);
43
+ }, className: "flex cursor-pointer items-center gap-2 text-red-600", children: [_jsx(Trash, { className: "size-4" }), " ", t('history.delete', 'Delete')] })] })] })) : 'modificationId' in history.data ? (_jsx(ModifyHistoryInfo, { modificationId: history.data.modificationId })) : ('from' in history.data &&
44
+ 'to' in history.data && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(OrderStateBadge, { state: history.data.from }), _jsx(ArrowRightLeft, { className: "text-muted-foreground size-4" }), _jsx(OrderStateBadge, { state: history.data.to })] })))] })] }) }), _jsx(TimelineDot, { status: "done", className: "bg-primary" }), _jsx(TimelineLine, { done: true, className: "bg-muted" }), _jsx(TimelineContent, { className: "relative mt-2", children: _jsxs("div", { className: "bg-muted/30 rounded-md border p-3", children: [_jsxs("div", { className: "mb-1 flex items-center gap-2", children: [entryIcon, _jsx("span", { className: "font-medium", children: t(`history.entryType.${history.type}`, history.type.replace(/_/g, ' ')) })] }), isNote && history.data?.note && (_jsx("div", { className: "bg-background mt-2 whitespace-pre-wrap rounded-md p-3 text-sm", children: history.data.note })), 'paymentId' in history.data && (_jsxs("div", { className: "mt-2 flex items-center gap-2 text-sm", children: [_jsx(CreditCard, { className: "size-4 text-purple-500" }), _jsx("span", { className: "font-medium", children: "Payment ID:" }), _jsx("code", { className: "bg-muted rounded px-1 py-0.5 font-mono text-xs", children: history.data.paymentId })] })), 'fulfillmentId' in history.data && (_jsxs("div", { className: "mt-2 flex items-center gap-2 text-sm", children: [_jsx(Package, { className: "size-4 text-green-500" }), _jsx("span", { className: "font-medium", children: "Fulfillment ID:" }), _jsx("code", { className: "bg-muted rounded px-1 py-0.5 font-mono text-xs", children: history.data.fulfillmentId })] })), 'modificationId' in history.data && (_jsx("div", { className: "bg-background mt-2 whitespace-pre-wrap rounded-md p-3 text-sm", children: modificationNote })), 'reason' in history.data && (_jsxs("div", { children: [_jsx("div", { className: "bg-background mt-2 whitespace-pre-wrap rounded-md p-3 text-sm", children: history.data.reason }), 'lines' in history.data && (_jsx("ul", { className: "mt-2 list-disc pl-5", children: history.data.lines
45
+ .map((l) => {
46
+ const line = order?.lines.find((line) => line.id === l.orderLineId);
47
+ if (!line)
48
+ return null;
49
+ return { line, newQuantity: l.quantity };
50
+ })
51
+ .map(({ line, newQuantity }) => (_jsxs("li", { className: "list-item list-disc flex-col pl-3", children: [_jsx("p", { className: "text-sm", children: line.productVariant.name }, line.id), _jsxs("p", { className: "flex gap-4", children: [_jsxs("span", { children: [t('history.quantityOld'), ": ", line.quantity] }), _jsxs("span", { children: [t('history.quantityNew'), ": ", newQuantity] })] })] }))) }))] }))] }) })] }, history.id));
52
+ }) })] }));
53
+ };
@@ -0,0 +1,5 @@
1
+ export * from './History';
2
+ export * from './DeleteEntryDialog';
3
+ export * from './EditEntryDialog';
4
+ export * from './Timeline';
5
+ export * from './AddEntryForm';
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation, Button, Label, Popover, PopoverContent, PopoverTrigger, useServer, } from '@deenruv/react-ui-devkit';
3
+ import { motion } from 'framer-motion';
4
+ import { NavLink } from 'react-router-dom';
5
+ export const ActiveAdmins = () => {
6
+ const { t } = useTranslation('common');
7
+ const activeClients = useServer((p) => p.activeClients);
8
+ const formatTimeAgo = (_date) => {
9
+ if (!_date)
10
+ return t('awesomeMenu.unknown');
11
+ const date = new Date(_date);
12
+ const now = new Date();
13
+ const diffInMinutes = Math.round((now.getTime() - date.getTime()) / 60000);
14
+ if (diffInMinutes === 0)
15
+ return t('awesomeMenu.justNow');
16
+ else if (diffInMinutes === 1)
17
+ return t('awesomeMenu.oneMinAgo');
18
+ else if (diffInMinutes > 1 && diffInMinutes < 5)
19
+ return t('awesomeMenu.valueMinAgo', { diffInMinutes });
20
+ else
21
+ return t('awesomeMenu.above5MinAgo');
22
+ };
23
+ return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "sm", className: "h-10", children: t('awesomeMenu.activeAdministratorsValue', { value: activeClients.length }) }) }), _jsx(PopoverContent, { className: "mr-4", children: _jsxs("div", { className: "flex flex-col gap-4 rounded-md", children: [_jsx(Label, { className: "select-none", children: t('awesomeMenu.activeAdministrators') }), activeClients.length ? (activeClients.map((client) => (_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-sm font-bold", children: [client.firstName, " ", client.lastName, " ", client.me && '(me)'] }), _jsx(motion.div, { animate: { scale: [1, 1.2, 1] }, transition: { duration: 1.5, repeat: Infinity }, className: "size-2 rounded-full bg-green-500" })] }), _jsx("span", { className: "text-muted-foreground text-sm", children: formatTimeAgo(client.lastActive) }), !client.me && (_jsx(NavLink, { to: client.location, className: "text-muted-foreground text-sm", viewTransition: true, children: client.location.replace(window.location.origin, '') }))] }) }, client.id)))) : (_jsx("div", { children: _jsx("span", { className: "text-muted-foreground text-sm", children: t('awesomeMenu.noActiveAdministrators') }) }))] }) })] }));
24
+ };
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, useServer, useSettings, DEFAULT_CHANNEL_CODE, cn, useTranslation, } from '@deenruv/react-ui-devkit';
3
+ import { useCallback } from 'react';
4
+ export function ChannelSwitcher({ className }) {
5
+ const channels = useServer((p) => p.channels);
6
+ const setSelectedChannel = useSettings((p) => p.setSelectedChannel);
7
+ const selectedChannel = useSettings((p) => p.selectedChannel);
8
+ const { t } = useTranslation('common');
9
+ const onChannelChange = (id) => {
10
+ const channel = channels.find((channel) => channel.id === id);
11
+ if (!channel)
12
+ return;
13
+ setSelectedChannel(channel);
14
+ };
15
+ const getChannelLabel = useCallback((code) => (code === DEFAULT_CHANNEL_CODE ? t('defaultChannel') : code), [t]);
16
+ if (!channels || channels.length === 0) {
17
+ return null;
18
+ }
19
+ return (_jsx("div", { className: className, children: _jsxs(Select, { defaultValue: selectedChannel?.id, onValueChange: onChannelChange, value: selectedChannel?.id, children: [_jsx(SelectTrigger, { className: cn('flex items-center gap-2 [&>span]:line-clamp-1 [&>span]:flex [&>span]:w-full [&>span]:items-center [&>span]:gap-1 [&>span]:truncate [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0'), "aria-label": "Select an channel", children: _jsx(SelectValue, { children: _jsx("span", { className: "ml-2", children: getChannelLabel(channels.find((account) => account.id === selectedChannel?.id)?.code) }) }) }), _jsx(SelectContent, { children: channels.map((channel) => (_jsx(SelectItem, { value: channel.id, children: _jsx("div", { className: "[&_svg]:text-foreground flex items-center gap-3 [&_svg]:size-4 [&_svg]:shrink-0", children: getChannelLabel(channel.code) }) }, channel.code))) })] }) }));
20
+ }
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LanguageCode } from '@deenruv/admin-types';
3
+ import { Badge, Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, getLanguageName, useSettings, useTranslation, } from '@deenruv/react-ui-devkit';
4
+ import { Check } from 'lucide-react';
5
+ import { US, PL, CZ, DE, EU } from 'country-flag-icons/react/3x2';
6
+ const uiLanguages = [LanguageCode.en, LanguageCode.pl];
7
+ const langFlagDict = {
8
+ [LanguageCode.en]: US,
9
+ [LanguageCode.pl]: PL,
10
+ [LanguageCode.cs]: CZ,
11
+ [LanguageCode.de]: DE,
12
+ [LanguageCode.af]: EU,
13
+ };
14
+ export const LanguagesDropdown = () => {
15
+ const { t } = useTranslation('common');
16
+ const { contentLng, setContentLng, setUiLng, uiLng, selectedChannel } = useSettings((p) => ({
17
+ uiLng: p.language,
18
+ setUiLng: p.setLanguage,
19
+ contentLng: p.translationsLanguage,
20
+ setContentLng: p.setTranslationsLanguage,
21
+ selectedChannel: p.selectedChannel,
22
+ }));
23
+ const Flag = langFlagDict[contentLng] || EU;
24
+ const contentLanguages = selectedChannel?.availableLanguageCodes || [];
25
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", className: "h-9", children: [t('language'), _jsx(Badge, { variant: "outline", className: "ml-2", children: _jsx(Flag, { className: "size-4" }) })] }) }), _jsxs(DropdownMenuContent, { align: "end", className: "z-[150]", children: [_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: _jsx("span", { children: t('content') }) }), _jsx(DropdownMenuPortal, { children: _jsx(DropdownMenuSubContent, { className: "z-[150]", children: contentLanguages.map((lng) => (_jsxs(DropdownMenuItem, { onClick: () => lng !== contentLng && setContentLng(lng), children: [_jsx("span", { children: getLanguageName(lng, uiLng) }), lng === contentLng && _jsx(Check, { className: "ml-auto size-4" })] }, lng))) }) })] }), _jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: _jsx("span", { children: "UI" }) }), _jsx(DropdownMenuPortal, { children: _jsx(DropdownMenuSubContent, { className: "z-[150]", children: uiLanguages.map((lng) => (_jsxs(DropdownMenuItem, { onClick: () => lng !== uiLng && setUiLng(lng), children: [_jsx("span", { children: getLanguageName(lng) }), lng === uiLng && _jsx(Check, { className: "ml-auto size-4" })] }, lng))) }) })] })] })] }));
26
+ };
@@ -0,0 +1,270 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { NavLink, useLocation } from 'react-router-dom';
3
+ import React, { useMemo } from 'react';
4
+ import { cn, buttonVariants, Routes, usePluginStore, Tooltip, TooltipContent, TooltipTrigger, useServer, Accordion, AccordionItem, AccordionTrigger, AccordionContent, useNotifications, useTranslation, capitalizeFirstLetter, } from '@deenruv/react-ui-devkit';
5
+ import { BarChart, Barcode, Store, ShoppingCart, Images, Folder, Globe2, Tag, UserCog, Users, UserRoundSearch, MapPin, Flag, Coins, Globe, Percent, CreditCard, Truck, Cog, UsersRound, Server, ScanBarcode, } from 'lucide-react';
6
+ import { Permission } from '@deenruv/admin-types';
7
+ export function Navigation({ isCollapsed }) {
8
+ const { t } = useTranslation('common');
9
+ const { t: _pluginT } = useTranslation();
10
+ const location = useLocation();
11
+ const { navMenuData, viewMarkers } = usePluginStore();
12
+ const userPermissions = useServer((p) => p.userPermissions);
13
+ const loaded = useServer((p) => p.loaded);
14
+ const getNavigationNotification = useNotifications(({ getNavigationNotification }) => getNavigationNotification);
15
+ const pluginT = (trans) => {
16
+ const split = trans.split('.');
17
+ const key = split.slice(1).join('.') || '';
18
+ const ns = split[0] || '';
19
+ return _pluginT(key, { ns });
20
+ };
21
+ const navigationGroups = useMemo(() => {
22
+ const navData = [
23
+ {
24
+ label: t('menuGroups.shop'),
25
+ id: 'shop-group',
26
+ links: [
27
+ { title: t('menu.dashboard'), href: Routes.dashboard, id: 'link-dashboard', icon: BarChart },
28
+ {
29
+ title: t('menu.orders'),
30
+ href: Routes.orders.list,
31
+ id: 'link-orders',
32
+ icon: ShoppingCart,
33
+ requiredPermissions: [Permission.ReadOrder],
34
+ },
35
+ {
36
+ title: t('menu.customers'),
37
+ href: Routes.customers.list,
38
+ id: 'link-customers',
39
+ icon: UserRoundSearch,
40
+ requiredPermissions: [Permission.ReadCustomer],
41
+ },
42
+ {
43
+ title: t('menu.customerGroups'),
44
+ href: Routes.customerGroups.list,
45
+ id: 'link-customerGroups',
46
+ icon: UsersRound,
47
+ requiredPermissions: [Permission.ReadCustomerGroup],
48
+ },
49
+ ],
50
+ },
51
+ {
52
+ label: t('menuGroups.assortment'),
53
+ id: 'assortment-group',
54
+ links: [
55
+ {
56
+ title: t('menu.products'),
57
+ href: Routes.products.list,
58
+ id: 'link-products',
59
+ icon: Barcode,
60
+ requiredPermissions: [Permission.ReadProduct, Permission.ReadCatalog],
61
+ },
62
+ {
63
+ title: t('menu.productVariants'),
64
+ href: Routes.productVariants.list,
65
+ id: 'link-product-variants',
66
+ icon: ScanBarcode,
67
+ requiredPermissions: [Permission.ReadProduct, Permission.ReadCatalog],
68
+ },
69
+ {
70
+ title: t('menu.collections'),
71
+ href: Routes.collections.list,
72
+ id: 'link-collections',
73
+ icon: Folder,
74
+ requiredPermissions: [Permission.ReadCollection, Permission.ReadCatalog],
75
+ },
76
+ {
77
+ title: t('menu.facets'),
78
+ href: Routes.facets.list,
79
+ id: 'link-facets',
80
+ icon: Tag,
81
+ requiredPermissions: [Permission.ReadFacet, Permission.ReadCatalog],
82
+ },
83
+ {
84
+ title: t('menu.assets'),
85
+ href: Routes.assets.list,
86
+ id: 'link-assets',
87
+ icon: Images,
88
+ requiredPermissions: [Permission.ReadAsset, Permission.ReadCatalog],
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ label: t('menuGroups.users'),
94
+ id: 'users-group',
95
+ links: [
96
+ {
97
+ title: t('menu.admins'),
98
+ href: Routes.admins.list,
99
+ id: 'link-admins',
100
+ icon: UserCog,
101
+ requiredPermissions: [Permission.ReadAdministrator],
102
+ },
103
+ {
104
+ title: t('menu.roles'),
105
+ href: Routes.roles.list,
106
+ id: 'link-roles',
107
+ icon: Users,
108
+ requiredPermissions: [Permission.ReadAdministrator],
109
+ },
110
+ {
111
+ title: t('menu.sellers'),
112
+ href: Routes.sellers.list,
113
+ id: 'link-sellers',
114
+ icon: Store,
115
+ requiredPermissions: [Permission.ReadSeller],
116
+ },
117
+ ],
118
+ },
119
+ {
120
+ label: t('menuGroups.promotions'),
121
+ id: 'promotions-group',
122
+ links: [
123
+ {
124
+ title: t('menu.promotions'),
125
+ href: Routes.promotions.list,
126
+ id: 'link-promotions',
127
+ icon: ShoppingCart,
128
+ requiredPermissions: [Permission.ReadPromotion],
129
+ },
130
+ ],
131
+ },
132
+ {
133
+ label: t('menuGroups.shipping'),
134
+ id: 'shipping-group',
135
+ links: [
136
+ {
137
+ title: t('menu.paymentMethods'),
138
+ href: Routes.paymentMethods.list,
139
+ id: 'link-payment-methods',
140
+ icon: CreditCard,
141
+ requiredPermissions: [Permission.ReadPaymentMethod],
142
+ },
143
+ {
144
+ title: t('menu.shippingMethods'),
145
+ href: Routes.shippingMethods.list,
146
+ id: 'link-shipping-methods',
147
+ icon: Truck,
148
+ requiredPermissions: [Permission.ReadShippingMethod],
149
+ },
150
+ {
151
+ title: t('menu.stock'),
152
+ href: Routes.stockLocations.list,
153
+ id: 'link-stock',
154
+ icon: MapPin,
155
+ requiredPermissions: [Permission.ReadStockLocation],
156
+ },
157
+ ],
158
+ },
159
+ {
160
+ label: t('menuGroups.settings'),
161
+ id: 'settings-group',
162
+ links: [
163
+ {
164
+ title: t('menu.channels'),
165
+ href: Routes.channels.list,
166
+ id: 'link-channels',
167
+ icon: Globe2,
168
+ requiredPermissions: [Permission.ReadChannel],
169
+ },
170
+ {
171
+ title: t('menu.zones'),
172
+ href: Routes.zones.list,
173
+ id: 'link-zones',
174
+ icon: Globe,
175
+ requiredPermissions: [Permission.ReadZone],
176
+ },
177
+ {
178
+ title: t('menu.countries'),
179
+ href: Routes.countries.list,
180
+ id: 'link-countries',
181
+ icon: Flag,
182
+ requiredPermissions: [Permission.ReadCountry],
183
+ },
184
+ {
185
+ title: t('menu.taxCategories'),
186
+ href: Routes.taxCategories.list,
187
+ id: 'link-tax-categories',
188
+ icon: Coins,
189
+ requiredPermissions: [Permission.ReadTaxCategory],
190
+ },
191
+ {
192
+ title: t('menu.taxRates'),
193
+ href: Routes.taxRates.list,
194
+ id: 'link-tax-rates',
195
+ icon: Percent,
196
+ requiredPermissions: [Permission.ReadTaxRate],
197
+ },
198
+ {
199
+ title: t('menu.globalSettings'),
200
+ href: Routes.globalSettings,
201
+ id: 'link-global-settings',
202
+ icon: Cog,
203
+ requiredPermissions: [Permission.ReadSettings],
204
+ },
205
+ {
206
+ title: t('menu.systemStatus'),
207
+ href: Routes.status,
208
+ id: 'link-system-status',
209
+ icon: Server,
210
+ requiredPermissions: [Permission.ReadSystem],
211
+ },
212
+ ],
213
+ },
214
+ ];
215
+ const { groups, links } = navMenuData;
216
+ groups.forEach(({ id, labelId, placement }) => {
217
+ let foundGroupIdx = -1;
218
+ const newGroup = { id, label: pluginT(labelId), links: [] };
219
+ if (placement?.groupId) {
220
+ foundGroupIdx = navData.findIndex((group) => group.id === placement.groupId);
221
+ }
222
+ if (foundGroupIdx == -1) {
223
+ navData.push(newGroup);
224
+ }
225
+ else {
226
+ navData.splice(foundGroupIdx + 1, 0, newGroup);
227
+ }
228
+ });
229
+ links.forEach(({ groupId, href, labelId, id, icon, placement }) => {
230
+ const foundGroupIdx = navData.findIndex((group) => group.id === groupId);
231
+ if (foundGroupIdx == -1)
232
+ throw new Error(`Navbar menu group with id ${groupId} was not found.\nPlugin navigation href: ${href}`);
233
+ const newElement = { title: pluginT(labelId), label: pluginT(labelId), href: `/${href}`, id, icon };
234
+ if (!placement) {
235
+ navData[foundGroupIdx].links.push(newElement);
236
+ return;
237
+ }
238
+ const foundIndex = navData[foundGroupIdx].links.findIndex((item) => item.id === placement.linkId);
239
+ const offset = placement.where === 'above' ? 0 : 1;
240
+ navData[foundGroupIdx].links.splice(foundIndex + offset, 0, newElement);
241
+ });
242
+ return navData;
243
+ }, [navMenuData.groups, navMenuData.links, t]);
244
+ const permittedNavigationGroups = useMemo(() => {
245
+ return navigationGroups
246
+ .map((group) => ({
247
+ ...group,
248
+ links: group.links.filter((link) => 'requiredPermissions' in link
249
+ ? link.requiredPermissions?.some((permission) => userPermissions.includes(permission))
250
+ : true),
251
+ }))
252
+ .filter((group) => group.links.length > 0);
253
+ }, [userPermissions, navigationGroups]);
254
+ // const defaultAccordionOpenValue = useMemo(
255
+ // () =>
256
+ // permittedNavigationGroups
257
+ // .filter((g) => !navMenuData.groups.find((pluginGroup) => pluginGroup.id === g.id))
258
+ // .map((g) => g.id),
259
+ // [permittedNavigationGroups, navMenuData],
260
+ // );
261
+ const defaultAccordionOpenValue = ['shop-group', 'assortment-group'];
262
+ if (!loaded)
263
+ return null;
264
+ return (_jsx("div", { className: "relative overflow-y-auto", children: _jsx("div", { "data-collapsed": isCollapsed, className: "group flex h-[calc(100%-70px)] flex-col gap-4 pb-2 data-[collapsed=true]:py-2 lg:h-[calc(100%-80px)]", children: _jsx(Accordion, { type: "multiple", className: "w-full", defaultValue: defaultAccordionOpenValue, value: isCollapsed ? permittedNavigationGroups.map((g) => g.id) : undefined, children: permittedNavigationGroups.map((group) => (_jsx(AccordionItem, { value: group.id, children: _jsxs(React.Fragment, { children: [!isCollapsed && (_jsx(AccordionTrigger, { className: cn('flex items-center justify-between pr-3 hover:no-underline'), children: _jsxs("div", { className: "flex items-center gap-2 px-6", children: [_jsx("h4", { className: "text-xs font-bold uppercase hover:underline", children: group.label }), getNavigationNotification(group.id), viewMarkers ? (_jsx("p", { className: "text-muted-foreground dark:text-muted-foreground text-xs font-semibold lowercase", children: group.id })) : null] }) })), _jsx(AccordionContent, { className: cn(isCollapsed ? 'py-2' : 'pb-4'), children: _jsx("nav", { id: group.id, className: "text-muted-foreground grid gap-1 px-2 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2", children: group.links.map((link, index) => {
265
+ const notifications = getNavigationNotification(link.id);
266
+ return (_jsx(React.Fragment, { children: isCollapsed ? (_jsxs(Tooltip, { delayDuration: 0, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("div", { children: _jsx(NavLink, { to: link.href, viewTransition: true, children: _jsxs("div", { className: cn(buttonVariants({ variant: 'navigation-link', size: 'icon' }), 'h-9 w-9', location.pathname === link.href &&
267
+ 'bg-muted hover:bg-muted hover:text-muted-foreground dark:bg-muted dark:hover:bg-muted opacity-100'), children: [_jsx(link.icon, { className: "size-6" }), _jsx("span", { className: "sr-only", children: link.title })] }) }) }) }), _jsxs(TooltipContent, { side: "right", className: "relative flex items-center gap-4", children: [viewMarkers ? (_jsx("div", { className: "text-muted-foreground dark:text-muted-foreground text-xs font-semibold lowercase", children: link.id })) : null, capitalizeFirstLetter(link.title), notifications] })] }, index)) : (_jsx(NavLink, { to: link.href, viewTransition: true, children: _jsxs("div", { id: link.id, className: cn('relative flex items-center justify-start rounded-md px-4 py-2 capitalize', location.pathname === link.href &&
268
+ 'bg-muted hover:bg-muted hover:text-muted-foreground dark:bg-muted dark:hover:bg-muted font-semibold opacity-100'), children: [viewMarkers ? (_jsx("div", { className: "text-muted-foreground dark:text-muted-foreground absolute right-2 top-1/2 -translate-y-1/2 text-xs font-semibold lowercase", children: link.id })) : null, _jsx(link.icon, { className: "mr-2 size-4" }), capitalizeFirstLetter(link.title), notifications] }) })) }, link.id));
269
+ }) }) })] }, group.id) }))) }) }) }));
270
+ }
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Permission } from '@deenruv/admin-types';
3
+ import { capitalizeFirstLetter, cn, Routes, Separator, useServer, useTranslation } from '@deenruv/react-ui-devkit';
4
+ import { Puzzle } from 'lucide-react';
5
+ import { NavLink } from 'react-router-dom';
6
+ export const NavigationFooter = ({ isCollapsed }) => {
7
+ const { t } = useTranslation('common');
8
+ const userPermissions = useServer((p) => p.userPermissions);
9
+ const isPermittedToExtensions = userPermissions.includes(Permission.ReadSettings);
10
+ return (_jsxs("div", { className: "bg-secondary flex w-full select-none flex-col gap-2 py-2 text-xs shadow-2xl", children: [isPermittedToExtensions && !isCollapsed && (_jsxs(_Fragment, { children: [_jsx("div", { children: _jsx(NavLink, { to: Routes.extensions, viewTransition: true, children: _jsxs("div", { className: cn('relative flex items-center justify-center rounded-md px-4 capitalize', location.pathname === Routes.extensions &&
11
+ 'bg-muted hover:bg-muted hover:text-muted-foreground dark:bg-muted dark:hover:bg-muted font-semibold opacity-100'), children: [_jsx(Puzzle, { className: "mr-2 size-4" }), capitalizeFirstLetter(t('menu.extensions'))] }) }) }), _jsx(Separator, {})] })), _jsxs("div", { className: "flex items-center justify-center gap-1", children: [!isCollapsed && _jsx("p", { className: "uppercase", children: "Deenruv" }), _jsxs("span", { children: [!isCollapsed ? 'ver. ' : 'v. ', window.__DEENRUV_SETTINGS__.appVersion] })] })] }));
12
+ };
@@ -0,0 +1,90 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Bell, Check, Clock, Trash2 } from 'lucide-react';
4
+ import { useEffect, useState, useRef, useMemo } from 'react';
5
+ import { Popover, PopoverTrigger, PopoverContent, Card, CardHeader, CardTitle, CardDescription, CardContent, useServer, Button, CardFooter, useNotifications, Tabs, TabsContent, TabsList, TabsTrigger, cn, formatDate, useTranslation, } from '@deenruv/react-ui-devkit';
6
+ const NOTIFICATIONS_LOCAL_STORAGE_KEY = 'DEENRUV_NOTIFICATIONS';
7
+ export const Notifications = () => {
8
+ const cyclingNotifications = useNotifications(({ notifications }) => notifications);
9
+ const getMainNotification = useNotifications(({ getMainNotification }) => getMainNotification);
10
+ const jobQueues = useServer(({ jobQueues }) => jobQueues);
11
+ const status = useServer(({ status }) => status);
12
+ const { t } = useTranslation('common');
13
+ const [notifications, setNotifications] = useState([]);
14
+ const prevJobQueuesRef = useRef(jobQueues);
15
+ const hasUnread = notifications.some((notification) => !notification.read);
16
+ useEffect(() => {
17
+ const savedNotifications = localStorage.getItem(NOTIFICATIONS_LOCAL_STORAGE_KEY);
18
+ if (savedNotifications) {
19
+ try {
20
+ const parsedNotifications = JSON.parse(savedNotifications).map((notification) => ({
21
+ ...notification,
22
+ icon: notification.running ? (_jsx(Clock, { className: "size-4 text-blue-500" })) : (_jsx(Check, { className: "size-4 text-green-500" })),
23
+ }));
24
+ setNotifications(parsedNotifications);
25
+ }
26
+ catch (error) {
27
+ console.error('Failed to parse notifications from localStorage', error);
28
+ }
29
+ }
30
+ }, []);
31
+ useEffect(() => {
32
+ if (notifications.length > 0) {
33
+ const serializableNotifications = notifications.map(({ icon: _, ...rest }) => rest);
34
+ localStorage.setItem(NOTIFICATIONS_LOCAL_STORAGE_KEY, JSON.stringify(serializableNotifications));
35
+ }
36
+ }, [notifications]);
37
+ const markAllAsRead = () => {
38
+ setNotifications((prev) => prev.map((notification) => ({ ...notification, read: true })));
39
+ };
40
+ const clearAllNotifications = () => {
41
+ setNotifications([]);
42
+ localStorage.removeItem(NOTIFICATIONS_LOCAL_STORAGE_KEY);
43
+ };
44
+ const components = useMemo(() => getMainNotification(notifications.map((notification) => notification.id)), [notifications]);
45
+ useEffect(() => {
46
+ if (jobQueues.length > 0) {
47
+ jobQueues.forEach((queue) => {
48
+ const prevQueue = prevJobQueuesRef.current.find((q) => q.name === queue.name);
49
+ if (queue.running && (!prevQueue || !prevQueue.running)) {
50
+ const newNotification = {
51
+ ...queue,
52
+ id: `${queue.name}-start-${Date.now()}`,
53
+ read: false,
54
+ title: t('notificationsBox.titleStart', { name: queue.name }),
55
+ description: t('notificationsBox.descriptionStart', { name: queue.name }),
56
+ time: formatDate(new Date(), {
57
+ hour: '2-digit',
58
+ minute: '2-digit',
59
+ second: '2-digit',
60
+ hour12: false,
61
+ }),
62
+ icon: _jsx(Clock, { className: "size-4 text-blue-500" }),
63
+ isJobQueue: true,
64
+ };
65
+ setNotifications((prev) => [newNotification, ...prev].slice(0, 10));
66
+ }
67
+ if (prevQueue && prevQueue.running && !queue.running) {
68
+ const newNotification = {
69
+ ...queue,
70
+ id: `${queue.name}-complete-${Date.now()}`,
71
+ read: false,
72
+ title: t('notificationsBox.titleComplete', { name: queue.name }),
73
+ description: t('notificationsBox.descriptionComplete', { name: queue.name }),
74
+ time: formatDate(new Date(), {
75
+ hour: '2-digit',
76
+ minute: '2-digit',
77
+ second: '2-digit',
78
+ hour12: false,
79
+ }),
80
+ icon: _jsx(Check, { className: "size-4 text-green-500" }),
81
+ isJobQueue: true,
82
+ };
83
+ setNotifications((prev) => [newNotification, ...prev].slice(0, 10));
84
+ }
85
+ });
86
+ prevJobQueuesRef.current = [...jobQueues];
87
+ }
88
+ }, [jobQueues, status]);
89
+ return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "icon", className: "relative size-10", children: [_jsx(Bell, { className: "size-4" }), hasUnread && (_jsx("span", { className: "absolute right-1.5 top-1.5 size-2 rounded-full bg-red-500", children: _jsx("span", { className: "absolute inset-0 animate-ping rounded-full bg-red-400 opacity-75" }) })), _jsx("span", { className: "sr-only", children: t('notificationsBox.toggleNotifications') })] }) }), _jsx(PopoverContent, { className: "w-md z-[2138] p-0", align: "end", children: _jsx(Tabs, { defaultValue: "ALL", className: "w-full", children: _jsxs(Card, { className: "w-full border-0 shadow-none", children: [_jsxs(CardHeader, { className: cn('bg-muted/30 flex w-full flex-col items-start justify-start gap-2 p-0', components.length === 0 && 'pb-3'), children: [_jsxs("div", { className: "flex h-full w-full flex-1 items-center justify-between px-4 pt-3", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx(CardTitle, { className: "text-base", children: t('notificationsBox.notifications') }), _jsx(CardDescription, { className: "mt-1 text-xs", children: t('notificationsBox.recentNotifications') })] }), notifications.length > 0 && (_jsxs(Button, { variant: "ghost", size: "sm", className: "h-8 text-xs", onClick: clearAllNotifications, children: [_jsx(Trash2, { className: "mr-1 size-3" }), t('notificationsBox.clearAll')] }))] }), components.length !== 0 && (_jsxs(TabsList, { className: "m-0 w-full rounded-none", children: [_jsx(TabsTrigger, { value: "ALL", className: "w-full rounded-none text-left", children: t('notificationsBox.all') }), cyclingNotifications.map((notification) => (_jsx(TabsTrigger, { value: notification.id, className: "w-full rounded-none text-left", children: notification.id }, notification.id)))] }))] }), _jsxs(CardContent, { className: "max-h-[400px] overflow-auto p-0", children: [_jsx(TabsContent, { value: "ALL", className: "mt-0", children: notifications.length > 0 ? (_jsx("div", { className: "divide-y", children: notifications.map((notification) => (_jsxs("div", { className: `flex items-start gap-3 p-4 transition-colors ${notification.read ? 'bg-background' : 'bg-muted/20'}`, children: [_jsx("div", { className: "mt-0.5", children: notification.icon }), _jsxs("div", { className: "flex-1 space-y-1", children: [_jsx("p", { className: "text-sm font-medium leading-none", children: notification.title }), _jsx("p", { className: "text-muted-foreground text-xs", children: notification.description }), _jsxs("div", { className: "flex items-center pt-1", children: [_jsx(Clock, { className: "text-muted-foreground mr-1 size-3" }), _jsx("span", { className: "text-muted-foreground text-xs", children: notification.time })] })] })] }, notification.id))) })) : (_jsxs("div", { className: "flex flex-col items-center justify-center px-4 py-8 text-center", children: [_jsx("div", { className: "bg-muted mb-3 rounded-full p-3", children: _jsx(Bell, { className: "text-muted-foreground size-6" }) }), _jsx("h3", { className: "text-sm font-medium", children: t('notificationsBox.emptyStateMessage') }), _jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: t('notificationsBox.emptyStateDescription') })] })) }), components.map((notification) => (_jsx(TabsContent, { value: notification.id, children: notification.component }, notification.id)))] }), hasUnread && (_jsx(CardFooter, { className: "flex items-center justify-end p-4", children: _jsxs(Button, { variant: "ghost", size: "sm", className: "h-8 text-xs", onClick: markAllAsRead, children: [_jsx(Check, { className: "mr-1 size-3" }), t('notificationsBox.markAllAsRead')] }) }))] }) }) })] }));
90
+ };