@cellarnode/ui 0.186.0 → 0.188.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.
- package/dist/brand/brand-assets-api.d.ts +58 -0
- package/dist/brand/brand-assets-api.d.ts.map +1 -0
- package/dist/brand/brand-assets-api.js +160 -0
- package/dist/brand/brand-assets-api.js.map +1 -0
- package/dist/brand/brand-generation-api.d.ts +44 -0
- package/dist/brand/brand-generation-api.d.ts.map +1 -0
- package/dist/brand/brand-generation-api.js +2 -0
- package/dist/brand/brand-generation-api.js.map +1 -0
- package/dist/brand/brand-generation-client.d.ts +36 -0
- package/dist/brand/brand-generation-client.d.ts.map +1 -0
- package/dist/brand/brand-generation-client.js +107 -0
- package/dist/brand/brand-generation-client.js.map +1 -0
- package/dist/brand/brand-generation-copy.d.ts +44 -0
- package/dist/brand/brand-generation-copy.d.ts.map +1 -0
- package/dist/brand/brand-generation-copy.js +70 -0
- package/dist/brand/brand-generation-copy.js.map +1 -0
- package/dist/brand/brand-generation-fixtures.d.ts +32 -0
- package/dist/brand/brand-generation-fixtures.d.ts.map +1 -0
- package/dist/brand/brand-generation-fixtures.js +88 -0
- package/dist/brand/brand-generation-fixtures.js.map +1 -0
- package/dist/brand/brand-generation-flow.d.ts +34 -0
- package/dist/brand/brand-generation-flow.d.ts.map +1 -0
- package/dist/brand/brand-generation-flow.js +34 -0
- package/dist/brand/brand-generation-flow.js.map +1 -0
- package/dist/brand/brand-generation-keys.d.ts +16 -0
- package/dist/brand/brand-generation-keys.d.ts.map +1 -0
- package/dist/brand/brand-generation-keys.js +16 -0
- package/dist/brand/brand-generation-keys.js.map +1 -0
- package/dist/brand/brand-generation-progress.d.ts +27 -0
- package/dist/brand/brand-generation-progress.d.ts.map +1 -0
- package/dist/brand/brand-generation-progress.js +61 -0
- package/dist/brand/brand-generation-progress.js.map +1 -0
- package/dist/brand/brand-generation-recovery-error.d.ts +8 -0
- package/dist/brand/brand-generation-recovery-error.d.ts.map +1 -0
- package/dist/brand/brand-generation-recovery-error.js +7 -0
- package/dist/brand/brand-generation-recovery-error.js.map +1 -0
- package/dist/brand/brand-generation-response.d.ts +86 -0
- package/dist/brand/brand-generation-response.d.ts.map +1 -0
- package/dist/brand/brand-generation-response.js +261 -0
- package/dist/brand/brand-generation-response.js.map +1 -0
- package/dist/brand/brand-generation-sse-parser.d.ts +14 -0
- package/dist/brand/brand-generation-sse-parser.d.ts.map +1 -0
- package/dist/brand/brand-generation-sse-parser.js +92 -0
- package/dist/brand/brand-generation-sse-parser.js.map +1 -0
- package/dist/brand/brand-generation-start.d.ts +49 -0
- package/dist/brand/brand-generation-start.d.ts.map +1 -0
- package/dist/brand/brand-generation-start.js +48 -0
- package/dist/brand/brand-generation-start.js.map +1 -0
- package/dist/brand/brand-generation-steps.d.ts +4 -0
- package/dist/brand/brand-generation-steps.d.ts.map +1 -0
- package/dist/brand/brand-generation-steps.js +29 -0
- package/dist/brand/brand-generation-steps.js.map +1 -0
- package/dist/brand/brand-generation-surface.d.ts +50 -0
- package/dist/brand/brand-generation-surface.d.ts.map +1 -0
- package/dist/brand/brand-generation-surface.js +25 -0
- package/dist/brand/brand-generation-surface.js.map +1 -0
- package/dist/brand/brand-generation-url.d.ts +6 -0
- package/dist/brand/brand-generation-url.d.ts.map +1 -0
- package/dist/brand/brand-generation-url.js +4 -0
- package/dist/brand/brand-generation-url.js.map +1 -0
- package/dist/brand/brand-image-chooser.d.ts +3 -1
- package/dist/brand/brand-image-chooser.d.ts.map +1 -1
- package/dist/brand/brand-image-chooser.js +7 -1
- package/dist/brand/brand-image-chooser.js.map +1 -1
- package/dist/brand/brand-image-choosers.d.ts +37 -0
- package/dist/brand/brand-image-choosers.d.ts.map +1 -0
- package/dist/brand/brand-image-choosers.js +76 -0
- package/dist/brand/brand-image-choosers.js.map +1 -0
- package/dist/brand/brand-workspace-change-notice.d.ts +20 -0
- package/dist/brand/brand-workspace-change-notice.d.ts.map +1 -0
- package/dist/brand/brand-workspace-change-notice.js +19 -0
- package/dist/brand/brand-workspace-change-notice.js.map +1 -0
- package/dist/brand/index.d.ts +37 -0
- package/dist/brand/index.d.ts.map +1 -1
- package/dist/brand/index.js +29 -0
- package/dist/brand/index.js.map +1 -1
- package/dist/brand/resume-brand-generation.d.ts +17 -0
- package/dist/brand/resume-brand-generation.d.ts.map +1 -0
- package/dist/brand/resume-brand-generation.js +22 -0
- package/dist/brand/resume-brand-generation.js.map +1 -0
- package/dist/brand/use-brand-generation-discovery.d.ts +14 -0
- package/dist/brand/use-brand-generation-discovery.d.ts.map +1 -0
- package/dist/brand/use-brand-generation-discovery.js +61 -0
- package/dist/brand/use-brand-generation-discovery.js.map +1 -0
- package/dist/brand/use-brand-generation-transport.d.ts +16 -0
- package/dist/brand/use-brand-generation-transport.d.ts.map +1 -0
- package/dist/brand/use-brand-generation-transport.js +182 -0
- package/dist/brand/use-brand-generation-transport.js.map +1 -0
- package/dist/brand/use-brand-generation.d.ts +35 -0
- package/dist/brand/use-brand-generation.d.ts.map +1 -0
- package/dist/brand/use-brand-generation.js +225 -0
- package/dist/brand/use-brand-generation.js.map +1 -0
- package/dist/brand/use-brand-image-operation-result.d.ts +43 -0
- package/dist/brand/use-brand-image-operation-result.d.ts.map +1 -0
- package/dist/brand/use-brand-image-operation-result.js +162 -0
- package/dist/brand/use-brand-image-operation-result.js.map +1 -0
- package/dist/brand/use-brand-profile-acceptance.d.ts +38 -0
- package/dist/brand/use-brand-profile-acceptance.d.ts.map +1 -0
- package/dist/brand/use-brand-profile-acceptance.js +84 -0
- package/dist/brand/use-brand-profile-acceptance.js.map +1 -0
- package/dist/brand/use-brand-public-visibility.d.ts +59 -0
- package/dist/brand/use-brand-public-visibility.d.ts.map +1 -0
- package/dist/brand/use-brand-public-visibility.js +69 -0
- package/dist/brand/use-brand-public-visibility.js.map +1 -0
- package/dist/brand/use-brand-workspace-concurrency.d.ts +132 -0
- package/dist/brand/use-brand-workspace-concurrency.d.ts.map +1 -0
- package/dist/brand/use-brand-workspace-concurrency.js +255 -0
- package/dist/brand/use-brand-workspace-concurrency.js.map +1 -0
- package/dist/brand/use-brand-workspace-image-candidates.d.ts +19 -0
- package/dist/brand/use-brand-workspace-image-candidates.d.ts.map +1 -0
- package/dist/brand/use-brand-workspace-image-candidates.js +39 -0
- package/dist/brand/use-brand-workspace-image-candidates.js.map +1 -0
- package/dist/brand/use-org-scoped-state.d.ts +3 -0
- package/dist/brand/use-org-scoped-state.d.ts.map +1 -0
- package/dist/brand/use-org-scoped-state.js +22 -0
- package/dist/brand/use-org-scoped-state.js.map +1 -0
- package/dist/components/multi-step-loader.d.ts +4 -0
- package/dist/components/multi-step-loader.d.ts.map +1 -1
- package/dist/components/multi-step-loader.js +4 -3
- package/dist/components/multi-step-loader.js.map +1 -1
- package/dist/moderation/moderation-event.d.ts +2 -0
- package/dist/moderation/moderation-event.d.ts.map +1 -1
- package/dist/moderation/moderation-event.js +7 -0
- package/dist/moderation/moderation-event.js.map +1 -1
- package/dist/moderation/moderation-store.d.ts.map +1 -1
- package/dist/moderation/moderation-store.js +4 -2
- package/dist/moderation/moderation-store.js.map +1 -1
- package/dist/realtime/job-status/schemas.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../components/button.js";
|
|
3
|
+
import { resolveBrandGenerationCopy } from "./brand-generation-copy.js";
|
|
4
|
+
import { BrandGenerationProgress } from "./brand-generation-progress.js";
|
|
5
|
+
import { BrandProfileWorkspace } from "./brand-profile-workspace.js";
|
|
6
|
+
// CJK text wraps at phrase boundaries inside the workspace's textareas.
|
|
7
|
+
const workspaceCjkTextClassName = "[&_textarea]:[word-break:auto-phrase]";
|
|
8
|
+
/**
|
|
9
|
+
* The generation page body: the draft-review workspace once there is a draft to
|
|
10
|
+
* review, otherwise the progress / recovery panel. The persona flows into the
|
|
11
|
+
* workspace so importer wording and sections match the saved profile page.
|
|
12
|
+
*/
|
|
13
|
+
export function BrandGenerationSurface({ brandGeneration, persona = "producer", copy, resolvedGenerationUrl, reviewProfileData, reviewVisibility, showReview, onSubmit, onVisibilityChange, saveTarget, fieldErrors, conflict, onReloadConflict, onKeepMineConflict, allowedImageOrigins, reviewCopy, formCopy, workspaceCopy, statusLabel, isAccepting, onAccept, onDismiss, isDismissing, actions, changeNotice, workspaceKey, imageChoosers, formatDateTime, }) {
|
|
14
|
+
const text = resolveBrandGenerationCopy(persona, copy);
|
|
15
|
+
if (showReview && reviewProfileData) {
|
|
16
|
+
return (_jsxs("div", { className: "flex flex-col gap-6", children: [changeNotice, _jsx(BrandProfileWorkspace, { className: workspaceCjkTextClassName, persona: persona, profile: reviewProfileData, onSubmit: onSubmit, status: "draft", statusLabel: statusLabel, reviewCopy: reviewCopy, formCopy: formCopy, copy: workspaceCopy, saveTarget: saveTarget, fieldErrors: fieldErrors, conflict: conflict, onReloadConflict: onReloadConflict, onKeepMineConflict: onKeepMineConflict, allowedImageOrigins: allowedImageOrigins, publicVisibility: reviewVisibility, onPublicVisibilityChange: onVisibilityChange,
|
|
17
|
+
// CEL-1862 workaround: the contact and key-people editors are not
|
|
18
|
+
// part of the generated-draft review.
|
|
19
|
+
contactEditor: _jsx(_Fragment, {}), keyPeopleEditor: _jsx(_Fragment, {}), actions: actions ?? (_jsxs(_Fragment, { children: [onAccept ? (_jsx(Button, { color: "brand", onClick: onAccept, disabled: isAccepting, children: isAccepting ? text.acceptingAction : text.acceptAction })) : null, onDismiss ? (_jsx(Button, { outline: true, onClick: onDismiss, disabled: isDismissing, children: text.dismissAction })) : null] })) }, workspaceKey), imageChoosers] }));
|
|
20
|
+
}
|
|
21
|
+
return (_jsx(BrandGenerationProgress, { job: brandGeneration.job, eligibility: brandGeneration.eligibility, transportDegraded: brandGeneration.transportDegraded, error: brandGeneration.error, resolvedUrl: resolvedGenerationUrl, persona: persona, copy: copy, formatDateTime: formatDateTime, onStart: (url, context) => void (context === undefined
|
|
22
|
+
? brandGeneration.start(url)
|
|
23
|
+
: brandGeneration.start(url, context)), onCancel: () => void brandGeneration.cancel(), onReset: brandGeneration.reset }));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=brand-generation-surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-generation-surface.js","sourceRoot":"","sources":["../../src/brand/brand-generation-surface.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAA4B,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAMlE,wEAAwE;AACxE,MAAM,yBAAyB,GAAG,uCAAuC,CAAC;AAsC1E;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,EACrC,eAAe,EACf,OAAO,GAAG,UAAU,EACpB,IAAI,EACJ,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,GACc;IAC5B,MAAM,IAAI,GAAG,0BAA0B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAEvD,IAAI,UAAU,IAAI,iBAAiB,EAAE,CAAC;QACpC,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aACjC,YAAY,EACb,KAAC,qBAAqB,IAEpB,SAAS,EAAE,yBAAyB,EACpC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,iBAAi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,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CACxB,KAAK,CAAC,OAAO,KAAK,SAAS;YACzB,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;YAC5B,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,EAE1C,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,eAAe,CAAC,MAAM,EAAE,EAC7C,OAAO,EAAE,eAAe,CAAC,KAAK,GAC9B,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function resolveGenerationUrl({ enteredUrl, profileSourceUrl, recoveredHomepageUrl, }: {
|
|
2
|
+
readonly enteredUrl: string;
|
|
3
|
+
readonly profileSourceUrl: string | null | undefined;
|
|
4
|
+
readonly recoveredHomepageUrl: string | undefined;
|
|
5
|
+
}): string;
|
|
6
|
+
//# sourceMappingURL=brand-generation-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-generation-url.d.ts","sourceRoot":"","sources":["../../src/brand/brand-generation-url.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,gBAAgB,EAChB,oBAAoB,GACrB,EAAE;IACD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACrD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CACnD,GAAG,MAAM,CAET"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-generation-url.js","sourceRoot":"","sources":["../../src/brand/brand-generation-url.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAC,EACnC,UAAU,EACV,gBAAgB,EAChB,oBAAoB,GAKrB;IACC,OAAO,UAAU,CAAC,IAAI,EAAE,IAAI,oBAAoB,EAAE,IAAI,EAAE,IAAI,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC7F,CAAC"}
|
|
@@ -54,7 +54,9 @@ export interface BrandImageChooserProps {
|
|
|
54
54
|
* Fires once a crop is confirmed, for either a picked candidate or a
|
|
55
55
|
* fresh upload. The caller owns persistence; an optional `operationId`
|
|
56
56
|
* on the resolved value lets a later `operationResult` prop update be
|
|
57
|
-
* correlated back to this specific call.
|
|
57
|
+
* correlated back to this specific call. Reject to signal failure: the
|
|
58
|
+
* crop dialog stays open for a retry and the rejection is not rethrown, so
|
|
59
|
+
* the caller reports the failure itself.
|
|
58
60
|
*/
|
|
59
61
|
readonly onApply: (result: ImageCropConfirm & {
|
|
60
62
|
readonly source: BrandImageChooserSource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand-image-chooser.d.ts","sourceRoot":"","sources":["../../src/brand/brand-image-chooser.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAIL,KAAK,yBAAyB,EAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,8BAA8B,EAC/B,MAAM,0BAA0B,CAAC;AAElC;;oCAEoC;AACpC,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;CAAE,GACvE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAA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AG;QAAE,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAA;KAAE,KACpE,4BAA4B,GAAG,IAAI,GAAG,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAC;IACxF;uDACmD;IACnD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC5D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,UAAU,EACV,qBAA0B,EAC1B,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,YAAwB,EACxB,eAAe,EACf,OAAO,EACP,SAAS,GACV,EAAE,sBAAsB,2CAiPxB"}
|
|
@@ -75,6 +75,12 @@ export function BrandImageChooser({ target, candidates, unavailableCandidates =
|
|
|
75
75
|
const applied = await onApply({ ...result, source: pendingSource });
|
|
76
76
|
currentOperationIdRef.current = applied?.operationId;
|
|
77
77
|
}
|
|
78
|
+
catch {
|
|
79
|
+
// A rejected `onApply` is the caller's failure to report (its own toast
|
|
80
|
+
// or error state). The crop dialog stays open for a retry; rethrowing
|
|
81
|
+
// here would only surface as an unhandled rejection from the dialog's
|
|
82
|
+
// submit handler.
|
|
83
|
+
}
|
|
78
84
|
finally {
|
|
79
85
|
setApplying(false);
|
|
80
86
|
}
|
|
@@ -88,7 +94,7 @@ export function BrandImageChooser({ target, candidates, unavailableCandidates =
|
|
|
88
94
|
!busy &&
|
|
89
95
|
!failed &&
|
|
90
96
|
!indeterminate &&
|
|
91
|
-
operationResult?.status === "saved" ? (_jsxs("p", { role: "status", className: "flex items-center gap-2 text-sm/6 text-[var(--tone-success-fg)]", children: [_jsx(CheckIcon, { className: "size-4", "aria-hidden": "true" }), c.savedStatus] })) : null, candidates.length === 0 && unavailableCandidates.length === 0 ? (_jsxs("div", { className: "flex flex-col items-start gap-3 rounded-xl border border-dashed border-border/70 bg-muted/20 p-5", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm/6 font-semibold text-foreground", children: c.emptyStateHeading }), _jsx("p", { className: "mt-1 text-sm/6 text-muted-foreground", children: c.emptyStateBody })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs("button", { type: "button", onClick: () => inputRef.current?.click(), className: "inline-flex min-h-11 items-center gap-1.5 rounded-lg bg-primary px-3.5 py-2 text-sm/5 font-medium text-primary-foreground hover:bg-primary/90", children: [_jsx(UploadIcon, { className: "size-4", "aria-hidden": "true" }), c.uploadAction] }), onCreateManually ? (_jsx("button", { type: "button", onClick: onCreateManually, className: "inline-flex min-h-11 items-center rounded-lg border border-border bg-background px-3.5 py-2 text-sm/5 font-medium text-foreground hover:bg-muted", children: c.createManuallyAction })) : null] })] })) : (_jsxs(_Fragment, { children: [_jsx(BrandImageSourcePicker, { candidates: candidates, unavailableCandidates: unavailableCandidates, onSelect: handleCandidateSelect, target: target, copy: copy, allowedImageOrigins: allowedImageOrigins }), _jsxs("button", { type: "button", onClick: () => inputRef.current?.click(), className: "inline-flex min-h-11 items-center gap-1.5 self-start rounded-lg border border-border bg-background px-3.5 py-2 text-sm/5 font-medium text-foreground hover:bg-muted focus-visible:outline-hidden focus-visible:ring-3 focus-visible:ring-ring/70", children: [_jsx(UploadIcon, { className: "size-4", "aria-hidden": "true" }), c.uploadNewAction] })] })), _jsx("input", { ref: inputRef, type: "file", accept: uploadAccept, tabIndex: -1, className: "sr-only", "aria-label": c.uploadAction, onChange: (event) => {
|
|
97
|
+
(operationResult?.status === "saved" || operationResult?.status === "passed") ? (_jsxs("p", { role: "status", className: "flex items-center gap-2 text-sm/6 text-[var(--tone-success-fg)]", children: [_jsx(CheckIcon, { className: "size-4", "aria-hidden": "true" }), operationResult?.status === "passed" ? c.passedStatus : c.savedStatus] })) : null, candidates.length === 0 && unavailableCandidates.length === 0 ? (_jsxs("div", { className: "flex flex-col items-start gap-3 rounded-xl border border-dashed border-border/70 bg-muted/20 p-5", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm/6 font-semibold text-foreground", children: c.emptyStateHeading }), _jsx("p", { className: "mt-1 text-sm/6 text-muted-foreground", children: c.emptyStateBody })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs("button", { type: "button", onClick: () => inputRef.current?.click(), className: "inline-flex min-h-11 items-center gap-1.5 rounded-lg bg-primary px-3.5 py-2 text-sm/5 font-medium text-primary-foreground hover:bg-primary/90", children: [_jsx(UploadIcon, { className: "size-4", "aria-hidden": "true" }), c.uploadAction] }), onCreateManually ? (_jsx("button", { type: "button", onClick: onCreateManually, className: "inline-flex min-h-11 items-center rounded-lg border border-border bg-background px-3.5 py-2 text-sm/5 font-medium text-foreground hover:bg-muted", children: c.createManuallyAction })) : null] })] })) : (_jsxs(_Fragment, { children: [_jsx(BrandImageSourcePicker, { candidates: candidates, unavailableCandidates: unavailableCandidates, onSelect: handleCandidateSelect, target: target, copy: copy, allowedImageOrigins: allowedImageOrigins }), _jsxs("button", { type: "button", onClick: () => inputRef.current?.click(), className: "inline-flex min-h-11 items-center gap-1.5 self-start rounded-lg border border-border bg-background px-3.5 py-2 text-sm/5 font-medium text-foreground hover:bg-muted focus-visible:outline-hidden focus-visible:ring-3 focus-visible:ring-ring/70", children: [_jsx(UploadIcon, { className: "size-4", "aria-hidden": "true" }), c.uploadNewAction] })] })), _jsx("input", { ref: inputRef, type: "file", accept: uploadAccept, tabIndex: -1, className: "sr-only", "aria-label": c.uploadAction, onChange: (event) => {
|
|
92
98
|
const file = event.target.files?.[0];
|
|
93
99
|
if (file)
|
|
94
100
|
handleFileChosen(file);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand-image-chooser.js","sourceRoot":"","sources":["../../src/brand/brand-image-chooser.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,eAAe,EAAyB,MAAM,mCAAmC,CAAC;AAG3F,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,EAClC,4BAA4B,GAE7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,sBAAsB,GAEvB,MAAM,6BAA6B,CAAC;AAuCrC,MAAM,oBAAoB,GAkBtB;IACF,iBAAiB,EAAE,qBAAqB;IACxC,cAAc,EAAE,oEAAoE;IACpF,YAAY,EAAE,iBAAiB;IAC/B,eAAe,EAAE,0BAA0B;IAC3C,oBAAoB,EAAE,2BAA2B;IACjD,cAAc,EAAE,sBAAsB;IACtC,WAAW,EAAE,OAAO;IACpB,YAAY,EAAE,mBAAmB;IACjC,cAAc,EAAE,4BAA4B;IAC5C,WAAW,EACT,2FAA2F;IAC7F,eAAe,EAAE,6BAA6B;IAC9C,YAAY,EAAE,sBAAsB;IACpC,WAAW,EAAE,WAAW;IACxB,aAAa,EAAE,SAAS;CACzB,CAAC;
|
|
1
|
+
{"version":3,"file":"brand-image-chooser.js","sourceRoot":"","sources":["../../src/brand/brand-image-chooser.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EA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
|
|
2
|
+
import type { BrandImageCandidateSet } from "./brand-image-candidates.js";
|
|
3
|
+
import type { BrandAssetsApi } from "./brand-assets-api.js";
|
|
4
|
+
import type { BrandWorkspaceNotice } from "./use-brand-profile-acceptance.js";
|
|
5
|
+
export interface BrandImageChoosersCopy {
|
|
6
|
+
readonly avatarLabel: string;
|
|
7
|
+
readonly bannerLabel: string;
|
|
8
|
+
readonly uploadRequiresProfile: string;
|
|
9
|
+
readonly uploadFailed: string;
|
|
10
|
+
readonly logoUploaded: string;
|
|
11
|
+
readonly bannerUploaded: string;
|
|
12
|
+
/** Passed through to both `BrandImageChooser`s. */
|
|
13
|
+
readonly chooser?: BrandImageChooserCopy;
|
|
14
|
+
}
|
|
15
|
+
export declare const DEFAULT_BRAND_IMAGE_CHOOSERS_COPY: BrandImageChoosersCopy;
|
|
16
|
+
export interface BrandImageChoosersProps {
|
|
17
|
+
/** `null` before a profile exists (manual create): uploads are refused, not sent. */
|
|
18
|
+
readonly brandProfileId: string | null;
|
|
19
|
+
readonly avatarCandidateSet: BrandImageCandidateSet;
|
|
20
|
+
readonly bannerCandidateSet: BrandImageCandidateSet;
|
|
21
|
+
readonly allowedImageOrigins: readonly string[];
|
|
22
|
+
/** Persistence. Wrap `BrandAssetsApi.upload` to add cache invalidation. */
|
|
23
|
+
readonly assetsApi: Pick<BrandAssetsApi, "upload" | "fetchModeration">;
|
|
24
|
+
readonly notify?: (notice: BrandWorkspaceNotice) => void;
|
|
25
|
+
readonly copy?: Partial<BrandImageChoosersCopy>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* CEL-2127 — the logo + banner choosers of the brand workspace. Mount with a
|
|
29
|
+
* `key` of the profile id so a profile switch (org switch, or the target
|
|
30
|
+
* flipping between approved profile and generated draft) remounts it and no
|
|
31
|
+
* stale "checking"/"saved" moderation state leaks across profiles.
|
|
32
|
+
*
|
|
33
|
+
* It owns persistence (the upload call) and correlating the moderation verdict
|
|
34
|
+
* back to the chooser. It must sit inside a `ModerationVerdictProvider`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function BrandImageChoosers({ brandProfileId, avatarCandidateSet, bannerCandidateSet, allowedImageOrigins, assetsApi, notify, copy, }: BrandImageChoosersProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
//# sourceMappingURL=brand-image-choosers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-image-choosers.d.ts","sourceRoot":"","sources":["../../src/brand/brand-image-choosers.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,qBAAqB,EAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAK3E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;CAC1C;AAED,eAAO,MAAM,iCAAiC,EAAE,sBAO/C,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,qFAAqF;IACrF,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;IACpD,QAAQ,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;IACpD,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,iBAAiB,CAAC,CAAC;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACjD;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,MAAM,EACN,IAAI,GACL,EAAE,uBAAuB,2CAoFzB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { BrandImageChooser } from "./brand-image-chooser.js";
|
|
4
|
+
import { candidateAssetSlot } from "./use-brand-workspace-image-candidates.js";
|
|
5
|
+
import { useBrandImageOperationResult, } from "./use-brand-image-operation-result.js";
|
|
6
|
+
export const DEFAULT_BRAND_IMAGE_CHOOSERS_COPY = {
|
|
7
|
+
avatarLabel: "Profile picture",
|
|
8
|
+
bannerLabel: "Banner",
|
|
9
|
+
uploadRequiresProfile: "Save your brand profile once before adding images.",
|
|
10
|
+
uploadFailed: "Upload failed. Please try again.",
|
|
11
|
+
logoUploaded: "Logo uploaded",
|
|
12
|
+
bannerUploaded: "Banner updated",
|
|
13
|
+
};
|
|
14
|
+
function targetDefaultSlot(target) {
|
|
15
|
+
return target === "banner" ? "banner" : "primary";
|
|
16
|
+
}
|
|
17
|
+
function sourceFileName(source) {
|
|
18
|
+
const raw = source.kind === "upload"
|
|
19
|
+
? source.file.name.replace(/\.[^./\\]+$/, "")
|
|
20
|
+
: source.candidate.sourceLabel || source.candidate.role;
|
|
21
|
+
const slug = raw
|
|
22
|
+
.trim()
|
|
23
|
+
.toLowerCase()
|
|
24
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
25
|
+
.replace(/^-+|-+$/g, "");
|
|
26
|
+
return slug || "brand-image";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* CEL-2127 — the logo + banner choosers of the brand workspace. Mount with a
|
|
30
|
+
* `key` of the profile id so a profile switch (org switch, or the target
|
|
31
|
+
* flipping between approved profile and generated draft) remounts it and no
|
|
32
|
+
* stale "checking"/"saved" moderation state leaks across profiles.
|
|
33
|
+
*
|
|
34
|
+
* It owns persistence (the upload call) and correlating the moderation verdict
|
|
35
|
+
* back to the chooser. It must sit inside a `ModerationVerdictProvider`.
|
|
36
|
+
*/
|
|
37
|
+
export function BrandImageChoosers({ brandProfileId, avatarCandidateSet, bannerCandidateSet, allowedImageOrigins, assetsApi, notify, copy, }) {
|
|
38
|
+
const text = { ...DEFAULT_BRAND_IMAGE_CHOOSERS_COPY, ...copy };
|
|
39
|
+
const avatarLabelId = useId();
|
|
40
|
+
const bannerLabelId = useId();
|
|
41
|
+
const avatarOperation = useBrandImageOperationResult(assetsApi.fetchModeration);
|
|
42
|
+
const bannerOperation = useBrandImageOperationResult(assetsApi.fetchModeration);
|
|
43
|
+
const applyImage = async (target, operation, result) => {
|
|
44
|
+
// No profile exists yet in the manual-create flow. Fail fast: no network
|
|
45
|
+
// call and no operationId the chooser could never resolve (a chooser stuck
|
|
46
|
+
// "saved"/"checking" forever), plus a clear reason for the user.
|
|
47
|
+
if (!brandProfileId) {
|
|
48
|
+
notify?.({ tone: "error", message: text.uploadRequiresProfile });
|
|
49
|
+
throw new Error("Cannot upload a brand image before a brand profile exists");
|
|
50
|
+
}
|
|
51
|
+
const slot = result.source.kind === "candidate"
|
|
52
|
+
? candidateAssetSlot(result.source.candidate)
|
|
53
|
+
: targetDefaultSlot(target);
|
|
54
|
+
const file = new File([result.blob], `${sourceFileName(result.source)}.webp`, {
|
|
55
|
+
type: result.blob.type || "image/webp",
|
|
56
|
+
});
|
|
57
|
+
// Snapshot before the request goes out, so an inline verdict published
|
|
58
|
+
// while it is in flight is honoured instead of gated out as pre-existing.
|
|
59
|
+
const startSeq = operation.beginOperation();
|
|
60
|
+
try {
|
|
61
|
+
const asset = await assetsApi.upload({ profileId: brandProfileId, slot, file });
|
|
62
|
+
operation.startOperation(asset.id, { brandProfileId, slot }, startSeq);
|
|
63
|
+
notify?.({
|
|
64
|
+
tone: "success",
|
|
65
|
+
message: slot === "banner" ? text.bannerUploaded : text.logoUploaded,
|
|
66
|
+
});
|
|
67
|
+
return { operationId: asset.id };
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
notify?.({ tone: "error", message: text.uploadFailed });
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return (_jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [_jsxs("section", { "aria-labelledby": avatarLabelId, children: [_jsx("p", { id: avatarLabelId, className: "mb-2 text-sm font-medium text-foreground", children: text.avatarLabel }), _jsx(BrandImageChooser, { target: "profilePicture", candidates: avatarCandidateSet.available, unavailableCandidates: avatarCandidateSet.unavailable, allowedImageOrigins: allowedImageOrigins, copy: text.chooser, cropAspect: 1, cropCircularMask: true, cropOutput: { type: "image/webp", quality: 0.9, maxDimension: 2048 }, onApply: (result) => applyImage("profilePicture", avatarOperation, result), operationResult: avatarOperation.operationResult, onRetry: avatarOperation.reset, onDismiss: avatarOperation.reset })] }), _jsxs("section", { "aria-labelledby": bannerLabelId, children: [_jsx("p", { id: bannerLabelId, className: "mb-2 text-sm font-medium text-foreground", children: text.bannerLabel }), _jsx(BrandImageChooser, { target: "banner", candidates: bannerCandidateSet.available, unavailableCandidates: bannerCandidateSet.unavailable, allowedImageOrigins: allowedImageOrigins, copy: text.chooser, cropAspect: 3, cropOutput: { type: "image/webp", quality: 0.9, maxDimension: 2048 }, onApply: (result) => applyImage("banner", bannerOperation, result), operationResult: bannerOperation.operationResult, onRetry: bannerOperation.reset, onDismiss: bannerOperation.reset })] })] }));
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=brand-image-choosers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-image-choosers.js","sourceRoot":"","sources":["../../src/brand/brand-image-choosers.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EACL,4BAA4B,GAE7B,MAAM,oCAAoC,CAAC;AAiB5C,MAAM,CAAC,MAAM,iCAAiC,GAA2B;IACvE,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,QAAQ;IACrB,qBAAqB,EAAE,oDAAoD;IAC3E,YAAY,EAAE,kCAAkC;IAChD,YAAY,EAAE,eAAe;IAC7B,cAAc,EAAE,gBAAgB;CACjC,CAAC;AAcF,SAAS,iBAAiB,CAAC,MAAwB;IACjD,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,SAAS,cAAc,CAAC,MAA+B;IACrD,MAAM,GAAG,GACP,MAAM,CAAC,IAAI,KAAK,QAAQ;QACtB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;QAC7C,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IAC5D,MAAM,IAAI,GAAG,GAAG;SACb,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC3B,OAAO,IAAI,IAAI,aAAa,CAAC;AAC/B,CAAC;AAED;;;;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gB,EAAE,eAAe,EAAE,MAAM,CAAC,EAC1E,eAAe,EAAE,eAAe,CAAC,eAAe,EAChD,OAAO,EAAE,eAAe,CAAC,KAAK,EAC9B,SAAS,EAAE,eAAe,CAAC,KAAK,GAChC,IACM,EACV,sCAA0B,aAAa,aACrC,YAAG,EAAE,EAAE,aAAa,EAAE,SAAS,EAAC,0CAA0C,YACvE,IAAI,CAAC,WAAW,GACf,EACJ,KAAC,iBAAiB,IAChB,MAAM,EAAC,QAAQ,EACf,UAAU,EAAE,kBAAkB,CAAC,SAAS,EACxC,qBAAqB,EAAE,kBAAkB,CAAC,WAAW,EACrD,mBAAmB,EAAE,mBAAmB,EACxC,IAAI,EAAE,IAAI,CAAC,OAAO,EAClB,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,EACpE,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAClE,eAAe,EAAE,eAAe,CAAC,eAAe,EAChD,OAAO,EAAE,eAAe,CAAC,KAAK,EAC9B,SAAS,EAAE,eAAe,CAAC,KAAK,GAChC,IACM,IACN,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface BrandWorkspaceChangeNoticeCopy {
|
|
2
|
+
readonly message: string;
|
|
3
|
+
readonly reloadAction: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const DEFAULT_BRAND_WORKSPACE_CHANGE_NOTICE_COPY: BrandWorkspaceChangeNoticeCopy;
|
|
6
|
+
export interface BrandWorkspaceChangeNoticeProps {
|
|
7
|
+
/** `serverChanged` from `useBrandWorkspaceConcurrency`. Renders nothing when false. */
|
|
8
|
+
readonly visible: boolean;
|
|
9
|
+
readonly onReload: () => void;
|
|
10
|
+
/** Disables the action while a write or a reload is in flight. */
|
|
11
|
+
readonly disabled?: boolean;
|
|
12
|
+
readonly copy?: Partial<BrandWorkspaceChangeNoticeCopy>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* CEL-2127 — shown above an open brand workspace when the server's profile
|
|
16
|
+
* moved underneath it. Saving is blocked until the user reloads, so the form
|
|
17
|
+
* never silently overwrites a newer version.
|
|
18
|
+
*/
|
|
19
|
+
export declare function BrandWorkspaceChangeNotice({ visible, onReload, disabled, copy, }: BrandWorkspaceChangeNoticeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
//# sourceMappingURL=brand-workspace-change-notice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-workspace-change-notice.d.ts","sourceRoot":"","sources":["../../src/brand/brand-workspace-change-notice.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,0CAA0C,EAAE,8BAGxD,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,uFAAuF;IACvF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC;CACzD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,OAAO,EACP,QAAQ,EACR,QAAgB,EAChB,IAAI,GACL,EAAE,+BAA+B,kDAiBjC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TriangleAlertIcon } from "lucide-react";
|
|
3
|
+
import { Button } from "../components/button.js";
|
|
4
|
+
export const DEFAULT_BRAND_WORKSPACE_CHANGE_NOTICE_COPY = {
|
|
5
|
+
message: "Brand profile changed elsewhere. Review latest values before saving.",
|
|
6
|
+
reloadAction: "Reload latest",
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* CEL-2127 — shown above an open brand workspace when the server's profile
|
|
10
|
+
* moved underneath it. Saving is blocked until the user reloads, so the form
|
|
11
|
+
* never silently overwrites a newer version.
|
|
12
|
+
*/
|
|
13
|
+
export function BrandWorkspaceChangeNotice({ visible, onReload, disabled = false, copy, }) {
|
|
14
|
+
if (!visible)
|
|
15
|
+
return null;
|
|
16
|
+
const resolved = { ...DEFAULT_BRAND_WORKSPACE_CHANGE_NOTICE_COPY, ...copy };
|
|
17
|
+
return (_jsxs("div", { role: "status", className: "flex flex-wrap items-center justify-between gap-3 rounded-lg border border-[var(--tone-warning-fg)]/30 bg-[var(--tone-warning-soft)] px-3 py-2 text-sm/6 text-[var(--tone-warning-fg)]", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [_jsx(TriangleAlertIcon, { "aria-hidden": "true", className: "size-5 shrink-0" }), resolved.message] }), _jsx(Button, { outline: true, onClick: onReload, disabled: disabled, children: resolved.reloadAction })] }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=brand-workspace-change-notice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-workspace-change-notice.js","sourceRoot":"","sources":["../../src/brand/brand-workspace-change-notice.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAO9C,MAAM,CAAC,MAAM,0CAA0C,GAAmC;IACxF,OAAO,EAAE,sEAAsE;IAC/E,YAAY,EAAE,eAAe;CAC9B,CAAC;AAWF;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,EACzC,OAAO,EACP,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,IAAI,GAC4B;IAChC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,MAAM,QAAQ,GAAG,EAAE,GAAG,0CAA0C,EAAE,GAAG,IAAI,EAAE,CAAC;IAC5E,OAAO,CACL,eACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,wLAAwL,aAElM,gBAAM,SAAS,EAAC,iCAAiC,aAC/C,KAAC,iBAAiB,mBAAa,MAAM,EAAC,SAAS,EAAC,iBAAiB,GAAG,EACnE,QAAQ,CAAC,OAAO,IACZ,EACP,KAAC,MAAM,IAAC,OAAO,QAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,YAClD,QAAQ,CAAC,YAAY,GACf,IACL,CACP,CAAC;AACJ,CAAC"}
|
package/dist/brand/index.d.ts
CHANGED
|
@@ -30,6 +30,26 @@ export { DEFAULT_BRAND_GENERATION_RECOVERY_COPY } from "./brand-generation-recov
|
|
|
30
30
|
export type { BrandGenerationRecoveryCopy } from "./brand-generation-recovery-copy.js";
|
|
31
31
|
export { emptyBrandGenerationContext } from "./brand-generation-types.js";
|
|
32
32
|
export type { BrandGenerationContextInput, BrandGenerationEligibility, BrandGenerationIneligibleReason, BrandGenerationMissingAssetAction, BrandGenerationOutcome, } from "./brand-generation-types.js";
|
|
33
|
+
export { useBrandGeneration } from "./use-brand-generation.js";
|
|
34
|
+
export type { UseBrandGenerationOptions, UseBrandGenerationResult } from "./use-brand-generation.js";
|
|
35
|
+
export { brandGenerationKeys, isTerminalStatus } from "./brand-generation-keys.js";
|
|
36
|
+
export type { BrandGenerationErrorKind } from "./brand-generation-keys.js";
|
|
37
|
+
export type { BrandGenerationApi, BrandGenerationStreamConfig } from "./brand-generation-api.js";
|
|
38
|
+
export { BrandGenerationRequestError, createBrandGenerationClient, } from "./brand-generation-client.js";
|
|
39
|
+
export type { BrandGenerationClientOptions } from "./brand-generation-client.js";
|
|
40
|
+
export { BrandGenerationResponseError } from "./brand-generation-response.js";
|
|
41
|
+
export type { BrandGenerationActiveJob, BrandGenerationActiveResult, BrandGenerationContext, BrandGenerationJob, BrandGenerationJobOutcome, BrandGenerationJobProgress, BrandGenerationJobStatus, BrandGenerationPageProgress, BrandGenerationPageStatus, BrandGenerationPhase, BrandGenerationStartResponse, } from "./brand-generation-response.js";
|
|
42
|
+
export type { BrandGenerationUpdate } from "./brand-generation-sse-parser.js";
|
|
43
|
+
export { deriveBrandGenerationFlow } from "./brand-generation-flow.js";
|
|
44
|
+
export { resolveGenerationUrl } from "./brand-generation-url.js";
|
|
45
|
+
export { buildBrandGenerationSteps } from "./brand-generation-steps.js";
|
|
46
|
+
export { BrandGenerationProgress } from "./brand-generation-progress.js";
|
|
47
|
+
export type { BrandGenerationProgressProps } from "./brand-generation-progress.js";
|
|
48
|
+
export { BrandGenerationSurface } from "./brand-generation-surface.js";
|
|
49
|
+
export type { BrandGenerationSurfaceProps } from "./brand-generation-surface.js";
|
|
50
|
+
export { BrandGenerationRecoveryError } from "./brand-generation-recovery-error.js";
|
|
51
|
+
export { defaultBrandGenerationCopy, resolveBrandGenerationCopy } from "./brand-generation-copy.js";
|
|
52
|
+
export type { BrandGenerationCopy } from "./brand-generation-copy.js";
|
|
33
53
|
export { BrandImageChooser } from "./brand-image-chooser.js";
|
|
34
54
|
export type { BrandImageChooserApplyResult, BrandImageChooserCopy, BrandImageChooserProps, BrandImageChooserSource, } from "./brand-image-chooser.js";
|
|
35
55
|
export { isBrandImageOperationFailed, isBrandImageOperationIndeterminate, isBrandImageOperationSettled, } from "./brand-image-chooser-types.js";
|
|
@@ -37,4 +57,21 @@ export type { BrandImageOperationResult, BrandImageOperationStatus, } from "./br
|
|
|
37
57
|
export { BRAND_PALETTE_MAX_COLORS } from "./brand-visual-form-values.js";
|
|
38
58
|
export type { BrandManualTypographyPatch, BrandTypographyFormValues, } from "./brand-visual-form-values.js";
|
|
39
59
|
export type { BrandVisualFormCopy } from "./brand-profile-form-visual.js";
|
|
60
|
+
export { classifyBrandProfileApiError, useBrandWorkspaceConcurrency, } from "./use-brand-workspace-concurrency.js";
|
|
61
|
+
export type { BrandWorkspaceEvent, BrandWorkspaceSaveFailure, BrandWorkspaceSnapshot, BrandWorkspaceTarget, BrandWorkspaceWriteBody, UseBrandWorkspaceConcurrencyOptions, UseBrandWorkspaceConcurrencyResult, } from "./use-brand-workspace-concurrency.js";
|
|
62
|
+
export { BrandWorkspaceChangeNotice, DEFAULT_BRAND_WORKSPACE_CHANGE_NOTICE_COPY, } from "./brand-workspace-change-notice.js";
|
|
63
|
+
export type { BrandWorkspaceChangeNoticeCopy, BrandWorkspaceChangeNoticeProps, } from "./brand-workspace-change-notice.js";
|
|
64
|
+
export { useBrandPublicVisibility } from "./use-brand-public-visibility.js";
|
|
65
|
+
export type { BrandPublicVisibilityApi, BrandPublicVisibilityEvent, BrandPublicVisibilityWrite, BrandVisibilityProfile, UseBrandPublicVisibilityOptions, } from "./use-brand-public-visibility.js";
|
|
66
|
+
export { BrandAssetsRequestError, createBrandAssetsClient, resolveBrandAssetMimeType, } from "./brand-assets-api.js";
|
|
67
|
+
export type { BrandAssetModeration, BrandAssetRecord, BrandAssetsApi, BrandAssetsClientOptions, UploadBrandAssetArgs, } from "./brand-assets-api.js";
|
|
68
|
+
export { candidateAssetSlot, useBrandWorkspaceImageCandidates, } from "./use-brand-workspace-image-candidates.js";
|
|
69
|
+
export { useBrandImageOperationResult } from "./use-brand-image-operation-result.js";
|
|
70
|
+
export type { BrandImageOperationController } from "./use-brand-image-operation-result.js";
|
|
71
|
+
export { BrandImageChoosers, DEFAULT_BRAND_IMAGE_CHOOSERS_COPY } from "./brand-image-choosers.js";
|
|
72
|
+
export type { BrandImageChoosersCopy, BrandImageChoosersProps } from "./brand-image-choosers.js";
|
|
73
|
+
export { BrandGenerationStart, DEFAULT_BRAND_GENERATION_START_COPY, } from "./brand-generation-start.js";
|
|
74
|
+
export type { BrandGenerationStartCopy, BrandGenerationStartProps } from "./brand-generation-start.js";
|
|
75
|
+
export { DEFAULT_BRAND_PROFILE_ACCEPTANCE_COPY, useBrandProfileAcceptance, } from "./use-brand-profile-acceptance.js";
|
|
76
|
+
export type { BrandProfileAcceptanceCopy, BrandWorkspaceNotice, UseBrandProfileAcceptanceOptions, } from "./use-brand-profile-acceptance.js";
|
|
40
77
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/brand/index.ts"],"names":[],"mappings":"AAGA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACxE,YAAY,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAK9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,YAAY,EACV,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,kCAAkC,EAClC,0BAA0B,EAC1B,uBAAuB,EAC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B,GAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,YAAY,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAC/F,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EACL,oBAAoB,EACpB,mCAAmC,GACpC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACpG,OAAO,EACL,qCAAqC,EACrC,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,gCAAgC,GACjC,MAAM,gCAAgC,CAAC"}
|
package/dist/brand/index.js
CHANGED
|
@@ -26,6 +26,21 @@ export { BrandGenerationRecovery } from "./brand-generation-recovery.js";
|
|
|
26
26
|
export { BrandGenerationContextForm } from "./brand-generation-context-form.js";
|
|
27
27
|
export { DEFAULT_BRAND_GENERATION_RECOVERY_COPY } from "./brand-generation-recovery-copy.js";
|
|
28
28
|
export { emptyBrandGenerationContext } from "./brand-generation-types.js";
|
|
29
|
+
// CEL-2127: the shared AI brand-generation flow (hook, SSE transport, HTTP
|
|
30
|
+
// client, parsers, progress and surface), lifted from producer so importer runs
|
|
31
|
+
// the identical pipeline. Transport-agnostic: the consumer injects the API and
|
|
32
|
+
// stream auth.
|
|
33
|
+
export { useBrandGeneration } from "./use-brand-generation.js";
|
|
34
|
+
export { brandGenerationKeys, isTerminalStatus } from "./brand-generation-keys.js";
|
|
35
|
+
export { BrandGenerationRequestError, createBrandGenerationClient, } from "./brand-generation-client.js";
|
|
36
|
+
export { BrandGenerationResponseError } from "./brand-generation-response.js";
|
|
37
|
+
export { deriveBrandGenerationFlow } from "./brand-generation-flow.js";
|
|
38
|
+
export { resolveGenerationUrl } from "./brand-generation-url.js";
|
|
39
|
+
export { buildBrandGenerationSteps } from "./brand-generation-steps.js";
|
|
40
|
+
export { BrandGenerationProgress } from "./brand-generation-progress.js";
|
|
41
|
+
export { BrandGenerationSurface } from "./brand-generation-surface.js";
|
|
42
|
+
export { BrandGenerationRecoveryError } from "./brand-generation-recovery-error.js";
|
|
43
|
+
export { defaultBrandGenerationCopy, resolveBrandGenerationCopy } from "./brand-generation-copy.js";
|
|
29
44
|
// CEL-1680 slice 2: the unified image chooser (logo, banner, favicon, OG),
|
|
30
45
|
// its operation-result presentation contract, and the extended candidate
|
|
31
46
|
// resolver (favicon/ogImage targets, dedup by asset id/content hash,
|
|
@@ -33,4 +48,18 @@ export { emptyBrandGenerationContext } from "./brand-generation-types.js";
|
|
|
33
48
|
export { BrandImageChooser } from "./brand-image-chooser.js";
|
|
34
49
|
export { isBrandImageOperationFailed, isBrandImageOperationIndeterminate, isBrandImageOperationSettled, } from "./brand-image-chooser-types.js";
|
|
35
50
|
export { BRAND_PALETTE_MAX_COLORS } from "./brand-visual-form-values.js";
|
|
51
|
+
// CEL-2127 lift 2: the rest of producer's brand workspace. Concurrency (409
|
|
52
|
+
// reload / keep-mine, TARGET_MISMATCH, server-changed detection), the public
|
|
53
|
+
// visibility toggle handler, the logo/banner choosers with their assets API,
|
|
54
|
+
// the idle start form and generated-profile acceptance. The data layer is
|
|
55
|
+
// injected and every string is a prop with an English default.
|
|
56
|
+
export { classifyBrandProfileApiError, useBrandWorkspaceConcurrency, } from "./use-brand-workspace-concurrency.js";
|
|
57
|
+
export { BrandWorkspaceChangeNotice, DEFAULT_BRAND_WORKSPACE_CHANGE_NOTICE_COPY, } from "./brand-workspace-change-notice.js";
|
|
58
|
+
export { useBrandPublicVisibility } from "./use-brand-public-visibility.js";
|
|
59
|
+
export { BrandAssetsRequestError, createBrandAssetsClient, resolveBrandAssetMimeType, } from "./brand-assets-api.js";
|
|
60
|
+
export { candidateAssetSlot, useBrandWorkspaceImageCandidates, } from "./use-brand-workspace-image-candidates.js";
|
|
61
|
+
export { useBrandImageOperationResult } from "./use-brand-image-operation-result.js";
|
|
62
|
+
export { BrandImageChoosers, DEFAULT_BRAND_IMAGE_CHOOSERS_COPY } from "./brand-image-choosers.js";
|
|
63
|
+
export { BrandGenerationStart, DEFAULT_BRAND_GENERATION_START_COPY, } from "./brand-generation-start.js";
|
|
64
|
+
export { DEFAULT_BRAND_PROFILE_ACCEPTANCE_COPY, useBrandProfileAcceptance, } from "./use-brand-profile-acceptance.js";
|
|
36
65
|
//# sourceMappingURL=index.js.map
|
package/dist/brand/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/brand/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,qCAAqC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,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4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAGjG,2EAA2E;AAC3E,yEAAyE;AACzE,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO1D,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,EAClC,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAOtE,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,0EAA0E;AAC1E,+DAA+D;AAC/D,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EACL,0BAA0B,EAC1B,0CAA0C,GAC3C,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAQzE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EACL,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EACL,oBAAoB,EACpB,mCAAmC,GACpC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,qCAAqC,EACrC,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BrandGenerationApi } from "./brand-generation-api.js";
|
|
2
|
+
import { type BrandGenerationErrorKind } from "./brand-generation-keys.js";
|
|
3
|
+
import type { BrandGenerationJob } from "./brand-generation-response.js";
|
|
4
|
+
import type { BrandGenerationUpdate } from "./brand-generation-sse-parser.js";
|
|
5
|
+
interface ResumeBrandGenerationOptions {
|
|
6
|
+
readonly api: Pick<BrandGenerationApi, "getStatus">;
|
|
7
|
+
readonly isCurrent: () => boolean;
|
|
8
|
+
readonly setError: (error: BrandGenerationErrorKind | null) => void;
|
|
9
|
+
readonly setIsGenerating: (isGenerating: boolean) => void;
|
|
10
|
+
readonly setTransportDegraded: (transportDegraded: boolean) => void;
|
|
11
|
+
readonly setJob: (job: BrandGenerationJob) => void;
|
|
12
|
+
readonly handleUpdate: (update: BrandGenerationUpdate) => void;
|
|
13
|
+
readonly connect: (jobId: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function resumeBrandGeneration(jobId: string, options: ResumeBrandGenerationOptions): Promise<void>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=resume-brand-generation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-brand-generation.d.ts","sourceRoot":"","sources":["../../src/brand/resume-brand-generation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAoB,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,UAAU,4BAA4B;IACpC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,wBAAwB,GAAG,IAAI,KAAK,IAAI,CAAC;IACpE,QAAQ,CAAC,eAAe,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,QAAQ,CAAC,oBAAoB,EAAE,CAAC,iBAAiB,EAAE,OAAO,KAAK,IAAI,CAAC;IACpE,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAef"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isTerminalStatus } from "./brand-generation-keys.js";
|
|
2
|
+
export async function resumeBrandGeneration(jobId, options) {
|
|
3
|
+
try {
|
|
4
|
+
options.setError(null);
|
|
5
|
+
options.setTransportDegraded(false);
|
|
6
|
+
options.setIsGenerating(true);
|
|
7
|
+
const status = await options.api.getStatus(jobId);
|
|
8
|
+
if (!options.isCurrent())
|
|
9
|
+
return;
|
|
10
|
+
options.setJob(status);
|
|
11
|
+
options.handleUpdate(status);
|
|
12
|
+
if (!isTerminalStatus(status.status))
|
|
13
|
+
options.connect(jobId);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
if (!options.isCurrent())
|
|
17
|
+
return;
|
|
18
|
+
options.setIsGenerating(false);
|
|
19
|
+
options.setError("resume");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=resume-brand-generation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-brand-generation.js","sourceRoot":"","sources":["../../src/brand/resume-brand-generation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAiC,MAAM,yBAAyB,CAAC;AAe1F,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAAa,EACb,OAAqC;IAErC,IAAI,CAAC;QACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACpC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YAAE,OAAO;QACjC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACvB,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC;YAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YAAE,OAAO;QACjC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { QueryKey } from "@tanstack/react-query";
|
|
2
|
+
import type { RefObject } from "react";
|
|
3
|
+
import type { BrandGenerationApi } from "./brand-generation-api.js";
|
|
4
|
+
export declare function useBrandGenerationDiscovery(orgId: string, api: Pick<BrandGenerationApi, "getActive">, profileKeyRef: RefObject<QueryKey>): {
|
|
5
|
+
activeQuery: import("@tanstack/react-query").UseQueryResult<import("./brand-generation-response.js").BrandGenerationActiveResult, Error>;
|
|
6
|
+
activeJob: import("./brand-generation-response.js").BrandGenerationActiveJob | null;
|
|
7
|
+
terminalQuery: import("@tanstack/react-query").UseQueryResult<import("./brand-generation-response.js").BrandGenerationActiveResult, Error>;
|
|
8
|
+
terminalJob: import("./brand-generation-response.js").BrandGenerationActiveJob | null;
|
|
9
|
+
eligibility: import("./brand-generation-types.js").BrandGenerationEligibility | null;
|
|
10
|
+
needsTerminalHandoff: boolean;
|
|
11
|
+
isDiscoveringActive: boolean;
|
|
12
|
+
discoveryError: Error | null;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=use-brand-generation-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-brand-generation-discovery.d.ts","sourceRoot":"","sources":["../../src/brand/use-brand-generation-discovery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,EAC1C,aAAa,EAAE,SAAS,CAAC,QAAQ,CAAC;;;;;;;;;EA0DnC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { isTerminalStatus, brandGenerationKeys } from "./brand-generation-keys.js";
|
|
4
|
+
export function useBrandGenerationDiscovery(orgId, api, profileKeyRef) {
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
|
+
const terminalProfileRefreshesRef = useRef(new Set());
|
|
7
|
+
const activeQuery = useQuery({
|
|
8
|
+
queryKey: brandGenerationKeys.active(orgId),
|
|
9
|
+
queryFn: () => api.getActive(),
|
|
10
|
+
enabled: Boolean(orgId),
|
|
11
|
+
staleTime: 0,
|
|
12
|
+
refetchOnMount: "always",
|
|
13
|
+
});
|
|
14
|
+
// CEL-1682 (contracts §2, carry-over from PR #761) — `activeQuery`/
|
|
15
|
+
// `terminalQuery` now resolve to `{ job, eligibility }` always (never
|
|
16
|
+
// collapsed to `null`), so the discovery-level eligibility snapshot stays
|
|
17
|
+
// reachable even when nothing is running — the motivating case for #688's
|
|
18
|
+
// envelope change (an org sitting in cooldown with no active job).
|
|
19
|
+
const activeJob = activeQuery.data?.job ?? null;
|
|
20
|
+
const terminalQuery = useQuery({
|
|
21
|
+
queryKey: brandGenerationKeys.latestTerminal(orgId),
|
|
22
|
+
queryFn: () => api.getActive(true),
|
|
23
|
+
enabled: Boolean(orgId) && activeQuery.isSuccess && activeJob === null,
|
|
24
|
+
staleTime: 0,
|
|
25
|
+
refetchOnMount: "always",
|
|
26
|
+
});
|
|
27
|
+
const terminalJob = terminalQuery.data?.job ?? null;
|
|
28
|
+
const needsTerminalHandoff = activeQuery.isSuccess && activeJob === null;
|
|
29
|
+
const isDiscoveringActive = (Boolean(orgId) && activeQuery.isPending) ||
|
|
30
|
+
(needsTerminalHandoff && (terminalQuery.isPending || terminalQuery.isFetching)) ||
|
|
31
|
+
(activeQuery.isFetching && activeQuery.data === undefined);
|
|
32
|
+
const discoveryError = activeQuery.isError
|
|
33
|
+
? activeQuery.error
|
|
34
|
+
: needsTerminalHandoff && terminalQuery.isError
|
|
35
|
+
? terminalQuery.error
|
|
36
|
+
: null;
|
|
37
|
+
// Prefer the active read's eligibility (always fetched, most current); the
|
|
38
|
+
// terminal read's is the same org-level snapshot and only serves as a
|
|
39
|
+
// fallback while `activeQuery` is still settling.
|
|
40
|
+
const eligibility = activeQuery.data?.eligibility ?? terminalQuery.data?.eligibility ?? null;
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!orgId || !terminalJob || !isTerminalStatus(terminalJob.status))
|
|
43
|
+
return;
|
|
44
|
+
const refreshKey = `${orgId}:${terminalJob.id}`;
|
|
45
|
+
if (terminalProfileRefreshesRef.current.has(refreshKey))
|
|
46
|
+
return;
|
|
47
|
+
terminalProfileRefreshesRef.current.add(refreshKey);
|
|
48
|
+
void queryClient.invalidateQueries({ queryKey: profileKeyRef.current });
|
|
49
|
+
}, [orgId, profileKeyRef, queryClient, terminalJob]);
|
|
50
|
+
return {
|
|
51
|
+
activeQuery,
|
|
52
|
+
activeJob,
|
|
53
|
+
terminalQuery,
|
|
54
|
+
terminalJob,
|
|
55
|
+
eligibility,
|
|
56
|
+
needsTerminalHandoff,
|
|
57
|
+
isDiscoveringActive,
|
|
58
|
+
discoveryError,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=use-brand-generation-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-brand-generation-discovery.js","sourceRoot":"","sources":["../../src/brand/use-brand-generation-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIjE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEhF,MAAM,UAAU,2BAA2B,CACzC,KAAa,EACb,GAA0C,EAC1C,aAAkC;IAElC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,2BAA2B,GAAG,MAAM,CAAC,IAAI,GAAG,EAAU,CAAC,CAAC;IAC9D,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,QAAQ,EAAE,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3C,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,EAAE;QAC9B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;QACvB,SAAS,EAAE,CAAC;QACZ,cAAc,EAAE,QAAQ;KACzB,CAAC,CAAC;IACH,oEAAoE;IACpE,sEAAsE;IACtE,0EAA0E;IAC1E,0EAA0E;IAC1E,mEAAmE;IACnE,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC;IAChD,MAAM,aAAa,GAAG,QAAQ,CAAC;QAC7B,QAAQ,EAAE,mBAAmB,CAAC,cAAc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