@vishu1301/script-writing 1.3.8 → 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
@@ -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
@@ -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: [
@@ -4378,7 +4378,6 @@ function ShotBreakdownView({
4378
4378
  {
4379
4379
  onSubmit: (values) => {
4380
4380
  addShot(values);
4381
- handleCloseModal();
4382
4381
  },
4383
4382
  cameras,
4384
4383
  shots,
@@ -4591,15 +4590,19 @@ function useShotBreakdownScene(options) {
4591
4590
  });
4592
4591
  }
4593
4592
  };
4594
- const initializeProduction = (count, type) => {
4593
+ const initializeProduction = async (count, type) => {
4595
4594
  var _a;
4596
4595
  const newCameras = [];
4597
4596
  for (let i = 1; i <= count; i++) {
4598
4597
  newCameras.push({ name: `Camera ${String.fromCharCode(64 + i)}` });
4599
4598
  }
4599
+ const result = (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
4600
+ if (result instanceof Promise) {
4601
+ await result;
4602
+ }
4600
4603
  setCameras(newCameras);
4601
4604
  setSceneType(type);
4602
- (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
4605
+ return result;
4603
4606
  };
4604
4607
  const addShot = (shotDetails) => {
4605
4608
  var _a;
@@ -4610,26 +4613,35 @@ function useShotBreakdownScene(options) {
4610
4613
  parts: selectionMenu.parts
4611
4614
  });
4612
4615
  setShots((prev) => [...prev, newShot]);
4613
- if (options.onShotAdded) {
4614
- (_a = options.onShotAdded) == null ? void 0 : _a.call(options, newShot).then(() => {
4616
+ const result = (_a = options.onShotAdded) == null ? void 0 : _a.call(options, newShot);
4617
+ if (result instanceof Promise) {
4618
+ return result.then(() => {
4615
4619
  clearSelection();
4616
4620
  });
4617
4621
  } else {
4618
4622
  clearSelection();
4623
+ return result;
4619
4624
  }
4620
4625
  };
4621
- const updateShot = (shotId, updatedDetails) => {
4626
+ const updateShot = async (shotId, updatedDetails) => {
4627
+ var _a;
4628
+ let updatedShot = null;
4622
4629
  setShots(
4623
4630
  (prev) => prev.map((shot) => {
4624
- var _a;
4625
4631
  if (shot.id === shotId) {
4626
- const fullUpdated = __spreadValues(__spreadValues({}, shot), updatedDetails);
4627
- (_a = options.onShotUpdated) == null ? void 0 : _a.call(options, shotId, fullUpdated);
4628
- return fullUpdated;
4632
+ updatedShot = __spreadValues(__spreadValues({}, shot), updatedDetails);
4633
+ return updatedShot;
4629
4634
  }
4630
4635
  return shot;
4631
4636
  })
4632
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
+ }
4633
4645
  };
4634
4646
  return {
4635
4647
  blocks,