@vendure/dashboard 3.8.2-master-202610270216 → 3.8.2-master-202610280208
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/bundle/chunks/{2SSKDMRQ-BHHzW1a_.js → 2SSKDMRQ-BCzvzALn.js} +2 -2
- package/dist/bundle/chunks/{AP7HFJJL-B5qPACUM.js → AP7HFJJL-rbIMbNgl.js} +1 -1
- package/dist/bundle/chunks/{WDYDFRGG-BfBnFCDT.js → WDYDFRGG-B6y763i5.js} +2 -2
- package/dist/bundle/chunks/{common-operations-DaHPL4es.js → common-operations-Dy3cIPYX.js} +19 -5
- package/dist/bundle/chunks/{locale-cLfB2IZc.js → locale-C3ggsgX8.js} +1 -1
- package/dist/bundle/chunks/{main-MGWdQzqd.js → main-LOPf04m3.js} +3 -3
- package/dist/bundle/lib.js +2 -2
- package/dist/bundle/main.js +2 -2
- package/package.json +3 -3
- package/src/lib/providers/auth.tsx +3 -2
- package/src/lib/providers/user-settings.spec.tsx +223 -2
- package/src/lib/providers/user-settings.tsx +25 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./AP7HFJJL-
|
|
2
|
-
import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./main-
|
|
1
|
+
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./AP7HFJJL-rbIMbNgl.js";
|
|
2
|
+
import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./main-LOPf04m3.js";
|
|
3
3
|
var DevtoolsPanelComponent = (props) => {
|
|
4
4
|
const [localStore, setLocalStore] = createLocalStorage({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as createContext, d as createSignal, o as onMount, e as createEffect, c as createMemo, a as createComponent, P as Portal, m as memo, S as Show, t as template, i as insert, f as createRenderEffect, h as className, j as clearDelegatedEvents, k as delegateEvents, u as useContext, l as onCleanup, s as sortFns, n as mutationSortFns, p as on, q as setAttribute, r as getSidedProp, v as use, w as convertRemToPixels, x as createUniqueId, y as batch, z as getQueryStatusLabel, A as getMutationStatusColor, B as getQueryStatusColor, C as getQueryStatusColorByLabel, D as displayValue, F as For, E as untrack, $ as $TRACK, G as useTransition, H as spread, I as mergeProps, J as createRoot, K as serialize, L as Index, M as updateNestedDataByPath, N as addEventListener, O as stringify, Q as Match, R as Switch, T as deleteNestedDataByPath, U as splitProps, V as Dynamic, W as createComputed } from "./main-
|
|
1
|
+
import { b as createContext, d as createSignal, o as onMount, e as createEffect, c as createMemo, a as createComponent, P as Portal, m as memo, S as Show, t as template, i as insert, f as createRenderEffect, h as className, j as clearDelegatedEvents, k as delegateEvents, u as useContext, l as onCleanup, s as sortFns, n as mutationSortFns, p as on, q as setAttribute, r as getSidedProp, v as use, w as convertRemToPixels, x as createUniqueId, y as batch, z as getQueryStatusLabel, A as getMutationStatusColor, B as getQueryStatusColor, C as getQueryStatusColorByLabel, D as displayValue, F as For, E as untrack, $ as $TRACK, G as useTransition, H as spread, I as mergeProps, J as createRoot, K as serialize, L as Index, M as updateNestedDataByPath, N as addEventListener, O as stringify, Q as Match, R as Switch, T as deleteNestedDataByPath, U as splitProps, V as Dynamic, W as createComputed } from "./main-LOPf04m3.js";
|
|
2
2
|
var isNonNullable = (i2) => i2 != null;
|
|
3
3
|
var filterNonNullable = (arr) => arr.filter(isNonNullable);
|
|
4
4
|
function chain(callbacks) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, D as Devtools, Q as QueryDevtoolsContext } from "./AP7HFJJL-
|
|
2
|
-
import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./main-
|
|
1
|
+
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, D as Devtools, Q as QueryDevtoolsContext } from "./AP7HFJJL-rbIMbNgl.js";
|
|
2
|
+
import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./main-LOPf04m3.js";
|
|
3
3
|
var DevtoolsComponent = (props) => {
|
|
4
4
|
const [localStore, setLocalStore] = createLocalStorage({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -9425,7 +9425,9 @@ const UserSettingsProvider = ({
|
|
|
9425
9425
|
}),
|
|
9426
9426
|
retry: false,
|
|
9427
9427
|
staleTime: 0,
|
|
9428
|
-
enabled: settingsStoreIsAvailable
|
|
9428
|
+
enabled: settingsStoreIsAvailable,
|
|
9429
|
+
// The previous session's value must not be read as a successful read of the next one
|
|
9430
|
+
placeholderData: void 0
|
|
9429
9431
|
});
|
|
9430
9432
|
useEffect(() => {
|
|
9431
9433
|
if (settingsStoreIsAvailable && error2?.message.includes(`Settings store field not registered: ${SETTINGS_STORE_KEY_USER_SETTINGS}`)) {
|
|
@@ -9441,7 +9443,7 @@ const UserSettingsProvider = ({
|
|
|
9441
9443
|
}
|
|
9442
9444
|
}),
|
|
9443
9445
|
onSuccess: (_2, settingsSaved) => {
|
|
9444
|
-
setServerSettings(settingsSaved);
|
|
9446
|
+
setServerSettings((current) => current ? settingsSaved : current);
|
|
9445
9447
|
saveInProgressRef.current = false;
|
|
9446
9448
|
},
|
|
9447
9449
|
onError: (error22) => {
|
|
@@ -9507,10 +9509,20 @@ const UserSettingsProvider = ({
|
|
|
9507
9509
|
[key]: value2
|
|
9508
9510
|
}));
|
|
9509
9511
|
};
|
|
9512
|
+
const resetServerSettings = () => {
|
|
9513
|
+
setServerSettings(null);
|
|
9514
|
+
setIsReady(false);
|
|
9515
|
+
if (settingsStoreIsAvailable) {
|
|
9516
|
+
setSettings({
|
|
9517
|
+
...defaultSettings
|
|
9518
|
+
});
|
|
9519
|
+
}
|
|
9520
|
+
};
|
|
9510
9521
|
const contextValue = {
|
|
9511
9522
|
settingsStoreIsAvailable,
|
|
9512
9523
|
settingsReady: isReady || !settingsStoreIsAvailable,
|
|
9513
9524
|
settings,
|
|
9525
|
+
resetServerSettings,
|
|
9514
9526
|
setDisplayLanguage: (language) => updateSetting("displayLanguage", language),
|
|
9515
9527
|
setDisplayLocale: (locale2) => updateSetting("displayLocale", locale2),
|
|
9516
9528
|
setContentLanguage: (language) => updateSetting("contentLanguage", language),
|
|
@@ -40827,7 +40839,7 @@ function useDayPickerLocale() {
|
|
|
40827
40839
|
} = useDisplayLocale();
|
|
40828
40840
|
const [calendarLocale, setCalendarLocale] = useState(void 0);
|
|
40829
40841
|
useEffect(() => {
|
|
40830
|
-
import("./locale-
|
|
40842
|
+
import("./locale-C3ggsgX8.js").then((mod) => {
|
|
40831
40843
|
setCalendarLocale(bcpTagToDatePickerLocale(bcp47Tag, mod));
|
|
40832
40844
|
});
|
|
40833
40845
|
}, [bcp47Tag]);
|
|
@@ -41390,7 +41402,8 @@ function AuthProvider({
|
|
|
41390
41402
|
const [isLoginLogoutInProgress, setIsLoginLogoutInProgress] = React.useState(false);
|
|
41391
41403
|
const {
|
|
41392
41404
|
settings,
|
|
41393
|
-
setActiveChannelId
|
|
41405
|
+
setActiveChannelId,
|
|
41406
|
+
resetServerSettings
|
|
41394
41407
|
} = useUserSettings();
|
|
41395
41408
|
const queryClient = useQueryClient();
|
|
41396
41409
|
const {
|
|
@@ -41523,6 +41536,7 @@ function AuthProvider({
|
|
|
41523
41536
|
}
|
|
41524
41537
|
if (data?.logout.success) {
|
|
41525
41538
|
queryClient.clear();
|
|
41539
|
+
resetServerSettings();
|
|
41526
41540
|
try {
|
|
41527
41541
|
localStorage.removeItem(LS_KEY_SELECTED_CHANNEL_TOKEN);
|
|
41528
41542
|
} catch {
|
|
@@ -41534,7 +41548,7 @@ function AuthProvider({
|
|
|
41534
41548
|
setStatus(isAuthenticated ? "authenticated" : "unauthenticated");
|
|
41535
41549
|
setIsLoginLogoutInProgress(false);
|
|
41536
41550
|
}
|
|
41537
|
-
}, [queryClient, isAuthenticated, refetchCurrentUser]);
|
|
41551
|
+
}, [queryClient, isAuthenticated, refetchCurrentUser, resetServerSettings]);
|
|
41538
41552
|
React.useEffect(() => {
|
|
41539
41553
|
if (isLoginLogoutInProgress) {
|
|
41540
41554
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r8 as normalizeDates$1, r9 as startOfWeek$1, ra as buildFormatLongFn$1, rb as buildLocalizeFn$1, rc as buildMatchFn$1, rd as buildMatchPatternFn$1, re as toDate$1, rf as match$1l, rg as localize$1n, rh as formatRelative$1n, ri as formatDistance$1n, rj as DateLib, rk as enUS$1 } from "./common-operations-
|
|
1
|
+
import { r8 as normalizeDates$1, r9 as startOfWeek$1, ra as buildFormatLongFn$1, rb as buildLocalizeFn$1, rc as buildMatchFn$1, rd as buildMatchPatternFn$1, re as toDate$1, rf as match$1l, rg as localize$1n, rh as formatRelative$1n, ri as formatDistance$1n, rj as DateLib, rk as enUS$1 } from "./common-operations-Dy3cIPYX.js";
|
|
2
2
|
function isSameWeek$1(laterDate, earlierDate, options2) {
|
|
3
3
|
const [laterDate_, earlierDate_] = normalizeDates$1(
|
|
4
4
|
options2?.in,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { c as createLucideIcon, pX as loadI18nMessages, q4 as toBcp47Tag, pn as useDisplayLocale, dL as useServerConfig, kw as FormatProvider, qn as UserSettingsProvider, qo as ThemeProvider, qp as AuthProvider, qq as ServerConfigProvider, qr as ChannelProvider, qs as AlertsProvider, np as CustomProviders, c$ as objectType, dd as stringType, pe as useAuth, gG as ResetPasswordForm, h_ as LoginBranding, gF as LoginForm, gE as ForgotPasswordForm, gq as AppLayout, qt as endOfDay, qu as startOfMonth, mQ as getDashboardWidgetFilters, dM as useUserSettings, pD as usePermissions, pw as useInsightsRefresh, mO as getVisibleDashboardWidgets, mA as buildInitialWidgetState, mz as mergeHiddenWidgetIds, mL as getDashboardWidget, eN as Page, eO as PageTitle, eP as PageActionBar, oH as ActionBarItem, go as DateRangePicker, dA as DropdownMenu, dB as DropdownMenuTrigger, d$ as Plus, dr as Button, dD as DropdownMenuContent, dE as DropdownMenuItem, qv as Sparkles, dI as RefreshCw, du as Tooltip, dv as TooltipTrigger, qw as SquarePen, dw as TooltipContent, eR as PageLayout, oS as FullWidthPageBlock, mS as WidgetFiltersProvider, kD as GridLayout, kA as insertWithReflow, kC as tidyLayouts, my as buildWidgetInstance, ky as findNextAvailablePosition, e1 as X, mU as WidgetInstanceProvider, kB as compactLayouts, pC as usePaginatedList, q9 as api, nd as getMutationName, fF as DataTableBulkActionItem, qx as Trash, qh as graphql, gm as useGeneratedColumns, g4 as DataTable, hu as CountrySelector, ls as Sheet, lz as SheetTrigger, lu as SheetContent, lx as SheetHeader, ly as SheetTitle, lv as SheetDescription, ei as ScrollArea, p2 as ListPage, hB as DetailPageButton, e_ as BooleanDisplayBadge, lX as StatusBadge, qm as setSettingsStoreValueDocument, qy as createColumnHelper, ht as CopyableText, e0 as Badge, m3 as Switch$1, k2 as Dialog, kb as DialogTrigger, k4 as DialogContent, k7 as DialogHeader, ka as DialogTitle, k5 as DialogDescription, f0 as JsonViewer, k6 as DialogFooter, d_ as Input, l_ as defineStateEntries, py as useLocalFormat, dV as Ellipsis, qz as Clock, qA as Check, qB as CircleX, dC as ChevronDown, qC as EllipsisVertical, dl as Select, dm as SelectTrigger, dn as SelectValue, dp as SelectContent, dq as SelectItem, h0 as AssignToChannelBulkAction, pk as useChannel, i0 as RemoveFromChannelBulkAction, qd as configurableOperationFragment, pT as LS_KEY_SHIPPING_TEST_ADDRESS, iw as AccordionItem, ix as AccordionTrigger, iv as AccordionContent, kv as Form, eU as FormFieldWrapper, qD as AddressCountrySelect, pU as LS_KEY_SHIPPING_TEST_ORDER, qE as useReactTable, qF as getCoreRowModel, m4 as Table, ma as TableHeader, mb as TableRow, m9 as TableHead, qG as flexRender, m5 as TableBody, m7 as TableCell, h$ as ProductVariantSelector, io as VendureImage, dZ as Trash2, f2 as Money, eB as Card, eC as CardHeader, ja as CardTitle, eE as CardContent, iK as Alert, iL as AlertDescription, iu as Accordion, ik as RichTextDescriptionCell, pW as SUPER_ADMIN_ROLE_CODE, pO as CUSTOMER_ROLE_CODE, qH as Layers, h7 as ChannelCodeLabel, ic as RoleCodeLabel, qb as getEntityDuplicatorsDocument, hr as getInitialConfigArgValue, hm as ConfigurableOperationInput, qa as duplicateEntityDocument, qI as Copy, dF as PermissionGuard, kR as NoPromotionsIllustration, hF as ErrorPage, n0 as extendDetailFormQuery, n7 as addCustomFields, p5 as getDetailQueryOptions, qJ as CURRENT_ADMINISTRATOR_AVATAR_QUERY_KEY, eL as useDetailPage, eS as PageBlock, eT as DetailFormGrid, lc as PasswordInput, gH as AdministratorAvatar, eW as CustomFieldsPageBlock, qc as assetFragment, hH as FacetValueSelector, lT as LoadingState, hG as FacetValueChip, h2 as usePriceFactor, fM as FacetValueFacetedFilter, kQ as NoProductsIllustration, ig as StockLevelLabel, qg as errorResultFragment, qf as configurableOperationDefFragment, pp as useDynamicTranslations, ih as CustomerCell, ii as OrderStateCell, ij as OrderMoneyCell, kP as NoOrdersIllustration, eJ as NEW_ENTITY_PATH, hS as LanguageSelector, qj as schemaLanguageCodes, fe as NumberInput, hY as PaginatedListDataTable, kL as NoCustomersIllustration, hX as PaginatedListDataTableKey, hA as CustomerSelector, qK as useDebounce, dX as Folder, qL as Search, dt as ChevronRight, qM as getExpandedRowModel, fY as getItemParentId, f$ as calculateDragTargetPosition, f_ as isCircularReference, g0 as calculateSiblingIndex, qN as deleteAssetsDocument, cG as enumType, cz as coerce, gQ as AssetGallery, kM as NoKeysIllustration, kN as NoMembersIllustration, p1 as detailPageRouteLoader, il as TaxCategorySelector, it as ZoneSelector, mh as Textarea, hp as ConfigurableOperationSelector, eV as TranslatableFormFieldWrapper, ft as RichTextInput, pu as useGroupedPermissions, mm as TooltipProvider, qO as Info, hc as ChannelSelector, ho as ConfigurableOperationMultiSelector, fa as DateTimeInput, cw as arrayType, q7 as a, mc as Tabs, me as TabsList, mf as TabsTrigger, qP as Link$1, md as TabsContent, jx as Command, jB as CommandInput, jD as CommandList, jz as CommandEmpty, jC as CommandItem, cy as booleanType, c5 as ZodIssueCode, d9 as recordType, kl as Field, ko as FieldError, fd as MoneyInput, C as Checkbox, hs as ConfirmationDialog, iy as AlertDialog, iB as AlertDialogContent, iE as AlertDialogHeader, iI as AlertDialogTitle, iC as AlertDialogDescription, iD as AlertDialogFooter, iA as AlertDialogCancel, iz as AlertDialogAction, jb as Chip, jG as ConfirmDialog, pB as usePage, fw as requireGeneratedSlug, fx as SlugInput, h5 as AssignedFacetValues, h4 as AssignedChannels, hC as EntityAssets, qQ as Package, jf as filterComboboxFreeTextItems, kq as FieldLabel, qR as ExternalLink, jg as ComboboxFreeText, qS as Settings2, e4 as Separator, hw as CustomFieldsForm, pQ as DEFAULT_CHANNEL_CODE, fs as createRelationSelectorConfig, fr as RelationSelector, k_ as Label, m2 as orderStateDictionary, dO as cn, qT as CircleAlert, qU as CircleCheck, pl as useCustomFieldConfig, gp as LabeledData, qV as isDestructiveTransition, qW as Globe, oG as HistoryEntry, hQ as useHistoryNoteEditor, hO as HistoryTimelineWithGrouping, hN as HistoryNoteInput, hL as HistoryNoteEditor, hM as HistoryNoteEntry, eD as Skeleton, n9 as getFieldsFromDocumentNode, fV as getColumnVisibility, jc as Collapsible, jd as CollapsibleTrigger, je as CollapsibleContent, p7 as getRefundDestinationExtension, pz as useIsMobile, qX as Pencil, qY as User, ds as ChevronLeft, fv as requireGeneratedCode, hx as CustomerAddressForm$1, qZ as Users, hy as CustomerGroupChip, hz as CustomerGroupSelector, k3 as DialogClose, pf as availableCountriesQueryKey, q_ as LoaderCircle, iM as AlertTitle, q$ as Eye, px as useJobQueuePolling, pj as useChannelColors, ie as SellerSelector, hv as CurrencySelector, h8 as ChannelColorPicker, r0 as tagListDocument, r1 as updateTagDocument, r2 as deleteTagDocument, r3 as createTagDocument, P as Popover, m as PopoverTrigger, r4 as ChevronsUpDown, q as PopoverContent, jA as CommandGroup, r5 as assetDetailDocument, r6 as assetUpdateDocument, gP as AssetFocalPointEditor, gV as AssetProperties, gT as AssetPreviewSelector, r7 as Focus, id as RoleSelector, hU as MultiSelect, pE as useRedirectToListOnNotFound, fk as SingleRelationInput, n_ as useGeneratedForm, c_ as numberType, f3 as AffixedInput, lS as Spinner, nM as useDashboardExtensions, m$ as registerDefaults, nr as executeDashboardExtensionCallbacks, lR as Toaster, p6 as useExtendedRouter, pI as useUiLanguageLoader, n4 as clearCustomFieldsMap, n3 as setCustomFieldsMap, kc as DirectionProvider } from "./common-operations-
|
|
2
|
+
import { c as createLucideIcon, pX as loadI18nMessages, q4 as toBcp47Tag, pn as useDisplayLocale, dL as useServerConfig, kw as FormatProvider, qn as UserSettingsProvider, qo as ThemeProvider, qp as AuthProvider, qq as ServerConfigProvider, qr as ChannelProvider, qs as AlertsProvider, np as CustomProviders, c$ as objectType, dd as stringType, pe as useAuth, gG as ResetPasswordForm, h_ as LoginBranding, gF as LoginForm, gE as ForgotPasswordForm, gq as AppLayout, qt as endOfDay, qu as startOfMonth, mQ as getDashboardWidgetFilters, dM as useUserSettings, pD as usePermissions, pw as useInsightsRefresh, mO as getVisibleDashboardWidgets, mA as buildInitialWidgetState, mz as mergeHiddenWidgetIds, mL as getDashboardWidget, eN as Page, eO as PageTitle, eP as PageActionBar, oH as ActionBarItem, go as DateRangePicker, dA as DropdownMenu, dB as DropdownMenuTrigger, d$ as Plus, dr as Button, dD as DropdownMenuContent, dE as DropdownMenuItem, qv as Sparkles, dI as RefreshCw, du as Tooltip, dv as TooltipTrigger, qw as SquarePen, dw as TooltipContent, eR as PageLayout, oS as FullWidthPageBlock, mS as WidgetFiltersProvider, kD as GridLayout, kA as insertWithReflow, kC as tidyLayouts, my as buildWidgetInstance, ky as findNextAvailablePosition, e1 as X, mU as WidgetInstanceProvider, kB as compactLayouts, pC as usePaginatedList, q9 as api, nd as getMutationName, fF as DataTableBulkActionItem, qx as Trash, qh as graphql, gm as useGeneratedColumns, g4 as DataTable, hu as CountrySelector, ls as Sheet, lz as SheetTrigger, lu as SheetContent, lx as SheetHeader, ly as SheetTitle, lv as SheetDescription, ei as ScrollArea, p2 as ListPage, hB as DetailPageButton, e_ as BooleanDisplayBadge, lX as StatusBadge, qm as setSettingsStoreValueDocument, qy as createColumnHelper, ht as CopyableText, e0 as Badge, m3 as Switch$1, k2 as Dialog, kb as DialogTrigger, k4 as DialogContent, k7 as DialogHeader, ka as DialogTitle, k5 as DialogDescription, f0 as JsonViewer, k6 as DialogFooter, d_ as Input, l_ as defineStateEntries, py as useLocalFormat, dV as Ellipsis, qz as Clock, qA as Check, qB as CircleX, dC as ChevronDown, qC as EllipsisVertical, dl as Select, dm as SelectTrigger, dn as SelectValue, dp as SelectContent, dq as SelectItem, h0 as AssignToChannelBulkAction, pk as useChannel, i0 as RemoveFromChannelBulkAction, qd as configurableOperationFragment, pT as LS_KEY_SHIPPING_TEST_ADDRESS, iw as AccordionItem, ix as AccordionTrigger, iv as AccordionContent, kv as Form, eU as FormFieldWrapper, qD as AddressCountrySelect, pU as LS_KEY_SHIPPING_TEST_ORDER, qE as useReactTable, qF as getCoreRowModel, m4 as Table, ma as TableHeader, mb as TableRow, m9 as TableHead, qG as flexRender, m5 as TableBody, m7 as TableCell, h$ as ProductVariantSelector, io as VendureImage, dZ as Trash2, f2 as Money, eB as Card, eC as CardHeader, ja as CardTitle, eE as CardContent, iK as Alert, iL as AlertDescription, iu as Accordion, ik as RichTextDescriptionCell, pW as SUPER_ADMIN_ROLE_CODE, pO as CUSTOMER_ROLE_CODE, qH as Layers, h7 as ChannelCodeLabel, ic as RoleCodeLabel, qb as getEntityDuplicatorsDocument, hr as getInitialConfigArgValue, hm as ConfigurableOperationInput, qa as duplicateEntityDocument, qI as Copy, dF as PermissionGuard, kR as NoPromotionsIllustration, hF as ErrorPage, n0 as extendDetailFormQuery, n7 as addCustomFields, p5 as getDetailQueryOptions, qJ as CURRENT_ADMINISTRATOR_AVATAR_QUERY_KEY, eL as useDetailPage, eS as PageBlock, eT as DetailFormGrid, lc as PasswordInput, gH as AdministratorAvatar, eW as CustomFieldsPageBlock, qc as assetFragment, hH as FacetValueSelector, lT as LoadingState, hG as FacetValueChip, h2 as usePriceFactor, fM as FacetValueFacetedFilter, kQ as NoProductsIllustration, ig as StockLevelLabel, qg as errorResultFragment, qf as configurableOperationDefFragment, pp as useDynamicTranslations, ih as CustomerCell, ii as OrderStateCell, ij as OrderMoneyCell, kP as NoOrdersIllustration, eJ as NEW_ENTITY_PATH, hS as LanguageSelector, qj as schemaLanguageCodes, fe as NumberInput, hY as PaginatedListDataTable, kL as NoCustomersIllustration, hX as PaginatedListDataTableKey, hA as CustomerSelector, qK as useDebounce, dX as Folder, qL as Search, dt as ChevronRight, qM as getExpandedRowModel, fY as getItemParentId, f$ as calculateDragTargetPosition, f_ as isCircularReference, g0 as calculateSiblingIndex, qN as deleteAssetsDocument, cG as enumType, cz as coerce, gQ as AssetGallery, kM as NoKeysIllustration, kN as NoMembersIllustration, p1 as detailPageRouteLoader, il as TaxCategorySelector, it as ZoneSelector, mh as Textarea, hp as ConfigurableOperationSelector, eV as TranslatableFormFieldWrapper, ft as RichTextInput, pu as useGroupedPermissions, mm as TooltipProvider, qO as Info, hc as ChannelSelector, ho as ConfigurableOperationMultiSelector, fa as DateTimeInput, cw as arrayType, q7 as a, mc as Tabs, me as TabsList, mf as TabsTrigger, qP as Link$1, md as TabsContent, jx as Command, jB as CommandInput, jD as CommandList, jz as CommandEmpty, jC as CommandItem, cy as booleanType, c5 as ZodIssueCode, d9 as recordType, kl as Field, ko as FieldError, fd as MoneyInput, C as Checkbox, hs as ConfirmationDialog, iy as AlertDialog, iB as AlertDialogContent, iE as AlertDialogHeader, iI as AlertDialogTitle, iC as AlertDialogDescription, iD as AlertDialogFooter, iA as AlertDialogCancel, iz as AlertDialogAction, jb as Chip, jG as ConfirmDialog, pB as usePage, fw as requireGeneratedSlug, fx as SlugInput, h5 as AssignedFacetValues, h4 as AssignedChannels, hC as EntityAssets, qQ as Package, jf as filterComboboxFreeTextItems, kq as FieldLabel, qR as ExternalLink, jg as ComboboxFreeText, qS as Settings2, e4 as Separator, hw as CustomFieldsForm, pQ as DEFAULT_CHANNEL_CODE, fs as createRelationSelectorConfig, fr as RelationSelector, k_ as Label, m2 as orderStateDictionary, dO as cn, qT as CircleAlert, qU as CircleCheck, pl as useCustomFieldConfig, gp as LabeledData, qV as isDestructiveTransition, qW as Globe, oG as HistoryEntry, hQ as useHistoryNoteEditor, hO as HistoryTimelineWithGrouping, hN as HistoryNoteInput, hL as HistoryNoteEditor, hM as HistoryNoteEntry, eD as Skeleton, n9 as getFieldsFromDocumentNode, fV as getColumnVisibility, jc as Collapsible, jd as CollapsibleTrigger, je as CollapsibleContent, p7 as getRefundDestinationExtension, pz as useIsMobile, qX as Pencil, qY as User, ds as ChevronLeft, fv as requireGeneratedCode, hx as CustomerAddressForm$1, qZ as Users, hy as CustomerGroupChip, hz as CustomerGroupSelector, k3 as DialogClose, pf as availableCountriesQueryKey, q_ as LoaderCircle, iM as AlertTitle, q$ as Eye, px as useJobQueuePolling, pj as useChannelColors, ie as SellerSelector, hv as CurrencySelector, h8 as ChannelColorPicker, r0 as tagListDocument, r1 as updateTagDocument, r2 as deleteTagDocument, r3 as createTagDocument, P as Popover, m as PopoverTrigger, r4 as ChevronsUpDown, q as PopoverContent, jA as CommandGroup, r5 as assetDetailDocument, r6 as assetUpdateDocument, gP as AssetFocalPointEditor, gV as AssetProperties, gT as AssetPreviewSelector, r7 as Focus, id as RoleSelector, hU as MultiSelect, pE as useRedirectToListOnNotFound, fk as SingleRelationInput, n_ as useGeneratedForm, c_ as numberType, f3 as AffixedInput, lS as Spinner, nM as useDashboardExtensions, m$ as registerDefaults, nr as executeDashboardExtensionCallbacks, lR as Toaster, p6 as useExtendedRouter, pI as useUiLanguageLoader, n4 as clearCustomFieldsMap, n3 as setCustomFieldsMap, kc as DirectionProvider } from "./common-operations-Dy3cIPYX.js";
|
|
3
3
|
import { toast } from "sonner";
|
|
4
4
|
import { i18n } from "@lingui/core";
|
|
5
5
|
import { I18nProvider as I18nProvider$1, useLingui, Trans } from "@lingui/react";
|
|
@@ -2933,7 +2933,7 @@ var TanstackQueryDevtools = class {
|
|
|
2933
2933
|
if (this.#Component) {
|
|
2934
2934
|
Devtools = this.#Component;
|
|
2935
2935
|
} else {
|
|
2936
|
-
Devtools = lazy(() => import("./WDYDFRGG-
|
|
2936
|
+
Devtools = lazy(() => import("./WDYDFRGG-B6y763i5.js"));
|
|
2937
2937
|
this.#Component = Devtools;
|
|
2938
2938
|
}
|
|
2939
2939
|
setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
|
|
@@ -3071,7 +3071,7 @@ var TanstackQueryDevtoolsPanel = class {
|
|
|
3071
3071
|
if (this.#Component) {
|
|
3072
3072
|
Devtools = this.#Component;
|
|
3073
3073
|
} else {
|
|
3074
|
-
Devtools = lazy(() => import("./2SSKDMRQ-
|
|
3074
|
+
Devtools = lazy(() => import("./2SSKDMRQ-BCzvzALn.js"));
|
|
3075
3075
|
this.#Component = Devtools;
|
|
3076
3076
|
}
|
|
3077
3077
|
setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
|
package/dist/bundle/lib.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createLucideIcon, g as getComputedStyle$1, i as isHTMLElement, r as round, a as getWindow, D as DEFAULT_SIDES, o as ownerDocument, b as getSide, d as createLucideIcon$1, e as isFieldDisabled, C as Checkbox, u as useDialogPortalContext, f as useDialogRootContext, h as useRenderElement, j as dialogStateAttributesMapping, k as useFormatSettings, p as parseCalendarDate, l as cn, P as Popover, m as PopoverTrigger, n as formatDateLabel, B as Button, q as PopoverContent, s as Calendar$1, t as formatCalendarDate, X as X$2, v as shimExports, N as NOOP, w as useCSPContext, x as useIsomorphicLayoutEffect, y as frame, L as LayoutGroupContext, z as animateVisualElement, A as setTarget, E as invariant, F as useConstant, G as resolveElements, H as popupTransitionStateMapping, I as DialogClose, J as DialogDescription, K as formatErrorMessage, M as useStableCallback, O as useIsoLayoutEffect, Q as clamp, S as SafeReact, R as error, T as useOpenChangeComplete, U as EMPTY_OBJECT, V as FOCUSABLE_POPUP_PROPS, W as COMPOSITE_KEYS, Y as FloatingFocusManager, Z as DialogPortal, _ as useControlled, $ as createChangeEventDetails, a0 as none, a1 as useRenderDialogRoot, a2 as android, a3 as addEventListener, a4 as closeWatcher, a5 as contains, a6 as hasScrollableAncestor, a7 as getTarget, a8 as findScrollableTouchTarget, a9 as DialogTitle, aa as DialogTrigger, ab as useAnimationFrame, ac as endingStyle, ad as mergeProps, ae as swipe, af as activeElement, ag as isElement, ah as BASE_UI_SWIPE_IGNORE_SELECTOR, ai as useBaseUiId, aj as MenubarContext, ak as FloatingTree, al as CompositeRoot, am as useFloatingNodeId, an as useFloatingTree, ao as useMenubarContext, ap as FloatingNode, aq as siblingOpen, ar as listNavigation, as as useFloatingParentNodeId, at as useTransitionStatus, au as linkPress, av as triggerHover, aw as outsidePress, ax as focusOut, ay as FloatingRootStore, az as PopupTriggerMap, aA as useHoverFloatingInteraction, aB as useDismiss, aC as transitionStatusMapping, aD as popupStateMapping, aE as inertValue, aF as getNodeChildren, aG as useDirection, aH as useTimeout, aI as useValueAsRef, aJ as useAnimationsFinished, aK as startingStyle, aL as useFloatingRootContext, aM as useHoverInteractionSharedState, aN as clearSafePolygonPointerEventsMutation, aO as useHoverReferenceInteraction, aP as safePolygon, aQ as useClick, aR as useButton, aS as CompositeItem, aT as EMPTY_ARRAY, aU as pressableTriggerOpenStateMapping, aV as FocusGuard, aW as isOutsideEvent, aX as getPreviousTabbable, aY as ownerVisuallyHidden, aZ as getNextTabbable, a_ as getTabbableAfterElement, a$ as triggerPress, b0 as stopEvent, b1 as PATIENT_CLICK_THRESHOLD, b2 as applySafePolygonPointerEventsMutation, b3 as FloatingPortal, b4 as useAnchorPositioningWithHook, b5 as useFloating, b6 as POPUP_COLLISION_AVOIDANCE, b7 as DROPDOWN_COLLISION_AVOIDANCE, b8 as mergeCleanups, b9 as usePositioner, ba as enableFocusInside, bb as disableFocusInside, bc as useId, bd as getDisabledMountTransitionStyles, be as triggerOpenStateMapping, bf as fieldValidityMapping, bg as useFormContext, bh as useFieldRootContext, bi as useLabelableContext, bj as useRegisterFieldControl, bk as useValueChanged, bl as areArraysEqual, bm as keyboard, bn as inputChange, bo as createGenericEventDetails, bp as warn, bq as getDefaultLabelId, br as resolveAriaLabelledBy, bs as CompositeList, bt as drag, bu as trackPress, bv as useLabelableId, bw as useCompositeListItem, bx as valueToPercent, by as visuallyHidden, bz as formatNumber, bA as useMergedRefs, bB as PAGE_UP, bC as PAGE_DOWN, bD as HOME, bE as END, bF as ARROW_LEFT, bG as ARROW_DOWN, bH as ARROW_RIGHT, bI as ARROW_UP, bJ as matchesFocusVisible, bK as BRAND, bL as DIRTY, bM as EMPTY_PATH, bN as INVALID, bO as NEVER, bP as OK, bQ as ParseStatus, bR as ZodType, bS as ZodAny, bT as ZodArray, bU as ZodBigInt, bV as ZodBoolean, bW as ZodBranded, bX as ZodCatch, bY as ZodDate, bZ as ZodDefault, b_ as ZodDiscriminatedUnion, b$ as ZodEffects, c0 as ZodEnum, c1 as ZodError, c2 as ZodFirstPartyTypeKind, c3 as ZodFunction, c4 as ZodIntersection, c5 as ZodIssueCode, c6 as ZodLazy, c7 as ZodLiteral, c8 as ZodMap, c9 as ZodNaN, ca as ZodNativeEnum, cb as ZodNever, cc as ZodNull, cd as ZodNullable, ce as ZodNumber, cf as ZodObject, cg as ZodOptional, ch as ZodParsedType, ci as ZodPipeline, cj as ZodPromise, ck as ZodReadonly, cl as ZodRecord, cm as ZodSet, cn as ZodString, co as ZodSymbol, cp as ZodTuple, cq as ZodUndefined, cr as ZodUnion, cs as ZodUnknown, ct as ZodVoid, cu as addIssueToContext, cv as anyType, cw as arrayType, cx as bigIntType, cy as booleanType, cz as coerce, cA as custom, cB as dateType, cC as datetimeRegex, cD as errorMap, cE as discriminatedUnionType, cF as effectsType, cG as enumType, cH as functionType, cI as getErrorMap, cJ as getParsedType, cK as instanceOfType, cL as intersectionType, cM as isAborted, cN as isAsync, cO as isDirty, cP as isValid, cQ as late, cR as lazyType, cS as literalType, cT as makeIssue, cU as mapType, cV as nanType, cW as nativeEnumType, cX as neverType, cY as nullType, cZ as nullableType, c_ as numberType, c$ as objectType, d0 as objectUtil, d1 as oboolean, d2 as onumber, d3 as optionalType, d4 as ostring, d5 as pipelineType, d6 as preprocessType, d7 as promiseType, d8 as quotelessJson, d9 as recordType, da as setType, db as setErrorMap, dc as strictObjectType, dd as stringType, de as symbolType, df as tupleType, dg as undefinedType, dh as unionType, di as unknownType, dj as util, dk as voidType, dl as Select, dm as SelectTrigger, dn as SelectValue, dp as SelectContent, dq as SelectItem, dr as Button$1, ds as ChevronLeft, dt as ChevronRight, du as Tooltip, dv as TooltipTrigger, dw as TooltipContent, dx as GlobalViewsSheet, dy as useSavedViews, dz as useDataTableContext, dA as DropdownMenu, dB as DropdownMenuTrigger, dC as ChevronDown, dD as DropdownMenuContent, dE as DropdownMenuItem, dF as PermissionGuard, dG as findMatchingSavedView, dH as UserViewsSheet, dI as RefreshCw, dJ as isMatchingSavedView, dK as SaveViewDialog, dL as useServerConfig, dM as useUserSettings, dN as useSortedLanguages, dO as cn$1, dP as useSidebar, dQ as SidebarGroup, dR as SidebarGroupLabel, dS as SidebarMenu, dT as SidebarMenuItem, dU as SidebarMenuButton, dV as Ellipsis, dW as SidebarMenuAction, dX as Folder, dY as DropdownMenuSeparator, dZ as Trash2, d_ as Input, d$ as Plus, e0 as Badge, e1 as X$3, e2 as CopyButton, e3 as cva, e4 as Separator, e5 as useRender, e6 as ChevronLeft$1, e7 as ChevronRight$1, e8 as throttle, e9 as warn$1, ea as isPercent, eb as getDisplayName, ec as clsx, ed as Tooltip$1, ee as Legend, ef as useCopy, eg as useCopyFeedback, eh as motion, ei as ScrollArea, ej as ScrollBar, ek as ChevronUp, el as ChevronDown$1, em as Check, en as Copy, eo as Minus, ep as MenuCheckboxItem, eq as MenuCheckboxItemIndicator, er as DropdownMenuGroup, es as DropdownMenuLabel, et as DropdownMenuPortal, eu as DropdownMenuRadioGroup, ev as MenuRadioItem, ew as MenuRadioItemIndicator, ex as DropdownMenuShortcut, ey as DropdownMenuSub, ez as DropdownMenuSubContent, eA as DropdownMenuSubTrigger, eB as Card, eC as CardHeader, eD as Skeleton, eE as CardContent, eF as CardAction, eG as ArrowUp, eH as ArrowDown, eI as warnOnce, eJ as NEW_ENTITY_PATH, eK as getEntityName, eL as useDetailPage, eM as getOperationVariablesFields, eN as Page, eO as PageTitle, eP as PageActionBar, eQ as PageActionBarRight, eR as PageLayout, eS as PageBlock, eT as DetailFormGrid, eU as FormFieldWrapper, eV as TranslatableFormFieldWrapper, eW as CustomFieldsPageBlock, eX as DefaultInputForType } from "./chunks/common-operations-
|
|
2
|
-
import { pN, kH, iu, iv, iw, ix, oH, oI, fE, fC, gH, f3, iK, iN, iL, iy, iz, iA, iB, iC, iD, iE, iF, iG, iH, iI, iJ, mq, iM, gI, mr, pY, gK, gJ, gq, iO, iP, iQ, iR, iS, gr, hg, gN, gP, gQ, gR, gU, gS, gT, gV, g$, h0, h1, h4, h5, iT, iU, iV, iW, iX, iY, g5, oV, p0, o$, e_, eY, eZ, f4, i_, i$, j0, j1, j2, j3, j4, ph, pO, j6, j7, j8, j9, ja, h6, h7, h8, hb, h9, ha, hc, gs, jb, jc, je, jd, fD, f5, jh, ji, jj, jk, jl, jm, jn, jg, jo, jp, jq, jr, js, jt, ju, jv, jx, jy, jz, jA, jB, jC, jD, jE, jF, hd, hm, f6, ho, hp, jG, hs, jH, jI, jJ, jK, jL, jM, jN, jO, jP, jQ, jR, jS, jT, jU, jV, jW, ht, hu, ir, pP, hv, f7, hw, nQ, np, hx, ih, hy, f8, hz, hA, g7, pQ, mx, g4, jX, jY, g6, fF, fI, g1, fJ, fK, ga, gc, fO, fQ, fP, fR, ge, gg, fL, fU, gi, g2, g3, go, e$, fa, k1, fb, hB, oJ, gt, gD, k2, k3, k4, k5, k6, k7, k8, k9, ka, kb, kc, mv, kd, ke, gb, kf, kI, kg, kh, ki, kj, kJ, lU, kk, hC, kK, hF, lV, hG, fM, fc, hH, fN, kl, km, kn, ko, kp, kq, kr, ks, kt, ku, gE, kv, nR, hI, kw, oS, gu, kD, oG, hJ, hK, hL, hM, hN, hP, hO, kE, kF, kG, gj, gd, pv, hR, i1, kU, kV, kW, kX, kY, kZ, f1, f0, pR, pS, pT, pU, pV, k_, gp, gv, hS, i2, jZ, j$, j_, p2, lT, oO, h_, gF, hT, gw, hZ, mF, f2, fd, fl, hU, gf, gx, gy, gA, gz, hV, kL, kM, kN, kO, kP, kQ, kR, kS, hD, kT, fe, hq, ij, ii, nZ, oR, oP, oQ, oU, k$, l0, l1, l2, l3, l4, hW, hY, hX, l5, l6, l7, l8, l9, la, lb, ff, lc, ip, ld, le, lf, fj, fi, h$, lg, lh, li, lj, lk, ll, lm, fr, fp, i0, gG, i3, is, i4, ik, i5, ft, ic, id, gh, pW, ln, lo, lp, lq, lr, fu, i6, ie, ls, lt, lu, lv, lw, lx, ly, lz, lA, lB, lC, lD, lE, lF, lG, lH, lI, lJ, lK, lL, lM, lN, lO, lP, lQ, fk, fx, lS, lX, ig, fy, fz, m3, m1, m4, m5, m6, m7, i7, i8, m8, i9, m9, ma, k0, mb, mc, md, me, mf, il, fA, mh, fB, iq, lR, mk, mi, mj, ia, mm, im, io, gn, mw, mR, mS, mT, mU, it, gM, mW, nz, n7, n6, nP, nv, ny, mY, oY, oZ, m_, gW, q9, gL, nU, qc, h3, pf, iZ, pb, g9, mA, gC, my, j5, f$, g0, q2, pi, n4, fo, lZ, kB, hh, qe, qf, qd, o1, gO, nS, fS, fs, fn, o5, ns, l_, hj, p1, qa, qg, mM, nr, n0, n1, p3, oo, jf, ky, q3, hl, ib, nu, nx, mp, mo, mV, o6, fV, n5, oF, oL, nl, oN, mL, mQ, mK, nV, nT, nO, p5, nt, qb, ni, hE, mN, ps, n9, q0, nX, hr, nw, fY, fZ, hi, mX, n8, nd, oW, nc, ne, na, nb, p7, fG, ql, q1, fX, pa, nf, oD, mZ, mO, nW, p8, n2, qh, oA, ov, nk, kA, hn, gZ, of, or, f_, o9, o8, oi, os, gB, he, nh, oz, oh, oq, og, op, ot, oc, oe, oy, oT, l$, ou, ox, oj, ng, oa, ob, om, on, ok, ol, od, oC, mB, mC, mD, kx, pX, lW, mE, fg, fh, m0, mz, o4, oB, gk, q5, nq, mG, m2, mH, gX, g8, hk, q8, fW, fm, o7, qi, kz, mn, nA, oK, nm, nn, oM, mJ, mP, nB, m$, nC, nD, nE, nF, nG, nH, nI, nJ, p4, nK, p9, nL, o0, q6, no, fv, fw, ow, fH, ms, g_, qk, qj, mt, nY, n3, oX, qm, hf, lY, o2, o3, fT, mg, kC, q4, ml, mI, n$, oE, pd, pc, gl, pe, pg, pk, pj, jw, mu, pl, nM, pm, f9, pn, po, pp, pq, pr, p6, pt, gm, n_, pu, hQ, pw, pz, pF, px, nj, py, nN, pZ, pB, pA, pC, pD, h2, pE, fq, pH, p_, pG, p$, pI, pJ, pK, pL, pM, o_, gY, q7 } from "./chunks/common-operations-
|
|
1
|
+
import { c as createLucideIcon, g as getComputedStyle$1, i as isHTMLElement, r as round, a as getWindow, D as DEFAULT_SIDES, o as ownerDocument, b as getSide, d as createLucideIcon$1, e as isFieldDisabled, C as Checkbox, u as useDialogPortalContext, f as useDialogRootContext, h as useRenderElement, j as dialogStateAttributesMapping, k as useFormatSettings, p as parseCalendarDate, l as cn, P as Popover, m as PopoverTrigger, n as formatDateLabel, B as Button, q as PopoverContent, s as Calendar$1, t as formatCalendarDate, X as X$2, v as shimExports, N as NOOP, w as useCSPContext, x as useIsomorphicLayoutEffect, y as frame, L as LayoutGroupContext, z as animateVisualElement, A as setTarget, E as invariant, F as useConstant, G as resolveElements, H as popupTransitionStateMapping, I as DialogClose, J as DialogDescription, K as formatErrorMessage, M as useStableCallback, O as useIsoLayoutEffect, Q as clamp, S as SafeReact, R as error, T as useOpenChangeComplete, U as EMPTY_OBJECT, V as FOCUSABLE_POPUP_PROPS, W as COMPOSITE_KEYS, Y as FloatingFocusManager, Z as DialogPortal, _ as useControlled, $ as createChangeEventDetails, a0 as none, a1 as useRenderDialogRoot, a2 as android, a3 as addEventListener, a4 as closeWatcher, a5 as contains, a6 as hasScrollableAncestor, a7 as getTarget, a8 as findScrollableTouchTarget, a9 as DialogTitle, aa as DialogTrigger, ab as useAnimationFrame, ac as endingStyle, ad as mergeProps, ae as swipe, af as activeElement, ag as isElement, ah as BASE_UI_SWIPE_IGNORE_SELECTOR, ai as useBaseUiId, aj as MenubarContext, ak as FloatingTree, al as CompositeRoot, am as useFloatingNodeId, an as useFloatingTree, ao as useMenubarContext, ap as FloatingNode, aq as siblingOpen, ar as listNavigation, as as useFloatingParentNodeId, at as useTransitionStatus, au as linkPress, av as triggerHover, aw as outsidePress, ax as focusOut, ay as FloatingRootStore, az as PopupTriggerMap, aA as useHoverFloatingInteraction, aB as useDismiss, aC as transitionStatusMapping, aD as popupStateMapping, aE as inertValue, aF as getNodeChildren, aG as useDirection, aH as useTimeout, aI as useValueAsRef, aJ as useAnimationsFinished, aK as startingStyle, aL as useFloatingRootContext, aM as useHoverInteractionSharedState, aN as clearSafePolygonPointerEventsMutation, aO as useHoverReferenceInteraction, aP as safePolygon, aQ as useClick, aR as useButton, aS as CompositeItem, aT as EMPTY_ARRAY, aU as pressableTriggerOpenStateMapping, aV as FocusGuard, aW as isOutsideEvent, aX as getPreviousTabbable, aY as ownerVisuallyHidden, aZ as getNextTabbable, a_ as getTabbableAfterElement, a$ as triggerPress, b0 as stopEvent, b1 as PATIENT_CLICK_THRESHOLD, b2 as applySafePolygonPointerEventsMutation, b3 as FloatingPortal, b4 as useAnchorPositioningWithHook, b5 as useFloating, b6 as POPUP_COLLISION_AVOIDANCE, b7 as DROPDOWN_COLLISION_AVOIDANCE, b8 as mergeCleanups, b9 as usePositioner, ba as enableFocusInside, bb as disableFocusInside, bc as useId, bd as getDisabledMountTransitionStyles, be as triggerOpenStateMapping, bf as fieldValidityMapping, bg as useFormContext, bh as useFieldRootContext, bi as useLabelableContext, bj as useRegisterFieldControl, bk as useValueChanged, bl as areArraysEqual, bm as keyboard, bn as inputChange, bo as createGenericEventDetails, bp as warn, bq as getDefaultLabelId, br as resolveAriaLabelledBy, bs as CompositeList, bt as drag, bu as trackPress, bv as useLabelableId, bw as useCompositeListItem, bx as valueToPercent, by as visuallyHidden, bz as formatNumber, bA as useMergedRefs, bB as PAGE_UP, bC as PAGE_DOWN, bD as HOME, bE as END, bF as ARROW_LEFT, bG as ARROW_DOWN, bH as ARROW_RIGHT, bI as ARROW_UP, bJ as matchesFocusVisible, bK as BRAND, bL as DIRTY, bM as EMPTY_PATH, bN as INVALID, bO as NEVER, bP as OK, bQ as ParseStatus, bR as ZodType, bS as ZodAny, bT as ZodArray, bU as ZodBigInt, bV as ZodBoolean, bW as ZodBranded, bX as ZodCatch, bY as ZodDate, bZ as ZodDefault, b_ as ZodDiscriminatedUnion, b$ as ZodEffects, c0 as ZodEnum, c1 as ZodError, c2 as ZodFirstPartyTypeKind, c3 as ZodFunction, c4 as ZodIntersection, c5 as ZodIssueCode, c6 as ZodLazy, c7 as ZodLiteral, c8 as ZodMap, c9 as ZodNaN, ca as ZodNativeEnum, cb as ZodNever, cc as ZodNull, cd as ZodNullable, ce as ZodNumber, cf as ZodObject, cg as ZodOptional, ch as ZodParsedType, ci as ZodPipeline, cj as ZodPromise, ck as ZodReadonly, cl as ZodRecord, cm as ZodSet, cn as ZodString, co as ZodSymbol, cp as ZodTuple, cq as ZodUndefined, cr as ZodUnion, cs as ZodUnknown, ct as ZodVoid, cu as addIssueToContext, cv as anyType, cw as arrayType, cx as bigIntType, cy as booleanType, cz as coerce, cA as custom, cB as dateType, cC as datetimeRegex, cD as errorMap, cE as discriminatedUnionType, cF as effectsType, cG as enumType, cH as functionType, cI as getErrorMap, cJ as getParsedType, cK as instanceOfType, cL as intersectionType, cM as isAborted, cN as isAsync, cO as isDirty, cP as isValid, cQ as late, cR as lazyType, cS as literalType, cT as makeIssue, cU as mapType, cV as nanType, cW as nativeEnumType, cX as neverType, cY as nullType, cZ as nullableType, c_ as numberType, c$ as objectType, d0 as objectUtil, d1 as oboolean, d2 as onumber, d3 as optionalType, d4 as ostring, d5 as pipelineType, d6 as preprocessType, d7 as promiseType, d8 as quotelessJson, d9 as recordType, da as setType, db as setErrorMap, dc as strictObjectType, dd as stringType, de as symbolType, df as tupleType, dg as undefinedType, dh as unionType, di as unknownType, dj as util, dk as voidType, dl as Select, dm as SelectTrigger, dn as SelectValue, dp as SelectContent, dq as SelectItem, dr as Button$1, ds as ChevronLeft, dt as ChevronRight, du as Tooltip, dv as TooltipTrigger, dw as TooltipContent, dx as GlobalViewsSheet, dy as useSavedViews, dz as useDataTableContext, dA as DropdownMenu, dB as DropdownMenuTrigger, dC as ChevronDown, dD as DropdownMenuContent, dE as DropdownMenuItem, dF as PermissionGuard, dG as findMatchingSavedView, dH as UserViewsSheet, dI as RefreshCw, dJ as isMatchingSavedView, dK as SaveViewDialog, dL as useServerConfig, dM as useUserSettings, dN as useSortedLanguages, dO as cn$1, dP as useSidebar, dQ as SidebarGroup, dR as SidebarGroupLabel, dS as SidebarMenu, dT as SidebarMenuItem, dU as SidebarMenuButton, dV as Ellipsis, dW as SidebarMenuAction, dX as Folder, dY as DropdownMenuSeparator, dZ as Trash2, d_ as Input, d$ as Plus, e0 as Badge, e1 as X$3, e2 as CopyButton, e3 as cva, e4 as Separator, e5 as useRender, e6 as ChevronLeft$1, e7 as ChevronRight$1, e8 as throttle, e9 as warn$1, ea as isPercent, eb as getDisplayName, ec as clsx, ed as Tooltip$1, ee as Legend, ef as useCopy, eg as useCopyFeedback, eh as motion, ei as ScrollArea, ej as ScrollBar, ek as ChevronUp, el as ChevronDown$1, em as Check, en as Copy, eo as Minus, ep as MenuCheckboxItem, eq as MenuCheckboxItemIndicator, er as DropdownMenuGroup, es as DropdownMenuLabel, et as DropdownMenuPortal, eu as DropdownMenuRadioGroup, ev as MenuRadioItem, ew as MenuRadioItemIndicator, ex as DropdownMenuShortcut, ey as DropdownMenuSub, ez as DropdownMenuSubContent, eA as DropdownMenuSubTrigger, eB as Card, eC as CardHeader, eD as Skeleton, eE as CardContent, eF as CardAction, eG as ArrowUp, eH as ArrowDown, eI as warnOnce, eJ as NEW_ENTITY_PATH, eK as getEntityName, eL as useDetailPage, eM as getOperationVariablesFields, eN as Page, eO as PageTitle, eP as PageActionBar, eQ as PageActionBarRight, eR as PageLayout, eS as PageBlock, eT as DetailFormGrid, eU as FormFieldWrapper, eV as TranslatableFormFieldWrapper, eW as CustomFieldsPageBlock, eX as DefaultInputForType } from "./chunks/common-operations-Dy3cIPYX.js";
|
|
2
|
+
import { pN, kH, iu, iv, iw, ix, oH, oI, fE, fC, gH, f3, iK, iN, iL, iy, iz, iA, iB, iC, iD, iE, iF, iG, iH, iI, iJ, mq, iM, gI, mr, pY, gK, gJ, gq, iO, iP, iQ, iR, iS, gr, hg, gN, gP, gQ, gR, gU, gS, gT, gV, g$, h0, h1, h4, h5, iT, iU, iV, iW, iX, iY, g5, oV, p0, o$, e_, eY, eZ, f4, i_, i$, j0, j1, j2, j3, j4, ph, pO, j6, j7, j8, j9, ja, h6, h7, h8, hb, h9, ha, hc, gs, jb, jc, je, jd, fD, f5, jh, ji, jj, jk, jl, jm, jn, jg, jo, jp, jq, jr, js, jt, ju, jv, jx, jy, jz, jA, jB, jC, jD, jE, jF, hd, hm, f6, ho, hp, jG, hs, jH, jI, jJ, jK, jL, jM, jN, jO, jP, jQ, jR, jS, jT, jU, jV, jW, ht, hu, ir, pP, hv, f7, hw, nQ, np, hx, ih, hy, f8, hz, hA, g7, pQ, mx, g4, jX, jY, g6, fF, fI, g1, fJ, fK, ga, gc, fO, fQ, fP, fR, ge, gg, fL, fU, gi, g2, g3, go, e$, fa, k1, fb, hB, oJ, gt, gD, k2, k3, k4, k5, k6, k7, k8, k9, ka, kb, kc, mv, kd, ke, gb, kf, kI, kg, kh, ki, kj, kJ, lU, kk, hC, kK, hF, lV, hG, fM, fc, hH, fN, kl, km, kn, ko, kp, kq, kr, ks, kt, ku, gE, kv, nR, hI, kw, oS, gu, kD, oG, hJ, hK, hL, hM, hN, hP, hO, kE, kF, kG, gj, gd, pv, hR, i1, kU, kV, kW, kX, kY, kZ, f1, f0, pR, pS, pT, pU, pV, k_, gp, gv, hS, i2, jZ, j$, j_, p2, lT, oO, h_, gF, hT, gw, hZ, mF, f2, fd, fl, hU, gf, gx, gy, gA, gz, hV, kL, kM, kN, kO, kP, kQ, kR, kS, hD, kT, fe, hq, ij, ii, nZ, oR, oP, oQ, oU, k$, l0, l1, l2, l3, l4, hW, hY, hX, l5, l6, l7, l8, l9, la, lb, ff, lc, ip, ld, le, lf, fj, fi, h$, lg, lh, li, lj, lk, ll, lm, fr, fp, i0, gG, i3, is, i4, ik, i5, ft, ic, id, gh, pW, ln, lo, lp, lq, lr, fu, i6, ie, ls, lt, lu, lv, lw, lx, ly, lz, lA, lB, lC, lD, lE, lF, lG, lH, lI, lJ, lK, lL, lM, lN, lO, lP, lQ, fk, fx, lS, lX, ig, fy, fz, m3, m1, m4, m5, m6, m7, i7, i8, m8, i9, m9, ma, k0, mb, mc, md, me, mf, il, fA, mh, fB, iq, lR, mk, mi, mj, ia, mm, im, io, gn, mw, mR, mS, mT, mU, it, gM, mW, nz, n7, n6, nP, nv, ny, mY, oY, oZ, m_, gW, q9, gL, nU, qc, h3, pf, iZ, pb, g9, mA, gC, my, j5, f$, g0, q2, pi, n4, fo, lZ, kB, hh, qe, qf, qd, o1, gO, nS, fS, fs, fn, o5, ns, l_, hj, p1, qa, qg, mM, nr, n0, n1, p3, oo, jf, ky, q3, hl, ib, nu, nx, mp, mo, mV, o6, fV, n5, oF, oL, nl, oN, mL, mQ, mK, nV, nT, nO, p5, nt, qb, ni, hE, mN, ps, n9, q0, nX, hr, nw, fY, fZ, hi, mX, n8, nd, oW, nc, ne, na, nb, p7, fG, ql, q1, fX, pa, nf, oD, mZ, mO, nW, p8, n2, qh, oA, ov, nk, kA, hn, gZ, of, or, f_, o9, o8, oi, os, gB, he, nh, oz, oh, oq, og, op, ot, oc, oe, oy, oT, l$, ou, ox, oj, ng, oa, ob, om, on, ok, ol, od, oC, mB, mC, mD, kx, pX, lW, mE, fg, fh, m0, mz, o4, oB, gk, q5, nq, mG, m2, mH, gX, g8, hk, q8, fW, fm, o7, qi, kz, mn, nA, oK, nm, nn, oM, mJ, mP, nB, m$, nC, nD, nE, nF, nG, nH, nI, nJ, p4, nK, p9, nL, o0, q6, no, fv, fw, ow, fH, ms, g_, qk, qj, mt, nY, n3, oX, qm, hf, lY, o2, o3, fT, mg, kC, q4, ml, mI, n$, oE, pd, pc, gl, pe, pg, pk, pj, jw, mu, pl, nM, pm, f9, pn, po, pp, pq, pr, p6, pt, gm, n_, pu, hQ, pw, pz, pF, px, nj, py, nN, pZ, pB, pA, pC, pD, h2, pE, fq, pH, p_, pG, p$, pI, pJ, pK, pL, pM, o_, gY, q7 } from "./chunks/common-operations-Dy3cIPYX.js";
|
|
3
3
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
4
4
|
import { Trans } from "@lingui/react";
|
|
5
5
|
import { useLingui } from "@lingui/react";
|
package/dist/bundle/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import "./chunks/common-operations-
|
|
2
|
+
import "./chunks/common-operations-Dy3cIPYX.js";
|
|
3
3
|
import "sonner";
|
|
4
|
-
import "./chunks/main-
|
|
4
|
+
import "./chunks/main-LOPf04m3.js";
|
|
5
5
|
import "@tanstack/react-router";
|
|
6
6
|
import "react";
|
|
7
7
|
import "react-dom";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/dashboard",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.8.2-master-
|
|
4
|
+
"version": "3.8.2-master-202610280208",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"@storybook/react-vite": "^10.3.1",
|
|
140
140
|
"@types/node": "^22.19.0",
|
|
141
141
|
"@vendure-io/design-lint": "^1.0.0",
|
|
142
|
-
"@vendure/common": "^3.8.2-master-
|
|
143
|
-
"@vendure/core": "^3.8.2-master-
|
|
142
|
+
"@vendure/common": "^3.8.2-master-202610280208",
|
|
143
|
+
"@vendure/core": "^3.8.2-master-202610280208",
|
|
144
144
|
"@vitest/browser": "^3.2.4",
|
|
145
145
|
"@vitest/coverage-v8": "^3.2.4",
|
|
146
146
|
"eslint": "^9.39.0",
|
|
@@ -158,7 +158,7 @@ export function AuthProvider({ children }: Readonly<{ children: React.ReactNode
|
|
|
158
158
|
const [status, setStatus] = React.useState<AuthContext['status']>('initial');
|
|
159
159
|
const [authenticationError, setAuthenticationError] = React.useState<string | undefined>();
|
|
160
160
|
const [isLoginLogoutInProgress, setIsLoginLogoutInProgress] = React.useState(false);
|
|
161
|
-
const { settings, setActiveChannelId } = useUserSettings();
|
|
161
|
+
const { settings, setActiveChannelId, resetServerSettings } = useUserSettings();
|
|
162
162
|
const queryClient = useQueryClient();
|
|
163
163
|
const { t } = useLingui();
|
|
164
164
|
const noChannelAccessError = t`You do not have access to any channel`;
|
|
@@ -332,6 +332,7 @@ export function AuthProvider({ children }: Readonly<{ children: React.ReactNode
|
|
|
332
332
|
if (data?.logout.success) {
|
|
333
333
|
// Clear all cached queries to prevent stale data
|
|
334
334
|
queryClient.clear();
|
|
335
|
+
resetServerSettings();
|
|
335
336
|
try {
|
|
336
337
|
// localStorage can throw (quota exceeded, Safari private
|
|
337
338
|
// mode, security errors, storage disabled). The server-side
|
|
@@ -351,7 +352,7 @@ export function AuthProvider({ children }: Readonly<{ children: React.ReactNode
|
|
|
351
352
|
setIsLoginLogoutInProgress(false);
|
|
352
353
|
}
|
|
353
354
|
},
|
|
354
|
-
[queryClient, isAuthenticated, refetchCurrentUser],
|
|
355
|
+
[queryClient, isAuthenticated, refetchCurrentUser, resetServerSettings],
|
|
355
356
|
);
|
|
356
357
|
|
|
357
358
|
// Handle status transitions based on query state
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { setupI18n } from '@lingui/core';
|
|
2
|
+
import { I18nProvider } from '@lingui/react';
|
|
3
|
+
import { keepPreviousData, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
2
4
|
import { act, useContext } from 'react';
|
|
3
5
|
import { createRoot, type Root } from 'react-dom/client';
|
|
4
6
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
7
|
|
|
6
8
|
import { SETTINGS_STORE_KEY_USER_SETTINGS } from '../storage-keys.js';
|
|
9
|
+
import { AuthContext, AuthProvider } from './auth.js';
|
|
7
10
|
import { UserSettingsContext, type UserSettingsContextType, UserSettingsProvider } from './user-settings.js';
|
|
8
11
|
|
|
9
12
|
const apiMock = vi.hoisted(() => ({ query: vi.fn(), mutate: vi.fn() }));
|
|
@@ -60,7 +63,7 @@ describe('UserSettingsProvider', () => {
|
|
|
60
63
|
apiMock.query.mockReset();
|
|
61
64
|
apiMock.mutate.mockReset();
|
|
62
65
|
apiMock.mutate.mockResolvedValue({ setSettingsStoreValue: { result: true } });
|
|
63
|
-
queryClient = new QueryClient();
|
|
66
|
+
queryClient = new QueryClient({ defaultOptions: { queries: { placeholderData: keepPreviousData } } });
|
|
64
67
|
container = document.createElement('div');
|
|
65
68
|
root = createRoot(container);
|
|
66
69
|
});
|
|
@@ -174,6 +177,63 @@ describe('UserSettingsProvider', () => {
|
|
|
174
177
|
expect(apiMock.mutate).not.toHaveBeenCalled();
|
|
175
178
|
});
|
|
176
179
|
|
|
180
|
+
it('initializes from the next session after the previous session ended', async () => {
|
|
181
|
+
apiMock.query.mockResolvedValue({ getSettingsStoreValue: { displayLanguage: 'de', theme: 'dark' } });
|
|
182
|
+
await render();
|
|
183
|
+
expect(context.settings.displayLanguage).toBe('de');
|
|
184
|
+
|
|
185
|
+
apiMock.query.mockRejectedValue(forbiddenError());
|
|
186
|
+
await act(async () => {
|
|
187
|
+
queryClient.clear();
|
|
188
|
+
context.resetServerSettings?.();
|
|
189
|
+
});
|
|
190
|
+
await flush();
|
|
191
|
+
expect(context.settingsReady).toBe(false);
|
|
192
|
+
|
|
193
|
+
await act(async () => context.setActiveChannelId('2'));
|
|
194
|
+
await flush();
|
|
195
|
+
expect(apiMock.mutate).not.toHaveBeenCalled();
|
|
196
|
+
|
|
197
|
+
apiMock.query.mockResolvedValue({
|
|
198
|
+
getSettingsStoreValue: { displayLanguage: 'fr', tableSettings: { products: { pageSize: 37 } } },
|
|
199
|
+
});
|
|
200
|
+
await act(async () => queryClient.invalidateQueries());
|
|
201
|
+
await flush();
|
|
202
|
+
|
|
203
|
+
expect(context.settingsReady).toBe(true);
|
|
204
|
+
expect(context.settings.displayLanguage).toBe('fr');
|
|
205
|
+
expect(context.settings.theme).toBe('system');
|
|
206
|
+
expect(context.settings.tableSettings).toEqual({ products: { pageSize: 37 } });
|
|
207
|
+
expect(apiMock.mutate).not.toHaveBeenCalled();
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('does not restore the previous session when its last save completes after the reset', async () => {
|
|
211
|
+
apiMock.query.mockResolvedValue({ getSettingsStoreValue: { displayLanguage: 'de' } });
|
|
212
|
+
await render();
|
|
213
|
+
|
|
214
|
+
let finishSave: (value: unknown) => void = () => undefined;
|
|
215
|
+
apiMock.mutate.mockReturnValue(new Promise(resolve => (finishSave = resolve)));
|
|
216
|
+
await act(async () => context.setTheme('dark'));
|
|
217
|
+
await flush();
|
|
218
|
+
expect(apiMock.mutate).toHaveBeenCalledTimes(1);
|
|
219
|
+
|
|
220
|
+
apiMock.query.mockRejectedValue(forbiddenError());
|
|
221
|
+
await act(async () => {
|
|
222
|
+
queryClient.clear();
|
|
223
|
+
context.resetServerSettings?.();
|
|
224
|
+
});
|
|
225
|
+
await flush();
|
|
226
|
+
await act(async () => finishSave({ setSettingsStoreValue: { result: true } }));
|
|
227
|
+
await flush();
|
|
228
|
+
|
|
229
|
+
apiMock.query.mockResolvedValue({ getSettingsStoreValue: { displayLanguage: 'fr' } });
|
|
230
|
+
await act(async () => queryClient.invalidateQueries());
|
|
231
|
+
await flush();
|
|
232
|
+
|
|
233
|
+
expect(context.settings.displayLanguage).toBe('fr');
|
|
234
|
+
expect(apiMock.mutate).toHaveBeenCalledTimes(1);
|
|
235
|
+
});
|
|
236
|
+
|
|
177
237
|
it('becomes ready when the settings store field is not registered', async () => {
|
|
178
238
|
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
|
|
179
239
|
apiMock.query.mockRejectedValue(
|
|
@@ -189,3 +249,164 @@ describe('UserSettingsProvider', () => {
|
|
|
189
249
|
warn.mockRestore();
|
|
190
250
|
});
|
|
191
251
|
});
|
|
252
|
+
|
|
253
|
+
// #5646: logging out and signing in as another administrator without a reload must
|
|
254
|
+
// initialize the settings from the new administrator's stored value
|
|
255
|
+
describe('UserSettingsProvider with AuthProvider', () => {
|
|
256
|
+
let container: HTMLDivElement;
|
|
257
|
+
let root: Root;
|
|
258
|
+
let queryClient: QueryClient;
|
|
259
|
+
let settingsContext: UserSettingsContextType;
|
|
260
|
+
let authContext: AuthContext;
|
|
261
|
+
let session: 'first' | 'second' | 'third' | null;
|
|
262
|
+
let stores: Record<'first' | 'second' | 'third', Record<string, any> | null>;
|
|
263
|
+
const channels = {
|
|
264
|
+
first: { id: '1', token: 'first-token' },
|
|
265
|
+
second: { id: '2', token: 'second-token' },
|
|
266
|
+
third: { id: '3', token: 'third-token' },
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
function Probe() {
|
|
270
|
+
settingsContext = useContext(UserSettingsContext)!;
|
|
271
|
+
authContext = useContext(AuthContext)!;
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async function flush() {
|
|
276
|
+
for (let i = 0; i < 10; i++) {
|
|
277
|
+
await act(async () => {
|
|
278
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const operationName = (document: any) => document?.definitions?.[0]?.name?.value;
|
|
284
|
+
|
|
285
|
+
function handleMutation(document: any, variables: any) {
|
|
286
|
+
switch (operationName(document)) {
|
|
287
|
+
case 'Login':
|
|
288
|
+
session = variables.username;
|
|
289
|
+
return Promise.resolve({
|
|
290
|
+
login: { __typename: 'CurrentUser', id: '1', identifier: session },
|
|
291
|
+
});
|
|
292
|
+
case 'LogOut':
|
|
293
|
+
session = null;
|
|
294
|
+
return Promise.resolve({ logout: { success: true } });
|
|
295
|
+
default:
|
|
296
|
+
if (session) {
|
|
297
|
+
stores[session] = variables.input.value;
|
|
298
|
+
}
|
|
299
|
+
return Promise.resolve({ setSettingsStoreValue: { result: true } });
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
async function render() {
|
|
304
|
+
await act(async () => {
|
|
305
|
+
root.render(
|
|
306
|
+
<I18nProvider i18n={setupI18n({ locale: 'en', messages: { en: {} } })}>
|
|
307
|
+
<QueryClientProvider client={queryClient}>
|
|
308
|
+
<UserSettingsProvider queryClient={queryClient}>
|
|
309
|
+
<AuthProvider>
|
|
310
|
+
<Probe />
|
|
311
|
+
</AuthProvider>
|
|
312
|
+
</UserSettingsProvider>
|
|
313
|
+
</QueryClientProvider>
|
|
314
|
+
</I18nProvider>,
|
|
315
|
+
);
|
|
316
|
+
});
|
|
317
|
+
await flush();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
beforeEach(() => {
|
|
321
|
+
localStorage.clear();
|
|
322
|
+
session = 'first';
|
|
323
|
+
stores = {
|
|
324
|
+
first: { displayLanguage: 'de', tableSettings: { products: { pageSize: 11 } } },
|
|
325
|
+
second: { displayLanguage: 'fr', tableSettings: { products: { pageSize: 37 } } },
|
|
326
|
+
third: null,
|
|
327
|
+
};
|
|
328
|
+
apiMock.query.mockReset();
|
|
329
|
+
apiMock.mutate.mockReset();
|
|
330
|
+
apiMock.query.mockImplementation((document: any) => {
|
|
331
|
+
const name = operationName(document);
|
|
332
|
+
if (name === 'CurrentUserInformation') {
|
|
333
|
+
return Promise.resolve(
|
|
334
|
+
session
|
|
335
|
+
? {
|
|
336
|
+
me: {
|
|
337
|
+
id: session,
|
|
338
|
+
identifier: session,
|
|
339
|
+
channels: [{ ...channels[session], code: session, permissions: [] }],
|
|
340
|
+
},
|
|
341
|
+
activeAdministrator: null,
|
|
342
|
+
}
|
|
343
|
+
: { me: null, activeAdministrator: null },
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
if (name === 'GetSettingsStoreValue') {
|
|
347
|
+
return session
|
|
348
|
+
? Promise.resolve({ getSettingsStoreValue: stores[session] })
|
|
349
|
+
: Promise.reject(forbiddenError());
|
|
350
|
+
}
|
|
351
|
+
return Promise.resolve({ activeAdministrator: null });
|
|
352
|
+
});
|
|
353
|
+
apiMock.mutate.mockImplementation((document: any, variables?: any) =>
|
|
354
|
+
variables === undefined
|
|
355
|
+
? (vars: any) => handleMutation(document, vars)
|
|
356
|
+
: handleMutation(document, variables),
|
|
357
|
+
);
|
|
358
|
+
queryClient = new QueryClient({ defaultOptions: { queries: { placeholderData: keepPreviousData } } });
|
|
359
|
+
container = document.createElement('div');
|
|
360
|
+
root = createRoot(container);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
afterEach(() => {
|
|
364
|
+
act(() => root.unmount());
|
|
365
|
+
queryClient.clear();
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it('initializes from the next administrator after logout and does not save the previous settings', async () => {
|
|
369
|
+
await render();
|
|
370
|
+
expect(authContext.status).toBe('authenticated');
|
|
371
|
+
expect(settingsContext.settings.displayLanguage).toBe('de');
|
|
372
|
+
|
|
373
|
+
await act(async () => authContext.logout());
|
|
374
|
+
await flush();
|
|
375
|
+
expect(authContext.status).toBe('unauthenticated');
|
|
376
|
+
|
|
377
|
+
await act(async () => authContext.login('second', 'password'));
|
|
378
|
+
await flush();
|
|
379
|
+
expect(authContext.status).toBe('authenticated');
|
|
380
|
+
|
|
381
|
+
expect(stores.second).toEqual(
|
|
382
|
+
expect.objectContaining({ displayLanguage: 'fr', tableSettings: { products: { pageSize: 37 } } }),
|
|
383
|
+
);
|
|
384
|
+
expect(stores.first?.displayLanguage).toBe('de');
|
|
385
|
+
expect(settingsContext.settings.displayLanguage).toBe('fr');
|
|
386
|
+
expect(settingsContext.settings.tableSettings).toEqual({ products: { pageSize: 37 } });
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
it('starts from the default settings when the next administrator has no stored value', async () => {
|
|
390
|
+
await render();
|
|
391
|
+
expect(settingsContext.settings.displayLanguage).toBe('de');
|
|
392
|
+
|
|
393
|
+
await act(async () => authContext.logout());
|
|
394
|
+
await flush();
|
|
395
|
+
await act(async () => authContext.login('third', 'password'));
|
|
396
|
+
await flush();
|
|
397
|
+
expect(authContext.status).toBe('authenticated');
|
|
398
|
+
expect(settingsContext.settings.displayLanguage).toBe('en');
|
|
399
|
+
expect(settingsContext.settings.tableSettings).toEqual({});
|
|
400
|
+
|
|
401
|
+
await act(async () => settingsContext.setTheme('dark'));
|
|
402
|
+
await flush();
|
|
403
|
+
expect(stores.third).toEqual(
|
|
404
|
+
expect.objectContaining({
|
|
405
|
+
displayLanguage: 'en',
|
|
406
|
+
theme: 'dark',
|
|
407
|
+
activeChannelId: '3',
|
|
408
|
+
tableSettings: {},
|
|
409
|
+
}),
|
|
410
|
+
);
|
|
411
|
+
});
|
|
412
|
+
});
|
|
@@ -89,6 +89,13 @@ export interface UserSettingsContextType {
|
|
|
89
89
|
*/
|
|
90
90
|
settingsReady: boolean;
|
|
91
91
|
settings: UserSettings;
|
|
92
|
+
/**
|
|
93
|
+
* @description
|
|
94
|
+
* Discards the settings of the current session and reverts to the default settings, so
|
|
95
|
+
* that the next successful read initializes them from the new session's stored value.
|
|
96
|
+
* Nothing is saved until then. Called by the `AuthProvider` on logout.
|
|
97
|
+
*/
|
|
98
|
+
resetServerSettings: () => void;
|
|
92
99
|
setDisplayLanguage: (language: string) => void;
|
|
93
100
|
setDisplayLocale: (locale: string | undefined) => void;
|
|
94
101
|
setContentLanguage: (language: string) => void;
|
|
@@ -175,6 +182,8 @@ export const UserSettingsProvider: React.FC<UserSettingsProviderProps> = ({ quer
|
|
|
175
182
|
retry: false,
|
|
176
183
|
staleTime: 0,
|
|
177
184
|
enabled: settingsStoreIsAvailable,
|
|
185
|
+
// The previous session's value must not be read as a successful read of the next one
|
|
186
|
+
placeholderData: undefined,
|
|
178
187
|
});
|
|
179
188
|
|
|
180
189
|
useEffect(() => {
|
|
@@ -196,8 +205,9 @@ export const UserSettingsProvider: React.FC<UserSettingsProviderProps> = ({ quer
|
|
|
196
205
|
input: { key: SETTINGS_STORE_KEY_USER_SETTINGS, value: settingsToSave },
|
|
197
206
|
}),
|
|
198
207
|
onSuccess: (_, settingsSaved) => {
|
|
199
|
-
// Only update serverSettings after successful save
|
|
200
|
-
|
|
208
|
+
// Only update serverSettings after successful save. A null value means the session
|
|
209
|
+
// was reset while this save was in flight, and the result must not restore it.
|
|
210
|
+
setServerSettings(current => (current ? settingsSaved : current));
|
|
201
211
|
saveInProgressRef.current = false;
|
|
202
212
|
},
|
|
203
213
|
onError: error => {
|
|
@@ -206,9 +216,9 @@ export const UserSettingsProvider: React.FC<UserSettingsProviderProps> = ({ quer
|
|
|
206
216
|
},
|
|
207
217
|
});
|
|
208
218
|
|
|
209
|
-
// Initialize settings from the first successful read of the server value
|
|
210
|
-
// `serverSettings` stays null, which stops the save effect
|
|
211
|
-
// browser's local copy over the stored value.
|
|
219
|
+
// Initialize settings from the first successful read of the server value after mount or
|
|
220
|
+
// `resetServerSettings`. Until then `serverSettings` stays null, which stops the save effect
|
|
221
|
+
// below from writing this browser's local copy over the stored value.
|
|
212
222
|
useEffect(() => {
|
|
213
223
|
if (serverSettings) {
|
|
214
224
|
return;
|
|
@@ -289,10 +299,20 @@ export const UserSettingsProvider: React.FC<UserSettingsProviderProps> = ({ quer
|
|
|
289
299
|
setSettings(prev => ({ ...prev, [key]: value }));
|
|
290
300
|
};
|
|
291
301
|
|
|
302
|
+
const resetServerSettings = () => {
|
|
303
|
+
setServerSettings(null);
|
|
304
|
+
setIsReady(false);
|
|
305
|
+
// Without the SettingsStore, the local copy is the only place the settings are kept
|
|
306
|
+
if (settingsStoreIsAvailable) {
|
|
307
|
+
setSettings({ ...defaultSettings });
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
|
|
292
311
|
const contextValue: UserSettingsContextType = {
|
|
293
312
|
settingsStoreIsAvailable,
|
|
294
313
|
settingsReady: isReady || !settingsStoreIsAvailable,
|
|
295
314
|
settings,
|
|
315
|
+
resetServerSettings,
|
|
296
316
|
setDisplayLanguage: language => updateSetting('displayLanguage', language),
|
|
297
317
|
setDisplayLocale: locale => updateSetting('displayLocale', locale),
|
|
298
318
|
setContentLanguage: language => updateSetting('contentLanguage', language),
|