@movvjs/svelte-schedule-view 0.2.3 → 0.2.4-MOVV-197
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/.svelte-kit/__package__/schedule-view/BookingInfo.svelte +4 -5
- package/.svelte-kit/__package__/schedule-view/api/booking/dto.d.ts +1 -0
- package/.svelte-kit/__package__/schedule-view/biz/index.d.ts +1 -0
- package/.svelte-kit/__package__/schedule-view/biz/index.js +1 -0
- package/.svelte-kit/__package__/schedule-view/biz/phoneNumber.d.ts +20 -0
- package/.svelte-kit/__package__/schedule-view/biz/phoneNumber.js +53 -0
- package/.svelte-kit/__package__/schedule-view/stores/booking.d.ts +0 -16
- package/.svelte-kit/__package__/schedule-view/stores/booking.js +0 -44
- package/.svelte-kit/generated/server/internal.js +1 -1
- package/.vscode/settings.json +2 -1
- package/dist/schedule-view/BookingInfo.svelte +4 -5
- package/dist/schedule-view/api/booking/dto.d.ts +1 -0
- package/dist/schedule-view/biz/index.d.ts +1 -0
- package/dist/schedule-view/biz/index.js +1 -0
- package/dist/schedule-view/biz/phoneNumber.d.ts +20 -0
- package/dist/schedule-view/biz/phoneNumber.js +53 -0
- package/dist/schedule-view/stores/booking.d.ts +0 -16
- package/dist/schedule-view/stores/booking.js +0 -44
- package/package.json +1 -1
- package/src/lib/schedule-view/BookingInfo.svelte +4 -5
- package/src/lib/schedule-view/api/booking/dto.ts +1 -0
- package/src/lib/schedule-view/biz/index.ts +1 -0
- package/src/lib/schedule-view/biz/phoneNumber.ts +60 -0
- package/src/lib/schedule-view/stores/booking.ts +0 -40
- package/src/routes/development/+page.svelte +1 -1
|
@@ -7,6 +7,7 @@ import { env } from "../store/env";
|
|
|
7
7
|
import { BookingServiceType, FileType } from "./types";
|
|
8
8
|
import { isEdit } from "./Schedule.svelte";
|
|
9
9
|
import { getCarName } from "./utils";
|
|
10
|
+
import { PhoneNumberBiz } from "./biz";
|
|
10
11
|
import { copiedBooking, originalBooking } from "./stores/booking";
|
|
11
12
|
import { alert } from "./components/notifications";
|
|
12
13
|
import Translation from "./components/translation/Translation.svelte";
|
|
@@ -22,8 +23,6 @@ const {
|
|
|
22
23
|
firstName,
|
|
23
24
|
lastName,
|
|
24
25
|
pax: copiedBookingPax,
|
|
25
|
-
telNumber,
|
|
26
|
-
telCountryCode,
|
|
27
26
|
isPicketServiceAvailable,
|
|
28
27
|
isPicketServiceSelected,
|
|
29
28
|
isBabySeatServiceAvailable,
|
|
@@ -49,7 +48,7 @@ async function copyContents() {
|
|
|
49
48
|
texts.push(`${$t("booking.flight")} : ${[$originalBooking.flight?.name, getTerminalName($originalBooking.flight)].filter(Boolean).join(" / ")}`);
|
|
50
49
|
}
|
|
51
50
|
texts.push(`${$t("booking.guestName")} : ${$fullName}`);
|
|
52
|
-
texts.push(`${$t("booking.telNo")} : ${$originalBooking.tel || "- -"}`);
|
|
51
|
+
texts.push(`${$t("booking.telNo")} : ${PhoneNumberBiz.format($originalBooking.countryCode, $originalBooking.tel) || "- -"}`);
|
|
53
52
|
const extraServiceText = $originalBooking.extra?.length > 0 ? $originalBooking.extra.map((s) => $t(`extraServiceType.${s.type}`)).join(", ") : "- -";
|
|
54
53
|
texts.push(`${$t("booking.extraService")} : ${extraServiceText}`);
|
|
55
54
|
texts.push(`${$t("booking.reservationStatus")} : ${$originalBooking.status}`);
|
|
@@ -274,9 +273,9 @@ function getTerminalName(flight) {
|
|
|
274
273
|
<th>{$t('booking.telNo')}</th>
|
|
275
274
|
<td>
|
|
276
275
|
{#if !$isEdit}
|
|
277
|
-
<p class="value-txt">{$originalBooking.tel || '- -'}</p>
|
|
276
|
+
<p class="value-txt">{PhoneNumberBiz.format($originalBooking.countryCode, $originalBooking.tel) || '- -'}</p>
|
|
278
277
|
{:else}
|
|
279
|
-
<PhoneNumberInput bind:telCountryCode={$
|
|
278
|
+
<PhoneNumberInput bind:telCountryCode={$copiedBooking.countryCode} bind:telNumber={$copiedBooking.tel} />
|
|
280
279
|
{/if}
|
|
281
280
|
</td>
|
|
282
281
|
</tr>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './phoneNumber';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './phoneNumber';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class PhoneNumberBiz {
|
|
2
|
+
/**
|
|
3
|
+
* 국가번호 및 연락처를 받아 합쳐진 연락처를 반환.
|
|
4
|
+
* @param countryCode 국가코드
|
|
5
|
+
* @param phoneNumber 연락처
|
|
6
|
+
* @param options.countryCodeFormatter 국가코드 포맷팅 함수
|
|
7
|
+
* @param options.phoneNumberFormatter 연락처 포맷팅 함수
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
static format(countryCode: string, phoneNumber: string, options?: {
|
|
11
|
+
countryCodeFormatter?: (countryCode: string) => string;
|
|
12
|
+
phoneNumberFormatter?: (phoneNumber: string) => string;
|
|
13
|
+
}): string;
|
|
14
|
+
/**
|
|
15
|
+
* 전화번호 유효성 검증
|
|
16
|
+
* @param countryCode 국가코드
|
|
17
|
+
* @param phoneNumber 연락처
|
|
18
|
+
*/
|
|
19
|
+
static validate(countryCode: string, phoneNumber: string): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// 공통 비즈니스 로직
|
|
2
|
+
export class PhoneNumberBiz {
|
|
3
|
+
/**
|
|
4
|
+
* 국가번호 및 연락처를 받아 합쳐진 연락처를 반환.
|
|
5
|
+
* @param countryCode 국가코드
|
|
6
|
+
* @param phoneNumber 연락처
|
|
7
|
+
* @param options.countryCodeFormatter 국가코드 포맷팅 함수
|
|
8
|
+
* @param options.phoneNumberFormatter 연락처 포맷팅 함수
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
static format(countryCode, phoneNumber, options) {
|
|
12
|
+
let result = [];
|
|
13
|
+
let code = countryCode;
|
|
14
|
+
let number = phoneNumber;
|
|
15
|
+
// 만약 코드는 없고, 번호만 있으면 과거 코드로 인식하고 나누기 후 할당
|
|
16
|
+
if (!code && number) {
|
|
17
|
+
const splitted = number.split(' ');
|
|
18
|
+
if (splitted.length > 1) {
|
|
19
|
+
code = splitted[0];
|
|
20
|
+
number = splitted[1];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (code) {
|
|
24
|
+
if (options?.countryCodeFormatter && typeof options.countryCodeFormatter === 'function') {
|
|
25
|
+
result.push(options.countryCodeFormatter(code));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
result.push(code);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (number) {
|
|
32
|
+
if (options?.phoneNumberFormatter && typeof options.phoneNumberFormatter === 'function') {
|
|
33
|
+
result.push(options.phoneNumberFormatter(number));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
result.push(number);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result.join(' ');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 전화번호 유효성 검증
|
|
43
|
+
* @param countryCode 국가코드
|
|
44
|
+
* @param phoneNumber 연락처
|
|
45
|
+
*/
|
|
46
|
+
static validate(countryCode, phoneNumber) {
|
|
47
|
+
if (!countryCode)
|
|
48
|
+
return false;
|
|
49
|
+
if (!phoneNumber)
|
|
50
|
+
return false;
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -74,14 +74,6 @@ export declare const originalBooking: {
|
|
|
74
74
|
subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number>) => import("svelte/store").Unsubscriber;
|
|
75
75
|
set(pax: number): void;
|
|
76
76
|
};
|
|
77
|
-
telCountryCode: {
|
|
78
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
79
|
-
set(countryCode: string): void;
|
|
80
|
-
};
|
|
81
|
-
telNumber: {
|
|
82
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
83
|
-
set(numbers: string): void;
|
|
84
|
-
};
|
|
85
77
|
isBabySeatService: {
|
|
86
78
|
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: import("svelte/store").Invalidator<boolean>) => import("svelte/store").Unsubscriber;
|
|
87
79
|
set(checked: boolean): void;
|
|
@@ -168,14 +160,6 @@ export declare const copiedBooking: {
|
|
|
168
160
|
subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number>) => import("svelte/store").Unsubscriber;
|
|
169
161
|
set(pax: number): void;
|
|
170
162
|
};
|
|
171
|
-
telCountryCode: {
|
|
172
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
173
|
-
set(countryCode: string): void;
|
|
174
|
-
};
|
|
175
|
-
telNumber: {
|
|
176
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
177
|
-
set(numbers: string): void;
|
|
178
|
-
};
|
|
179
163
|
isBabySeatService: {
|
|
180
164
|
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: import("svelte/store").Invalidator<boolean>) => import("svelte/store").Unsubscriber;
|
|
181
165
|
set(checked: boolean): void;
|
|
@@ -165,48 +165,6 @@ function createBookingStore(bookingDTO) {
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
-
// 연락처 국가번호 값 & 변경
|
|
169
|
-
const telCountryCode = {
|
|
170
|
-
subscribe: derived(booking, $booking => {
|
|
171
|
-
if (!$booking?.tel)
|
|
172
|
-
return null;
|
|
173
|
-
const splitted = $booking.tel.split(' ');
|
|
174
|
-
return splitted.find(tel => tel.startsWith('+')) ?? null;
|
|
175
|
-
}).subscribe,
|
|
176
|
-
set(countryCode) {
|
|
177
|
-
copiedBooking.update($booking => {
|
|
178
|
-
const tels = [];
|
|
179
|
-
if (countryCode)
|
|
180
|
-
tels.push(countryCode);
|
|
181
|
-
const $telNumber = get(telNumber);
|
|
182
|
-
if ($telNumber)
|
|
183
|
-
tels.push($telNumber);
|
|
184
|
-
$booking.tel = tels.join(' ');
|
|
185
|
-
return $booking;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
// 연락처 번호 값 & 변경
|
|
190
|
-
const telNumber = {
|
|
191
|
-
subscribe: derived(booking, $booking => {
|
|
192
|
-
if (!$booking?.tel)
|
|
193
|
-
return null;
|
|
194
|
-
const splitted = $booking.tel.split(' ').filter(tel => !tel.startsWith('+'));
|
|
195
|
-
return splitted.join('');
|
|
196
|
-
}).subscribe,
|
|
197
|
-
set(numbers) {
|
|
198
|
-
copiedBooking.update($booking => {
|
|
199
|
-
const tels = [];
|
|
200
|
-
const $telCountryCode = get(telCountryCode);
|
|
201
|
-
if ($telCountryCode)
|
|
202
|
-
tels.push($telCountryCode);
|
|
203
|
-
if (numbers)
|
|
204
|
-
tels.push(numbers);
|
|
205
|
-
$booking.tel = tels.join(' ');
|
|
206
|
-
return $booking;
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
168
|
// baby seat 서비스 여부 및 변경
|
|
211
169
|
const isBabySeatService = {
|
|
212
170
|
subscribe: derived(extraServices, $extraServices => {
|
|
@@ -353,8 +311,6 @@ function createBookingStore(bookingDTO) {
|
|
|
353
311
|
firstName,
|
|
354
312
|
lastName,
|
|
355
313
|
pax,
|
|
356
|
-
telCountryCode,
|
|
357
|
-
telNumber,
|
|
358
314
|
isBabySeatService,
|
|
359
315
|
isPicketService,
|
|
360
316
|
addTime
|
|
@@ -21,7 +21,7 @@ export const options = {
|
|
|
21
21
|
app: ({ head, body, assets, nonce, env }) => "<!DOCTYPE html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<link rel=\"icon\" href=\"" + assets + "/favicon.png\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<meta name=\"referrer\" content=\"no-referrer\" />\n\t\t" + head + "\n\t</head>\n\t<body data-sveltekit-preload-data=\"hover\">\n\t\t<div>" + body + "</div>\n\t</body>\n</html>\n",
|
|
22
22
|
error: ({ status, message }) => "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<title>" + message + "</title>\n\n\t\t<style>\n\t\t\tbody {\n\t\t\t\t--bg: white;\n\t\t\t\t--fg: #222;\n\t\t\t\t--divider: #ccc;\n\t\t\t\tbackground: var(--bg);\n\t\t\t\tcolor: var(--fg);\n\t\t\t\tfont-family:\n\t\t\t\t\tsystem-ui,\n\t\t\t\t\t-apple-system,\n\t\t\t\t\tBlinkMacSystemFont,\n\t\t\t\t\t'Segoe UI',\n\t\t\t\t\tRoboto,\n\t\t\t\t\tOxygen,\n\t\t\t\t\tUbuntu,\n\t\t\t\t\tCantarell,\n\t\t\t\t\t'Open Sans',\n\t\t\t\t\t'Helvetica Neue',\n\t\t\t\t\tsans-serif;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t.error {\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tmax-width: 32rem;\n\t\t\t\tmargin: 0 1rem;\n\t\t\t}\n\n\t\t\t.status {\n\t\t\t\tfont-weight: 200;\n\t\t\t\tfont-size: 3rem;\n\t\t\t\tline-height: 1;\n\t\t\t\tposition: relative;\n\t\t\t\ttop: -0.05rem;\n\t\t\t}\n\n\t\t\t.message {\n\t\t\t\tborder-left: 1px solid var(--divider);\n\t\t\t\tpadding: 0 0 0 1rem;\n\t\t\t\tmargin: 0 0 0 1rem;\n\t\t\t\tmin-height: 2.5rem;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t}\n\n\t\t\t.message h1 {\n\t\t\t\tfont-weight: 400;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t@media (prefers-color-scheme: dark) {\n\t\t\t\tbody {\n\t\t\t\t\t--bg: #222;\n\t\t\t\t\t--fg: #ddd;\n\t\t\t\t\t--divider: #666;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div class=\"error\">\n\t\t\t<span class=\"status\">" + status + "</span>\n\t\t\t<div class=\"message\">\n\t\t\t\t<h1>" + message + "</h1>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>\n"
|
|
23
23
|
},
|
|
24
|
-
version_hash: "
|
|
24
|
+
version_hash: "173ovcu"
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export async function get_hooks() {
|
package/.vscode/settings.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"i18n-ally.localesPaths": ["src/lib/i18n
|
|
2
|
+
"i18n-ally.localesPaths": ["src/lib/i18n/locales"],
|
|
3
3
|
"i18n-ally.sourceLanguage": "en",
|
|
4
|
+
"i18n-ally.displayLanguage": "en",
|
|
4
5
|
"i18n-ally.keystyle": "nested",
|
|
5
6
|
"workbench.colorCustomizations": {
|
|
6
7
|
"activityBar.activeBackground": "#e8a7b4",
|
|
@@ -7,6 +7,7 @@ import { env } from "../store/env";
|
|
|
7
7
|
import { BookingServiceType, FileType } from "./types";
|
|
8
8
|
import { isEdit } from "./Schedule.svelte";
|
|
9
9
|
import { getCarName } from "./utils";
|
|
10
|
+
import { PhoneNumberBiz } from "./biz";
|
|
10
11
|
import { copiedBooking, originalBooking } from "./stores/booking";
|
|
11
12
|
import { alert } from "./components/notifications";
|
|
12
13
|
import Translation from "./components/translation/Translation.svelte";
|
|
@@ -22,8 +23,6 @@ const {
|
|
|
22
23
|
firstName,
|
|
23
24
|
lastName,
|
|
24
25
|
pax: copiedBookingPax,
|
|
25
|
-
telNumber,
|
|
26
|
-
telCountryCode,
|
|
27
26
|
isPicketServiceAvailable,
|
|
28
27
|
isPicketServiceSelected,
|
|
29
28
|
isBabySeatServiceAvailable,
|
|
@@ -49,7 +48,7 @@ async function copyContents() {
|
|
|
49
48
|
texts.push(`${$t("booking.flight")} : ${[$originalBooking.flight?.name, getTerminalName($originalBooking.flight)].filter(Boolean).join(" / ")}`);
|
|
50
49
|
}
|
|
51
50
|
texts.push(`${$t("booking.guestName")} : ${$fullName}`);
|
|
52
|
-
texts.push(`${$t("booking.telNo")} : ${$originalBooking.tel || "- -"}`);
|
|
51
|
+
texts.push(`${$t("booking.telNo")} : ${PhoneNumberBiz.format($originalBooking.countryCode, $originalBooking.tel) || "- -"}`);
|
|
53
52
|
const extraServiceText = $originalBooking.extra?.length > 0 ? $originalBooking.extra.map((s) => $t(`extraServiceType.${s.type}`)).join(", ") : "- -";
|
|
54
53
|
texts.push(`${$t("booking.extraService")} : ${extraServiceText}`);
|
|
55
54
|
texts.push(`${$t("booking.reservationStatus")} : ${$originalBooking.status}`);
|
|
@@ -274,9 +273,9 @@ function getTerminalName(flight) {
|
|
|
274
273
|
<th>{$t('booking.telNo')}</th>
|
|
275
274
|
<td>
|
|
276
275
|
{#if !$isEdit}
|
|
277
|
-
<p class="value-txt">{$originalBooking.tel || '- -'}</p>
|
|
276
|
+
<p class="value-txt">{PhoneNumberBiz.format($originalBooking.countryCode, $originalBooking.tel) || '- -'}</p>
|
|
278
277
|
{:else}
|
|
279
|
-
<PhoneNumberInput bind:telCountryCode={$
|
|
278
|
+
<PhoneNumberInput bind:telCountryCode={$copiedBooking.countryCode} bind:telNumber={$copiedBooking.tel} />
|
|
280
279
|
{/if}
|
|
281
280
|
</td>
|
|
282
281
|
</tr>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './phoneNumber';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './phoneNumber';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class PhoneNumberBiz {
|
|
2
|
+
/**
|
|
3
|
+
* 국가번호 및 연락처를 받아 합쳐진 연락처를 반환.
|
|
4
|
+
* @param countryCode 국가코드
|
|
5
|
+
* @param phoneNumber 연락처
|
|
6
|
+
* @param options.countryCodeFormatter 국가코드 포맷팅 함수
|
|
7
|
+
* @param options.phoneNumberFormatter 연락처 포맷팅 함수
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
static format(countryCode: string, phoneNumber: string, options?: {
|
|
11
|
+
countryCodeFormatter?: (countryCode: string) => string;
|
|
12
|
+
phoneNumberFormatter?: (phoneNumber: string) => string;
|
|
13
|
+
}): string;
|
|
14
|
+
/**
|
|
15
|
+
* 전화번호 유효성 검증
|
|
16
|
+
* @param countryCode 국가코드
|
|
17
|
+
* @param phoneNumber 연락처
|
|
18
|
+
*/
|
|
19
|
+
static validate(countryCode: string, phoneNumber: string): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// 공통 비즈니스 로직
|
|
2
|
+
export class PhoneNumberBiz {
|
|
3
|
+
/**
|
|
4
|
+
* 국가번호 및 연락처를 받아 합쳐진 연락처를 반환.
|
|
5
|
+
* @param countryCode 국가코드
|
|
6
|
+
* @param phoneNumber 연락처
|
|
7
|
+
* @param options.countryCodeFormatter 국가코드 포맷팅 함수
|
|
8
|
+
* @param options.phoneNumberFormatter 연락처 포맷팅 함수
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
static format(countryCode, phoneNumber, options) {
|
|
12
|
+
let result = [];
|
|
13
|
+
let code = countryCode;
|
|
14
|
+
let number = phoneNumber;
|
|
15
|
+
// 만약 코드는 없고, 번호만 있으면 과거 코드로 인식하고 나누기 후 할당
|
|
16
|
+
if (!code && number) {
|
|
17
|
+
const splitted = number.split(' ');
|
|
18
|
+
if (splitted.length > 1) {
|
|
19
|
+
code = splitted[0];
|
|
20
|
+
number = splitted[1];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (code) {
|
|
24
|
+
if (options?.countryCodeFormatter && typeof options.countryCodeFormatter === 'function') {
|
|
25
|
+
result.push(options.countryCodeFormatter(code));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
result.push(code);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (number) {
|
|
32
|
+
if (options?.phoneNumberFormatter && typeof options.phoneNumberFormatter === 'function') {
|
|
33
|
+
result.push(options.phoneNumberFormatter(number));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
result.push(number);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result.join(' ');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 전화번호 유효성 검증
|
|
43
|
+
* @param countryCode 국가코드
|
|
44
|
+
* @param phoneNumber 연락처
|
|
45
|
+
*/
|
|
46
|
+
static validate(countryCode, phoneNumber) {
|
|
47
|
+
if (!countryCode)
|
|
48
|
+
return false;
|
|
49
|
+
if (!phoneNumber)
|
|
50
|
+
return false;
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -74,14 +74,6 @@ export declare const originalBooking: {
|
|
|
74
74
|
subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number>) => import("svelte/store").Unsubscriber;
|
|
75
75
|
set(pax: number): void;
|
|
76
76
|
};
|
|
77
|
-
telCountryCode: {
|
|
78
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
79
|
-
set(countryCode: string): void;
|
|
80
|
-
};
|
|
81
|
-
telNumber: {
|
|
82
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
83
|
-
set(numbers: string): void;
|
|
84
|
-
};
|
|
85
77
|
isBabySeatService: {
|
|
86
78
|
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: import("svelte/store").Invalidator<boolean>) => import("svelte/store").Unsubscriber;
|
|
87
79
|
set(checked: boolean): void;
|
|
@@ -168,14 +160,6 @@ export declare const copiedBooking: {
|
|
|
168
160
|
subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number>) => import("svelte/store").Unsubscriber;
|
|
169
161
|
set(pax: number): void;
|
|
170
162
|
};
|
|
171
|
-
telCountryCode: {
|
|
172
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
173
|
-
set(countryCode: string): void;
|
|
174
|
-
};
|
|
175
|
-
telNumber: {
|
|
176
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
177
|
-
set(numbers: string): void;
|
|
178
|
-
};
|
|
179
163
|
isBabySeatService: {
|
|
180
164
|
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: import("svelte/store").Invalidator<boolean>) => import("svelte/store").Unsubscriber;
|
|
181
165
|
set(checked: boolean): void;
|
|
@@ -165,48 +165,6 @@ function createBookingStore(bookingDTO) {
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
-
// 연락처 국가번호 값 & 변경
|
|
169
|
-
const telCountryCode = {
|
|
170
|
-
subscribe: derived(booking, $booking => {
|
|
171
|
-
if (!$booking?.tel)
|
|
172
|
-
return null;
|
|
173
|
-
const splitted = $booking.tel.split(' ');
|
|
174
|
-
return splitted.find(tel => tel.startsWith('+')) ?? null;
|
|
175
|
-
}).subscribe,
|
|
176
|
-
set(countryCode) {
|
|
177
|
-
copiedBooking.update($booking => {
|
|
178
|
-
const tels = [];
|
|
179
|
-
if (countryCode)
|
|
180
|
-
tels.push(countryCode);
|
|
181
|
-
const $telNumber = get(telNumber);
|
|
182
|
-
if ($telNumber)
|
|
183
|
-
tels.push($telNumber);
|
|
184
|
-
$booking.tel = tels.join(' ');
|
|
185
|
-
return $booking;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
// 연락처 번호 값 & 변경
|
|
190
|
-
const telNumber = {
|
|
191
|
-
subscribe: derived(booking, $booking => {
|
|
192
|
-
if (!$booking?.tel)
|
|
193
|
-
return null;
|
|
194
|
-
const splitted = $booking.tel.split(' ').filter(tel => !tel.startsWith('+'));
|
|
195
|
-
return splitted.join('');
|
|
196
|
-
}).subscribe,
|
|
197
|
-
set(numbers) {
|
|
198
|
-
copiedBooking.update($booking => {
|
|
199
|
-
const tels = [];
|
|
200
|
-
const $telCountryCode = get(telCountryCode);
|
|
201
|
-
if ($telCountryCode)
|
|
202
|
-
tels.push($telCountryCode);
|
|
203
|
-
if (numbers)
|
|
204
|
-
tels.push(numbers);
|
|
205
|
-
$booking.tel = tels.join(' ');
|
|
206
|
-
return $booking;
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
168
|
// baby seat 서비스 여부 및 변경
|
|
211
169
|
const isBabySeatService = {
|
|
212
170
|
subscribe: derived(extraServices, $extraServices => {
|
|
@@ -353,8 +311,6 @@ function createBookingStore(bookingDTO) {
|
|
|
353
311
|
firstName,
|
|
354
312
|
lastName,
|
|
355
313
|
pax,
|
|
356
|
-
telCountryCode,
|
|
357
|
-
telNumber,
|
|
358
314
|
isBabySeatService,
|
|
359
315
|
isPicketService,
|
|
360
316
|
addTime
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { BookingServiceType, FileType, type Flight } from '$scheduleView/types'
|
|
11
11
|
import { isEdit } from '$scheduleView/Schedule.svelte'
|
|
12
12
|
import { getCarName } from '$scheduleView/utils'
|
|
13
|
+
import { PhoneNumberBiz } from '$scheduleView/biz'
|
|
13
14
|
import { copiedBooking, originalBooking } from '$scheduleView/stores/booking'
|
|
14
15
|
|
|
15
16
|
import { alert } from '$scheduleView/components/notifications'
|
|
@@ -28,8 +29,6 @@
|
|
|
28
29
|
firstName,
|
|
29
30
|
lastName,
|
|
30
31
|
pax: copiedBookingPax,
|
|
31
|
-
telNumber,
|
|
32
|
-
telCountryCode,
|
|
33
32
|
isPicketServiceAvailable,
|
|
34
33
|
isPicketServiceSelected,
|
|
35
34
|
isBabySeatServiceAvailable,
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
}
|
|
59
58
|
texts.push(`${$t('booking.guestName')} : ${$fullName}`)
|
|
60
59
|
// texts.push(`Email : ${$originalBooking.email || '- -'}`) // 제외
|
|
61
|
-
texts.push(`${$t('booking.telNo')} : ${$originalBooking.tel || '- -'}`)
|
|
60
|
+
texts.push(`${$t('booking.telNo')} : ${PhoneNumberBiz.format($originalBooking.countryCode, $originalBooking.tel) || '- -'}`)
|
|
62
61
|
const extraServiceText = $originalBooking.extra?.length > 0 ? $originalBooking.extra.map(s => $t(`extraServiceType.${s.type}`)).join(', ') : '- -'
|
|
63
62
|
texts.push(`${$t('booking.extraService')} : ${extraServiceText}`)
|
|
64
63
|
texts.push(`${$t('booking.reservationStatus')} : ${$originalBooking.status}`)
|
|
@@ -297,9 +296,9 @@
|
|
|
297
296
|
<th>{$t('booking.telNo')}</th>
|
|
298
297
|
<td>
|
|
299
298
|
{#if !$isEdit}
|
|
300
|
-
<p class="value-txt">{$originalBooking.tel || '- -'}</p>
|
|
299
|
+
<p class="value-txt">{PhoneNumberBiz.format($originalBooking.countryCode, $originalBooking.tel) || '- -'}</p>
|
|
301
300
|
{:else}
|
|
302
|
-
<PhoneNumberInput bind:telCountryCode={$
|
|
301
|
+
<PhoneNumberInput bind:telCountryCode={$copiedBooking.countryCode} bind:telNumber={$copiedBooking.tel} />
|
|
303
302
|
{/if}
|
|
304
303
|
</td>
|
|
305
304
|
</tr>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './phoneNumber'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// 공통 비즈니스 로직
|
|
2
|
+
export class PhoneNumberBiz {
|
|
3
|
+
/**
|
|
4
|
+
* 국가번호 및 연락처를 받아 합쳐진 연락처를 반환.
|
|
5
|
+
* @param countryCode 국가코드
|
|
6
|
+
* @param phoneNumber 연락처
|
|
7
|
+
* @param options.countryCodeFormatter 국가코드 포맷팅 함수
|
|
8
|
+
* @param options.phoneNumberFormatter 연락처 포맷팅 함수
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
static format(
|
|
12
|
+
countryCode: string,
|
|
13
|
+
phoneNumber: string,
|
|
14
|
+
options?: {
|
|
15
|
+
countryCodeFormatter?: (countryCode: string) => string
|
|
16
|
+
phoneNumberFormatter?: (phoneNumber: string) => string
|
|
17
|
+
}
|
|
18
|
+
) {
|
|
19
|
+
let result = []
|
|
20
|
+
|
|
21
|
+
let code = countryCode
|
|
22
|
+
let number = phoneNumber
|
|
23
|
+
|
|
24
|
+
// 만약 코드는 없고, 번호만 있으면 과거 코드로 인식하고 나누기 후 할당
|
|
25
|
+
if (!code && number) {
|
|
26
|
+
const splitted = number.split(' ')
|
|
27
|
+
if (splitted.length > 1) {
|
|
28
|
+
code = splitted[0]
|
|
29
|
+
number = splitted[1]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (code) {
|
|
34
|
+
if (options?.countryCodeFormatter && typeof options.countryCodeFormatter === 'function') {
|
|
35
|
+
result.push(options.countryCodeFormatter(code))
|
|
36
|
+
} else {
|
|
37
|
+
result.push(code)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (number) {
|
|
41
|
+
if (options?.phoneNumberFormatter && typeof options.phoneNumberFormatter === 'function') {
|
|
42
|
+
result.push(options.phoneNumberFormatter(number))
|
|
43
|
+
} else {
|
|
44
|
+
result.push(number)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result.join(' ')
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 전화번호 유효성 검증
|
|
52
|
+
* @param countryCode 국가코드
|
|
53
|
+
* @param phoneNumber 연락처
|
|
54
|
+
*/
|
|
55
|
+
static validate(countryCode: string, phoneNumber: string) {
|
|
56
|
+
if (!countryCode) return false
|
|
57
|
+
if (!phoneNumber) return false
|
|
58
|
+
return true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -199,44 +199,6 @@ function createBookingStore(bookingDTO: Awaited<ReturnType<typeof BookingAPI.get
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
// 연락처 국가번호 값 & 변경
|
|
203
|
-
const telCountryCode = {
|
|
204
|
-
subscribe: derived(booking, $booking => {
|
|
205
|
-
if (!$booking?.tel) return null
|
|
206
|
-
const splitted = $booking.tel.split(' ')
|
|
207
|
-
return splitted.find(tel => tel.startsWith('+')) ?? null
|
|
208
|
-
}).subscribe,
|
|
209
|
-
set(countryCode: string) {
|
|
210
|
-
copiedBooking.update($booking => {
|
|
211
|
-
const tels = []
|
|
212
|
-
if (countryCode) tels.push(countryCode)
|
|
213
|
-
const $telNumber = get(telNumber)
|
|
214
|
-
if ($telNumber) tels.push($telNumber)
|
|
215
|
-
$booking.tel = tels.join(' ')
|
|
216
|
-
return $booking
|
|
217
|
-
})
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// 연락처 번호 값 & 변경
|
|
222
|
-
const telNumber = {
|
|
223
|
-
subscribe: derived(booking, $booking => {
|
|
224
|
-
if (!$booking?.tel) return null
|
|
225
|
-
const splitted = $booking.tel.split(' ').filter(tel => !tel.startsWith('+'))
|
|
226
|
-
return splitted.join('')
|
|
227
|
-
}).subscribe,
|
|
228
|
-
set(numbers: string) {
|
|
229
|
-
copiedBooking.update($booking => {
|
|
230
|
-
const tels = []
|
|
231
|
-
const $telCountryCode = get(telCountryCode)
|
|
232
|
-
if ($telCountryCode) tels.push($telCountryCode)
|
|
233
|
-
if (numbers) tels.push(numbers)
|
|
234
|
-
$booking.tel = tels.join(' ')
|
|
235
|
-
return $booking
|
|
236
|
-
})
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
202
|
// baby seat 서비스 여부 및 변경
|
|
241
203
|
const isBabySeatService = {
|
|
242
204
|
subscribe: derived(extraServices, $extraServices => {
|
|
@@ -385,8 +347,6 @@ function createBookingStore(bookingDTO: Awaited<ReturnType<typeof BookingAPI.get
|
|
|
385
347
|
firstName,
|
|
386
348
|
lastName,
|
|
387
349
|
pax,
|
|
388
|
-
telCountryCode,
|
|
389
|
-
telNumber,
|
|
390
350
|
isBabySeatService,
|
|
391
351
|
isPicketService,
|
|
392
352
|
addTime
|