@vishu1301/script-writing 1.3.7 → 1.3.9

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.d.cts CHANGED
@@ -218,23 +218,23 @@ declare function ShotBreakdownView({ blocks, isLoading, shots, selectionMenu, ha
218
218
  parts: ShotPart[];
219
219
  } | null;
220
220
  handleMouseUp: () => void;
221
- addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => void;
222
- updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => void;
221
+ addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => any;
222
+ updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => any;
223
223
  clearSelection: () => void;
224
224
  menuRef: React__default.RefObject<HTMLDivElement | null>;
225
225
  cameras: Camera[];
226
- initializeProduction: (count: number, type: string) => void;
226
+ initializeProduction: (count: number, type: string) => any;
227
227
  }): react_jsx_runtime.JSX.Element;
228
228
 
229
229
  interface UseShotBreakdownOptions {
230
230
  scene_url: string;
231
231
  fetchOptions?: RequestInit;
232
232
  onAISummarize?: (scene: any) => void;
233
- onShotAdded?: (shot: Shot) => void;
233
+ onShotAdded?: (shot: Shot) => any;
234
234
  onShotsBulkAdded?: (shots: Shot[], summary?: string) => Promise<void>;
235
- onShotRemoved?: (shotId: string) => void;
236
- onShotUpdated?: (shotId: string, detail: Shot) => void;
237
- onProductionInitialized?: (cameras: Camera[], type: string) => void;
235
+ onShotRemoved?: (shotId: string) => any;
236
+ onShotUpdated?: (shotId: string, detail: Shot) => any;
237
+ onProductionInitialized?: (cameras: Camera[], type: string) => any;
238
238
  preLoadedShots?: Shot[];
239
239
  preloadedCameras?: Camera[];
240
240
  preloadedSceneType?: string;
@@ -252,9 +252,9 @@ declare function useShotBreakdownScene(options: UseShotBreakdownOptions): {
252
252
  } | null;
253
253
  handleMouseUp: () => void;
254
254
  cameras: Camera[];
255
- initializeProduction: (count: number, type: string) => void;
256
- addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => void;
257
- updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => void;
255
+ initializeProduction: (count: number, type: string) => Promise<any>;
256
+ addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => any;
257
+ updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => Promise<any>;
258
258
  clearSelection: () => void;
259
259
  menuRef: React$1.RefObject<HTMLDivElement | null>;
260
260
  };
package/dist/index.d.ts CHANGED
@@ -218,23 +218,23 @@ declare function ShotBreakdownView({ blocks, isLoading, shots, selectionMenu, ha
218
218
  parts: ShotPart[];
219
219
  } | null;
220
220
  handleMouseUp: () => void;
221
- addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => void;
222
- updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => void;
221
+ addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => any;
222
+ updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => any;
223
223
  clearSelection: () => void;
224
224
  menuRef: React__default.RefObject<HTMLDivElement | null>;
225
225
  cameras: Camera[];
226
- initializeProduction: (count: number, type: string) => void;
226
+ initializeProduction: (count: number, type: string) => any;
227
227
  }): react_jsx_runtime.JSX.Element;
228
228
 
229
229
  interface UseShotBreakdownOptions {
230
230
  scene_url: string;
231
231
  fetchOptions?: RequestInit;
232
232
  onAISummarize?: (scene: any) => void;
233
- onShotAdded?: (shot: Shot) => void;
233
+ onShotAdded?: (shot: Shot) => any;
234
234
  onShotsBulkAdded?: (shots: Shot[], summary?: string) => Promise<void>;
235
- onShotRemoved?: (shotId: string) => void;
236
- onShotUpdated?: (shotId: string, detail: Shot) => void;
237
- onProductionInitialized?: (cameras: Camera[], type: string) => void;
235
+ onShotRemoved?: (shotId: string) => any;
236
+ onShotUpdated?: (shotId: string, detail: Shot) => any;
237
+ onProductionInitialized?: (cameras: Camera[], type: string) => any;
238
238
  preLoadedShots?: Shot[];
239
239
  preloadedCameras?: Camera[];
240
240
  preloadedSceneType?: string;
@@ -252,9 +252,9 @@ declare function useShotBreakdownScene(options: UseShotBreakdownOptions): {
252
252
  } | null;
253
253
  handleMouseUp: () => void;
254
254
  cameras: Camera[];
255
- initializeProduction: (count: number, type: string) => void;
256
- addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => void;
257
- updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => void;
255
+ initializeProduction: (count: number, type: string) => Promise<any>;
256
+ addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => any;
257
+ updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => Promise<any>;
258
258
  clearSelection: () => void;
259
259
  menuRef: React$1.RefObject<HTMLDivElement | null>;
260
260
  };
package/dist/index.js CHANGED
@@ -3848,8 +3848,8 @@ var ProductionSetupModal = ({
3848
3848
  numCameras: Yup.number().min(1, "Must be at least 1").max(20, "Cannot add more than 20 cameras").required("Number of cameras is required"),
3849
3849
  scene_type: Yup.string().required("Scene type is required")
3850
3850
  }),
