@deenruv/admin-dashboard 1.0.16 → 1.0.17-dev.15
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/DeenruvAdminPanel.js +35 -46
- package/dist/access/access-context.js +10 -0
- package/dist/access/built-in-routes.js +300 -0
- package/dist/access/index.js +6 -0
- package/dist/access/navigation.js +33 -0
- package/dist/access/permission-access.js +9 -0
- package/dist/access/permission-routes.js +3 -0
- package/dist/access/types.js +1 -0
- package/dist/components/GlobalSearch.js +37 -62
- package/dist/components/Menu/ActiveAdmins.js +1 -1
- package/dist/components/Menu/ChannelSwitcher.js +1 -1
- package/dist/components/Menu/LanguagesDropdown.js +1 -1
- package/dist/components/Menu/Navigation.js +68 -229
- package/dist/components/Menu/NavigationFooter.js +7 -4
- package/dist/components/Menu/Notifications.js +1 -1
- package/dist/components/Menu/index.js +50 -16
- package/dist/components/storefrontAction/StorefrontAction.js +9 -0
- package/dist/components/storefrontAction/StorefrontAction.logic.js +27 -0
- package/dist/components/storefrontAction/index.js +2 -0
- package/dist/index.css +54 -44
- package/dist/locales/en/admins.json +62 -0
- package/dist/locales/en/collections.json +21 -0
- package/dist/locales/en/common.json +2 -0
- package/dist/locales/en/orders.json +8 -0
- package/dist/locales/en/products.json +29 -2
- package/dist/locales/en/promotions.json +4 -0
- package/dist/locales/pl/admins.json +62 -0
- package/dist/locales/pl/collections.json +21 -0
- package/dist/locales/pl/common.json +2 -0
- package/dist/locales/pl/orders.json +8 -0
- package/dist/locales/pl/products.json +29 -2
- package/dist/locales/pl/promotions.json +4 -0
- package/dist/pages/Root.js +31 -15
- package/dist/pages/admins/Detail.js +1 -1
- package/dist/pages/admins/List.js +8 -3
- package/dist/pages/admins/Provision.js +173 -0
- package/dist/pages/admins/Provision.logic.js +53 -0
- package/dist/pages/admins/index.js +1 -0
- package/dist/pages/assets/List.js +3 -3
- package/dist/pages/channels/Detail.js +1 -1
- package/dist/pages/collections/Detail.js +24 -6
- package/dist/pages/collections/List.js +87 -20
- package/dist/pages/collections/_components/CollectionDetailView.js +15 -2
- package/dist/pages/collections/_components/FiltersCard.js +51 -11
- package/dist/pages/collections/_components/collectionStorefrontAction/CollectionStorefrontAction.js +41 -0
- package/dist/pages/collections/_components/collectionStorefrontAction/CollectionStorefrontAction.logic.js +44 -0
- package/dist/pages/collections/_components/collectionStorefrontAction/index.js +2 -0
- package/dist/pages/countries/Detail.js +1 -1
- package/dist/pages/customers/_components/PersonalDataCard.js +2 -1
- package/dist/pages/extensions/Extensions.js +3 -7
- package/dist/pages/facets/Detail.js +1 -1
- package/dist/pages/orders/Detail.js +38 -5
- package/dist/pages/orders/List.js +1 -16
- package/dist/pages/orders/_components/CancelAndRefundDialog.js +1 -2
- package/dist/pages/orders/_components/OrderLineCustomFields.js +1 -1
- package/dist/pages/orders/_components/ProductsTable.js +1 -2
- package/dist/pages/orders/_components/RefundPaymentCard.js +1 -2
- package/dist/pages/payment-methods/Detail.js +1 -1
- package/dist/pages/product-variants/List.js +3 -3
- package/dist/pages/products/Detail.js +62 -5
- package/dist/pages/products/_components/AssetsCard.js +15 -2
- package/dist/pages/products/_components/OptionsCard.js +7 -5
- package/dist/pages/products/_components/PriceCard.js +21 -8
- package/dist/pages/products/_components/ProductDetailView.js +7 -3
- package/dist/pages/products/_components/Variant.js +53 -26
- package/dist/pages/products/_components/VariantsTab.js +1 -1
- package/dist/pages/products/_components/productStorefrontAction/ProductStorefrontAction.js +42 -0
- package/dist/pages/products/_components/productStorefrontAction/ProductStorefrontAction.logic.js +39 -0
- package/dist/pages/products/_components/productStorefrontAction/index.js +2 -0
- package/dist/pages/promotions/Detail.js +34 -3
- package/dist/pages/promotions/_components/EnabledCard.js +2 -2
- package/dist/pages/promotions/_components/PromotionDetailSidebar.js +2 -1
- package/dist/pages/roles/Detail.js +1 -1
- package/dist/pages/roles/_components/PermissionsTable.js +0 -1
- package/dist/pages/sellers/Detail.js +1 -1
- package/dist/pages/shipping-methods/Detail.js +10 -6
- package/dist/pages/shipping-methods/_components/CalculatorCard.js +27 -11
- package/dist/pages/shipping-methods/_components/CheckerCard.js +28 -12
- package/dist/pages/stock-locations/Detail.js +1 -1
- package/dist/pages/tax-rates/Detail.js +1 -1
- package/dist/pages/zones/Detail.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +68 -68
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useParams } from 'react-router';
|
|
3
|
-
import { useTranslation, useValidators, createDeenruvForm, DetailView, useMutation } from '@deenruv/react-ui-devkit';
|
|
3
|
+
import { useTranslation, useValidators, createDeenruvForm, DetailView, useMutation, useSettings, } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { $, Permission, scalars, typedGql } from '@deenruv/admin-types';
|
|
5
5
|
import { PromotionDetailView } from "./_components/PromotionDetailView";
|
|
6
6
|
import { PromotionDetailSidebar } from "./_components/PromotionDetailSidebar";
|
|
7
|
+
const DEFAULT_PROMOTION_LANGUAGE_CODE = 'en';
|
|
8
|
+
const ensureDefaultPromotionTranslation = (translations, defaultLanguageCode) => {
|
|
9
|
+
const sourceTranslation = translations.find((translation) => !!translation.name?.trim()) ?? translations[0];
|
|
10
|
+
if (!sourceTranslation?.name?.trim())
|
|
11
|
+
return translations;
|
|
12
|
+
let hasDefaultLanguage = false;
|
|
13
|
+
const normalizedTranslations = translations.map((translation) => {
|
|
14
|
+
if (translation.languageCode !== defaultLanguageCode)
|
|
15
|
+
return translation;
|
|
16
|
+
hasDefaultLanguage = true;
|
|
17
|
+
if (translation.name?.trim())
|
|
18
|
+
return translation;
|
|
19
|
+
return {
|
|
20
|
+
...translation,
|
|
21
|
+
name: sourceTranslation.name,
|
|
22
|
+
description: translation.description ?? sourceTranslation.description ?? '',
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
if (hasDefaultLanguage)
|
|
26
|
+
return normalizedTranslations;
|
|
27
|
+
return [
|
|
28
|
+
...normalizedTranslations,
|
|
29
|
+
{
|
|
30
|
+
languageCode: defaultLanguageCode,
|
|
31
|
+
name: sourceTranslation.name,
|
|
32
|
+
description: sourceTranslation.description ?? '',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
};
|
|
7
36
|
const EditPromotionMutation = typedGql('mutation', { scalars })({
|
|
8
37
|
updatePromotion: [{ input: $('input', 'UpdatePromotionInput!') }, { '...on Promotion': { id: true } }],
|
|
9
38
|
});
|
|
@@ -20,6 +49,7 @@ export const PromotionsDetailPage = () => {
|
|
|
20
49
|
const [create] = useMutation(CreatePromotionMutation);
|
|
21
50
|
const [remove] = useMutation(DeletePromotionMutation);
|
|
22
51
|
const { translationsValidator, configurableOperationArrayValidator } = useValidators();
|
|
52
|
+
const defaultLanguageCode = useSettings((state) => state.selectedChannel?.defaultLanguageCode ?? DEFAULT_PROMOTION_LANGUAGE_CODE);
|
|
23
53
|
return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "promotions-detail-view", main: {
|
|
24
54
|
name: 'promotion',
|
|
25
55
|
label: 'Promotion',
|
|
@@ -50,9 +80,10 @@ export const PromotionsDetailPage = () => {
|
|
|
50
80
|
throw new Error('Fill required fields.');
|
|
51
81
|
const conditions = data.conditions;
|
|
52
82
|
const actions = data.actions;
|
|
83
|
+
const translations = data.translations;
|
|
53
84
|
const input = {
|
|
54
|
-
translations:
|
|
55
|
-
enabled: data.enabled
|
|
85
|
+
translations: id ? translations : ensureDefaultPromotionTranslation(translations, defaultLanguageCode),
|
|
86
|
+
enabled: typeof data.enabled === 'boolean' ? data.enabled : true,
|
|
56
87
|
actions,
|
|
57
88
|
conditions: conditions?.map((el) => ({
|
|
58
89
|
...el,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation, Label, Switch, CustomCard, CardIcons } from '@deenruv/react-ui-devkit';
|
|
3
3
|
export const EnabledCard = ({ onEnabledChange, enabledValue }) => {
|
|
4
|
-
const { t } = useTranslation('
|
|
5
|
-
return (_jsx(CustomCard, { title: t('
|
|
4
|
+
const { t } = useTranslation('promotions');
|
|
5
|
+
return (_jsx(CustomCard, { title: t('enabled.header'), icon: _jsx(CardIcons.default, {}), color: "teal", children: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Switch, { id: "promotion-enabled", checked: enabledValue ?? false, onCheckedChange: onEnabledChange }), _jsx(Label, { htmlFor: "promotion-enabled", children: t('enabled.label') })] }) }));
|
|
6
6
|
};
|
|
@@ -6,6 +6,7 @@ import { useEffect } from 'react';
|
|
|
6
6
|
export const PromotionDetailSidebar = () => {
|
|
7
7
|
const { id, form } = useDetailView('promotions-detail-view', 'CreatePromotionInput', 'enabled');
|
|
8
8
|
const { base } = form;
|
|
9
|
+
const enabledValue = base.watch('enabled');
|
|
9
10
|
// Always call useQuery unconditionally to preserve hook order.
|
|
10
11
|
// Pass a placeholder id when none exists; the result will simply be ignored.
|
|
11
12
|
const { data } = useQuery(PromotionQuery, { initialVariables: { id: id ?? '' } });
|
|
@@ -14,5 +15,5 @@ export const PromotionDetailSidebar = () => {
|
|
|
14
15
|
base.setField('enabled', data.promotion.enabled);
|
|
15
16
|
}
|
|
16
17
|
}, [data, id]);
|
|
17
|
-
return (_jsx("div", { className: "flex w-full flex-col gap-4", children: _jsx(EnabledCard, { enabledValue:
|
|
18
|
+
return (_jsx("div", { className: "flex w-full flex-col gap-4", children: _jsx(EnabledCard, { enabledValue: id ? enabledValue : (enabledValue ?? true), onEnabledChange: (e) => base.setField('enabled', e) }) }));
|
|
18
19
|
};
|
|
@@ -42,7 +42,7 @@ export const RolesDetailPage = () => {
|
|
|
42
42
|
if (!id) {
|
|
43
43
|
throw new Error('Could not find the id.');
|
|
44
44
|
}
|
|
45
|
-
return remove({
|
|
45
|
+
return remove({ id });
|
|
46
46
|
}, [remove, id]);
|
|
47
47
|
return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "roles-detail-view", main: {
|
|
48
48
|
name: 'role',
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
3
|
import { useTranslation, cn, Table, TableBody, TableCell, TableRow, useServer } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { CircleCheckBig } from 'lucide-react';
|
|
5
|
-
import permissionsJson from "../../../locales/en/permissions.json";
|
|
6
5
|
export const PermissionsTable = ({ currentPermissions, onPermissionsChange }) => {
|
|
7
6
|
const { t } = useTranslation('permissions');
|
|
8
7
|
const [groupedPermissions, setGroupedPermissions] = useState();
|
|
@@ -31,7 +31,7 @@ export const SellersDetailPage = () => {
|
|
|
31
31
|
if (!id) {
|
|
32
32
|
throw new Error('Could not find the id.');
|
|
33
33
|
}
|
|
34
|
-
return remove({
|
|
34
|
+
return remove({ id });
|
|
35
35
|
}, [remove, id]);
|
|
36
36
|
return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "sellers-detail-view", main: {
|
|
37
37
|
name: 'seller',
|
|
@@ -3,6 +3,10 @@ import { useCallback } from 'react';
|
|
|
3
3
|
import { useParams } from 'react-router';
|
|
4
4
|
import { useTranslation, DetailView, createDeenruvForm, getMutation, useMutation } from '@deenruv/react-ui-devkit';
|
|
5
5
|
import { ShippingMethodDetailView } from "./_components/ShippingMethodDetailView.js";
|
|
6
|
+
const isMissingConfigArgValue = (value) => value == null || value.trim() === '';
|
|
7
|
+
const hasMissingConfigArgs = (operation) => {
|
|
8
|
+
return !!operation?.arguments?.some((argument) => isMissingConfigArgValue(argument.value));
|
|
9
|
+
};
|
|
6
10
|
const CreateShippingMethodMutation = getMutation('createShippingMethod');
|
|
7
11
|
const EditShippingMethodMutation = getMutation('updateShippingMethod');
|
|
8
12
|
const DeleteShippingMethodMutation = getMutation('deleteShippingMethod');
|
|
@@ -44,7 +48,7 @@ export const ShippingMethodsDetailPage = () => {
|
|
|
44
48
|
if (!id) {
|
|
45
49
|
throw new Error('Could not find the id.');
|
|
46
50
|
}
|
|
47
|
-
return remove({
|
|
51
|
+
return remove({ id });
|
|
48
52
|
}, [remove, id]);
|
|
49
53
|
return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "shippingMethods-detail-view", main: {
|
|
50
54
|
name: 'shippingMethod',
|
|
@@ -63,11 +67,11 @@ export const ShippingMethodsDetailPage = () => {
|
|
|
63
67
|
checker: {
|
|
64
68
|
validate: (v) => {
|
|
65
69
|
const hasCode = !!v?.code;
|
|
66
|
-
const
|
|
70
|
+
const hasInvalidArguments = hasMissingConfigArgs(v);
|
|
67
71
|
const errors = [];
|
|
68
72
|
if (!hasCode)
|
|
69
73
|
errors.push(t('validation.checkerCodeRequired'));
|
|
70
|
-
if (
|
|
74
|
+
if (hasInvalidArguments)
|
|
71
75
|
errors.push(t('validation.checkerArgsRequired'));
|
|
72
76
|
return errors;
|
|
73
77
|
},
|
|
@@ -75,12 +79,12 @@ export const ShippingMethodsDetailPage = () => {
|
|
|
75
79
|
calculator: {
|
|
76
80
|
validate: (v) => {
|
|
77
81
|
const hasCode = !!v?.code;
|
|
78
|
-
const hasInvalidArguments = v
|
|
82
|
+
const hasInvalidArguments = hasMissingConfigArgs(v);
|
|
79
83
|
const errors = [];
|
|
80
84
|
if (!hasCode)
|
|
81
|
-
errors.push(t('validation.
|
|
85
|
+
errors.push(t('validation.calculatorCodeRequired'));
|
|
82
86
|
if (hasInvalidArguments)
|
|
83
|
-
errors.push(t('validation.
|
|
87
|
+
errors.push(t('validation.calculatorArgsRequired'));
|
|
84
88
|
return errors;
|
|
85
89
|
},
|
|
86
90
|
},
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { Button,
|
|
3
|
+
import { Button, apiClient, ErrorMessage, generateInputComponents, usePluginStore, InputFieldComponent, CardIcons, CustomCard, SimpleSelect, useTranslation, PaymentMethodHandlerSelector, } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { X } from 'lucide-react';
|
|
5
|
+
const decodeConfigArgValue = (value) => {
|
|
6
|
+
try {
|
|
7
|
+
const result = JSON.parse(value);
|
|
8
|
+
if (result && typeof result === 'object' && !Array.isArray(result)) {
|
|
9
|
+
return JSON.stringify(result);
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const encodeConfigArgValue = (value) => {
|
|
18
|
+
return Array.isArray(value) ? JSON.stringify(value) : (value ?? '').toString();
|
|
19
|
+
};
|
|
20
|
+
const createInitialArguments = (args) => {
|
|
21
|
+
return args.map((arg) => ({
|
|
22
|
+
name: arg.name,
|
|
23
|
+
value: encodeConfigArgValue(arg.defaultValue),
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
5
26
|
export const CalculatorCard = ({ currentCalculatorValue, onCalculatorValueChange, errors, }) => {
|
|
6
27
|
const { t } = useTranslation('shippingMethods');
|
|
7
28
|
const [calculators, setCalculators] = useState([]);
|
|
@@ -22,21 +43,16 @@ export const CalculatorCard = ({ currentCalculatorValue, onCalculatorValueChange
|
|
|
22
43
|
}, [fetchOptions]);
|
|
23
44
|
const handleCalculatorValueChange = useCallback((code, args) => {
|
|
24
45
|
const correspondingCalculator = calculators.find((h) => h.code === code);
|
|
25
|
-
console.log('args', args);
|
|
26
46
|
if (correspondingCalculator)
|
|
27
47
|
onCalculatorValueChange({
|
|
28
48
|
code: correspondingCalculator.code,
|
|
29
|
-
arguments: args
|
|
30
|
-
correspondingCalculator.args.map((a) => ({
|
|
31
|
-
name: a.name,
|
|
32
|
-
value: 'false',
|
|
33
|
-
})),
|
|
49
|
+
arguments: args ?? createInitialArguments(correspondingCalculator.args),
|
|
34
50
|
});
|
|
35
51
|
}, [calculators, onCalculatorValueChange]);
|
|
36
52
|
const clearInput = useCallback(() => {
|
|
37
53
|
onCalculatorValueChange(undefined);
|
|
38
54
|
}, [onCalculatorValueChange]);
|
|
39
|
-
return (_jsx(CustomCard, { title: t('details.calculator.title'), icon: _jsx(CardIcons.calc, {}), color: "indigo", children: _jsxs("div", { className: "flex basis-full flex-col gap-3 md:basis-1/2", children: [_jsxs("div", { className: "flex items-end gap-1", children: [_jsx(SimpleSelect, { label: t('details.calculator.type'), value: currentCalculatorValue ? currentCalculatorValue.code : '', onValueChange: handleCalculatorValueChange, options: allCalculatorsOptions }), currentCalculatorValue?.code && (_jsx(Button, { variant: 'secondary', className: "p-2", onClick: clearInput, children: _jsx(X, { size: 20 }) }))] }), _jsx("div", { className: "flex gap-3", children: currentCalculatorValue?.arguments.map((e
|
|
55
|
+
return (_jsx(CustomCard, { title: t('details.calculator.title'), icon: _jsx(CardIcons.calc, {}), color: "indigo", children: _jsxs("div", { className: "flex basis-full flex-col gap-3 md:basis-1/2", children: [_jsxs("div", { className: "flex items-end gap-1", children: [_jsx(SimpleSelect, { label: t('details.calculator.type'), value: currentCalculatorValue ? currentCalculatorValue.code : '', onValueChange: handleCalculatorValueChange, options: allCalculatorsOptions }), currentCalculatorValue?.code && (_jsx(Button, { variant: 'secondary', className: "p-2", onClick: clearInput, children: _jsx(X, { size: 20 }) }))] }), _jsx("div", { className: "flex gap-3", children: currentCalculatorValue?.arguments.map((e) => {
|
|
40
56
|
const calculator = calculators?.find((ch) => ch.code === currentCalculatorValue.code);
|
|
41
57
|
const argument = calculator?.args.find((a) => a.name === e.name);
|
|
42
58
|
if (!argument)
|
|
@@ -48,7 +64,7 @@ export const CalculatorCard = ({ currentCalculatorValue, onCalculatorValueChange
|
|
|
48
64
|
description: [{ languageCode: 'en', value: argument.description || '' }],
|
|
49
65
|
},
|
|
50
66
|
], getInputComponent).map((field) => {
|
|
51
|
-
const value = e.value;
|
|
67
|
+
const value = decodeConfigArgValue(e.value);
|
|
52
68
|
const setValue = (data) => {
|
|
53
69
|
try {
|
|
54
70
|
onCalculatorValueChange({
|
|
@@ -58,7 +74,7 @@ export const CalculatorCard = ({ currentCalculatorValue, onCalculatorValueChange
|
|
|
58
74
|
if (a.name === field.name) {
|
|
59
75
|
return {
|
|
60
76
|
name: a.name,
|
|
61
|
-
value:
|
|
77
|
+
value: encodeConfigArgValue(data),
|
|
62
78
|
};
|
|
63
79
|
}
|
|
64
80
|
}
|
|
@@ -73,7 +89,7 @@ export const CalculatorCard = ({ currentCalculatorValue, onCalculatorValueChange
|
|
|
73
89
|
console.error('Error setting value');
|
|
74
90
|
}
|
|
75
91
|
};
|
|
76
|
-
return (_jsx(
|
|
92
|
+
return (_jsx(InputFieldComponent, { field: field, value: value, setValue: setValue, additionalData: {} }, field.name));
|
|
77
93
|
});
|
|
78
94
|
}) }), _jsx(ErrorMessage, { errors: errors })] }) }));
|
|
79
95
|
};
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { Button,
|
|
3
|
+
import { Button, apiClient, ErrorMessage, generateInputComponents, usePluginStore, InputFieldComponent, CustomCard, CardIcons, SimpleSelect, useTranslation, PaymentMethodHandlerSelector, } from '@deenruv/react-ui-devkit';
|
|
4
4
|
import { X } from 'lucide-react';
|
|
5
|
+
const decodeConfigArgValue = (value) => {
|
|
6
|
+
try {
|
|
7
|
+
const result = JSON.parse(value);
|
|
8
|
+
if (result && typeof result === 'object' && !Array.isArray(result)) {
|
|
9
|
+
return JSON.stringify(result);
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const encodeConfigArgValue = (value) => {
|
|
18
|
+
return Array.isArray(value) ? JSON.stringify(value) : (value ?? '').toString();
|
|
19
|
+
};
|
|
20
|
+
const createInitialArguments = (args) => {
|
|
21
|
+
return args.map((arg) => ({
|
|
22
|
+
name: arg.name,
|
|
23
|
+
value: encodeConfigArgValue(arg.defaultValue),
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
5
26
|
export const CheckerCard = ({ currentCheckerValue, onCheckerValueChange, errors }) => {
|
|
6
27
|
const { t } = useTranslation('shippingMethods');
|
|
7
28
|
const [checkers, setCheckers] = useState([]);
|
|
@@ -25,20 +46,15 @@ export const CheckerCard = ({ currentCheckerValue, onCheckerValueChange, errors
|
|
|
25
46
|
if (correspondingChecker)
|
|
26
47
|
onCheckerValueChange({
|
|
27
48
|
code: correspondingChecker.code,
|
|
28
|
-
arguments: args
|
|
29
|
-
correspondingChecker.args.map((a) => ({
|
|
30
|
-
name: a.name,
|
|
31
|
-
value: 'false',
|
|
32
|
-
})),
|
|
49
|
+
arguments: args ?? createInitialArguments(correspondingChecker.args),
|
|
33
50
|
});
|
|
34
51
|
}, [checkers, onCheckerValueChange]);
|
|
35
52
|
const clearInput = useCallback(() => {
|
|
36
|
-
console.log('CLICK');
|
|
37
53
|
onCheckerValueChange(undefined);
|
|
38
54
|
}, [onCheckerValueChange]);
|
|
39
|
-
return (_jsx(CustomCard, { title: t('details.options.title'), icon: _jsx(CardIcons.check, {}), color: "teal", upperRight: _jsx(ErrorMessage, { errors: errors }), children: _jsxs("div", { className: "flex basis-full flex-col gap-3 md:basis-1/2", children: [_jsxs("div", { className: "flex items-end gap-1", children: [_jsx(SimpleSelect, { label: t('details.options.checker'), value: currentCheckerValue ? currentCheckerValue.code : '', onValueChange: handleCheckerValueChange, options: allCheckersOptions }), currentCheckerValue?.code && (_jsx(Button, { variant: 'secondary', className: "p-2", onClick: clearInput, children: _jsx(X, { size: 20 }) }))] }), _jsx("div", { className: "flex", children: currentCheckerValue?.arguments.map((e
|
|
55
|
+
return (_jsx(CustomCard, { title: t('details.options.title'), icon: _jsx(CardIcons.check, {}), color: "teal", upperRight: _jsx(ErrorMessage, { errors: errors }), children: _jsxs("div", { className: "flex basis-full flex-col gap-3 md:basis-1/2", children: [_jsxs("div", { className: "flex items-end gap-1", children: [_jsx(SimpleSelect, { label: t('details.options.checker'), value: currentCheckerValue ? currentCheckerValue.code : '', onValueChange: handleCheckerValueChange, options: allCheckersOptions }), currentCheckerValue?.code && (_jsx(Button, { variant: 'secondary', className: "p-2", onClick: clearInput, children: _jsx(X, { size: 20 }) }))] }), _jsx("div", { className: "flex", children: currentCheckerValue?.arguments.map((e) => {
|
|
40
56
|
const checker = checkers?.find((ch) => ch.code === currentCheckerValue.code);
|
|
41
|
-
const argument = checker?.args.find((a) => a.name ===
|
|
57
|
+
const argument = checker?.args.find((a) => a.name === e.name);
|
|
42
58
|
if (!argument)
|
|
43
59
|
return null;
|
|
44
60
|
return generateInputComponents([
|
|
@@ -48,7 +64,7 @@ export const CheckerCard = ({ currentCheckerValue, onCheckerValueChange, errors
|
|
|
48
64
|
description: [{ languageCode: 'en', value: argument.description || '' }],
|
|
49
65
|
},
|
|
50
66
|
], getInputComponent).map((field) => {
|
|
51
|
-
const value = e.value;
|
|
67
|
+
const value = decodeConfigArgValue(e.value);
|
|
52
68
|
const setValue = (data) => {
|
|
53
69
|
try {
|
|
54
70
|
onCheckerValueChange({
|
|
@@ -56,7 +72,7 @@ export const CheckerCard = ({ currentCheckerValue, onCheckerValueChange, errors
|
|
|
56
72
|
arguments: currentCheckerValue.arguments.map((a) => {
|
|
57
73
|
try {
|
|
58
74
|
if (a.name === field.name) {
|
|
59
|
-
return { name: field.name, value:
|
|
75
|
+
return { name: field.name, value: encodeConfigArgValue(data) };
|
|
60
76
|
}
|
|
61
77
|
}
|
|
62
78
|
catch {
|
|
@@ -70,7 +86,7 @@ export const CheckerCard = ({ currentCheckerValue, onCheckerValueChange, errors
|
|
|
70
86
|
console.error('Error setting value');
|
|
71
87
|
}
|
|
72
88
|
};
|
|
73
|
-
return (_jsx(
|
|
89
|
+
return (_jsx(InputFieldComponent, { field: field, value: value, setValue: setValue, additionalData: {} }, field.name));
|
|
74
90
|
});
|
|
75
91
|
}) })] }) }));
|
|
76
92
|
};
|
|
@@ -37,7 +37,7 @@ export const TaxRatesDetailPage = () => {
|
|
|
37
37
|
if (!id) {
|
|
38
38
|
throw new Error('Could not find the id.');
|
|
39
39
|
}
|
|
40
|
-
return remove({
|
|
40
|
+
return remove({ id });
|
|
41
41
|
}, [remove, id]);
|
|
42
42
|
return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "taxRates-detail-view", main: {
|
|
43
43
|
name: 'taxRate',
|
|
@@ -67,7 +67,7 @@ export const ZonesDetailPage = () => {
|
|
|
67
67
|
if (!id) {
|
|
68
68
|
throw new Error('Could not find the id.');
|
|
69
69
|
}
|
|
70
|
-
return remove({
|
|
70
|
+
return remove({ id });
|
|
71
71
|
}, [remove, id]);
|
|
72
72
|
return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "zones-detail-view", main: {
|
|
73
73
|
name: 'zone',
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ADMIN_DASHBOARD_VERSION = '1.0.
|
|
1
|
+
export const ADMIN_DASHBOARD_VERSION = '1.0.17-dev.15';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deenruv/admin-dashboard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17-dev.15",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"style": "dist/index.css",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,96 +13,96 @@
|
|
|
13
13
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
14
14
|
"@dnd-kit/sortable": "^10.0.0",
|
|
15
15
|
"@dnd-kit/utilities": "^3.2.2",
|
|
16
|
-
"@hookform/resolvers": "^5.
|
|
17
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
18
|
-
"@radix-ui/react-alert-dialog": "^1.1.
|
|
19
|
-
"@radix-ui/react-aspect-ratio": "^1.1.
|
|
20
|
-
"@radix-ui/react-checkbox": "^1.3.
|
|
21
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
22
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
23
|
-
"@radix-ui/react-hover-card": "^1.1.
|
|
16
|
+
"@hookform/resolvers": "^5.4.0",
|
|
17
|
+
"@radix-ui/react-accordion": "^1.2.14",
|
|
18
|
+
"@radix-ui/react-alert-dialog": "^1.1.17",
|
|
19
|
+
"@radix-ui/react-aspect-ratio": "^1.1.10",
|
|
20
|
+
"@radix-ui/react-checkbox": "^1.3.5",
|
|
21
|
+
"@radix-ui/react-dialog": "^1.1.17",
|
|
22
|
+
"@radix-ui/react-dropdown-menu": "^2.1.18",
|
|
23
|
+
"@radix-ui/react-hover-card": "^1.1.17",
|
|
24
24
|
"@radix-ui/react-icons": "^1.3.2",
|
|
25
|
-
"@radix-ui/react-label": "^2.1.
|
|
26
|
-
"@radix-ui/react-popover": "^1.1.
|
|
27
|
-
"@radix-ui/react-radio-group": "^1.
|
|
28
|
-
"@radix-ui/react-scroll-area": "^1.2.
|
|
29
|
-
"@radix-ui/react-select": "^2.
|
|
30
|
-
"@radix-ui/react-separator": "^1.1.
|
|
31
|
-
"@radix-ui/react-slot": "^1.
|
|
32
|
-
"@radix-ui/react-switch": "^1.
|
|
33
|
-
"@radix-ui/react-tabs": "^1.1.
|
|
34
|
-
"@radix-ui/react-toast": "^1.2.
|
|
35
|
-
"@radix-ui/react-toggle": "^1.1.
|
|
36
|
-
"@radix-ui/react-toggle-group": "^1.1.
|
|
37
|
-
"@radix-ui/react-tooltip": "^1.2.
|
|
25
|
+
"@radix-ui/react-label": "^2.1.10",
|
|
26
|
+
"@radix-ui/react-popover": "^1.1.17",
|
|
27
|
+
"@radix-ui/react-radio-group": "^1.4.1",
|
|
28
|
+
"@radix-ui/react-scroll-area": "^1.2.12",
|
|
29
|
+
"@radix-ui/react-select": "^2.3.1",
|
|
30
|
+
"@radix-ui/react-separator": "^1.1.10",
|
|
31
|
+
"@radix-ui/react-slot": "^1.3.0",
|
|
32
|
+
"@radix-ui/react-switch": "^1.3.1",
|
|
33
|
+
"@radix-ui/react-tabs": "^1.1.15",
|
|
34
|
+
"@radix-ui/react-toast": "^1.2.17",
|
|
35
|
+
"@radix-ui/react-toggle": "^1.1.12",
|
|
36
|
+
"@radix-ui/react-toggle-group": "^1.1.13",
|
|
37
|
+
"@radix-ui/react-tooltip": "^1.2.10",
|
|
38
38
|
"@tanstack/react-table": "^8.21.3",
|
|
39
|
-
"@tiptap/extension-document": "^3.
|
|
40
|
-
"@tiptap/extension-heading": "^3.
|
|
41
|
-
"@tiptap/extension-paragraph": "^3.
|
|
42
|
-
"@tiptap/extension-text": "^3.
|
|
43
|
-
"@tiptap/pm": "^3.
|
|
44
|
-
"@tiptap/react": "^3.
|
|
45
|
-
"@tiptap/starter-kit": "^3.
|
|
39
|
+
"@tiptap/extension-document": "^3.27.1",
|
|
40
|
+
"@tiptap/extension-heading": "^3.27.1",
|
|
41
|
+
"@tiptap/extension-paragraph": "^3.27.1",
|
|
42
|
+
"@tiptap/extension-text": "^3.27.1",
|
|
43
|
+
"@tiptap/pm": "^3.27.1",
|
|
44
|
+
"@tiptap/react": "^3.27.1",
|
|
45
|
+
"@tiptap/starter-kit": "^3.27.1",
|
|
46
46
|
"class-variance-authority": "^0.7.1",
|
|
47
47
|
"clsx": "^2.1.1",
|
|
48
48
|
"cmdk": "^1.1.1",
|
|
49
49
|
"compression": "^1.8.1",
|
|
50
|
-
"date-fns": "^4.
|
|
50
|
+
"date-fns": "^4.4.0",
|
|
51
51
|
"express": "^5.2.1",
|
|
52
|
-
"framer-motion": "^12.
|
|
53
|
-
"i18next": "^
|
|
54
|
-
"i18next-browser-languagedetector": "^8.2.
|
|
52
|
+
"framer-motion": "^12.40.0",
|
|
53
|
+
"i18next": "^26.3.1",
|
|
54
|
+
"i18next-browser-languagedetector": "^8.2.1",
|
|
55
55
|
"localforage": "^1.10.0",
|
|
56
|
-
"lucide-react": "^
|
|
57
|
-
"match-sorter": "^8.
|
|
56
|
+
"lucide-react": "^1.21.0",
|
|
57
|
+
"match-sorter": "^8.3.0",
|
|
58
58
|
"next-themes": "^0.4.6",
|
|
59
|
-
"react": "^19.2.
|
|
59
|
+
"react": "^19.2.7",
|
|
60
60
|
"react-color": "^2.19.3",
|
|
61
|
-
"react-day-picker": "^
|
|
62
|
-
"react-dom": "^19.2.
|
|
63
|
-
"react-hook-form": "^7.
|
|
64
|
-
"react-i18next": "^
|
|
65
|
-
"react-is": "^19.2.
|
|
66
|
-
"react-resizable-panels": "^
|
|
67
|
-
"react-router": "^
|
|
68
|
-
"recharts": "^3.
|
|
69
|
-
"rimraf": "^6.1.
|
|
61
|
+
"react-day-picker": "^10.0.1",
|
|
62
|
+
"react-dom": "^19.2.7",
|
|
63
|
+
"react-hook-form": "^7.80.0",
|
|
64
|
+
"react-i18next": "^17.0.8",
|
|
65
|
+
"react-is": "^19.2.7",
|
|
66
|
+
"react-resizable-panels": "^4.11.2",
|
|
67
|
+
"react-router": "^8.0.1",
|
|
68
|
+
"recharts": "^3.8.1",
|
|
69
|
+
"rimraf": "^6.1.3",
|
|
70
70
|
"sirv": "^3.0.2",
|
|
71
71
|
"socket.io-client": "^4.8.3",
|
|
72
72
|
"sonner": "^2.0.7",
|
|
73
73
|
"sort-by": "^1.2.0",
|
|
74
|
-
"tailwind-merge": "^3.
|
|
75
|
-
"ts-patch": "^
|
|
76
|
-
"typescript-transform-paths": "^
|
|
77
|
-
"use-debounce": "^10.1.
|
|
78
|
-
"uuid": "^
|
|
74
|
+
"tailwind-merge": "^3.6.0",
|
|
75
|
+
"ts-patch": "^4.0.1",
|
|
76
|
+
"typescript-transform-paths": "^4.0.0",
|
|
77
|
+
"use-debounce": "^10.1.1",
|
|
78
|
+
"uuid": "^14.0.1",
|
|
79
79
|
"vaul": "^1.1.2",
|
|
80
80
|
"yup": "^1.7.1",
|
|
81
|
-
"zod": "^4.3
|
|
82
|
-
"zustand": "^5.0.
|
|
83
|
-
"@deenruv/admin-dashboard": "1.0.
|
|
84
|
-
"@deenruv/admin-types": "1.0.
|
|
85
|
-
"@deenruv/deenruv-examples-plugin": "1.0.
|
|
86
|
-
"@deenruv/react-ui-devkit": "1.0.
|
|
81
|
+
"zod": "^4.4.3",
|
|
82
|
+
"zustand": "^5.0.14",
|
|
83
|
+
"@deenruv/admin-dashboard": "1.0.17-dev.15",
|
|
84
|
+
"@deenruv/admin-types": "1.0.17-dev.15",
|
|
85
|
+
"@deenruv/deenruv-examples-plugin": "1.0.17-dev.15",
|
|
86
|
+
"@deenruv/react-ui-devkit": "1.0.17-dev.15"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@tailwindcss/typography": "^0.5.
|
|
89
|
+
"@tailwindcss/typography": "^0.5.20",
|
|
90
90
|
"@types/express": "^5.0.6",
|
|
91
|
-
"@types/react": "^19.2.
|
|
91
|
+
"@types/react": "^19.2.17",
|
|
92
92
|
"@types/react-color": "^3.0.13",
|
|
93
93
|
"@types/react-dom": "^19.2.3",
|
|
94
94
|
"@types/uuid": "^11.0.0",
|
|
95
|
-
"@vitejs/plugin-react-swc": "^4.
|
|
96
|
-
"eslint": "^9.
|
|
97
|
-
"graphql-zeus": "^7.1
|
|
98
|
-
"i18next-resources-for-ts": "^2.
|
|
99
|
-
"tailwindcss": "^4.1
|
|
100
|
-
"tsx": "^4.
|
|
95
|
+
"@vitejs/plugin-react-swc": "^4.3.1",
|
|
96
|
+
"eslint": "^9.39.4",
|
|
97
|
+
"graphql-zeus": "^7.2.1",
|
|
98
|
+
"i18next-resources-for-ts": "^2.1.0",
|
|
99
|
+
"tailwindcss": "^4.3.1",
|
|
100
|
+
"tsx": "^4.22.4",
|
|
101
101
|
"tw-animate-css": "^1.4.0",
|
|
102
|
-
"typescript": "~
|
|
103
|
-
"vite": "^
|
|
104
|
-
"vite-plugin-i18next-loader": "^
|
|
105
|
-
"vite-tsconfig-paths": "^6.1.
|
|
102
|
+
"typescript": "~6.0.3",
|
|
103
|
+
"vite": "^8.0.16",
|
|
104
|
+
"vite-plugin-i18next-loader": "^4.0.1",
|
|
105
|
+
"vite-tsconfig-paths": "^6.1.1"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
108
|
"watch": "tspc --watch",
|