@optifye/dashboard-core 6.11.0 → 6.11.1
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 +6 -93
- package/dist/index.mjs +6 -93
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -69275,74 +69275,6 @@ var buildInitials = (name) => {
|
|
|
69275
69275
|
const second = parts.length > 1 ? parts[1]?.[0] || "" : "";
|
|
69276
69276
|
return `${first}${second}`.toUpperCase();
|
|
69277
69277
|
};
|
|
69278
|
-
var MOCK_IE_TEAM_USER_ID = "mock-industrial-engineering-team";
|
|
69279
|
-
var MOCK_IE_TICKET_ID = "mock-ie-rack-too-far-away";
|
|
69280
|
-
var getRandomVideoGalleryClips = (recommendations, maxClips = 3) => {
|
|
69281
|
-
const seen = /* @__PURE__ */ new Set();
|
|
69282
|
-
const candidates = [];
|
|
69283
|
-
recommendations.forEach((rec) => {
|
|
69284
|
-
if (!Array.isArray(rec.evidence)) return;
|
|
69285
|
-
rec.evidence.forEach((evidenceItem) => {
|
|
69286
|
-
if (evidenceItem.type !== "video_gallery" || !Array.isArray(evidenceItem.clips)) return;
|
|
69287
|
-
evidenceItem.clips.forEach((rawClip) => {
|
|
69288
|
-
if (!rawClip || typeof rawClip.clip_id !== "string") return;
|
|
69289
|
-
const key = `${rawClip.clip_id}:${rawClip.workspace_id || ""}`;
|
|
69290
|
-
if (seen.has(key)) return;
|
|
69291
|
-
seen.add(key);
|
|
69292
|
-
candidates.push({
|
|
69293
|
-
clip_id: rawClip.clip_id,
|
|
69294
|
-
workspace_id: typeof rawClip.workspace_id === "string" ? rawClip.workspace_id : void 0,
|
|
69295
|
-
cycle_time_seconds: typeof rawClip.cycle_time_seconds === "number" ? rawClip.cycle_time_seconds : void 0,
|
|
69296
|
-
cycle_sec: typeof rawClip.cycle_sec === "number" ? rawClip.cycle_sec : void 0
|
|
69297
|
-
});
|
|
69298
|
-
});
|
|
69299
|
-
});
|
|
69300
|
-
});
|
|
69301
|
-
for (let i = candidates.length - 1; i > 0; i -= 1) {
|
|
69302
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
69303
|
-
[candidates[i], candidates[j]] = [candidates[j], candidates[i]];
|
|
69304
|
-
}
|
|
69305
|
-
return candidates.slice(0, Math.max(1, maxClips));
|
|
69306
|
-
};
|
|
69307
|
-
var buildIEMockRecommendation = (recommendations, lineNameById) => {
|
|
69308
|
-
const now4 = /* @__PURE__ */ new Date();
|
|
69309
|
-
const firstSeen = new Date(now4.getTime() - 3 * 24 * 60 * 60 * 1e3).toISOString();
|
|
69310
|
-
const sampleRec = recommendations.find((rec) => !!rec.line_id) || recommendations[0];
|
|
69311
|
-
const lineId = sampleRec?.line_id;
|
|
69312
|
-
const line = lineId ? lineNameById.get(lineId) || sampleRec?.line || "Line 1" : sampleRec?.line || "Line 1";
|
|
69313
|
-
const shiftLabel = sampleRec?.shift_label;
|
|
69314
|
-
const shiftId = sampleRec?.shift_id;
|
|
69315
|
-
const randomClips = getRandomVideoGalleryClips(recommendations, 3);
|
|
69316
|
-
return {
|
|
69317
|
-
id: MOCK_IE_TICKET_ID,
|
|
69318
|
-
issue_id: MOCK_IE_TICKET_ID,
|
|
69319
|
-
issue_number: 0,
|
|
69320
|
-
issue_status: "open",
|
|
69321
|
-
template_code: "ie_rack_too_far_away_mock",
|
|
69322
|
-
type: "cycle_time",
|
|
69323
|
-
title: "Rack too far away",
|
|
69324
|
-
location: "Industrial Engineering Review",
|
|
69325
|
-
line,
|
|
69326
|
-
line_id: lineId,
|
|
69327
|
-
description: "We analyzed 30 slow clips and saw that the top reason was the operator having to reach for the desk.",
|
|
69328
|
-
resolution_instructions: "Completion condition: Move the rack 3 inches closer to the operator for better ergonomic posture.",
|
|
69329
|
-
shift_id: shiftId,
|
|
69330
|
-
shift_label: shiftLabel,
|
|
69331
|
-
first_seen_at: firstSeen,
|
|
69332
|
-
visible_since: firstSeen,
|
|
69333
|
-
weeks_open: 1,
|
|
69334
|
-
ticket_status: "active",
|
|
69335
|
-
assigned_to_user_id: MOCK_IE_TEAM_USER_ID,
|
|
69336
|
-
assigned_user_ids: [MOCK_IE_TEAM_USER_ID],
|
|
69337
|
-
evidence: randomClips.length > 0 ? [
|
|
69338
|
-
{
|
|
69339
|
-
type: "video_gallery",
|
|
69340
|
-
title: "Slow clips analyzed",
|
|
69341
|
-
clips: randomClips
|
|
69342
|
-
}
|
|
69343
|
-
] : []
|
|
69344
|
-
};
|
|
69345
|
-
};
|
|
69346
69278
|
var ClipVideoCarousel = ({ clips, clipsService }) => {
|
|
69347
69279
|
const [currentIndex, setCurrentIndex] = React141.useState(0);
|
|
69348
69280
|
const [videos, setVideos] = React141.useState([]);
|
|
@@ -69801,21 +69733,6 @@ var ImprovementCenterView = () => {
|
|
|
69801
69733
|
return map;
|
|
69802
69734
|
}, [companyLines, configuredLines]);
|
|
69803
69735
|
const companyId = user?.company_id || entityConfig.companyId;
|
|
69804
|
-
const industrialEngineeringTeamMember = React141.useMemo(
|
|
69805
|
-
() => ({
|
|
69806
|
-
id: MOCK_IE_TEAM_USER_ID,
|
|
69807
|
-
name: "Industrial Engineering Team",
|
|
69808
|
-
role: "industrial_engineering",
|
|
69809
|
-
initials: "IE"
|
|
69810
|
-
}),
|
|
69811
|
-
[]
|
|
69812
|
-
);
|
|
69813
|
-
const teamMembersWithIETeam = React141.useMemo(() => {
|
|
69814
|
-
if (teamMembers.some((member) => member.id === MOCK_IE_TEAM_USER_ID)) {
|
|
69815
|
-
return teamMembers;
|
|
69816
|
-
}
|
|
69817
|
-
return [...teamMembers, industrialEngineeringTeamMember];
|
|
69818
|
-
}, [teamMembers, industrialEngineeringTeamMember]);
|
|
69819
69736
|
const clipsService = React141.useMemo(() => {
|
|
69820
69737
|
try {
|
|
69821
69738
|
return new S3ClipsSupabaseService(dashboardConfig);
|
|
@@ -69928,11 +69845,7 @@ var ImprovementCenterView = () => {
|
|
|
69928
69845
|
});
|
|
69929
69846
|
const allowed = new Set(scopeLineIds);
|
|
69930
69847
|
const scopedRecommendations = recs.filter((r2) => !r2.line_id || allowed.has(r2.line_id));
|
|
69931
|
-
|
|
69932
|
-
setRecommendations([
|
|
69933
|
-
mockRecommendation,
|
|
69934
|
-
...scopedRecommendations.filter((recommendation) => recommendation.id !== MOCK_IE_TICKET_ID)
|
|
69935
|
-
]);
|
|
69848
|
+
setRecommendations(scopedRecommendations);
|
|
69936
69849
|
} catch (err) {
|
|
69937
69850
|
if (cancelled) return;
|
|
69938
69851
|
setLoadError(err?.message || "Failed to load recommendations");
|
|
@@ -69945,10 +69858,10 @@ var ImprovementCenterView = () => {
|
|
|
69945
69858
|
return () => {
|
|
69946
69859
|
cancelled = true;
|
|
69947
69860
|
};
|
|
69948
|
-
}, [supabase, companyId, scopeLineIdsKey
|
|
69861
|
+
}, [supabase, companyId, scopeLineIdsKey]);
|
|
69949
69862
|
const teamMembersById = React141.useMemo(() => {
|
|
69950
|
-
return new Map(
|
|
69951
|
-
}, [
|
|
69863
|
+
return new Map(teamMembers.map((member) => [member.id, member]));
|
|
69864
|
+
}, [teamMembers]);
|
|
69952
69865
|
const filteredRecommendations = React141.useMemo(() => {
|
|
69953
69866
|
return recommendations.filter((rec) => {
|
|
69954
69867
|
if (selectedLineId !== "all" && rec.line_id !== selectedLineId) return false;
|
|
@@ -70066,7 +69979,7 @@ var ImprovementCenterView = () => {
|
|
|
70066
69979
|
setSelectedWeeksRange(weeksRange);
|
|
70067
69980
|
};
|
|
70068
69981
|
const handleMemberFilterChange = (memberId) => {
|
|
70069
|
-
const memberName = memberId === "all" ? "all" :
|
|
69982
|
+
const memberName = memberId === "all" ? "all" : teamMembers.find((member) => member.id === memberId)?.name || memberId;
|
|
70070
69983
|
trackCoreEvent("Improvement Center Filter Applied", {
|
|
70071
69984
|
filter_type: "member",
|
|
70072
69985
|
filter_value: memberName,
|
|
@@ -70148,7 +70061,7 @@ var ImprovementCenterView = () => {
|
|
|
70148
70061
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: [
|
|
70149
70062
|
{ value: selectedShift, onChange: handleShiftFilterChange, options: shiftOptions, label: "Shift" },
|
|
70150
70063
|
{ value: selectedWeeksRange, onChange: handleWeeksFilterChange, options: weekOptions.map((o) => o.id), labels: weekOptions, label: "Duration" },
|
|
70151
|
-
{ value: selectedMemberId, onChange: handleMemberFilterChange, options: ["all", ...
|
|
70064
|
+
{ value: selectedMemberId, onChange: handleMemberFilterChange, options: ["all", ...teamMembers.map((m) => m.id)], labels: teamMembers, label: "Member" },
|
|
70152
70065
|
{ value: selectedLineId, onChange: handleLineFilterChange, options: lineOptions.map((o) => o.id), labels: lineOptions, label: "Line" }
|
|
70153
70066
|
].map((filter2, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
70154
70067
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs font-medium text-gray-500 uppercase tracking-wide ml-1", children: filter2.label }),
|
package/dist/index.mjs
CHANGED
|
@@ -69246,74 +69246,6 @@ var buildInitials = (name) => {
|
|
|
69246
69246
|
const second = parts.length > 1 ? parts[1]?.[0] || "" : "";
|
|
69247
69247
|
return `${first}${second}`.toUpperCase();
|
|
69248
69248
|
};
|
|
69249
|
-
var MOCK_IE_TEAM_USER_ID = "mock-industrial-engineering-team";
|
|
69250
|
-
var MOCK_IE_TICKET_ID = "mock-ie-rack-too-far-away";
|
|
69251
|
-
var getRandomVideoGalleryClips = (recommendations, maxClips = 3) => {
|
|
69252
|
-
const seen = /* @__PURE__ */ new Set();
|
|
69253
|
-
const candidates = [];
|
|
69254
|
-
recommendations.forEach((rec) => {
|
|
69255
|
-
if (!Array.isArray(rec.evidence)) return;
|
|
69256
|
-
rec.evidence.forEach((evidenceItem) => {
|
|
69257
|
-
if (evidenceItem.type !== "video_gallery" || !Array.isArray(evidenceItem.clips)) return;
|
|
69258
|
-
evidenceItem.clips.forEach((rawClip) => {
|
|
69259
|
-
if (!rawClip || typeof rawClip.clip_id !== "string") return;
|
|
69260
|
-
const key = `${rawClip.clip_id}:${rawClip.workspace_id || ""}`;
|
|
69261
|
-
if (seen.has(key)) return;
|
|
69262
|
-
seen.add(key);
|
|
69263
|
-
candidates.push({
|
|
69264
|
-
clip_id: rawClip.clip_id,
|
|
69265
|
-
workspace_id: typeof rawClip.workspace_id === "string" ? rawClip.workspace_id : void 0,
|
|
69266
|
-
cycle_time_seconds: typeof rawClip.cycle_time_seconds === "number" ? rawClip.cycle_time_seconds : void 0,
|
|
69267
|
-
cycle_sec: typeof rawClip.cycle_sec === "number" ? rawClip.cycle_sec : void 0
|
|
69268
|
-
});
|
|
69269
|
-
});
|
|
69270
|
-
});
|
|
69271
|
-
});
|
|
69272
|
-
for (let i = candidates.length - 1; i > 0; i -= 1) {
|
|
69273
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
69274
|
-
[candidates[i], candidates[j]] = [candidates[j], candidates[i]];
|
|
69275
|
-
}
|
|
69276
|
-
return candidates.slice(0, Math.max(1, maxClips));
|
|
69277
|
-
};
|
|
69278
|
-
var buildIEMockRecommendation = (recommendations, lineNameById) => {
|
|
69279
|
-
const now4 = /* @__PURE__ */ new Date();
|
|
69280
|
-
const firstSeen = new Date(now4.getTime() - 3 * 24 * 60 * 60 * 1e3).toISOString();
|
|
69281
|
-
const sampleRec = recommendations.find((rec) => !!rec.line_id) || recommendations[0];
|
|
69282
|
-
const lineId = sampleRec?.line_id;
|
|
69283
|
-
const line = lineId ? lineNameById.get(lineId) || sampleRec?.line || "Line 1" : sampleRec?.line || "Line 1";
|
|
69284
|
-
const shiftLabel = sampleRec?.shift_label;
|
|
69285
|
-
const shiftId = sampleRec?.shift_id;
|
|
69286
|
-
const randomClips = getRandomVideoGalleryClips(recommendations, 3);
|
|
69287
|
-
return {
|
|
69288
|
-
id: MOCK_IE_TICKET_ID,
|
|
69289
|
-
issue_id: MOCK_IE_TICKET_ID,
|
|
69290
|
-
issue_number: 0,
|
|
69291
|
-
issue_status: "open",
|
|
69292
|
-
template_code: "ie_rack_too_far_away_mock",
|
|
69293
|
-
type: "cycle_time",
|
|
69294
|
-
title: "Rack too far away",
|
|
69295
|
-
location: "Industrial Engineering Review",
|
|
69296
|
-
line,
|
|
69297
|
-
line_id: lineId,
|
|
69298
|
-
description: "We analyzed 30 slow clips and saw that the top reason was the operator having to reach for the desk.",
|
|
69299
|
-
resolution_instructions: "Completion condition: Move the rack 3 inches closer to the operator for better ergonomic posture.",
|
|
69300
|
-
shift_id: shiftId,
|
|
69301
|
-
shift_label: shiftLabel,
|
|
69302
|
-
first_seen_at: firstSeen,
|
|
69303
|
-
visible_since: firstSeen,
|
|
69304
|
-
weeks_open: 1,
|
|
69305
|
-
ticket_status: "active",
|
|
69306
|
-
assigned_to_user_id: MOCK_IE_TEAM_USER_ID,
|
|
69307
|
-
assigned_user_ids: [MOCK_IE_TEAM_USER_ID],
|
|
69308
|
-
evidence: randomClips.length > 0 ? [
|
|
69309
|
-
{
|
|
69310
|
-
type: "video_gallery",
|
|
69311
|
-
title: "Slow clips analyzed",
|
|
69312
|
-
clips: randomClips
|
|
69313
|
-
}
|
|
69314
|
-
] : []
|
|
69315
|
-
};
|
|
69316
|
-
};
|
|
69317
69249
|
var ClipVideoCarousel = ({ clips, clipsService }) => {
|
|
69318
69250
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
69319
69251
|
const [videos, setVideos] = useState([]);
|
|
@@ -69772,21 +69704,6 @@ var ImprovementCenterView = () => {
|
|
|
69772
69704
|
return map;
|
|
69773
69705
|
}, [companyLines, configuredLines]);
|
|
69774
69706
|
const companyId = user?.company_id || entityConfig.companyId;
|
|
69775
|
-
const industrialEngineeringTeamMember = useMemo(
|
|
69776
|
-
() => ({
|
|
69777
|
-
id: MOCK_IE_TEAM_USER_ID,
|
|
69778
|
-
name: "Industrial Engineering Team",
|
|
69779
|
-
role: "industrial_engineering",
|
|
69780
|
-
initials: "IE"
|
|
69781
|
-
}),
|
|
69782
|
-
[]
|
|
69783
|
-
);
|
|
69784
|
-
const teamMembersWithIETeam = useMemo(() => {
|
|
69785
|
-
if (teamMembers.some((member) => member.id === MOCK_IE_TEAM_USER_ID)) {
|
|
69786
|
-
return teamMembers;
|
|
69787
|
-
}
|
|
69788
|
-
return [...teamMembers, industrialEngineeringTeamMember];
|
|
69789
|
-
}, [teamMembers, industrialEngineeringTeamMember]);
|
|
69790
69707
|
const clipsService = useMemo(() => {
|
|
69791
69708
|
try {
|
|
69792
69709
|
return new S3ClipsSupabaseService(dashboardConfig);
|
|
@@ -69899,11 +69816,7 @@ var ImprovementCenterView = () => {
|
|
|
69899
69816
|
});
|
|
69900
69817
|
const allowed = new Set(scopeLineIds);
|
|
69901
69818
|
const scopedRecommendations = recs.filter((r2) => !r2.line_id || allowed.has(r2.line_id));
|
|
69902
|
-
|
|
69903
|
-
setRecommendations([
|
|
69904
|
-
mockRecommendation,
|
|
69905
|
-
...scopedRecommendations.filter((recommendation) => recommendation.id !== MOCK_IE_TICKET_ID)
|
|
69906
|
-
]);
|
|
69819
|
+
setRecommendations(scopedRecommendations);
|
|
69907
69820
|
} catch (err) {
|
|
69908
69821
|
if (cancelled) return;
|
|
69909
69822
|
setLoadError(err?.message || "Failed to load recommendations");
|
|
@@ -69916,10 +69829,10 @@ var ImprovementCenterView = () => {
|
|
|
69916
69829
|
return () => {
|
|
69917
69830
|
cancelled = true;
|
|
69918
69831
|
};
|
|
69919
|
-
}, [supabase, companyId, scopeLineIdsKey
|
|
69832
|
+
}, [supabase, companyId, scopeLineIdsKey]);
|
|
69920
69833
|
const teamMembersById = useMemo(() => {
|
|
69921
|
-
return new Map(
|
|
69922
|
-
}, [
|
|
69834
|
+
return new Map(teamMembers.map((member) => [member.id, member]));
|
|
69835
|
+
}, [teamMembers]);
|
|
69923
69836
|
const filteredRecommendations = useMemo(() => {
|
|
69924
69837
|
return recommendations.filter((rec) => {
|
|
69925
69838
|
if (selectedLineId !== "all" && rec.line_id !== selectedLineId) return false;
|
|
@@ -70037,7 +69950,7 @@ var ImprovementCenterView = () => {
|
|
|
70037
69950
|
setSelectedWeeksRange(weeksRange);
|
|
70038
69951
|
};
|
|
70039
69952
|
const handleMemberFilterChange = (memberId) => {
|
|
70040
|
-
const memberName = memberId === "all" ? "all" :
|
|
69953
|
+
const memberName = memberId === "all" ? "all" : teamMembers.find((member) => member.id === memberId)?.name || memberId;
|
|
70041
69954
|
trackCoreEvent("Improvement Center Filter Applied", {
|
|
70042
69955
|
filter_type: "member",
|
|
70043
69956
|
filter_value: memberName,
|
|
@@ -70119,7 +70032,7 @@ var ImprovementCenterView = () => {
|
|
|
70119
70032
|
/* @__PURE__ */ jsx("div", { className: "space-y-3", children: [
|
|
70120
70033
|
{ value: selectedShift, onChange: handleShiftFilterChange, options: shiftOptions, label: "Shift" },
|
|
70121
70034
|
{ value: selectedWeeksRange, onChange: handleWeeksFilterChange, options: weekOptions.map((o) => o.id), labels: weekOptions, label: "Duration" },
|
|
70122
|
-
{ value: selectedMemberId, onChange: handleMemberFilterChange, options: ["all", ...
|
|
70035
|
+
{ value: selectedMemberId, onChange: handleMemberFilterChange, options: ["all", ...teamMembers.map((m) => m.id)], labels: teamMembers, label: "Member" },
|
|
70123
70036
|
{ value: selectedLineId, onChange: handleLineFilterChange, options: lineOptions.map((o) => o.id), labels: lineOptions, label: "Line" }
|
|
70124
70037
|
].map((filter2, idx) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
70125
70038
|
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-gray-500 uppercase tracking-wide ml-1", children: filter2.label }),
|