sales-frontend-components 0.0.121 → 0.0.123

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.js CHANGED
@@ -1392,6 +1392,9 @@ const useNationalityComponent = () => {
1392
1392
  const { isOpen, closeModal, openModal } = salesFrontendDesignSystem.useModalState();
1393
1393
  const NationalitySearchComponent = () => /* @__PURE__ */ jsxRuntime.jsx(NationalityComponent, { isOpen, onClose: closeModal, setValue: setNationality });
1394
1394
  return {
1395
+ isOpen,
1396
+ closeModal,
1397
+ setNationality,
1395
1398
  nationality,
1396
1399
  openModal,
1397
1400
  NationalitySearchComponent
@@ -1805,7 +1808,10 @@ const useVisaComponent = () => {
1805
1808
  return {
1806
1809
  visa,
1807
1810
  openModal,
1808
- VisaSearchComponent
1811
+ VisaSearchComponent,
1812
+ isOpen,
1813
+ closeModal,
1814
+ setVisa
1809
1815
  };
1810
1816
  };
1811
1817
 
@@ -3514,9 +3520,11 @@ function useCamera({
3514
3520
  onDelete,
3515
3521
  show,
3516
3522
  type = "multiple",
3517
- buttonText
3523
+ buttonText,
3524
+ initData
3518
3525
  } = {}) {
3519
- const [attachedPhotos, setAttachedPhotos] = React.useState([]);
3526
+ const convertedInitData = initData?.map((data, index) => ({ ...data, id: String(index + 1) }));
3527
+ const [attachedPhotos, setAttachedPhotos] = React.useState(convertedInitData || []);
3520
3528
  const findImage = (imageId) => {
3521
3529
  return attachedPhotos.find((image) => image.id === imageId);
3522
3530
  };
@@ -3585,7 +3593,21 @@ function useCamera({
3585
3593
  getImage: findImage,
3586
3594
  deleteImage,
3587
3595
  attachedPhotos,
3588
- Attachment: CameraComponent
3596
+ Attachment: CameraComponent,
3597
+ addImage: (data, name) => {
3598
+ let blobUrl = "";
3599
+ if (data instanceof Blob) {
3600
+ blobUrl = URL.createObjectURL(data);
3601
+ } else if (typeof data === "string") {
3602
+ blobUrl = URL.createObjectURL(salesFrontendUtils.base64ToBlob(data));
3603
+ }
3604
+ const newPhoto = {
3605
+ id: genImageId(),
3606
+ src: blobUrl,
3607
+ name: name || `\uC11C\uB958\uC0AC\uC9C4_${attachedPhotos.length + 1}`
3608
+ };
3609
+ setAttachedPhotos([...attachedPhotos, newPhoto]);
3610
+ }
3589
3611
  };
3590
3612
  }
3591
3613