@deenruv/facet-harmonica-plugin 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +40 -0
  3. package/dist/plugin-server/index.d.ts +4 -0
  4. package/dist/plugin-server/index.js +128 -0
  5. package/dist/plugin-server/zeus/const.d.ts +6 -0
  6. package/dist/plugin-server/zeus/const.js +3706 -0
  7. package/dist/plugin-server/zeus/index.d.ts +18922 -0
  8. package/dist/plugin-server/zeus/index.js +1093 -0
  9. package/dist/plugin-server/zeus/typedDocumentNode.d.ts +3 -0
  10. package/dist/plugin-server/zeus/typedDocumentNode.js +16 -0
  11. package/dist/plugin-ui/components/CheckboxAccordion.d.ts +10 -0
  12. package/dist/plugin-ui/components/CheckboxAccordion.js +14 -0
  13. package/dist/plugin-ui/components/DedicatedButtons.d.ts +2 -0
  14. package/dist/plugin-ui/components/DedicatedButtons.js +54 -0
  15. package/dist/plugin-ui/components/FacetHarmonica.d.ts +2 -0
  16. package/dist/plugin-ui/components/FacetHarmonica.js +59 -0
  17. package/dist/plugin-ui/components/index.d.ts +1 -0
  18. package/dist/plugin-ui/components/index.js +1 -0
  19. package/dist/plugin-ui/graphql/index.d.ts +1 -0
  20. package/dist/plugin-ui/graphql/index.js +1 -0
  21. package/dist/plugin-ui/graphql/mutations.d.ts +18 -0
  22. package/dist/plugin-ui/graphql/mutations.js +9 -0
  23. package/dist/plugin-ui/graphql/queries.d.ts +122 -0
  24. package/dist/plugin-ui/graphql/queries.js +11 -0
  25. package/dist/plugin-ui/graphql/scalars.d.ts +13 -0
  26. package/dist/plugin-ui/graphql/scalars.js +14 -0
  27. package/dist/plugin-ui/graphql/selectors.d.ts +69 -0
  28. package/dist/plugin-ui/graphql/selectors.js +27 -0
  29. package/dist/plugin-ui/index.d.ts +1 -0
  30. package/dist/plugin-ui/index.js +23 -0
  31. package/dist/plugin-ui/locales/en/accordion.json +5 -0
  32. package/dist/plugin-ui/locales/en/index.d.ts +6 -0
  33. package/dist/plugin-ui/locales/en/index.js +2 -0
  34. package/dist/plugin-ui/locales/pl/accordion.json +5 -0
  35. package/dist/plugin-ui/locales/pl/index.d.ts +6 -0
  36. package/dist/plugin-ui/locales/pl/index.js +2 -0
  37. package/dist/plugin-ui/tables.d.ts +5 -0
  38. package/dist/plugin-ui/tables.js +55 -0
  39. package/dist/plugin-ui/translation-ns.d.ts +1 -0
  40. package/dist/plugin-ui/translation-ns.js +1 -0
  41. package/dist/plugin-ui/tsconfig.json +18 -0
  42. package/dist/plugin-ui/zeus/const.d.ts +6 -0
  43. package/dist/plugin-ui/zeus/const.js +3703 -0
  44. package/dist/plugin-ui/zeus/index.d.ts +18922 -0
  45. package/dist/plugin-ui/zeus/index.js +1085 -0
  46. package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +3 -0
  47. package/dist/plugin-ui/zeus/typedDocumentNode.js +9 -0
  48. package/package.json +48 -0
