@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.cjs CHANGED
@@ -3874,8 +3874,8 @@ var ProductionSetupModal = ({
3874
3874
  numCameras: Yup__namespace.number().min(1, "Must be at least 1").max(20, "Cannot add more than 20 cameras").required("Number of cameras is required"),
3875
3875
  scene_type: Yup__namespace.string().required("Scene type is required")
3876
3876
  }),
3877
- onSubmit: (values) => {
3878
- initializeProduction(values.numCameras, values.scene_type);
3877
+ onSubmit: async (values) => {
3878
+ await initializeProduction(values.numCameras, values.scene_type);
3879
3879
  },
3880
3880
  children: ({ isSubmitting, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { className: "flex flex-col gap-6", children: [
3881
3881
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-5", children: [
@@ -4404,7 +4404,6 @@ function ShotBreakdownView({
4404
4404
  {
4405
4405
  onSubmit: (values) => {
4406
4406
  addShot(values);
4407
- handleCloseModal();
4408
4407
  },
4409
4408
  cameras,
4410
4409
  shots,
@@ -4617,15 +4616,19 @@ function useShotBreakdownScene(options) {
4617
4616
  });
4618
4617
  }
4619
4618
  };
4620
- const initializeProduction = (count, type) => {
4619
+ const initializeProduction = async (count, type) => {
4621
4620
  var _a;
4622
4621
  const newCameras = [];
4623
4622
  for (let i = 1; i <= count; i++) {
4624
4623
  newCameras.push({ name: `Camera ${String.fromCharCode(64 + i)}` });
4625
4624
  }
4625
+ const result = (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
4626
+ if (result instanceof Promise) {
4627
+ await result;
4628
+ }
4626
4629
  setCameras(newCameras);
4627
4630
  setSceneType(type);
4628
- (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
4631
+ return result;
4629
4632
  };
4630
4633
  const addShot = (shotDetails) => {
4631
4634
  var _a;
@@ -4636,26 +4639,35 @@ function useShotBreakdownScene(options) {
4636
4639
  parts: selectionMenu.parts
4637
4640
  });
4638
4641
  setShots((prev) => [...prev, newShot]);
4639
- if (options.onShotAdded) {
4640
- (_a = options.onShotAdded) == null ? void 0 : _a.call(options, newShot).then(() => {
4642
+ const result = (_a = options.onShotAdded) == null ? void 0 : _a.call(options, newShot);
4643
+ if (result instanceof Promise) {
4644
+ return result.then(() => {
4641
4645
  clearSelection();
4642
4646
  });
4643
4647
  } else {
4644
4648
  clearSelection();
4649
+ return result;
4645
4650
  }
4646
4651
  };
4647
- const updateShot = (shotId, updatedDetails) => {
4652
+ const updateShot = async (shotId, updatedDetails) => {
4653
+ var _a;
4654
+ let updatedShot = null;
4648
4655
  setShots(
4649
4656
  (prev) => prev.map((shot) => {
4650
- var _a;
4651
4657
  if (shot.id === shotId) {
4652
- const fullUpdated = __spreadValues(__spreadValues({}, shot), updatedDetails);
4653
- (_a = options.onShotUpdated) == null ? void 0 : _a.call(options, shotId, fullUpdated);
4654
- return fullUpdated;
4658
+ updatedShot = __spreadValues(__spreadValues({}, shot), updatedDetails);
4659
+ return updatedShot;
4655
4660
  }
4656
4661
  return shot;
4657
4662
  })
4658
4663
  );
4664
+ if (updatedShot) {
4665
+ const result = (_a = options.onShotUpdated) == null ? void 0 : _a.call(options, shotId, updatedShot);
4666
+ if (result instanceof Promise) {
4667
+ await result;
4668
+ }
4669
+ return result;
4670
+ }
4659
4671
  };
4660
4672
  return {
4661
4673
  blocks,