sales-frontend-components 0.0.187 → 0.0.189

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.ts CHANGED
@@ -665,7 +665,7 @@ interface DownloadTargetInfo {
665
665
  downloadTarget: string | (() => Promise<string>);
666
666
  onSuccess?: () => void;
667
667
  onError?: () => void;
668
- fileName?: string;
668
+ fileName: string;
669
669
  }
670
670
  /**
671
671
  * @property downloadTargetInfo - 다운로드 대상 정보
package/dist/index.esm.js CHANGED
@@ -144,6 +144,16 @@ var isClient = () => {
144
144
  return false;
145
145
  }
146
146
  };
147
+ var getBusinessWorkDivisionCode = () => {
148
+ return location.pathname.split("/")[1] ?? "";
149
+ };
150
+ var getServicePath = () => {
151
+ if (typeof window.isStorybookEnv === "boolean") {
152
+ return "";
153
+ } else {
154
+ return `/${getBusinessWorkDivisionCode()}`;
155
+ }
156
+ };
147
157
  var isAndroidDevice = () => {
148
158
  if (isClient() === false) {
149
159
  return false;
@@ -3002,53 +3012,64 @@ function useJobSearchModal() {
3002
3012
  openModal();
3003
3013
  };
3004
3014
  const closeModalWithCheck = () => {
3005
- setIsConfirmed(true);
3006
3015
  if (!selectedJob) {
3007
3016
  ModalUtils.alert("\uC9C1\uC885\uC744 \uC120\uD0DD\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uC9C1\uC885 \uC120\uD0DD \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694.", "\uC9C1\uC885\uC744 \uC120\uD0DD\uD574\uC8FC\uC138\uC694.", {
3008
3017
  modalId: "job-search-alert-no-selected"
3009
3018
  });
3010
3019
  return;
3011
3020
  }
3021
+ setIsConfirmed(true);
3012
3022
  closeModal();
3013
3023
  };
3014
3024
  return {
3015
- JobSearchModal: /* @__PURE__ */ jsxs(Modal.Root, { isOpen, onClose: closeModal, modalSize: "xlarge", children: [
3016
- /* @__PURE__ */ jsx(Modal.Overlay, {}),
3017
- /* @__PURE__ */ jsxs(Modal.Content, { style: { height: "697px" }, children: [
3018
- /* @__PURE__ */ jsx(Modal.Header, { headerTitle: "\uC9C1\uC885 \uAC80\uC0C9", showCloseButton: true }),
3019
- /* @__PURE__ */ jsx(Modal.Body, { raw: true, children: /* @__PURE__ */ jsx(
3020
- JobSearch,
3021
- {
3022
- firstCategory,
3023
- firstCategoryList,
3024
- secondCategoryList,
3025
- setFirstCategory,
3026
- secondCategory,
3027
- activeTab,
3028
- onTabChange,
3029
- searchTerm,
3030
- setSearchInput,
3031
- filteredJobs: filteredJobs || [],
3032
- onJobSelect: handleJobSelect,
3033
- searchInput,
3034
- setSearchTerm,
3035
- setSecondCategory,
3036
- isLoading
3037
- }
3038
- ) }),
3039
- /* @__PURE__ */ jsx(Modal.Footer, { children: /* @__PURE__ */ jsx(
3040
- Button,
3041
- {
3042
- variant: "primary",
3043
- size: "medium",
3044
- appearance: "filled",
3045
- width: "full",
3046
- onClick: closeModalWithCheck,
3047
- children: "\uD655\uC778"
3048
- }
3049
- ) })
3050
- ] })
3051
- ] }),
3025
+ JobSearchModal: /* @__PURE__ */ jsxs(
3026
+ Modal.Root,
3027
+ {
3028
+ isOpen,
3029
+ onClose: () => {
3030
+ closeModal();
3031
+ setIsConfirmed(false);
3032
+ },
3033
+ modalSize: "xlarge",
3034
+ children: [
3035
+ /* @__PURE__ */ jsx(Modal.Overlay, {}),
3036
+ /* @__PURE__ */ jsxs(Modal.Content, { style: { height: "697px" }, children: [
3037
+ /* @__PURE__ */ jsx(Modal.Header, { headerTitle: "\uC9C1\uC885 \uAC80\uC0C9", showCloseButton: true }),
3038
+ /* @__PURE__ */ jsx(Modal.Body, { raw: true, children: /* @__PURE__ */ jsx(
3039
+ JobSearch,
3040
+ {
3041
+ firstCategory,
3042
+ firstCategoryList,
3043
+ secondCategoryList,
3044
+ setFirstCategory,
3045
+ secondCategory,
3046
+ activeTab,
3047
+ onTabChange,
3048
+ searchTerm,
3049
+ setSearchInput,
3050
+ filteredJobs: filteredJobs || [],
3051
+ onJobSelect: handleJobSelect,
3052
+ searchInput,
3053
+ setSearchTerm,
3054
+ setSecondCategory,
3055
+ isLoading
3056
+ }
3057
+ ) }),
3058
+ /* @__PURE__ */ jsx(Modal.Footer, { children: /* @__PURE__ */ jsx(
3059
+ Button,
3060
+ {
3061
+ variant: "primary",
3062
+ size: "medium",
3063
+ appearance: "filled",
3064
+ width: "full",
3065
+ onClick: closeModalWithCheck,
3066
+ children: "\uD655\uC778"
3067
+ }
3068
+ ) })
3069
+ ] })
3070
+ ]
3071
+ }
3072
+ ),
3052
3073
  JobSearchComponent: /* @__PURE__ */ jsx(
3053
3074
  JobSearch,
3054
3075
  {
@@ -3261,57 +3282,78 @@ function useJobVehicleSearchModal() {
3261
3282
  setIsConfirmed,
3262
3283
  openJobVehicleModal: openInitModal,
3263
3284
  closeJobVehicleModal: closeModal,
3264
- JobVehicleSearchModalComponent: /* @__PURE__ */ jsxs(Modal.Root, { isOpen, onClose: closeModal, modalSize: "xlarge", children: [
3265
- /* @__PURE__ */ jsx(Modal.Overlay, {}),
3266
- /* @__PURE__ */ jsxs(Modal.Content, { style: { height: "697px" }, children: [
3267
- /* @__PURE__ */ jsx(Modal.Header, { headerTitle: "\uC9C1\uC885\xB7\uC6B4\uC804\uCC28\uC885 \uAC80\uC0C9", showCloseButton: true }),
3268
- /* @__PURE__ */ jsx(Modal.Body, { className: cx$5("job-vehicle-search-modal"), raw: true, children: /* @__PURE__ */ jsxs(Fragment, { children: [
3269
- /* @__PURE__ */ jsxs("div", { className: cx$5("left-panel"), children: [
3270
- /* @__PURE__ */ jsxs("div", { className: cx$5("card-section"), children: [
3271
- /* @__PURE__ */ jsxs(
3272
- "div",
3273
- {
3274
- className: cx$5("card-menu", { "card-selected": rightPanelView === "jobSearch" }),
3275
- onClick: () => setRightPanelView("jobSearch"),
3276
- children: [
3277
- /* @__PURE__ */ jsxs("div", { className: cx$5("card-title"), children: [
3278
- /* @__PURE__ */ jsx(IconIllustJob, { className: cx$5("card-icon") }),
3279
- /* @__PURE__ */ jsx("span", { className: cx$5("card-text", "typo-title5", "text-body"), children: "\uC9C1\uC885" }),
3280
- /* @__PURE__ */ jsx(IconSubUiArrowRight, {})
3281
- ] }),
3282
- /* @__PURE__ */ jsx("div", { className: "typo-body2 text-body_2", children: selectedJob ? selectedJob.occupationIndustryName : "\uBBF8\uC120\uD0DD" })
3283
- ]
3284
- }
3285
- ),
3286
- /* @__PURE__ */ jsxs(
3287
- "div",
3288
- {
3289
- className: cx$5("card-menu", { "card-selected": rightPanelView === "vehicleSelection" }),
3290
- onClick: () => setRightPanelView("vehicleSelection"),
3291
- children: [
3292
- /* @__PURE__ */ jsxs("div", { className: cx$5("card-title"), children: [
3293
- /* @__PURE__ */ jsx(IconIllustVehicle, { className: cx$5("card-icon") }),
3294
- /* @__PURE__ */ jsx("span", { className: cx$5("card-text", "typo-title5", "text-body"), children: "\uC6B4\uC804 \uC5EC\uBD80\xB7\uCC28\uC885" }),
3295
- /* @__PURE__ */ jsx(IconSubUiArrowRight, {})
3296
- ] }),
3297
- /* @__PURE__ */ jsxs("div", { className: "typo-body2 text-body_2", children: [
3298
- selectedVehicle?.integrationCodeValueName,
3299
- selectedVehicle?.integrationCodeValue || "\uBBF8\uC120\uD0DD"
3300
- ] })
3301
- ]
3302
- }
3303
- )
3304
- ] }),
3305
- /* @__PURE__ */ jsx(JobVehicleSearchGrade, { riskGrade, hospitalizationGrade })
3306
- ] }),
3307
- /* @__PURE__ */ jsx("div", { className: cx$5("right-panel"), children: rightPanelView === "jobSearch" ? JobSearch : VehicleSearch })
3308
- ] }) }),
3309
- /* @__PURE__ */ jsx(Modal.Footer, { style: { marginTop: 0 }, children: /* @__PURE__ */ jsx(Button, { variant: "primary", size: "medium", appearance: "filled", width: "full", onClick: () => {
3310
- validate();
3311
- setIsConfirmed(true);
3312
- }, children: "\uD655\uC778" }) })
3313
- ] })
3314
- ] })
3285
+ JobVehicleSearchModalComponent: /* @__PURE__ */ jsxs(
3286
+ Modal.Root,
3287
+ {
3288
+ isOpen,
3289
+ onClose: () => {
3290
+ closeModal();
3291
+ setIsConfirmed(false);
3292
+ },
3293
+ modalSize: "xlarge",
3294
+ children: [
3295
+ /* @__PURE__ */ jsx(Modal.Overlay, {}),
3296
+ /* @__PURE__ */ jsxs(Modal.Content, { style: { height: "697px" }, children: [
3297
+ /* @__PURE__ */ jsx(Modal.Header, { headerTitle: "\uC9C1\uC885\xB7\uC6B4\uC804\uCC28\uC885 \uAC80\uC0C9", showCloseButton: true }),
3298
+ /* @__PURE__ */ jsx(Modal.Body, { className: cx$5("job-vehicle-search-modal"), raw: true, children: /* @__PURE__ */ jsxs(Fragment, { children: [
3299
+ /* @__PURE__ */ jsxs("div", { className: cx$5("left-panel"), children: [
3300
+ /* @__PURE__ */ jsxs("div", { className: cx$5("card-section"), children: [
3301
+ /* @__PURE__ */ jsxs(
3302
+ "div",
3303
+ {
3304
+ className: cx$5("card-menu", { "card-selected": rightPanelView === "jobSearch" }),
3305
+ onClick: () => setRightPanelView("jobSearch"),
3306
+ children: [
3307
+ /* @__PURE__ */ jsxs("div", { className: cx$5("card-title"), children: [
3308
+ /* @__PURE__ */ jsx(IconIllustJob, { className: cx$5("card-icon") }),
3309
+ /* @__PURE__ */ jsx("span", { className: cx$5("card-text", "typo-title5", "text-body"), children: "\uC9C1\uC885" }),
3310
+ /* @__PURE__ */ jsx(IconSubUiArrowRight, {})
3311
+ ] }),
3312
+ /* @__PURE__ */ jsx("div", { className: "typo-body2 text-body_2", children: selectedJob ? selectedJob.occupationIndustryName : "\uBBF8\uC120\uD0DD" })
3313
+ ]
3314
+ }
3315
+ ),
3316
+ /* @__PURE__ */ jsxs(
3317
+ "div",
3318
+ {
3319
+ className: cx$5("card-menu", { "card-selected": rightPanelView === "vehicleSelection" }),
3320
+ onClick: () => setRightPanelView("vehicleSelection"),
3321
+ children: [
3322
+ /* @__PURE__ */ jsxs("div", { className: cx$5("card-title"), children: [
3323
+ /* @__PURE__ */ jsx(IconIllustVehicle, { className: cx$5("card-icon") }),
3324
+ /* @__PURE__ */ jsx("span", { className: cx$5("card-text", "typo-title5", "text-body"), children: "\uC6B4\uC804 \uC5EC\uBD80\xB7\uCC28\uC885" }),
3325
+ /* @__PURE__ */ jsx(IconSubUiArrowRight, {})
3326
+ ] }),
3327
+ /* @__PURE__ */ jsxs("div", { className: "typo-body2 text-body_2", children: [
3328
+ selectedVehicle?.integrationCodeValueName,
3329
+ selectedVehicle?.integrationCodeValue || "\uBBF8\uC120\uD0DD"
3330
+ ] })
3331
+ ]
3332
+ }
3333
+ )
3334
+ ] }),
3335
+ /* @__PURE__ */ jsx(JobVehicleSearchGrade, { riskGrade, hospitalizationGrade })
3336
+ ] }),
3337
+ /* @__PURE__ */ jsx("div", { className: cx$5("right-panel"), children: rightPanelView === "jobSearch" ? JobSearch : VehicleSearch })
3338
+ ] }) }),
3339
+ /* @__PURE__ */ jsx(Modal.Footer, { style: { marginTop: 0 }, children: /* @__PURE__ */ jsx(
3340
+ Button,
3341
+ {
3342
+ variant: "primary",
3343
+ size: "medium",
3344
+ appearance: "filled",
3345
+ width: "full",
3346
+ onClick: () => {
3347
+ validate();
3348
+ setIsConfirmed(true);
3349
+ },
3350
+ children: "\uD655\uC778"
3351
+ }
3352
+ ) })
3353
+ ] })
3354
+ ]
3355
+ }
3356
+ )
3315
3357
  };
3316
3358
  }
3317
3359
 
@@ -4555,26 +4597,9 @@ const useDownloader = () => {
4555
4597
  const [isLoading, setIsLoading] = useState(false);
4556
4598
  const downloadFile = async (url, fileName) => {
4557
4599
  try {
4558
- let downloadUrl = "";
4559
- if (url.startsWith("http")) {
4560
- const response = await fetch(url);
4561
- if (!response.ok) {
4562
- throw new Error(`Failed to download ${url}`);
4563
- }
4564
- const blob = await response.blob();
4565
- downloadUrl = window.URL.createObjectURL(blob);
4566
- } else if (url.startsWith("blob")) {
4567
- downloadUrl = url;
4568
- } else {
4569
- throw new Error(`unknown type : ${url}`);
4570
- }
4571
- const a = document.createElement("a");
4572
- a.href = downloadUrl;
4573
- a.download = fileName || url.split("/").pop() || "download";
4574
- document.body.appendChild(a);
4575
- a.click();
4576
- a.remove();
4577
- window.URL.revokeObjectURL(downloadUrl);
4600
+ const servicePath = getServicePath();
4601
+ const downloadUrl = `${servicePath}/internal/api/download?filename=${encodeURIComponent(fileName)}&filepath=${encodeURIComponent(url)}`;
4602
+ window.location.href = downloadUrl;
4578
4603
  } catch (e) {
4579
4604
  console.error(e);
4580
4605
  throw e;