@@ -0,0 +1,3 @@
1
+ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
2
+ import { ValueTypes, GenericOperation, OperationOptions, GraphQLTypes, InputType, ScalarDefinition, ThunderGraphQLOptions, ExtractVariables } from './';
3
+ export declare const typedGql: <O extends "query" | "mutation", SCLR extends ScalarDefinition, R extends keyof ValueTypes = GenericOperation<O>>(operation: O, graphqlOptions?: ThunderGraphQLOptions<SCLR> | undefined) => <Z extends ValueTypes[R]>(o: Z & { [P in keyof Z]: P extends keyof ValueTypes[R] ? Z[P] : never; }, ops?: OperationOptions) => TypedDocumentNode<InputType<GraphQLTypes[R], Z, SCLR>, ExtractVariables<Z>>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.typedGql = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ const _1 = require("./");
9
+ const typedGql = (operation, graphqlOptions) => (o, ops) => {
10
+ const str = (0, _1.Zeus)(operation, o, {
11
+ operationOptions: ops,
12
+ scalars: graphqlOptions === null || graphqlOptions === void 0 ? void 0 : graphqlOptions.scalars,
13
+ });
14
+ return (0, graphql_tag_1.default)(str);
15
+ };
16
+ exports.typedGql = typedGql;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { FacetValue } from "../graphql";
3
+ interface CheckboxAccordionProps {
4
+ checkedFacetsIds?: string[];
5
+ title: string | undefined;
6
+ allFacets: FacetValue[] | undefined;
7
+ onChange: (itemId: string, checked: boolean) => void;
8
+ }
9
+ export declare const CheckboxAccordion: React.FC<CheckboxAccordionProps>;
10
+ export {};
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Checkbox, Label, } from "@deenruv/react-ui-devkit";
3
+ export const CheckboxAccordion = ({ checkedFacetsIds, title, allFacets, onChange, }) => {
4
+ return (React.createElement(Accordion, { type: "single", collapsible: true, className: "w-full" },
5
+ React.createElement(AccordionItem, { value: "item-1" },
6
+ React.createElement(AccordionTrigger, null, title),
7
+ React.createElement(AccordionContent, null,
8
+ React.createElement("div", { className: "grid grid-cols-4 gap-4" }, allFacets?.map((f) => (React.createElement("div", { key: f.code, className: "flex items-center gap-3" },
9
+ React.createElement(Checkbox, { name: f.code, id: f.code, checked: checkedFacetsIds?.includes(f.id), onCheckedChange: (e) => onChange(f.id, e) }),
10
+ React.createElement(Label, { htmlFor: f.code, className: "flex items-center gap-2 font-normal" },
11
+ f.customFields?.hexColor &&
12
+ f.customFields?.hexColor !== "#" && (React.createElement("div", { className: "border-gray size-4 rounded-full border border-solid", style: { backgroundColor: f.customFields?.hexColor } })),
13
+ f.name)))))))));
14
+ };
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const DedicatedButtons: () => React.JSX.Element | null;
@@ -0,0 +1,54 @@
1
+ import { Button, Dialog, DialogContent, DialogTrigger, ORDER_STATE, useDetailView, useTranslation, } from "@deenruv/react-ui-devkit";
2
+ import { NotepadText, Printer } from "lucide-react";
3
+ import React from "react";
4
+ const illegalStates = [
5
+ ORDER_STATE.DRAFT,
6
+ ORDER_STATE.ADDING_ITEMS,
7
+ ORDER_STATE.ARRANGING_PAYMENT,
8
+ ORDER_STATE.MODIFYING,
9
+ ORDER_STATE.PAYMENT_AUTHORIZED,
10
+ ORDER_STATE.PAYMENT_SETTLED,
11
+ ORDER_STATE.CANCELLED,
12
+ ];
13
+ export const DedicatedButtons = () => {
14
+ const { t } = useTranslation();
15
+ const { entity: order } = useDetailView("orders-detail-view");
16
+ const createProforma = async (type) => {
17
+ if (!order)
18
+ return;
19
+ // const { sendInvoiceToWFirma } = await apiClient('mutation')({
20
+ // sendInvoiceToWFirma: [
21
+ // { input: { orderID: order.id, invoiceType: type === 'proforma' ? 'proforma' : 'receipt_fiscal_normal' } },
22
+ // { url: true },
23
+ // ],
24
+ // });
25
+ // if (sendInvoiceToWFirma) {
26
+ // window.open(
27
+ // type === 'proforma' ? 'https://wfirma.pl/invoices/index/proforma' : 'https://wfirma.pl/invoices/index/all',
28
+ // '_blank',
29
+ // );
30
+ // toast.success(t(type === 'proforma' ? 'invoice.createProformaSuccess' : 'invoice.createReceiptSuccess'));
31
+ // } else {
32
+ // toast.error(t(type === 'proforma' ? 'invoice.createProformaError' : 'invoice.createReceiptError'));
33
+ // }
34
+ };
35
+ if (!order || illegalStates.includes(order.state)) {
36
+ return null;
37
+ }
38
+ return (React.createElement(React.Fragment, null,
39
+ React.createElement(Button, { className: "flex gap-2", onClick: () => createProforma("proforma") },
40
+ React.createElement(Printer, { size: 20 }),
41
+ " ",
42
+ t("invoice.createProformaButton")),
43
+ React.createElement(Button, { className: "flex gap-2", onClick: () => createProforma("receipt") },
44
+ React.createElement(Printer, { size: 20 }),
45
+ " ",
46
+ t("invoice.createReceiptButton")),
47
+ React.createElement(Dialog, null,
48
+ React.createElement(DialogTrigger, { asChild: true },
49
+ React.createElement(Button, { variant: "secondary", className: "flex gap-2" },
50
+ React.createElement(NotepadText, { size: 20 }),
51
+ " ",
52
+ t("realization.createRealization"))),
53
+ React.createElement(DialogContent, { className: "min-w-[60vw]" }))));
54
+ };
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const FacetHarmonica: () => React.JSX.Element;
@@ -0,0 +1,59 @@
1
+ import React, { useMemo } from "react";
2
+ import { Card, CardContent, CardHeader, CardTitle, useDetailView, useQuery, useTranslation, } from "@deenruv/react-ui-devkit";
3
+ import { translationNS } from "../translation-ns";
4
+ import { CheckboxAccordion } from "./CheckboxAccordion";
5
+ import { FACETS_QUERY } from "../graphql/queries.js";
6
+ import { SortOrder } from "@deenruv/admin-types";
7
+ export const FacetHarmonica = () => {
8
+ const { t } = useTranslation(translationNS);
9
+ const { entity, setEntity } = useDetailView("products-detail-view", "UpdateProductInput");
10
+ const { data } = useQuery(FACETS_QUERY, {
11
+ initialVariables: {
12
+ facetOptions: {
13
+ sort: {
14
+ createdAt: SortOrder.ASC,
15
+ usedForProductCreations: SortOrder.ASC,
16
+ },
17
+ },
18
+ },
19
+ });
20
+ const handleFacetCheckboxChange = (facetValueId, checked) => {
21
+ const facetValue = data?.facets?.items
22
+ ?.map((f) => f.values)
23
+ .flat()
24
+ .find((f) => f.id === facetValueId);
25
+ if (!facetValue)
26
+ return;
27
+ const newFacetValues = checked
28
+ ? [...(entity?.facetValues || []), facetValue]
29
+ : entity?.facetValues?.filter((f) => f.id !== facetValueId);
30
+ const facetValues = newFacetValues?.filter((v, i, a) => a.findIndex((t) => t.id === v.id) === i);
31
+ if (!newFacetValues)
32
+ return;
33
+ setEntity({ ...entity, facetValues });
34
+ };
35
+ const checkedFacetsIds = useMemo(() => entity?.facetValues.map((f) => f.id), [entity?.facetValues]);
36
+ const { mainFacets, colorFacets, otherFacets } = useMemo(() => {
37
+ const mainFacets = data?.facets?.items?.filter((f) => f.customFields?.usedForProductCreations);
38
+ const colorFacets = data?.facets?.items?.filter((f) => f.customFields?.colorsCollection);
39
+ const otherFacets = data?.facets?.items?.filter((f) => !f.customFields?.colorsCollection &&
40
+ !f.customFields?.usedForProductCreations);
41
+ return { mainFacets, colorFacets, otherFacets };
42
+ }, [data?.facets?.items]);
43
+ return (React.createElement(React.Fragment, null,
44
+ mainFacets?.length ? (React.createElement(Card, null,
45
+ React.createElement(CardHeader, null,
46
+ React.createElement(CardTitle, { className: "flex flex-row justify-between text-base" }, t("colors"))),
47
+ React.createElement(CardContent, null,
48
+ React.createElement("div", { className: "flex flex-col" }, mainFacets?.map((f) => (React.createElement(CheckboxAccordion, { key: f.id, title: f.name, allFacets: f.values, checkedFacetsIds: checkedFacetsIds, onChange: handleFacetCheckboxChange }))))))) : null,
49
+ colorFacets?.length ? (React.createElement(Card, null,
50
+ React.createElement(CardHeader, null,
51
+ React.createElement(CardTitle, { className: "flex flex-row justify-between text-base" }, t("colorPalettes"))),
52
+ React.createElement(CardContent, null,
53
+ React.createElement("div", { className: "flex flex-col" }, colorFacets?.map((f) => (React.createElement(CheckboxAccordion, { key: f.id, title: f.name, allFacets: f.values, checkedFacetsIds: checkedFacetsIds, onChange: handleFacetCheckboxChange }))))))) : null,
54
+ otherFacets?.length ? (React.createElement(Card, null,
55
+ React.createElement(CardHeader, null,
56
+ React.createElement(CardTitle, { className: "flex flex-row justify-between text-base" }, t("otherOptions"))),
57
+ React.createElement(CardContent, null,
58
+ React.createElement("div", { className: "flex flex-col" }, otherFacets?.map((f) => (React.createElement(CheckboxAccordion, { key: f.id, title: f.name, allFacets: f.values, checkedFacetsIds: checkedFacetsIds, onChange: handleFacetCheckboxChange }))))))) : null));
59
+ };
@@ -0,0 +1 @@
1
+ export * from "./FacetHarmonica";
@@ -0,0 +1 @@
1
+ export * from "./FacetHarmonica";
@@ -0,0 +1 @@
1
+ export * from "./selectors";
@@ -0,0 +1 @@
1
+ export * from "./selectors";
@@ -0,0 +1,18 @@
1
+ export declare const DO_REALIZATION: import("@graphql-typed-document-node/core").TypedDocumentNode<{
2
+ registerRealization?: {
3
+ url?: string | null | undefined;
4
+ } | undefined;
5
+ }, {} & {
6
+ input: {
7
+ orderID: string | import("../zeus/index.js").Variable<any, string>;
8
+ assets: import("../zeus/index.js").Variable<any, string> | {
9
+ id: string | import("../zeus/index.js").Variable<any, string>;
10
+ orderLineID: string | import("../zeus/index.js").Variable<any, string>;
11
+ preview: string | import("../zeus/index.js").Variable<any, string>;
12
+ }[];
13
+ plannedAt: string | import("../zeus/index.js").Variable<any, string>;
14
+ finalPlannedAt: string | import("../zeus/index.js").Variable<any, string>;
15
+ note: string | import("../zeus/index.js").Variable<any, string>;
16
+ color: string | import("../zeus/index.js").Variable<any, string>;
17
+ };
18
+ }>;
@@ -0,0 +1,9 @@
1
+ import { scalars } from "@deenruv/admin-types";
2
+ import { typedGql } from "../zeus/typedDocumentNode.js";
3
+ import { $ } from "../zeus/index.js";
4
+ export const DO_REALIZATION = typedGql("mutation", { scalars })({
5
+ registerRealization: [
6
+ { input: $("input", "OrderRealizationInput!") },
7
+ { url: true },
8
+ ],
9
+ });
@@ -0,0 +1,122 @@
1
+ export declare const FACETS_QUERY: import("@graphql-typed-document-node/core").TypedDocumentNode<{
2
+ facets: {
3
+ items: {
4
+ values: {
5
+ id: string;
6
+ customFields?: {
7
+ hexColor?: string | null | undefined;
8
+ isNew?: boolean | null | undefined;
9
+ isHidden?: boolean | null | undefined;
10
+ image?: {
11
+ id: string;
12
+ preview: string;
13
+ } | undefined;
14
+ } | undefined;
15
+ name: string;
16
+ code: string;
17
+ }[];
18
+ id: string;
19
+ customFields?: {
20
+ usedForColors?: boolean | null | undefined;
21
+ usedForProductCreations?: boolean | null | undefined;
22
+ colorsCollection?: boolean | null | undefined;
23
+ } | undefined;
24
+ name: string;
25
+ code: string;
26
+ }[];
27
+ totalItems: number;
28
+ };
29
+ }, {} & {
30
+ facetOptions: {
31
+ skip?: number | import("../zeus/index.js").Variable<any, string> | null | undefined;
32
+ take?: number | import("../zeus/index.js").Variable<any, string> | null | undefined;
33
+ sort?: {
34
+ id?: import("../zeus/index.js").SortOrder | import("../zeus/index.js").Variable<any, string> | null | undefined;
35
+ createdAt?: import("../zeus/index.js").SortOrder | import("../zeus/index.js").Variable<any, string> | null | undefined;
36
+ updatedAt?: import("../zeus/index.js").SortOrder | import("../zeus/index.js").Variable<any, string> | null | undefined;
37
+ name?: import("../zeus/index.js").SortOrder | import("../zeus/index.js").Variable<any, string> | null | undefined;
38
+ code?: import("../zeus/index.js").SortOrder | import("../zeus/index.js").Variable<any, string> | null | undefined;
39
+ usedForColors?: import("../zeus/index.js").SortOrder | import("../zeus/index.js").Variable<any, string> | null | undefined;
40
+ usedForProductCreations?: import("../zeus/index.js").SortOrder | import("../zeus/index.js").Variable<any, string> | null | undefined;
41
+ colorsCollection?: import("../zeus/index.js").SortOrder | import("../zeus/index.js").Variable<any, string> | null | undefined;
42
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
43
+ filter?: {
44
+ isPrivate?: {
45
+ eq?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
46
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
47
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
48
+ id?: {
49
+ eq?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
50
+ notEq?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
51
+ in?: string[] | import("../zeus/index.js").Variable<any, string> | null | undefined;
52
+ notIn?: string[] | import("../zeus/index.js").Variable<any, string> | null | undefined;
53
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
54
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
55
+ createdAt?: {
56
+ eq?: unknown;
57
+ before?: unknown;
58
+ after?: unknown;
59
+ between?: {
60
+ start: unknown;
61
+ end: unknown;
62
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
63
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
64
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
65
+ updatedAt?: {
66
+ eq?: unknown;
67
+ before?: unknown;
68
+ after?: unknown;
69
+ between?: {
70
+ start: unknown;
71
+ end: unknown;
72
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
73
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
74
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
75
+ languageCode?: {
76
+ eq?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
77
+ notEq?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
78
+ contains?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
79
+ notContains?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
80
+ in?: string[] | import("../zeus/index.js").Variable<any, string> | null | undefined;
81
+ notIn?: string[] | import("../zeus/index.js").Variable<any, string> | null | undefined;
82
+ regex?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
83
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
84
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
85
+ name?: {
86
+ eq?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
87
+ notEq?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
88
+ contains?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
89
+ notContains?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
90
+ in?: string[] | import("../zeus/index.js").Variable<any, string> | null | undefined;
91
+ notIn?: string[] | import("../zeus/index.js").Variable<any, string> | null | undefined;
92
+ regex?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
93
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
94
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
95
+ code?: {
96
+ eq?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
97
+ notEq?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
98
+ contains?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
99
+ notContains?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
100
+ in?: string[] | import("../zeus/index.js").Variable<any, string> | null | undefined;
101
+ notIn?: string[] | import("../zeus/index.js").Variable<any, string> | null | undefined;
102
+ regex?: string | import("../zeus/index.js").Variable<any, string> | null | undefined;
103
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
104
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
105
+ _and?: import("../zeus/index.js").Variable<any, string> | any[] | null | undefined;
106
+ _or?: import("../zeus/index.js").Variable<any, string> | any[] | null | undefined;
107
+ usedForColors?: {
108
+ eq?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
109
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
110
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
111
+ usedForProductCreations?: {
112
+ eq?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
113
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
114
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
115
+ colorsCollection?: {
116
+ eq?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
117
+ isNull?: boolean | import("../zeus/index.js").Variable<any, string> | null | undefined;
118
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
119
+ } | import("../zeus/index.js").Variable<any, string> | null | undefined;
120
+ filterOperator?: import("../zeus/index.js").LogicalOperator | import("../zeus/index.js").Variable<any, string> | null | undefined;
121
+ };
122
+ }>;
@@ -0,0 +1,11 @@
1
+ import { typedGql } from "../zeus/typedDocumentNode.js";
2
+ import { $ } from "../zeus/index.js";
3
+ import { scalars } from "./scalars.js";
4
+ import { FacetListOptionsSelector } from "./selectors.js";
5
+ const query = typedGql("query", { scalars });
6
+ export const FACETS_QUERY = query({
7
+ facets: [
8
+ { options: $("facetOptions", "FacetListOptions!") },
9
+ FacetListOptionsSelector,
10
+ ],
11
+ });
@@ -0,0 +1,13 @@
1
+ export declare const scalars: {
2
+ DateTime: {
3
+ decode: (e: unknown) => string;
4
+ encode: (e: unknown) => string;
5
+ };
6
+ JSON: {
7
+ decode: (e: unknown) => any;
8
+ encode: (e: unknown) => string;
9
+ };
10
+ Money: {
11
+ decode: (e: unknown) => number;
12
+ };
13
+ };
@@ -0,0 +1,14 @@
1
+ import { ZeusScalars } from "../zeus";
2
+ export const scalars = ZeusScalars({
3
+ DateTime: {
4
+ decode: (e) => new Date(e).toISOString(),
5
+ encode: (e) => e.toISOString(),
6
+ },
7
+ JSON: {
8
+ decode: (e) => JSON.parse(e),
9
+ encode: (e) => JSON.stringify(e),
10
+ },
11
+ Money: {
12
+ decode: (e) => e,
13
+ },
14
+ });
@@ -0,0 +1,69 @@
1
+ import { FromSelector } from "../zeus";
2
+ declare const FacetValueSelector: {
3
+ id: true;
4
+ name: true;
5
+ code: true;
6
+ customFields: {
7
+ hexColor: true;
8
+ image: {
9
+ id: true;
10
+ preview: true;
11
+ };
12
+ isHidden: true;
13
+ isNew: true;
14
+ };
15
+ };
16
+ declare const FacetSelector: {
17
+ id: true;
18
+ name: true;
19
+ code: true;
20
+ customFields: {
21
+ colorsCollection: true;
22
+ usedForColors: true;
23
+ usedForProductCreations: true;
24
+ };
25
+ values: {
26
+ id: true;
27
+ name: true;
28
+ code: true;
29
+ customFields: {
30
+ hexColor: true;
31
+ image: {
32
+ id: true;
33
+ preview: true;
34
+ };
35
+ isHidden: true;
36
+ isNew: true;
37
+ };
38
+ };
39
+ };
40
+ export declare const FacetListOptionsSelector: {
41
+ items: {
42
+ id: true;
43
+ name: true;
44
+ code: true;
45
+ customFields: {
46
+ colorsCollection: true;
47
+ usedForColors: true;
48
+ usedForProductCreations: true;
49
+ };
50
+ values: {
51
+ id: true;
52
+ name: true;
53
+ code: true;
54
+ customFields: {
55
+ hexColor: true;
56
+ image: {
57
+ id: true;
58
+ preview: true;
59
+ };
60
+ isHidden: true;
61
+ isNew: true;
62
+ };
63
+ };
64
+ };
65
+ totalItems: true;
66
+ };
67
+ export type FacetValue = FromSelector<typeof FacetValueSelector, "FacetValue">;
68
+ export type Facet = FromSelector<typeof FacetSelector, "Facet">;
69
+ export {};
@@ -0,0 +1,27 @@
1
+ import { Selector } from "../zeus";
2
+ const FacetValueSelector = Selector("FacetValue")({
3
+ id: true,
4
+ name: true,
5
+ code: true,
6
+ customFields: {
7
+ hexColor: true,
8
+ image: { id: true, preview: true },
9
+ isHidden: true,
10
+ isNew: true,
11
+ },
12
+ });
13
+ const FacetSelector = Selector("Facet")({
14
+ id: true,
15
+ name: true,
16
+ code: true,
17
+ customFields: {
18
+ colorsCollection: true,
19
+ usedForColors: true,
20
+ usedForProductCreations: true,
21
+ },
22
+ values: FacetValueSelector,
23
+ });
24
+ export const FacetListOptionsSelector = Selector("FacetList")({
25
+ items: FacetSelector,
26
+ totalItems: true,
27
+ });
@@ -0,0 +1 @@
1
+ export declare const FacetHarmonicaUiPlugin: import("@deenruv/react-ui-devkit").DeenruvUIPlugin<Record<string, any>>;
@@ -0,0 +1,23 @@
1
+ import { createDeenruvUIPlugin } from "@deenruv/react-ui-devkit";
2
+ import pl from "./locales/pl";
3
+ import en from "./locales/en";
4
+ import { translationNS } from "./translation-ns";
5
+ import { FacetHarmonica } from "./components";
6
+ import { tables } from "./tables.js";
7
+ import { DedicatedButtons } from "./components/DedicatedButtons.js";
8
+ export const FacetHarmonicaUiPlugin = createDeenruvUIPlugin({
9
+ version: "1.0.0",
10
+ name: "Facet Harmonica",
11
+ components: [
12
+ {
13
+ id: "products-detail-view",
14
+ component: FacetHarmonica,
15
+ },
16
+ ],
17
+ // FacetsAccordions
18
+ tables,
19
+ translations: { ns: translationNS, data: { en, pl } },
20
+ actions: {
21
+ inline: [{ id: "orders-detail-view", component: DedicatedButtons }],
22
+ },
23
+ });
@@ -0,0 +1,5 @@
1
+ {
2
+ "colors": "Colors",
3
+ "colorPalettes": "Color palettes",
4
+ "otherOptions": "Other options"
5
+ }
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ colors: string;
3
+ colorPalettes: string;
4
+ otherOptions: string;
5
+ }[];
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import accordion from "./accordion.json";
2
+ export default [accordion];
@@ -0,0 +1,5 @@
1
+ {
2
+ "colors": "Kolory",
3
+ "colorPalettes": "Palety kolorów",
4
+ "otherOptions": "Inne opcje"
5
+ }
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ colors: string;
3
+ colorPalettes: string;
4
+ otherOptions: string;
5
+ }[];
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import accordion from "./accordion.json";
2
+ export default [accordion];
@@ -0,0 +1,5 @@
1
+ import { DeenruvUIPlugin } from "@deenruv/react-ui-devkit";
2
+ import { ScalarsType } from "@deenruv/admin-types";
3
+ import { FromSelector, GraphQLTypes } from "./zeus/index.js";
4
+ export type FromSelectorWithScalars<SELECTOR, NAME extends keyof GraphQLTypes> = FromSelector<SELECTOR, NAME, ScalarsType>;
5
+ export declare const tables: DeenruvUIPlugin["tables"];
@@ -0,0 +1,55 @@
1
+ import { Tooltip, TooltipContent, TooltipTrigger, } from "@deenruv/react-ui-devkit";
2
+ import React from "react";
3
+ import { CircleOff, CheckCircle, XCircle, ImageOff } from "lucide-react";
4
+ // declare module '@deenruv/react-ui-devkit' {
5
+ // interface ExternalListLocationSelector {
6
+ // 'products-list-view': FromSelectorWithScalars<GraphQLTypes['Product'], 'Product'>;
7
+ // 'products-list-views': FromSelectorWithScalars<GraphQLTypes['Product'], 'Product'>;
8
+ // }
9
+ // }
10
+ export const tables = [
11
+ {
12
+ id: "facet-values-list",
13
+ columns: [
14
+ {
15
+ accessorKey: "customFields.hexColor",
16
+ header: () => "Color",
17
+ cell: ({ row }) => {
18
+ const color =
19
+ // @ts-ignore
20
+ row.original.customFields.hexColor;
21
+ return !color || color === "---" ? (React.createElement(CircleOff, { size: 18 })) : (React.createElement("div", { className: "border-gray size-5 rounded-full border-2 border-solid", style: {
22
+ backgroundColor: color,
23
+ } }));
24
+ },
25
+ },
26
+ {
27
+ accessorKey: "customFields.isNew",
28
+ header: () => "New",
29
+ cell: ({ row }) =>
30
+ // @ts-ignore
31
+ row.original.customFields.isNew ? (React.createElement(CheckCircle, { size: 20 })) : (React.createElement(XCircle, { size: 20 })),
32
+ },
33
+ {
34
+ accessorKey: "customFields.isHidden",
35
+ header: () => "Hidden",
36
+ cell: ({ row }) =>
37
+ // @ts-ignore
38
+ row.original.customFields.isNew ? (React.createElement(CheckCircle, { size: 20 })) : (React.createElement(XCircle, { size: 20 })),
39
+ },
40
+ {
41
+ accessorKey: "customFields.image",
42
+ header: () => "Image",
43
+ cell: ({ row }) => {
44
+ // @ts-ignore
45
+ const value = row.original.customFields?.image?.preview;
46
+ return value ? (React.createElement(Tooltip, null,
47
+ React.createElement(TooltipTrigger, null,
48
+ React.createElement("img", { className: "border-gray rounded-sm", width: 24, src: value + "?preset=tiny" })),
49
+ React.createElement(TooltipContent, { className: "my-2", side: "left" },
50
+ React.createElement("img", { width: 300, src: value + "?preset=medium" })))) : (React.createElement(ImageOff, { size: 20 }));
51
+ },
52
+ },
53
+ ],
54
+ },
55
+ ];
@@ -0,0 +1 @@
1
+ export declare const translationNS: string;
@@ -0,0 +1 @@
1
+ export const translationNS = Symbol("product-badges-plugin").toString();
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "ESNext",
4
+ "moduleResolution": "node",
5
+ "target": "ES2020",
6
+ "jsx": "react",
7
+ "outDir": "../../dist/plugin-ui",
8
+ "importHelpers": true,
9
+ "declaration": true,
10
+ "resolveJsonModule": true,
11
+ "skipLibCheck": true,
12
+ "strict": true,
13
+ "noImplicitAny": true,
14
+ "esModuleInterop": true,
15
+ "allowSyntheticDefaultImports": true
16
+ },
17
+ "include": ["./**/*.tsx", "./**/*.json", "./**/*.ts"]
18
+ }