@orangecatai/adgen-canvas 0.0.26 → 0.0.27

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.
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-FABLWJ5B.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
1
+ import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-AO5DXVZ2.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
@@ -1 +1 @@
1
- import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-FABLWJ5B.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
1
+ import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-AO5DXVZ2.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
@@ -0,0 +1,14 @@
1
+ import "./CampaignDropdown.scss";
2
+ import type { CampaignSummary } from "../types";
3
+ export declare const CampaignDropdown: ({ onFetchCampaigns, onCreateCampaign, onAdd, disabled, disabledReason, }: {
4
+ onFetchCampaigns?: () => Promise<{
5
+ campaigns: CampaignSummary[];
6
+ }>;
7
+ onCreateCampaign?: (name: string) => Promise<CampaignSummary>;
8
+ onAdd?: (campaignId: string) => Promise<{
9
+ ok: boolean;
10
+ error?: string;
11
+ }>;
12
+ disabled?: boolean;
13
+ disabledReason?: string;
14
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -65,6 +65,20 @@ export declare const MODEL_CONFIG: {
65
65
  readonly supportedResolutions: readonly ["1K", "2K", "4K"];
66
66
  readonly supportedRatios: readonly ["1:1", "21:9", "16:9", "3:2", "4:3", "5:4", "4:5", "3:4", "2:3", "9:16"];
67
67
  };
68
+ readonly "gpt image 1 mini": {
69
+ readonly modelId: "openai/gpt-image-1-mini";
70
+ readonly textOutput: false;
71
+ readonly supportsImageSize: false;
72
+ readonly supportedResolutions: readonly ["1K"];
73
+ readonly supportedRatios: readonly ["1:1", "2:3", "3:2"];
74
+ };
75
+ readonly "gpt image 2": {
76
+ readonly modelId: "openai/gpt-image-2";
77
+ readonly textOutput: false;
78
+ readonly supportsImageSize: false;
79
+ readonly supportedResolutions: readonly ["1K", "2K"];
80
+ readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
81
+ };
68
82
  };
69
83
  export type ModelName = keyof typeof MODEL_CONFIG;
70
84
  export declare const MODEL_NAMES: ModelName[];
@@ -1,9 +1,25 @@
1
1
  import type { ExcalidrawVideoElement } from "@orangecatai/element/types";
2
+ import type { CampaignSummary } from "../types";
2
3
  import "./VideoElement.scss";
3
4
  interface VideoElementProps {
4
5
  element: ExcalidrawVideoElement;
5
6
  isActive: boolean;
6
7
  videoDownloadProxyUrl?: string;
8
+ onFetchCampaigns?: () => Promise<{
9
+ campaigns: CampaignSummary[];
10
+ }>;
11
+ onCreateCampaign?: (name: string) => Promise<CampaignSummary>;
12
+ onAddToCampaign?: (payload: {
13
+ kind: "video";
14
+ campaignId: string;
15
+ videoUrl: string;
16
+ mimeType: string;
17
+ width: number;
18
+ height: number;
19
+ }) => Promise<{
20
+ ok: boolean;
21
+ error?: string;
22
+ }>;
7
23
  }
8
- export declare const VideoElement: ({ element, videoDownloadProxyUrl, }: VideoElementProps) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const VideoElement: ({ element, videoDownloadProxyUrl, onFetchCampaigns, onCreateCampaign, onAddToCampaign, }: VideoElementProps) => import("react/jsx-runtime").JSX.Element;
9
25
  export {};
@@ -57,4 +57,5 @@ export type { AppState, BinaryFiles, BinaryFileData, ExcalidrawProps, Excalidraw
57
57
  export type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, OrderedExcalidrawElement, ExcalidrawElementType, ExcalidrawVideoElement, } from "@orangecatai/element/types";
58
58
  export type { ImageEditToolbarCallbacks } from "./components/ImageEditToolbar";
59
59
  export type { CustomFontSpec, BrandContext } from "./types";
60
+ export type { CampaignSummary, AddToCampaignPayload } from "./types";
60
61
  export type { ReviewerFeedback, ReviewIssue, } from "./components/ai-chat/reviewerAgent";
@@ -521,6 +521,31 @@ export type BrandContext = {
521
521
  */
522
522
  headlineFontUrl?: string;
523
523
  };
524
+ /** A campaign the user can save a frame/video snapshot into. */
525
+ export type CampaignSummary = {
526
+ id: string;
527
+ name: string;
528
+ };
529
+ /**
530
+ * Payload passed to `onAddToCampaign`. `image` carries a rendered PNG blob
531
+ * of the exported frame; `video` carries the video element's existing URL
532
+ * (the host copies the file server-side — it never round-trips the browser).
533
+ */
534
+ export type AddToCampaignPayload = {
535
+ kind: "image";
536
+ campaignId: string;
537
+ blob: Blob;
538
+ mimeType: string;
539
+ width: number;
540
+ height: number;
541
+ } | {
542
+ kind: "video";
543
+ campaignId: string;
544
+ videoUrl: string;
545
+ mimeType: string;
546
+ width: number;
547
+ height: number;
548
+ };
524
549
  export interface ExcalidrawProps {
525
550
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
526
551
  onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
@@ -675,6 +700,28 @@ export interface ExcalidrawProps {
675
700
  onAfterVideoGen?: () => void;
676
701
  /** Host proxy URL for video downloads — works around S3 CORS / presigned-URL expiry. */
677
702
  videoDownloadProxyUrl?: string;
703
+ /**
704
+ * Fetches the user's campaigns for the "Add to campaign" dropdown on the
705
+ * frame toolbar and the video element toolbar. Without this prop, the
706
+ * campaign button is not rendered.
707
+ */
708
+ onFetchCampaigns?: () => Promise<{
709
+ campaigns: CampaignSummary[];
710
+ }>;
711
+ /**
712
+ * Creates a new campaign from the inline "New campaign" row in the
713
+ * dropdown. Returns the created campaign so the SDK can auto-select it.
714
+ */
715
+ onCreateCampaign?: (name: string) => Promise<CampaignSummary>;
716
+ /**
717
+ * Saves a snapshot of the selected frame (exported to PNG) or video
718
+ * element (by its existing URL) into the chosen campaign. This is a
719
+ * free action (no credit gate) since no AI call is involved.
720
+ */
721
+ onAddToCampaign?: (payload: AddToCampaignPayload) => Promise<{
722
+ ok: boolean;
723
+ error?: string;
724
+ }>;
678
725
  /**
679
726
  * Called before a background removal is run (deduct credits, check quota).
680
727
  * Return `{ allowed: false, error: "..." }` to block the operation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecatai/adgen-canvas",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -1 +0,0 @@
1
- import{S as a,T as b,U as c}from"../chunk-PIJUOUUJ.js";import"../chunk-FABLWJ5B.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};