@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.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: [
@@ -4006,14 +4006,7 @@ function ViewShotModal({ shot }) {
4006
4006
  /* @__PURE__ */ jsxRuntime.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: [
4007
4007
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 mb-8", children: [
4008
4008
  /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-[11px] font-bold uppercase tracking-widest text-blumine-700 mb-4 ml-1", children: "Core Identity" }),
4009
- /* @__PURE__ */ jsxRuntime.jsx(
4010
- PropertyRow,
4011
- {
4012
- icon: lucideReact.Clapperboard,
4013
- label: "Shot Type",
4014
- value: shot.shot_type
4015
- }
4016
- ),
4009
+ /* @__PURE__ */ jsxRuntime.jsx(PropertyRow, { icon: lucideReact.Video, label: "Shot Type", value: shot.shot_type }),
4017
4010
  /* @__PURE__ */ jsxRuntime.jsx(
4018
4011
  PropertyRow,
4019
4012
  {
@@ -4036,8 +4029,7 @@ function ViewShotModal({ shot }) {
4036
4029
  label: "Duration",
4037
4030
  value: shot.duration_seconds ? `${shot.duration_seconds}` : null
4038
4031
  }
4039
- ),
4040
- /* @__PURE__ */ jsxRuntime.jsx(PropertyRow, { icon: lucideReact.Video, label: "Shot Type", value: shot.shot_type })
4032
+ )
4041
4033
  ] }),
4042
4034
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-px bg-slate-100 mb-8 mt-4" }),
4043
4035
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row lg:flex-col gap-10 lg:gap-8 w-full", children: [
@@ -4412,7 +4404,6 @@ function ShotBreakdownView({
4412
4404
  {
4413
4405
  onSubmit: (values) => {
4414
4406
  addShot(values);
4415
- handleCloseModal();
4416
4407
  },
4417
4408
  cameras,
4418
4409
  shots,
@@ -4432,8 +4423,9 @@ function ShotBreakdownView({
4432
4423
  production_setup_modal_default,
4433
4424
  {
4434
4425
  initializeProduction: (count, type) => {
4435
- initializeProduction(count, type);
4436
- setIsInitModalOpen(false);
4426
+ initializeProduction(count, type).then(() => {
4427
+ setIsInitModalOpen(false);
4428
+ });
4437
4429
  },
4438
4430
  initialValues: {
4439
4431
  numCameras: cameras.length || 1,
@@ -4467,8 +4459,9 @@ function ShotBreakdownView({
4467
4459
  handleCloseModal: () => setUpdatingShotId(null),
4468
4460
  userShotValue: shots.find((s) => s.id === updatingShotId),
4469
4461
  onSubmit: (values) => {
4470
- updateShot(updatingShotId, values);
4471
- setUpdatingShotId(null);
4462
+ updateShot(updatingShotId, values).then(() => {
4463
+ setUpdatingShotId(null);
4464
+ });
4472
4465
  }
4473
4466
  }
4474
4467
  )
@@ -4623,15 +4616,19 @@ function useShotBreakdownScene(options) {
4623
4616
  });
4624
4617
  }
4625
4618
  };
4626
- const initializeProduction = (count, type) => {
4619
+ const initializeProduction = async (count, type) => {
4627
4620
  var _a;
4628
4621
  const newCameras = [];
4629
4622
  for (let i = 1; i <= count; i++) {
4630
4623
  newCameras.push({ name: `Camera ${String.fromCharCode(64 + i)}` });
4631
4624
  }
4625
+ const result = (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
4626
+ if (result instanceof Promise) {
4627
+ await result;
4628
+ }
4632
4629
  setCameras(newCameras);
4633
4630
  setSceneType(type);
4634
- (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
4631
+ return result;
4635
4632
  };
4636
4633
  const addShot = (shotDetails) => {
4637
4634
  var _a;
@@ -4642,21 +4639,35 @@ function useShotBreakdownScene(options) {
4642
4639
  parts: selectionMenu.parts
4643
4640
  });
4644
4641
  setShots((prev) => [...prev, newShot]);
4645
- (_a = options.onShotAdded) == null ? void 0 : _a.call(options, newShot);
4646
- clearSelection();
4642
+ const result = (_a = options.onShotAdded) == null ? void 0 : _a.call(options, newShot);
4643
+ if (result instanceof Promise) {
4644
+ return result.then(() => {
4645
+ clearSelection();
4646
+ });
4647
+ } else {
4648
+ clearSelection();
4649
+ return result;
4650
+ }
4647
4651
  };
4648
- const updateShot = (shotId, updatedDetails) => {
4652
+ const updateShot = async (shotId, updatedDetails) => {
4653
+ var _a;
4654
+ let updatedShot = null;
4649
4655
  setShots(
4650
4656
  (prev) => prev.map((shot) => {
4651
- var _a;
4652
4657
  if (shot.id === shotId) {
4653
- const fullUpdated = __spreadValues(__spreadValues({}, shot), updatedDetails);
4654
- (_a = options.onShotUpdated) == null ? void 0 : _a.call(options, shotId, fullUpdated);
4655
- return fullUpdated;
4658
+ updatedShot = __spreadValues(__spreadValues({}, shot), updatedDetails);
4659
+ return updatedShot;
4656
4660
  }
4657
4661
  return shot;
4658
4662
  })
4659
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
+ }
4660
4671
  };
4661
4672
  return {
4662
4673
  blocks,