@deenruv/replicate-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 (62) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +43 -0
  3. package/dist/plugin-server/constants.d.ts +2 -0
  4. package/dist/plugin-server/constants.js +5 -0
  5. package/dist/plugin-server/controllers/replicate.d.ts +22 -0
  6. package/dist/plugin-server/controllers/replicate.js +56 -0
  7. package/dist/plugin-server/e2e/order-export.e2e.test.d.ts +1 -0
  8. package/dist/plugin-server/e2e/order-export.e2e.test.js +163 -0
  9. package/dist/plugin-server/e2e/with-token.e2e.test.d.ts +1 -0
  10. package/dist/plugin-server/e2e/with-token.e2e.test.js +72 -0
  11. package/dist/plugin-server/e2e/without-token.e2e.test.d.ts +1 -0
  12. package/dist/plugin-server/e2e/without-token.e2e.test.js +75 -0
  13. package/dist/plugin-server/entites/replicate.entity.d.ts +13 -0
  14. package/dist/plugin-server/entites/replicate.entity.js +41 -0
  15. package/dist/plugin-server/extensions/replicate.extension.d.ts +1 -0
  16. package/dist/plugin-server/extensions/replicate.extension.js +78 -0
  17. package/dist/plugin-server/graphql/generated-admin-types.d.ts +5847 -0
  18. package/dist/plugin-server/graphql/generated-admin-types.js +1036 -0
  19. package/dist/plugin-server/index.d.ts +5 -0
  20. package/dist/plugin-server/index.js +42 -0
  21. package/dist/plugin-server/resolvers/replicate-admin.resolver.d.ts +35 -0
  22. package/dist/plugin-server/resolvers/replicate-admin.resolver.js +84 -0
  23. package/dist/plugin-server/services/replicate.service.d.ts +43 -0
  24. package/dist/plugin-server/services/replicate.service.js +389 -0
  25. package/dist/plugin-server/types.d.ts +19 -0
  26. package/dist/plugin-server/types.js +2 -0
  27. package/dist/plugin-server/zeus/const.d.ts +6 -0
  28. package/dist/plugin-server/zeus/const.js +3777 -0
  29. package/dist/plugin-server/zeus/index.d.ts +19250 -0
  30. package/dist/plugin-server/zeus/index.js +1104 -0
  31. package/dist/plugin-server/zeus/typedDocumentNode.d.ts +3 -0
  32. package/dist/plugin-server/zeus/typedDocumentNode.js +13 -0
  33. package/dist/plugin-ui/components/Replicate.d.ts +2 -0
  34. package/dist/plugin-ui/components/Replicate.js +307 -0
  35. package/dist/plugin-ui/components/ReplicateUtilities.d.ts +4 -0
  36. package/dist/plugin-ui/components/ReplicateUtilities.js +57 -0
  37. package/dist/plugin-ui/components/index.d.ts +1 -0
  38. package/dist/plugin-ui/components/index.js +1 -0
  39. package/dist/plugin-ui/graphql/mutations.d.ts +11 -0
  40. package/dist/plugin-ui/graphql/mutations.js +11 -0
  41. package/dist/plugin-ui/graphql/queries.d.ts +73 -0
  42. package/dist/plugin-ui/graphql/queries.js +30 -0
  43. package/dist/plugin-ui/graphql/selectors.d.ts +24 -0
  44. package/dist/plugin-ui/graphql/selectors.js +17 -0
  45. package/dist/plugin-ui/index.d.ts +1 -0
  46. package/dist/plugin-ui/index.js +25 -0
  47. package/dist/plugin-ui/locales/en/badges.json +25 -0
  48. package/dist/plugin-ui/locales/en/index.d.ts +26 -0
  49. package/dist/plugin-ui/locales/en/index.js +2 -0
  50. package/dist/plugin-ui/locales/pl/badges.json +25 -0
  51. package/dist/plugin-ui/locales/pl/index.d.ts +26 -0
  52. package/dist/plugin-ui/locales/pl/index.js +2 -0
  53. package/dist/plugin-ui/translation-ns.d.ts +1 -0
  54. package/dist/plugin-ui/translation-ns.js +1 -0
  55. package/dist/plugin-ui/tsconfig.json +18 -0
  56. package/dist/plugin-ui/zeus/const.d.ts +6 -0
  57. package/dist/plugin-ui/zeus/const.js +3774 -0
  58. package/dist/plugin-ui/zeus/index.d.ts +19250 -0
  59. package/dist/plugin-ui/zeus/index.js +1096 -0
  60. package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +3 -0
  61. package/dist/plugin-ui/zeus/typedDocumentNode.js +9 -0
  62. package/package.json +54 -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 './index.js';
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,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typedGql = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ const index_js_1 = require("./index.js");
6
+ const typedGql = (operation, graphqlOptions) => (o, ops) => {
7
+ const str = (0, index_js_1.Zeus)(operation, o, {
8
+ operationOptions: ops,
9
+ scalars: graphqlOptions === null || graphqlOptions === void 0 ? void 0 : graphqlOptions.scalars,
10
+ });
11
+ return (0, graphql_tag_1.gql)(str);
12
+ };
13
+ exports.typedGql = typedGql;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const ReplicateInput: () => React.JSX.Element;
@@ -0,0 +1,307 @@
1
+ import { useState, useEffect, useRef } from "react";
2
+ import { useTranslation } from "react-i18next";
3
+ import { CircleUser, ArrowRight } from "lucide-react";
4
+ import { cn, Routes, ScrollArea } from "@deenruv/react-ui-devkit";
5
+ import { Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Input, Label, useLazyQuery, useMutation, Badge, } from "@deenruv/react-ui-devkit";
6
+ import { translationNS } from "../translation-ns";
7
+ import { useForm, FormProvider } from "react-hook-form";
8
+ import { startOrderExportToReplicateMutation } from "../graphql/mutations.js";
9
+ import { getPredictionIDQuery, getReplicatePredictionsQuery, getPredictionItemQuery, } from "../graphql/queries.js";
10
+ import { PredictionStatus, PredictionType, SortOrder } from "../zeus/index.js";
11
+ import { DatePickerWithRange, copyToClipboard, exportToCsv, } from "./ReplicateUtilities.js";
12
+ import { useLocation, useNavigate } from "react-router-dom";
13
+ import React from "react";
14
+ const PredictionStatusTypes = [
15
+ {
16
+ value: PredictionStatus.starting,
17
+ label: "In progress",
18
+ },
19
+ {
20
+ value: PredictionStatus.succeeded,
21
+ label: "Completed",
22
+ },
23
+ {
24
+ value: PredictionStatus.failed,
25
+ label: "Failed",
26
+ },
27
+ ];
28
+ const MAX_RETRIES = 25;
29
+ export const ReplicateInput = () => {
30
+ const { t } = useTranslation(translationNS);
31
+ const location = useLocation();
32
+ const navigate = useNavigate();
33
+ const methods = useForm({
34
+ defaultValues: {
35
+ num_prospects: 100,
36
+ start_date: "",
37
+ end_date: "",
38
+ predict_type: PredictionType.RFM_SCORE,
39
+ show_metrics: true,
40
+ },
41
+ });
42
+ const getQueryParams = (query) => {
43
+ if (!query || query === "")
44
+ return {};
45
+ const [key, value] = query.substring(1).split("=");
46
+ return key && value ? { [key]: value } : {};
47
+ };
48
+ const queryParams = getQueryParams(location.search);
49
+ const replicateId = queryParams.replicateId;
50
+ const [items, setItems] = useState([]);
51
+ const [totalItems, setTotalItems] = useState(0);
52
+ const [predictions, setPredictions] = useState([]);
53
+ const { register, handleSubmit } = methods;
54
+ const [startOrderExportToReplicate] = useMutation(startOrderExportToReplicateMutation);
55
+ const [getPredictionID] = useLazyQuery(getPredictionIDQuery);
56
+ const [getReplicatePredictions] = useLazyQuery(getReplicatePredictionsQuery);
57
+ const [getPredictionItem] = useLazyQuery(getPredictionItemQuery);
58
+ const [predictionID, setPredictionID] = useState(null);
59
+ const [loading, setLoading] = useState(false);
60
+ const [predictionEntityID, setPredictionEntityID] = useState(null);
61
+ const [activePredictionId, setActivePredictionId] = useState(replicateId || null);
62
+ const [shouldStartPolling, setShouldStartPolling] = useState(false);
63
+ const [isPolling, setIsPolling] = useState(true);
64
+ const retryCountRef = useRef(0);
65
+ const intervalRef = useRef(null);
66
+ const retryPredictionCountRef = useRef(0);
67
+ useEffect(() => {
68
+ if (activePredictionId) {
69
+ const newUrl = `${location.pathname}?replicateId=${activePredictionId}`;
70
+ navigate(newUrl, { replace: true });
71
+ }
72
+ }, [activePredictionId, navigate, location.pathname]);
73
+ useEffect(() => {
74
+ if (replicateId) {
75
+ setActivePredictionId(replicateId);
76
+ fetchPrediction(replicateId);
77
+ }
78
+ }, [predictions]);
79
+ useEffect(() => {
80
+ if (!predictionEntityID || !isPolling)
81
+ return;
82
+ intervalRef.current = setInterval(() => {
83
+ if (retryCountRef.current >= MAX_RETRIES) {
84
+ console.warn("Max retries reached. Stopping polling.");
85
+ clearInterval(intervalRef.current);
86
+ setIsPolling(false);
87
+ return;
88
+ }
89
+ getPredictionID({
90
+ prediction_entity_id: predictionEntityID,
91
+ })
92
+ .then((response) => {
93
+ if (response?.getPredictionID) {
94
+ clearInterval(intervalRef.current);
95
+ setIsPolling(false);
96
+ setPredictionID(response.getPredictionID);
97
+ setActivePredictionId(response.getPredictionID);
98
+ }
99
+ else {
100
+ retryCountRef.current += 1;
101
+ }
102
+ })
103
+ .catch((error) => {
104
+ console.error("Error fetching prediction:", error);
105
+ retryCountRef.current += 1;
106
+ });
107
+ }, 5000);
108
+ return () => {
109
+ if (intervalRef.current)
110
+ clearInterval(intervalRef.current);
111
+ };
112
+ }, [predictionEntityID, isPolling]);
113
+ function fetchList() {
114
+ getReplicatePredictions({
115
+ options: { sort: { finishedAt: SortOrder.DESC } },
116
+ }).then((response) => {
117
+ if (response?.getReplicatePredictions) {
118
+ const predictions = response.getReplicatePredictions.items;
119
+ setItems(predictions);
120
+ setTotalItems(response.getReplicatePredictions.totalItems);
121
+ const startingPredictions = predictions.filter((item) => item.status === PredictionStatus.starting);
122
+ startingPredictions.forEach((prediction) => {
123
+ getPredictionItem({
124
+ id: prediction.id,
125
+ }).then((response) => {
126
+ if (response?.getPredictionItem) {
127
+ fetchList();
128
+ }
129
+ });
130
+ });
131
+ }
132
+ });
133
+ }
134
+ useEffect(() => {
135
+ fetchList();
136
+ }, []);
137
+ useEffect(() => {
138
+ if (!shouldStartPolling)
139
+ return;
140
+ const pollInterval = 2000;
141
+ const maxRetries = 40;
142
+ let retryCount = 0;
143
+ const intervalId = setInterval(() => {
144
+ if (retryCount >= maxRetries) {
145
+ clearInterval(intervalId);
146
+ setShouldStartPolling(false);
147
+ return;
148
+ }
149
+ getReplicatePredictions({
150
+ options: { sort: { finishedAt: SortOrder.DESC } },
151
+ }).then((response) => {
152
+ if (response?.getReplicatePredictions) {
153
+ const predictions = response.getReplicatePredictions.items;
154
+ setItems(predictions);
155
+ setTotalItems(response.getReplicatePredictions.totalItems);
156
+ const startingPrediction = predictions.find((item) => item.status === PredictionStatus.starting);
157
+ if (startingPrediction) {
158
+ setActivePredictionId(startingPrediction.id);
159
+ }
160
+ if (!predictions.some((item) => item.status === PredictionStatus.starting)) {
161
+ clearInterval(intervalId);
162
+ setShouldStartPolling(false);
163
+ }
164
+ }
165
+ });
166
+ retryCount++;
167
+ }, pollInterval);
168
+ return () => clearInterval(intervalId);
169
+ }, [shouldStartPolling]);
170
+ function fetchPrediction(predictionID) {
171
+ if (!predictionID)
172
+ return;
173
+ setActivePredictionId(predictionID);
174
+ getPredictionItem({
175
+ id: predictionID,
176
+ })
177
+ .then((response) => {
178
+ if (response?.getPredictionItem) {
179
+ if (response.getPredictionItem.status === PredictionStatus.succeeded) {
180
+ setPredictions(response.getPredictionItem.predictions);
181
+ setLoading(false);
182
+ }
183
+ else if (response.getPredictionItem.status === PredictionStatus.failed) {
184
+ setPredictions([]);
185
+ setLoading(false);
186
+ }
187
+ else if (response.getPredictionItem.status === PredictionStatus.starting) {
188
+ setPredictionID(predictionID);
189
+ retryPredictionCountRef.current = 0;
190
+ }
191
+ }
192
+ else {
193
+ setLoading(false);
194
+ }
195
+ })
196
+ .catch((error) => {
197
+ console.error("Error fetching prediction:", error);
198
+ setLoading(false);
199
+ });
200
+ }
201
+ const submit = async (data) => {
202
+ try {
203
+ setPredictionID(null);
204
+ setPredictionEntityID(null);
205
+ setIsPolling(true);
206
+ retryCountRef.current = 0;
207
+ retryPredictionCountRef.current = 0;
208
+ setLoading(true);
209
+ setShouldStartPolling(true);
210
+ const response = await startOrderExportToReplicate({
211
+ input: {
212
+ startDate: new Date(data.start_date),
213
+ endDate: new Date(data.end_date),
214
+ predictType: data.predict_type,
215
+ showMetrics: data.show_metrics,
216
+ },
217
+ });
218
+ setPredictionEntityID(response.startOrderExportToReplicate);
219
+ }
220
+ catch (error) {
221
+ console.log(error);
222
+ setLoading(false);
223
+ }
224
+ };
225
+ const getStatusColor = (status) => {
226
+ switch (status) {
227
+ case PredictionStatus.succeeded:
228
+ return "bg-green-500";
229
+ case PredictionStatus.failed:
230
+ return "bg-red-500";
231
+ case PredictionStatus.starting:
232
+ return "bg-blue-500";
233
+ default:
234
+ return "bg-gray-500";
235
+ }
236
+ };
237
+ return (React.createElement(FormProvider, { ...methods },
238
+ React.createElement("div", { className: "flex h-screen w-full gap-4 px-4 py-2 md:px-8 md:py-4" },
239
+ React.createElement("div", { className: "flex w-1/3 flex-col gap-4" },
240
+ React.createElement(Card, { className: "w-full" },
241
+ React.createElement(CardHeader, null,
242
+ React.createElement("div", { className: "flex w-full items-center justify-between" },
243
+ React.createElement("div", { className: "flex flex-col gap-2" },
244
+ React.createElement(CardTitle, null, t("Set up your model"))),
245
+ React.createElement(Button, { onClick: handleSubmit((data) => submit(data)) }, t("Run model")))),
246
+ React.createElement(CardContent, null,
247
+ React.createElement("div", { className: "flex flex-row items-start gap-4" },
248
+ React.createElement("div", { className: "flex flex-col gap-1" },
249
+ React.createElement(Label, null, t("Show X the best prospects:")),
250
+ React.createElement(Input, { className: "w-[175px]", ...register("num_prospects") })),
251
+ React.createElement("div", { className: "flex flex-col gap-1" },
252
+ React.createElement(Label, null, t("Orders data range:")),
253
+ React.createElement(DatePickerWithRange, null))))),
254
+ React.createElement(Card, { className: "h-[calc(100vh-288px)] w-full" },
255
+ React.createElement(CardHeader, null,
256
+ React.createElement(CardTitle, null, t("Previous model runs"))),
257
+ React.createElement(CardContent, { className: "h-[calc(100%-64px)]" },
258
+ React.createElement(ScrollArea, { className: "h-full" },
259
+ React.createElement("div", { className: "flex flex-col gap-3" }, items.map((item, index) => (React.createElement(Card, { key: index, className: cn("border hover:border-primary transition-colors", activePredictionId === item.id
260
+ ? "border-black border-2"
261
+ : ""), onClick: () => fetchPrediction(item.id) },
262
+ React.createElement(CardContent, { className: "py-3" },
263
+ React.createElement("div", { className: "flex items-center justify-between" },
264
+ React.createElement("div", { className: "flex flex-col" },
265
+ React.createElement("div", { className: "mt-1 flex items-center gap-2" },
266
+ React.createElement("span", { className: "max-w-[200px] truncate text-sm font-medium" },
267
+ "#",
268
+ item.id),
269
+ React.createElement(Badge, { variant: "outline", className: cn("text-xs", getStatusColor(item.status)) }, PredictionStatusTypes.find((status) => status.value === item.status)?.label),
270
+ React.createElement("span", { className: "max-w-[200px] truncate text-sm font-medium" }, item.finishedAt
271
+ ? new Date(item.finishedAt).toLocaleString()
272
+ : " "))),
273
+ item.status === PredictionStatus.succeeded && (React.createElement(Button, { size: "icon", variant: "ghost", className: "size-8", onClick: () => fetchPrediction(item.id), title: t("Fetch predictions") },
274
+ React.createElement(ArrowRight, { className: "size-4" }))))))))))))),
275
+ React.createElement(Card, { className: "h-[calc(100vh-100px)] w-2/3" },
276
+ React.createElement(CardHeader, null,
277
+ React.createElement("div", { className: "flex w-full items-center justify-between" },
278
+ React.createElement("div", { className: "flex flex-col gap-2" },
279
+ React.createElement(CardTitle, null, t("The most promising customers")),
280
+ React.createElement(CardDescription, null, loading)),
281
+ predictions?.length != 0 && (React.createElement("div", { className: "flex gap-1" },
282
+ React.createElement(Button, { onClick: () => predictions &&
283
+ copyToClipboard("[" +
284
+ predictions
285
+ .map((predictions) => predictions.customer?.emailAddress)
286
+ .join(", ") +
287
+ "]") }, t("Copy to clipboard")),
288
+ React.createElement(Button, { onClick: () => exportToCsv(predictions) }, t("Export to CSV")))))),
289
+ React.createElement(CardContent, { className: "h-[calc(100%-100px)]" }, loading ? (React.createElement("div", null, t("loading"))) : (React.createElement("div", { className: "flex h-full flex-col gap-2" }, predictions && (React.createElement(ScrollArea, { className: "h-full" },
290
+ React.createElement("div", { className: "flex flex-col gap-3" }, (predictions ?? [])
291
+ .slice(0, methods.watch("num_prospects"))
292
+ .map((prediction) => (React.createElement(Card, { key: prediction.customer?.id ||
293
+ Math.random().toString() },
294
+ React.createElement(CardContent, { className: "py-3" },
295
+ React.createElement("div", { className: "flex items-center justify-between" },
296
+ React.createElement("span", { className: "flex items-center" },
297
+ React.createElement(CircleUser, { className: "mr-2" }),
298
+ prediction.customer?.firstName,
299
+ " ",
300
+ prediction.customer?.lastName,
301
+ React.createElement("span", { className: "text-muted-foreground ml-2" },
302
+ "(",
303
+ prediction.customer?.emailAddress,
304
+ ")")),
305
+ React.createElement(Button, { size: "icon", variant: "ghost", className: "size-8", onClick: () => window.open(Routes.customers.to(prediction.customer?.id || "")), title: t("Go to customer profile") },
306
+ React.createElement(ArrowRight, { className: "size-4" })))))))))))))))));
307
+ };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ export declare function DatePickerWithRange({ className, }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
3
+ export declare function exportToCsv(predictions: any): void;
4
+ export declare function copyToClipboard(text: string): void;
@@ -0,0 +1,57 @@
1
+ import { useFormContext } from "react-hook-form";
2
+ import React, { useEffect } from "react";
3
+ import { format } from "date-fns";
4
+ import { cn } from "@deenruv/react-ui-devkit";
5
+ import { Popover, PopoverContent, PopoverTrigger, Calendar, Button, } from "@deenruv/react-ui-devkit";
6
+ import { CalendarIcon } from "lucide-react";
7
+ export function DatePickerWithRange({ className, }) {
8
+ const { setValue, watch } = useFormContext();
9
+ const [date, setDate] = React.useState(undefined);
10
+ useEffect(() => {
11
+ if (date?.from) {
12
+ setValue("start_date", format(date.from, "yyyy-MM-dd"));
13
+ }
14
+ if (date?.to) {
15
+ setValue("end_date", format(date.to, "yyyy-MM-dd"));
16
+ }
17
+ }, [date, setValue]);
18
+ const startDate = watch("start_date");
19
+ const endDate = watch("end_date");
20
+ useEffect(() => {
21
+ if (startDate || endDate) {
22
+ setDate({
23
+ from: startDate ? new Date(startDate) : undefined,
24
+ to: endDate ? new Date(endDate) : undefined,
25
+ });
26
+ }
27
+ }, [startDate, endDate]);
28
+ return (React.createElement("div", { className: cn("grid gap-2", className) },
29
+ React.createElement(Popover, null,
30
+ React.createElement(PopoverTrigger, { asChild: true },
31
+ React.createElement(Button, { id: "date", variant: "outline", className: cn("w-[200px] justify-start text-left font-normal", !date && "text-muted-foreground") },
32
+ React.createElement(CalendarIcon, null),
33
+ date?.from ? (date.to ? (React.createElement(React.Fragment, null,
34
+ format(date.from, "LLL dd, y"),
35
+ " -",
36
+ " ",
37
+ format(date.to, "LLL dd, y"))) : (format(date.from, "LLL dd, y"))) : (React.createElement("span", null, "Pick a date")))),
38
+ React.createElement(PopoverContent, { className: "w-auto p-0", align: "start" },
39
+ React.createElement(Calendar, { initialFocus: true, mode: "range", defaultMonth: date?.from, selected: date, onSelect: setDate, numberOfMonths: 2 })))));
40
+ }
41
+ export function exportToCsv(predictions) {
42
+ const rowName = "email";
43
+ const rowContent = predictions
44
+ .map((prediction) => `${prediction.customer?.emailAddress}`)
45
+ .join("\n");
46
+ const csv = `${rowName}\n${rowContent}`;
47
+ const blob = new Blob([csv], { type: "text/csv" });
48
+ const url = URL.createObjectURL(blob);
49
+ const a = document.createElement("a");
50
+ a.href = url;
51
+ const timestamp = new Date().toLocaleString();
52
+ a.download = `predictions-${timestamp}.csv`;
53
+ a.click();
54
+ }
55
+ export function copyToClipboard(text) {
56
+ navigator.clipboard.writeText(text);
57
+ }
@@ -0,0 +1 @@
1
+ export * from "./Replicate";
@@ -0,0 +1 @@
1
+ export * from "./Replicate";
@@ -0,0 +1,11 @@
1
+ export declare const startOrderExportToReplicateMutation: import("@graphql-typed-document-node/core").TypedDocumentNode<{
2
+ startOrderExportToReplicate: string;
3
+ }, {} & {
4
+ input: {
5
+ numLastOrder?: number | import("../zeus").Variable<any, string> | null | undefined;
6
+ startDate?: unknown;
7
+ endDate?: unknown;
8
+ predictType?: import("../zeus").PredictionType | import("../zeus").Variable<any, string> | null | undefined;
9
+ showMetrics?: boolean | import("../zeus").Variable<any, string> | null | undefined;
10
+ };
11
+ }>;
@@ -0,0 +1,11 @@
1
+ import { typedGql } from "../zeus/typedDocumentNode";
2
+ import { $ } from "../zeus";
3
+ import { scalars } from "@deenruv/admin-types";
4
+ export const startOrderExportToReplicateMutation = typedGql("mutation", {
5
+ scalars,
6
+ })({
7
+ startOrderExportToReplicate: [
8
+ { input: $("input", "StartOrderExportToReplicateInput!") },
9
+ true,
10
+ ],
11
+ });
@@ -0,0 +1,73 @@
1
+ export declare const getPredictionIDQuery: import("@graphql-typed-document-node/core").TypedDocumentNode<{
2
+ getPredictionID?: string | null | undefined;
3
+ }, {} & {
4
+ prediction_entity_id: string;
5
+ }>;
6
+ export declare const getReplicatePredictionsQuery: import("@graphql-typed-document-node/core").TypedDocumentNode<{
7
+ getReplicatePredictions: {
8
+ items: {
9
+ id: string;
10
+ status: import("../zeus").PredictionStatus;
11
+ finishedAt?: string | null | undefined;
12
+ }[];
13
+ totalItems: number;
14
+ };
15
+ }, {
16
+ options?: {
17
+ skip?: number | import("../zeus").Variable<any, string> | null | undefined;
18
+ take?: number | import("../zeus").Variable<any, string> | null | undefined;
19
+ sort?: {
20
+ id?: import("../zeus").SortOrder | import("../zeus").Variable<any, string> | null | undefined;
21
+ finishedAt?: import("../zeus").SortOrder | import("../zeus").Variable<any, string> | null | undefined;
22
+ } | import("../zeus").Variable<any, string> | null | undefined;
23
+ filter?: {
24
+ id?: {
25
+ eq?: string | import("../zeus").Variable<any, string> | null | undefined;
26
+ notEq?: string | import("../zeus").Variable<any, string> | null | undefined;
27
+ in?: string[] | import("../zeus").Variable<any, string> | null | undefined;
28
+ notIn?: string[] | import("../zeus").Variable<any, string> | null | undefined;
29
+ isNull?: boolean | import("../zeus").Variable<any, string> | null | undefined;
30
+ } | import("../zeus").Variable<any, string> | null | undefined;
31
+ status?: {
32
+ eq?: string | import("../zeus").Variable<any, string> | null | undefined;
33
+ notEq?: string | import("../zeus").Variable<any, string> | null | undefined;
34
+ contains?: string | import("../zeus").Variable<any, string> | null | undefined;
35
+ notContains?: string | import("../zeus").Variable<any, string> | null | undefined;
36
+ in?: string[] | import("../zeus").Variable<any, string> | null | undefined;
37
+ notIn?: string[] | import("../zeus").Variable<any, string> | null | undefined;
38
+ regex?: string | import("../zeus").Variable<any, string> | null | undefined;
39
+ isNull?: boolean | import("../zeus").Variable<any, string> | null | undefined;
40
+ } | import("../zeus").Variable<any, string> | null | undefined;
41
+ finishedAt?: {
42
+ eq?: unknown;
43
+ before?: unknown;
44
+ after?: unknown;
45
+ between?: {
46
+ start: unknown;
47
+ end: unknown;
48
+ } | import("../zeus").Variable<any, string> | null | undefined;
49
+ isNull?: boolean | import("../zeus").Variable<any, string> | null | undefined;
50
+ } | import("../zeus").Variable<any, string> | null | undefined;
51
+ _and?: import("../zeus").Variable<any, string> | any[] | null | undefined;
52
+ _or?: import("../zeus").Variable<any, string> | any[] | null | undefined;
53
+ } | import("../zeus").Variable<any, string> | null | undefined;
54
+ filterOperator?: import("../zeus").LogicalOperator | import("../zeus").Variable<any, string> | null | undefined;
55
+ } | undefined;
56
+ } & {}>;
57
+ export declare const getPredictionItemQuery: import("@graphql-typed-document-node/core").TypedDocumentNode<{
58
+ getPredictionItem: {
59
+ status: import("../zeus").PredictionStatus;
60
+ predictions?: {
61
+ id: string;
62
+ customer: {
63
+ id: string;
64
+ firstName: string;
65
+ lastName: string;
66
+ emailAddress: string;
67
+ };
68
+ score: number;
69
+ }[] | undefined;
70
+ };
71
+ }, {} & {
72
+ id: string;
73
+ }>;
@@ -0,0 +1,30 @@
1
+ import { typedGql } from "../zeus/typedDocumentNode";
2
+ import { $ } from "../zeus";
3
+ import { scalars } from "@deenruv/admin-types";
4
+ import { PredictionSelector, ReplicateEntityListSelector } from "./selectors";
5
+ export const getPredictionIDQuery = typedGql("query", { scalars })({
6
+ getPredictionID: [
7
+ {
8
+ input: {
9
+ prediction_entity_id: $("prediction_entity_id", "String!"),
10
+ },
11
+ },
12
+ true,
13
+ ],
14
+ });
15
+ export const getReplicatePredictionsQuery = typedGql("query", { scalars })({
16
+ getReplicatePredictions: [
17
+ {
18
+ options: $("options", "ReplicateEntityListOptions"),
19
+ },
20
+ ReplicateEntityListSelector,
21
+ ],
22
+ });
23
+ export const getPredictionItemQuery = typedGql("query", { scalars })({
24
+ getPredictionItem: [
25
+ {
26
+ id: $("id", "String!"),
27
+ },
28
+ PredictionSelector,
29
+ ],
30
+ });
@@ -0,0 +1,24 @@
1
+ import { FromSelector } from "../zeus";
2
+ export declare const PredictionSelector: {
3
+ predictions: {
4
+ id: true;
5
+ score: true;
6
+ customer: {
7
+ emailAddress: true;
8
+ id: true;
9
+ firstName: true;
10
+ lastName: true;
11
+ };
12
+ };
13
+ status: true;
14
+ };
15
+ export declare const ReplicateEntityListSelector: {
16
+ items: {
17
+ id: true;
18
+ status: true;
19
+ finishedAt: true;
20
+ };
21
+ totalItems: true;
22
+ };
23
+ export type ReplicatePredictionListType = FromSelector<typeof PredictionSelector, "PredictionResult">;
24
+ export type ReplicateEntityListType = FromSelector<typeof ReplicateEntityListSelector, "ReplicateEntityList">;
@@ -0,0 +1,17 @@
1
+ import { Selector } from "../zeus";
2
+ export const PredictionSelector = Selector("PredictionResult")({
3
+ predictions: {
4
+ id: true,
5
+ score: true,
6
+ customer: { emailAddress: true, id: true, firstName: true, lastName: true },
7
+ },
8
+ status: true,
9
+ });
10
+ export const ReplicateEntityListSelector = Selector("ReplicateEntityList")({
11
+ items: {
12
+ id: true,
13
+ status: true,
14
+ finishedAt: true,
15
+ },
16
+ totalItems: true,
17
+ });
@@ -0,0 +1 @@
1
+ export declare const ReplicateUiPlugin: import("@deenruv/react-ui-devkit").DeenruvUIPlugin<Record<string, any>>;
@@ -0,0 +1,25 @@
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 { ReplicateInput } from "./components/Replicate";
6
+ import React from "react";
7
+ import { NotebookPenIcon } from "lucide-react";
8
+ export const ReplicateUiPlugin = createDeenruvUIPlugin({
9
+ version: "1.0.0",
10
+ name: "Replicate Newsletter Plugin",
11
+ pages: [{ element: React.createElement(ReplicateInput, null), path: "" }],
12
+ navMenuLinks: [
13
+ {
14
+ groupId: "promotions-group",
15
+ href: "",
16
+ id: "newsletter-model",
17
+ labelId: "Newsletter Model",
18
+ icon: NotebookPenIcon,
19
+ },
20
+ ],
21
+ translations: {
22
+ ns: translationNS,
23
+ data: { en, pl },
24
+ },
25
+ });
@@ -0,0 +1,25 @@
1
+ {
2
+ "title": "Badges",
3
+ "description": "Badges that will be shown on product image",
4
+ "not-found": "No badges has been found",
5
+ "modal": {
6
+ "add": {
7
+ "title": "Add badge",
8
+ "action": "Add",
9
+ "success": "Added successfully"
10
+ },
11
+ "edit": {
12
+ "title": "Edit badge",
13
+ "action": "Edit",
14
+ "success": "Edited successfully"
15
+ },
16
+ "remove": {
17
+ "title": "Remove badge",
18
+ "description": "Are you sure you want to remove this badge?",
19
+ "action": "Remove",
20
+ "success": "Removed successfully"
21
+ },
22
+ "text-error": "Text field can't be empty",
23
+ "cancel": "Cancel"
24
+ }
25
+ }
@@ -0,0 +1,26 @@
1
+ declare const _default: {
2
+ title: string;
3
+ description: string;
4
+ "not-found": string;
5
+ modal: {
6
+ add: {
7
+ title: string;
8
+ action: string;
9
+ success: string;
10
+ };
11
+ edit: {
12
+ title: string;
13
+ action: string;
14
+ success: string;
15
+ };
16
+ remove: {
17
+ title: string;
18
+ description: string;
19
+ action: string;
20
+ success: string;
21
+ };
22
+ "text-error": string;
23
+ cancel: string;
24
+ };
25
+ }[];
26
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import badges from "./badges.json";
2
+ export default [badges];