@streamoid/catalogix-chat 0.2.21 → 0.2.23
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/index.js +167 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/CatalogixChat.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect9 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/api.ts
|
|
5
5
|
var _config = {
|
|
@@ -3078,14 +3078,15 @@ function MapAttributesChat({
|
|
|
3078
3078
|
}
|
|
3079
3079
|
|
|
3080
3080
|
// src/EditFeed/index.tsx
|
|
3081
|
-
import React8, { useState as useState8, useMemo as useMemo6, useCallback as useCallback6 } from "react";
|
|
3081
|
+
import React8, { useState as useState8, useMemo as useMemo6, useCallback as useCallback6, useRef as useRef5, useEffect as useEffect6 } from "react";
|
|
3082
3082
|
import {
|
|
3083
3083
|
AlertTriangle as AlertTriangle2,
|
|
3084
3084
|
Check as Check3,
|
|
3085
3085
|
ChevronDown as ChevronDown3,
|
|
3086
3086
|
ChevronRight as ChevronRight3,
|
|
3087
|
+
HelpCircle,
|
|
3087
3088
|
Pencil as Pencil3,
|
|
3088
|
-
|
|
3089
|
+
Send as Send2,
|
|
3089
3090
|
Loader2 as Loader26,
|
|
3090
3091
|
X as X2,
|
|
3091
3092
|
RefreshCw
|
|
@@ -3152,20 +3153,102 @@ async function mergeFeed(fileUrl, feedFormat, changes) {
|
|
|
3152
3153
|
}
|
|
3153
3154
|
);
|
|
3154
3155
|
}
|
|
3156
|
+
async function fetchValidValues(sourceMp, marketplaceOv, category, attribute) {
|
|
3157
|
+
const { catalogixBaseUrl } = getApiConfig();
|
|
3158
|
+
const params = new URLSearchParams({
|
|
3159
|
+
response_style: "light",
|
|
3160
|
+
category,
|
|
3161
|
+
attribute
|
|
3162
|
+
});
|
|
3163
|
+
const url = `${catalogixBaseUrl}/marketplaces/${sourceMp}/versions/${marketplaceOv}/structure?${params}`;
|
|
3164
|
+
const resp = await fetchJson(url);
|
|
3165
|
+
return resp[attribute] ?? Object.values(resp)[0] ?? [];
|
|
3166
|
+
}
|
|
3155
3167
|
function EditableCell2({
|
|
3156
3168
|
value,
|
|
3157
3169
|
hasError,
|
|
3158
3170
|
errorMessage,
|
|
3159
3171
|
onChange,
|
|
3160
|
-
readOnly
|
|
3172
|
+
readOnly,
|
|
3173
|
+
onFetchSuggestions
|
|
3161
3174
|
}) {
|
|
3162
3175
|
const [editing, setEditing] = useState8(false);
|
|
3163
3176
|
const [draft, setDraft] = useState8(value);
|
|
3177
|
+
const [showSuggestions, setShowSuggestions] = useState8(false);
|
|
3178
|
+
const [suggestions, setSuggestions] = useState8(null);
|
|
3179
|
+
const [loadingSuggestions, setLoadingSuggestions] = useState8(false);
|
|
3180
|
+
const suggestionsRef = useRef5(null);
|
|
3181
|
+
useEffect6(() => {
|
|
3182
|
+
if (!showSuggestions) return;
|
|
3183
|
+
const handler = (e) => {
|
|
3184
|
+
if (suggestionsRef.current && !suggestionsRef.current.contains(e.target)) {
|
|
3185
|
+
setShowSuggestions(false);
|
|
3186
|
+
}
|
|
3187
|
+
};
|
|
3188
|
+
document.addEventListener("mousedown", handler);
|
|
3189
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
3190
|
+
}, [showSuggestions]);
|
|
3191
|
+
const handleToggleSuggestions = useCallback6(
|
|
3192
|
+
async (e) => {
|
|
3193
|
+
e.stopPropagation();
|
|
3194
|
+
if (showSuggestions) {
|
|
3195
|
+
setShowSuggestions(false);
|
|
3196
|
+
return;
|
|
3197
|
+
}
|
|
3198
|
+
setShowSuggestions(true);
|
|
3199
|
+
if (suggestions !== null || !onFetchSuggestions) return;
|
|
3200
|
+
setLoadingSuggestions(true);
|
|
3201
|
+
try {
|
|
3202
|
+
const vals = await onFetchSuggestions();
|
|
3203
|
+
setSuggestions(vals);
|
|
3204
|
+
} catch {
|
|
3205
|
+
setSuggestions([]);
|
|
3206
|
+
} finally {
|
|
3207
|
+
setLoadingSuggestions(false);
|
|
3208
|
+
}
|
|
3209
|
+
},
|
|
3210
|
+
[showSuggestions, suggestions, onFetchSuggestions]
|
|
3211
|
+
);
|
|
3212
|
+
const selectSuggestion = useCallback6(
|
|
3213
|
+
(val) => {
|
|
3214
|
+
onChange(val);
|
|
3215
|
+
setDraft(val);
|
|
3216
|
+
setShowSuggestions(false);
|
|
3217
|
+
},
|
|
3218
|
+
[onChange]
|
|
3219
|
+
);
|
|
3164
3220
|
const commit = useCallback6(() => {
|
|
3165
3221
|
setEditing(false);
|
|
3166
3222
|
if (draft !== value) onChange(draft);
|
|
3167
3223
|
}, [draft, value, onChange]);
|
|
3168
|
-
|
|
3224
|
+
const suggestionsPanel = showSuggestions && hasError && onFetchSuggestions ? /* @__PURE__ */ jsx22(
|
|
3225
|
+
"div",
|
|
3226
|
+
{
|
|
3227
|
+
ref: suggestionsRef,
|
|
3228
|
+
className: "absolute left-0 top-full z-20 mt-1 rounded border bg-popover p-1.5 shadow-md max-w-[280px]",
|
|
3229
|
+
children: loadingSuggestions ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5 text-[10px] text-muted-foreground px-1 py-0.5", children: [
|
|
3230
|
+
/* @__PURE__ */ jsx22(Loader26, { className: "h-3 w-3 animate-spin" }),
|
|
3231
|
+
"Loading valid values\u2026"
|
|
3232
|
+
] }) : suggestions && suggestions.length > 0 ? /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-1 max-h-[120px] overflow-auto", children: suggestions.map((s) => /* @__PURE__ */ jsx22(
|
|
3233
|
+
"button",
|
|
3234
|
+
{
|
|
3235
|
+
type: "button",
|
|
3236
|
+
onClick: (e) => {
|
|
3237
|
+
e.stopPropagation();
|
|
3238
|
+
selectSuggestion(s);
|
|
3239
|
+
},
|
|
3240
|
+
className: cn(
|
|
3241
|
+
"inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",
|
|
3242
|
+
"hover:bg-primary hover:text-primary-foreground cursor-pointer",
|
|
3243
|
+
"border-border bg-muted/40 text-foreground"
|
|
3244
|
+
),
|
|
3245
|
+
children: s
|
|
3246
|
+
},
|
|
3247
|
+
s
|
|
3248
|
+
)) }) : /* @__PURE__ */ jsx22("p", { className: "text-[10px] text-muted-foreground px-1 py-0.5", children: "No valid values found." })
|
|
3249
|
+
}
|
|
3250
|
+
) : null;
|
|
3251
|
+
if (readOnly) {
|
|
3169
3252
|
return /* @__PURE__ */ jsxs11(
|
|
3170
3253
|
"div",
|
|
3171
3254
|
{
|
|
@@ -3182,26 +3265,29 @@ function EditableCell2({
|
|
|
3182
3265
|
);
|
|
3183
3266
|
}
|
|
3184
3267
|
if (editing) {
|
|
3185
|
-
return /* @__PURE__ */
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3268
|
+
return /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
|
|
3269
|
+
/* @__PURE__ */ jsx22(
|
|
3270
|
+
Input,
|
|
3271
|
+
{
|
|
3272
|
+
autoFocus: true,
|
|
3273
|
+
value: draft,
|
|
3274
|
+
onChange: (e) => setDraft(e.target.value),
|
|
3275
|
+
onBlur: commit,
|
|
3276
|
+
onKeyDown: (e) => {
|
|
3277
|
+
if (e.key === "Enter") commit();
|
|
3278
|
+
if (e.key === "Escape") {
|
|
3279
|
+
setDraft(value);
|
|
3280
|
+
setEditing(false);
|
|
3281
|
+
}
|
|
3282
|
+
},
|
|
3283
|
+
className: cn(
|
|
3284
|
+
"h-7 text-sm rounded px-1.5",
|
|
3285
|
+
hasError && "border-destructive focus-visible:ring-destructive/30"
|
|
3286
|
+
)
|
|
3287
|
+
}
|
|
3288
|
+
),
|
|
3289
|
+
suggestionsPanel
|
|
3290
|
+
] });
|
|
3205
3291
|
}
|
|
3206
3292
|
return /* @__PURE__ */ jsxs11(
|
|
3207
3293
|
"div",
|
|
@@ -3218,24 +3304,35 @@ function EditableCell2({
|
|
|
3218
3304
|
children: [
|
|
3219
3305
|
/* @__PURE__ */ jsx22("span", { className: "truncate max-w-[160px]", children: value }),
|
|
3220
3306
|
/* @__PURE__ */ jsx22(Pencil3, { className: "h-3 w-3 shrink-0 opacity-0 group-hover:opacity-70 transition-opacity" }),
|
|
3221
|
-
hasError &&
|
|
3307
|
+
hasError && onFetchSuggestions && /* @__PURE__ */ jsx22(
|
|
3308
|
+
"button",
|
|
3309
|
+
{
|
|
3310
|
+
type: "button",
|
|
3311
|
+
onClick: handleToggleSuggestions,
|
|
3312
|
+
className: "shrink-0 rounded p-0.5 hover:bg-destructive/20 transition-colors",
|
|
3313
|
+
title: "Show valid values",
|
|
3314
|
+
children: /* @__PURE__ */ jsx22(HelpCircle, { className: "h-3 w-3" })
|
|
3315
|
+
}
|
|
3316
|
+
),
|
|
3317
|
+
hasError && errorMessage && !showSuggestions && /* @__PURE__ */ jsx22("div", { className: "absolute left-0 top-full z-10 mt-1 hidden group-hover:block", children: /* @__PURE__ */ jsx22("div", { className: "rounded bg-destructive px-2 py-1 text-[10px] text-destructive-foreground shadow-md max-w-[260px] whitespace-normal", children: errorMessage }) }),
|
|
3318
|
+
suggestionsPanel
|
|
3222
3319
|
]
|
|
3223
3320
|
}
|
|
3224
3321
|
);
|
|
3225
3322
|
}
|
|
3226
|
-
function MissingAttributesBanner({ text }) {
|
|
3227
|
-
const [open, setOpen] = useState8(
|
|
3323
|
+
function MissingAttributesBanner({ text, defaultOpen = false }) {
|
|
3324
|
+
const [open, setOpen] = useState8(defaultOpen);
|
|
3228
3325
|
const attrs = text.split(",").map((s) => s.trim().replace(/^'|'$/g, ""));
|
|
3229
3326
|
const preview = attrs.slice(0, 3);
|
|
3230
|
-
return /* @__PURE__ */ jsxs11("div", { className: "text-xs
|
|
3327
|
+
return /* @__PURE__ */ jsxs11("div", { className: "text-xs px-2 py-1.5 border-t border-dashed border-amber-300/60 bg-amber-50/40 dark:bg-amber-950/20 text-amber-700 dark:text-amber-400", children: [
|
|
3231
3328
|
/* @__PURE__ */ jsxs11(
|
|
3232
3329
|
"button",
|
|
3233
3330
|
{
|
|
3234
3331
|
type: "button",
|
|
3235
|
-
className: "flex items-center gap-1 hover:text-
|
|
3332
|
+
className: "flex items-center gap-1 hover:text-amber-900 dark:hover:text-amber-300 transition-colors",
|
|
3236
3333
|
onClick: () => setOpen((v) => !v),
|
|
3237
3334
|
children: [
|
|
3238
|
-
/* @__PURE__ */ jsx22(
|
|
3335
|
+
/* @__PURE__ */ jsx22(AlertTriangle2, { className: "h-3 w-3" }),
|
|
3239
3336
|
/* @__PURE__ */ jsx22("span", { className: "font-medium", children: "Missing attributes:" }),
|
|
3240
3337
|
!open && /* @__PURE__ */ jsxs11("span", { children: [
|
|
3241
3338
|
preview.join(", "),
|
|
@@ -3344,6 +3441,13 @@ function EditFeed({
|
|
|
3344
3441
|
editedRowIndices.add(idx);
|
|
3345
3442
|
}
|
|
3346
3443
|
if (editedRowIndices.size === 0) {
|
|
3444
|
+
if (errorCount === 0) {
|
|
3445
|
+
onSubmit(
|
|
3446
|
+
{ transformedUrl },
|
|
3447
|
+
"No critical errors. Proceeding with current feed."
|
|
3448
|
+
);
|
|
3449
|
+
return;
|
|
3450
|
+
}
|
|
3347
3451
|
setErrorMsg("No cells have been edited. Please fix the highlighted values first.");
|
|
3348
3452
|
setIsLoading(false);
|
|
3349
3453
|
return;
|
|
@@ -3409,6 +3513,7 @@ function EditFeed({
|
|
|
3409
3513
|
rowNumbers,
|
|
3410
3514
|
columns,
|
|
3411
3515
|
editedCells,
|
|
3516
|
+
errorCount,
|
|
3412
3517
|
storeId,
|
|
3413
3518
|
feedFileType,
|
|
3414
3519
|
mappingKey,
|
|
@@ -3420,17 +3525,22 @@ function EditFeed({
|
|
|
3420
3525
|
/* @__PURE__ */ jsx22("div", { className: "flex items-center justify-between px-1", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
3421
3526
|
/* @__PURE__ */ jsx22(AlertTriangle2, { className: "h-4 w-4 text-destructive" }),
|
|
3422
3527
|
/* @__PURE__ */ jsx22("span", { className: "font-medium text-sm", children: "Feed Validation Issues" }),
|
|
3423
|
-
/* @__PURE__ */ jsxs11(Badge, { variant: "destructive", className: "text-[10px]", children: [
|
|
3528
|
+
errorCount > 0 && /* @__PURE__ */ jsxs11(Badge, { variant: "destructive", className: "text-[10px]", children: [
|
|
3424
3529
|
errorCount,
|
|
3425
3530
|
" error",
|
|
3426
3531
|
errorCount !== 1 ? "s" : ""
|
|
3427
3532
|
] }),
|
|
3533
|
+
dataIssuesRaw.length > 0 && /* @__PURE__ */ jsxs11(Badge, { variant: "outline", className: "text-[10px] border-amber-400 text-amber-600 dark:text-amber-400", children: [
|
|
3534
|
+
dataIssuesRaw.length,
|
|
3535
|
+
" warning",
|
|
3536
|
+
dataIssuesRaw.length !== 1 ? "s" : ""
|
|
3537
|
+
] }),
|
|
3428
3538
|
editedCells.size > 0 && /* @__PURE__ */ jsxs11(Badge, { variant: "secondary", className: "text-[10px]", children: [
|
|
3429
3539
|
editedCells.size,
|
|
3430
3540
|
" edited"
|
|
3431
3541
|
] })
|
|
3432
3542
|
] }) }),
|
|
3433
|
-
/* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground px-1", children: "Click on the highlighted cells to edit their values, then submit to re-validate." }),
|
|
3543
|
+
/* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground px-1", children: errorCount > 0 ? "Click on the highlighted cells to edit their values, then submit to re-validate." : "No critical errors found. Review the warnings below and edit values if needed, or proceed." }),
|
|
3434
3544
|
statusMsg && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 px-2 py-1.5 rounded bg-muted text-xs text-muted-foreground", children: [
|
|
3435
3545
|
/* @__PURE__ */ jsx22(Loader26, { className: "h-3 w-3 animate-spin" }),
|
|
3436
3546
|
statusMsg
|
|
@@ -3461,12 +3571,18 @@ function EditFeed({
|
|
|
3461
3571
|
hasError: !!cellErr,
|
|
3462
3572
|
errorMessage: cellErr,
|
|
3463
3573
|
onChange: (val) => handleCellChange(rowIdx, col, val),
|
|
3464
|
-
readOnly: isLoading
|
|
3574
|
+
readOnly: isLoading,
|
|
3575
|
+
onFetchSuggestions: cellErr ? () => fetchValidValues(
|
|
3576
|
+
sourceMp,
|
|
3577
|
+
marketplaceOv,
|
|
3578
|
+
row["Category"] ?? "",
|
|
3579
|
+
col
|
|
3580
|
+
) : void 0
|
|
3465
3581
|
}
|
|
3466
3582
|
) }, col);
|
|
3467
3583
|
})
|
|
3468
3584
|
] }),
|
|
3469
|
-
missingAttrs && /* @__PURE__ */ jsx22("tr", { children: /* @__PURE__ */ jsx22("td", { colSpan: columns.length + 1, children: /* @__PURE__ */ jsx22(MissingAttributesBanner, { text: missingAttrs }) }) })
|
|
3585
|
+
missingAttrs && /* @__PURE__ */ jsx22("tr", { children: /* @__PURE__ */ jsx22("td", { colSpan: columns.length + 1, children: /* @__PURE__ */ jsx22(MissingAttributesBanner, { text: missingAttrs, defaultOpen: errorCount === 0 }) }) })
|
|
3470
3586
|
] }, rowIdx);
|
|
3471
3587
|
}),
|
|
3472
3588
|
rows.length === 0 && /* @__PURE__ */ jsx22(TableRow, { children: /* @__PURE__ */ jsx22(
|
|
@@ -3502,8 +3618,8 @@ function EditFeed({
|
|
|
3502
3618
|
className: "gap-1.5",
|
|
3503
3619
|
disabled: isLoading,
|
|
3504
3620
|
children: [
|
|
3505
|
-
isLoading ? /* @__PURE__ */ jsx22(Loader26, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx22(RefreshCw, { className: "h-3.5 w-3.5" }),
|
|
3506
|
-
"Fix & Re-validate"
|
|
3621
|
+
isLoading ? /* @__PURE__ */ jsx22(Loader26, { className: "h-3.5 w-3.5 animate-spin" }) : errorCount > 0 ? /* @__PURE__ */ jsx22(RefreshCw, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx22(Send2, { className: "h-3.5 w-3.5" }),
|
|
3622
|
+
errorCount > 0 ? "Fix & Re-validate" : editedCells.size > 0 ? "Fix & Re-validate" : "Proceed"
|
|
3507
3623
|
]
|
|
3508
3624
|
}
|
|
3509
3625
|
)
|
|
@@ -3512,7 +3628,7 @@ function EditFeed({
|
|
|
3512
3628
|
}
|
|
3513
3629
|
|
|
3514
3630
|
// src/Automations/ProductAutomation.tsx
|
|
3515
|
-
import { useState as useState10, useEffect as
|
|
3631
|
+
import { useState as useState10, useEffect as useEffect7, useCallback as useCallback8, useRef as useRef6 } from "react";
|
|
3516
3632
|
import { ArrowLeft as ArrowLeft3, Search as Search4, Loader2 as Loader28, ChevronDown as ChevronDown4, Play } from "lucide-react";
|
|
3517
3633
|
|
|
3518
3634
|
// src/Automations/api.ts
|
|
@@ -4001,14 +4117,14 @@ function ProductAutomation({
|
|
|
4001
4117
|
const [loadingOptions, setLoadingOptions] = useState10({});
|
|
4002
4118
|
const [schemaLoading, setSchemaLoading] = useState10(false);
|
|
4003
4119
|
const [applying, setApplying] = useState10(false);
|
|
4004
|
-
const configsRef =
|
|
4120
|
+
const configsRef = useRef6(configs);
|
|
4005
4121
|
configsRef.current = configs;
|
|
4006
|
-
const optionsRef =
|
|
4122
|
+
const optionsRef = useRef6(options);
|
|
4007
4123
|
optionsRef.current = options;
|
|
4008
|
-
const loadingOptionsRef =
|
|
4124
|
+
const loadingOptionsRef = useRef6(loadingOptions);
|
|
4009
4125
|
loadingOptionsRef.current = loadingOptions;
|
|
4010
4126
|
const productsCount = selectedProducts.includes("all") ? excludedProducts.length === 0 ? totalProducts : totalProducts - excludedProducts.length : productsCountProp;
|
|
4011
|
-
|
|
4127
|
+
useEffect7(() => {
|
|
4012
4128
|
setLoading(true);
|
|
4013
4129
|
fetchAutomationList(storeId, "product", true).then((data) => {
|
|
4014
4130
|
const groups = {};
|
|
@@ -4024,7 +4140,7 @@ function ProductAutomation({
|
|
|
4024
4140
|
if (sorted.length > 0) setExpandedGroups([sorted[0]]);
|
|
4025
4141
|
}).catch(console.error).finally(() => setLoading(false));
|
|
4026
4142
|
}, [storeId]);
|
|
4027
|
-
|
|
4143
|
+
useEffect7(() => {
|
|
4028
4144
|
if (!selected) {
|
|
4029
4145
|
setSchema([]);
|
|
4030
4146
|
setConfigs({});
|
|
@@ -4043,7 +4159,7 @@ function ProductAutomation({
|
|
|
4043
4159
|
configsRef.current = defaults;
|
|
4044
4160
|
}).catch(console.error).finally(() => setSchemaLoading(false));
|
|
4045
4161
|
}, [selected, storeId]);
|
|
4046
|
-
|
|
4162
|
+
useEffect7(() => {
|
|
4047
4163
|
if (schema.length === 0) return;
|
|
4048
4164
|
const flatItems = schema.flatMap((s) => s.mapping_parameters ?? [s]);
|
|
4049
4165
|
for (const item of flatItems) {
|
|
@@ -4299,7 +4415,7 @@ function formatTimeSaved(totalSeconds) {
|
|
|
4299
4415
|
}
|
|
4300
4416
|
|
|
4301
4417
|
// src/Automations/StoreAutomation.tsx
|
|
4302
|
-
import { useState as useState11, useEffect as
|
|
4418
|
+
import { useState as useState11, useEffect as useEffect8, useCallback as useCallback9, useRef as useRef7 } from "react";
|
|
4303
4419
|
import { ArrowLeft as ArrowLeft4, Settings } from "lucide-react";
|
|
4304
4420
|
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4305
4421
|
function StoreAutomation({
|
|
@@ -4313,7 +4429,7 @@ function StoreAutomation({
|
|
|
4313
4429
|
const [automations, setAutomations] = useState11([]);
|
|
4314
4430
|
const [selectedConfigs, setSelectedConfigs] = useState11({ ...enabledAutomations });
|
|
4315
4431
|
const [selectedAutomation, setSelectedAutomation] = useState11(null);
|
|
4316
|
-
|
|
4432
|
+
useEffect8(() => {
|
|
4317
4433
|
setLoading(true);
|
|
4318
4434
|
fetchAutomationList(storeId, "default").then((data) => {
|
|
4319
4435
|
setAutomations(
|
|
@@ -4448,11 +4564,11 @@ function AutomationConfigEditor({
|
|
|
4448
4564
|
);
|
|
4449
4565
|
const [options, setOptions] = useState11({});
|
|
4450
4566
|
const [loadingOptions, setLoadingOptions] = useState11({});
|
|
4451
|
-
const configsRef =
|
|
4567
|
+
const configsRef = useRef7(configs);
|
|
4452
4568
|
configsRef.current = configs;
|
|
4453
|
-
const optionsRef =
|
|
4569
|
+
const optionsRef = useRef7(options);
|
|
4454
4570
|
optionsRef.current = options;
|
|
4455
|
-
|
|
4571
|
+
useEffect8(() => {
|
|
4456
4572
|
if (!automation.isEnabled) return;
|
|
4457
4573
|
setSchemaLoading(true);
|
|
4458
4574
|
fetchAutomationSchema(storeId, automation.automation, "default").then((items) => {
|
|
@@ -4467,7 +4583,7 @@ function AutomationConfigEditor({
|
|
|
4467
4583
|
}
|
|
4468
4584
|
}).catch(console.error).finally(() => setSchemaLoading(false));
|
|
4469
4585
|
}, [storeId, automation, initialConfigs]);
|
|
4470
|
-
|
|
4586
|
+
useEffect8(() => {
|
|
4471
4587
|
if (schema.length === 0) return;
|
|
4472
4588
|
for (const item of schema) {
|
|
4473
4589
|
if (!item.curl) continue;
|
|
@@ -4598,7 +4714,7 @@ function CatalogixChat(props) {
|
|
|
4598
4714
|
const filters = uiProps.filters ?? {};
|
|
4599
4715
|
const selectedPageRange = uiProps.selectedPageRange ?? [];
|
|
4600
4716
|
const enabledAutomations = uiProps.enabledAutomations ?? {};
|
|
4601
|
-
|
|
4717
|
+
useEffect9(() => {
|
|
4602
4718
|
configureApi({ catalogixBaseUrl });
|
|
4603
4719
|
}, [catalogixBaseUrl]);
|
|
4604
4720
|
if (section === "select_products") {
|
package/package.json
CHANGED