3851
- onSubmit: (values) => {
3852
- initializeProduction(values.numCameras, values.scene_type);
3851
+ onSubmit: async (values) => {
3852
+ await initializeProduction(values.numCameras, values.scene_type);
3853
3853
  },
3854
3854
  children: ({ isSubmitting, setFieldValue }) => /* @__PURE__ */ jsxs(Form, { className: "flex flex-col gap-6", children: [
3855
3855
  /* @__PURE__ */ jsxs("div", { className: "grid gap-5", children: [
@@ -3980,14 +3980,7 @@ function ViewShotModal({ shot }) {
3980
3980
  /* @__PURE__ */ jsxs("div", { className: "w-full lg:w-[340px] xl:w-[380px] shrink-0 bg-[#fdfdfd] border-t lg:border-t-0 lg:border-l border-slate-200/60 p-6 sm:p-8 pb-12 lg:pb-8 h-full", children: [
3981
3981
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 mb-8", children: [
3982
3982
  /* @__PURE__ */ jsx("h4", { className: "text-[11px] font-bold uppercase tracking-widest text-blumine-700 mb-4 ml-1", children: "Core Identity" }),
3983
- /* @__PURE__ */ jsx(
3984
- PropertyRow,
3985
- {
3986
- icon: Clapperboard,
3987
- label: "Shot Type",
3988
- value: shot.shot_type
3989
- }
3990
- ),
3983
+ /* @__PURE__ */ jsx(PropertyRow, { icon: Video, label: "Shot Type", value: shot.shot_type }),
3991
3984
  /* @__PURE__ */ jsx(
3992
3985
  PropertyRow,
3993
3986
  {
@@ -4010,8 +4003,7 @@ function ViewShotModal({ shot }) {
4010
4003
  label: "Duration",
4011
4004
  value: shot.duration_seconds ? `${shot.duration_seconds}` : null
4012
4005
  }
4013
- ),
4014
- /* @__PURE__ */ jsx(PropertyRow, { icon: Video, label: "Shot Type", value: shot.shot_type })
4006
+ )
4015
4007
  ] }),
4016
4008
  /* @__PURE__ */ jsx("div", { className: "w-full h-px bg-slate-100 mb-8 mt-4" }),
4017
4009
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row lg:flex-col gap-10 lg:gap-8 w-full", children: [
@@ -4386,7 +4378,6 @@ function ShotBreakdownView({
4386
4378
  {
4387
4379
  onSubmit: (values) => {
4388
4380
  addShot(values);
4389
- handleCloseModal();
4390
4381
  },
4391
4382
  cameras,
4392
4383
  shots,
@@ -4406,8 +4397,9 @@ function ShotBreakdownView({
4406
4397
  production_setup_modal_default,
4407
4398
  {
4408
4399
  initializeProduction: (count, type) => {
4409
- initializeProduction(count, type);
4410
- setIsInitModalOpen(false);
4400
+ initializeProduction(count, type).then(() => {
4401
+ setIsInitModalOpen(false);
4402
+ });
4411
4403
  },
4412
4404
  initialValues: {
4413
4405
  numCameras: cameras.length || 1,
@@ -4441,8 +4433,9 @@ function ShotBreakdownView({
4441
4433
  handleCloseModal: () => setUpdatingShotId(null),
4442
4434
  userShotValue: shots.find((s) => s.id === updatingShotId),
4443
4435
  onSubmit: (values) => {
4444
- updateShot(updatingShotId, values);
4445
- setUpdatingShotId(null);
4436
+ updateShot(updatingShotId, values).then(() => {
4437
+ setUpdatingShotId(null);
4438
+ });
4446
4439
  }
4447
4440
  }
4448
4441
  )
@@ -4597,15 +4590,19 @@ function useShotBreakdownScene(options) {
4597
4590
  });
4598
4591
  }
4599
4592
  };
4600
- const initializeProduction = (count, type) => {
4593
+ const initializeProduction = async (count, type) => {
4601
4594
  var _a;
4602
4595
  const newCameras = [];
4603
4596
  for (let i = 1; i <= count; i++) {
4604
4597
  newCameras.push({ name: `Camera ${String.fromCharCode(64 + i)}` });
4605
4598
  }
4599
+ const result = (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
4600
+ if (result instanceof Promise) {
4601
+ await result;
4602
+ }
4606
4603
  setCameras(newCameras);
4607
4604
  setSceneType(type);
4608
- (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
4605
+ return result;
4609
4606
  };
4610
4607
  const addShot = (shotDetails) => {
4611
4608
  var _a;
@@ -4616,21 +4613,35 @@ function useShotBreakdownScene(options) {
4616
4613
  parts: selectionMenu.parts
4617
4614
  });
4618
4615
  setShots((prev) => [...prev, newShot]);
4619
- (_a = options.onShotAdded) == null ? void 0 : _a.call(options, newShot);
4620
- clearSelection();
4616
+ const result = (_a = options.onShotAdded) == null ? void 0 : _a.call(options, newShot);
4617
+ if (result instanceof Promise) {
4618
+ return result.then(() => {
4619
+ clearSelection();
4620
+ });
4621
+ } else {
4622
+ clearSelection();
4623
+ return result;
4624
+ }
4621
4625
  };
4622
- const updateShot = (shotId, updatedDetails) => {
4626
+ const updateShot = async (shotId, updatedDetails) => {
4627
+ var _a;
4628
+ let updatedShot = null;
4623
4629
  setShots(
4624
4630
  (prev) => prev.map((shot) => {
4625
- var _a;
4626
4631
  if (shot.id === shotId) {
4627
- const fullUpdated = __spreadValues(__spreadValues({}, shot), updatedDetails);
4628
- (_a = options.onShotUpdated) == null ? void 0 : _a.call(options, shotId, fullUpdated);
4629
- return fullUpdated;
4632
+ updatedShot = __spreadValues(__spreadValues({}, shot), updatedDetails);
4633
+ return updatedShot;
4630
4634
  }
4631
4635
  return shot;
4632
4636
  })
4633
4637
  );
4638
+ if (updatedShot) {
4639
+ const result = (_a = options.onShotUpdated) == null ? void 0 : _a.call(options, shotId, updatedShot);
4640
+ if (result instanceof Promise) {
4641
+ await result;
4642
+ }
4643
+ return result;
4644
+ }
4634
4645
  };
4635
4646
  return {
4636
4647
  blocks,