@movvjs/svelte-schedule-view 0.4.1-beta-3 → 0.4.2

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.
@@ -2,8 +2,7 @@
2
2
  </script>
3
3
 
4
4
  <script>import "./assets/scss/indie_booking.scss";
5
- import toast, { Toaster } from "svelte-french-toast";
6
- import { onMount } from "svelte";
5
+ import { Toaster } from "svelte-french-toast";
7
6
  import { writable } from "svelte/store";
8
7
  import { cloneDeep } from "lodash-es";
9
8
  import consola from "consola";
@@ -43,19 +42,20 @@ $:
43
42
  $:
44
43
  difference = $isEdit ? $editPriceDifference : $priceDifference;
45
44
  export function init(options) {
46
- const { target, isDev, token, locale, viewOnly = false } = options;
47
- if (!target)
45
+ if (!options.target)
48
46
  throw new Error("target\uC744 \uC9C0\uC815\uD574\uC8FC\uC138\uC694.");
49
- if (!token)
47
+ if (!options.token)
50
48
  throw new Error("token\uC744 \uB123\uC5B4\uC8FC\uC138\uC694.");
51
- if (!locale)
49
+ if (!options.locale)
52
50
  throw new Error("locale\uC744 \uB123\uC5B4\uC8FC\uC138\uC694.");
53
- if (locale) {
54
- i18nInit({ fallbackLocale: "en", initialLocale: locale });
55
- dayjs.locale(locale);
56
- }
57
- googleMaps();
58
- function googleMaps() {
51
+ setLocale(options.locale);
52
+ initGoogleMapsAPI();
53
+ setOptions(options);
54
+ initialized = true;
55
+ return {
56
+ open
57
+ };
58
+ function initGoogleMapsAPI() {
59
59
  ;
60
60
  ((g) => {
61
61
  var h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window;
@@ -82,19 +82,24 @@ export function init(options) {
82
82
  // Add other bootstrap parameters as needed, using camel case.
83
83
  });
84
84
  }
85
- env.set({
86
- target,
87
- accessToken: token.accessToken,
88
- refreshToken: token.refreshToken,
89
- viewOnly,
90
- locale,
91
- isDev
92
- });
93
- consola.withTag("svelte-schedule-view").info("\uC124\uC815\uB41C env", $env);
94
- initialized = true;
95
- return {
96
- open
97
- };
85
+ function setLocale(locale) {
86
+ if (locale) {
87
+ i18nInit({ fallbackLocale: "en", initialLocale: locale });
88
+ dayjs.locale(locale);
89
+ }
90
+ }
91
+ function setOptions(options2) {
92
+ const { target, isDev, token, locale, viewOnly = false } = options2;
93
+ env.set({
94
+ target,
95
+ accessToken: token.accessToken,
96
+ refreshToken: token.refreshToken,
97
+ viewOnly,
98
+ locale,
99
+ isDev
100
+ });
101
+ consola.withTag("svelte-schedule-view").info("\uC124\uC815\uB41C env", $env);
102
+ }
98
103
  }
99
104
  export async function forceInitByFmsAdmin(options) {
100
105
  const { isDev, locale, viewOnly = false } = options;
@@ -221,12 +226,6 @@ async function save() {
221
226
  <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
222
227
  </div>
223
228
  <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
224
- <!-- <select class="indie_select_nor">
225
- <option value="">2023-10-16 (Mon)</option>
226
- <option value="">2023-10-16 (Mon)</option>
227
- </select> -->
228
-
229
- <!-- <button type="button" class="btn_close">닫기</button> -->
230
229
  </div>
231
230
 
232
231
  <div class="contents_b">
@@ -2,8 +2,7 @@
2
2
  </script>
3
3
 
4
4
  <script>import "./assets/scss/indie_booking.scss";
5
- import toast, { Toaster } from "svelte-french-toast";
6
- import { onMount } from "svelte";
5
+ import { Toaster } from "svelte-french-toast";
7
6
  import { writable } from "svelte/store";
8
7
  import { cloneDeep } from "lodash-es";
9
8
  import consola from "consola";
@@ -43,19 +42,20 @@ $:
43
42
  $:
44
43
  difference = $isEdit ? $editPriceDifference : $priceDifference;
45
44
  export function init(options) {
46
- const { target, isDev, token, locale, viewOnly = false } = options;
47
- if (!target)
45
+ if (!options.target)
48
46
  throw new Error("target\uC744 \uC9C0\uC815\uD574\uC8FC\uC138\uC694.");
49
- if (!token)
47
+ if (!options.token)
50
48
  throw new Error("token\uC744 \uB123\uC5B4\uC8FC\uC138\uC694.");
51
- if (!locale)
49
+ if (!options.locale)
52
50
  throw new Error("locale\uC744 \uB123\uC5B4\uC8FC\uC138\uC694.");
53
- if (locale) {
54
- i18nInit({ fallbackLocale: "en", initialLocale: locale });
55
- dayjs.locale(locale);
56
- }
57
- googleMaps();
58
- function googleMaps() {
51
+ setLocale(options.locale);
52
+ initGoogleMapsAPI();
53
+ setOptions(options);
54
+ initialized = true;
55
+ return {
56
+ open
57
+ };
58
+ function initGoogleMapsAPI() {
59
59
  ;
60
60
  ((g) => {
61
61
  var h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window;
@@ -82,19 +82,24 @@ export function init(options) {
82
82
  // Add other bootstrap parameters as needed, using camel case.
83
83
  });
84
84
  }
85
- env.set({
86
- target,
87
- accessToken: token.accessToken,
88
- refreshToken: token.refreshToken,
89
- viewOnly,
90
- locale,
91
- isDev
92
- });
93
- consola.withTag("svelte-schedule-view").info("\uC124\uC815\uB41C env", $env);
94
- initialized = true;
95
- return {
96
- open
97
- };
85
+ function setLocale(locale) {
86
+ if (locale) {
87
+ i18nInit({ fallbackLocale: "en", initialLocale: locale });
88
+ dayjs.locale(locale);
89
+ }
90
+ }
91
+ function setOptions(options2) {
92
+ const { target, isDev, token, locale, viewOnly = false } = options2;
93
+ env.set({
94
+ target,
95
+ accessToken: token.accessToken,
96
+ refreshToken: token.refreshToken,
97
+ viewOnly,
98
+ locale,
99
+ isDev
100
+ });
101
+ consola.withTag("svelte-schedule-view").info("\uC124\uC815\uB41C env", $env);
102
+ }
98
103
  }
99
104
  export async function forceInitByFmsAdmin(options) {
100
105
  const { isDev, locale, viewOnly = false } = options;
@@ -221,12 +226,6 @@ async function save() {
221
226
  <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
222
227
  </div>
223
228
  <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
224
- <!-- <select class="indie_select_nor">
225
- <option value="">2023-10-16 (Mon)</option>
226
- <option value="">2023-10-16 (Mon)</option>
227
- </select> -->
228
-
229
- <!-- <button type="button" class="btn_close">닫기</button> -->
230
229
  </div>
231
230
 
232
231
  <div class="contents_b">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movvjs/svelte-schedule-view",
3
- "version": "0.4.1-beta-3",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "author": {
@@ -14,8 +14,7 @@
14
14
 
15
15
  <script lang="ts">
16
16
  import './assets/scss/indie_booking.scss'
17
- import toast, { Toaster } from 'svelte-french-toast'
18
- import { onMount } from 'svelte'
17
+ import { Toaster } from 'svelte-french-toast'
19
18
  import { writable } from 'svelte/store'
20
19
  import { cloneDeep } from 'lodash-es'
21
20
  import consola from 'consola'
@@ -42,23 +41,6 @@
42
41
  import BookingInfo from '$scheduleView/BookingInfo.svelte'
43
42
  import Portal from 'svelte-portal'
44
43
 
45
- // onMount(() => {
46
- // googleMaps()
47
-
48
- // function googleMaps() {
49
- // // https://developers.google.com/maps/documentation/javascript/load-maps-js-api?hl=ko#dynamic-library-import
50
- // // prettier-ignore
51
- // ;(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
52
- // key: "AIzaSyDe1e91bi67YTTnPGQlKTHXeNqMPOYkjW0",
53
- // v: "weekly",
54
- // region: "kr",
55
- // language: navigator?.language || "en",
56
- // // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
57
- // // Add other bootstrap parameters as needed, using camel case.
58
- // });
59
- // }
60
- // })
61
-
62
44
  const { stdt, price, priceDifference, isModifiable } = originalBooking
63
45
  const {
64
46
  price: editPrice,
@@ -85,20 +67,22 @@
85
67
  * @param options
86
68
  */
87
69
  export function init(options: InitOption) {
88
- const { target, isDev, token, locale, viewOnly = false } = options
70
+ if (!options.target) throw new Error('target을 지정해주세요.')
71
+ if (!options.token) throw new Error('token을 넣어주세요.')
72
+ if (!options.locale) throw new Error('locale을 넣어주세요.')
89
73
 
90
- if (!target) throw new Error('target을 지정해주세요.')
91
- if (!token) throw new Error('token을 넣어주세요.')
92
- if (!locale) throw new Error('locale을 넣어주세요.')
74
+ setLocale(options.locale)
75
+ initGoogleMapsAPI()
76
+ setOptions(options)
93
77
 
94
- if (locale) {
95
- i18nInit({ fallbackLocale: 'en', initialLocale: locale })
96
- dayjs.locale(locale)
97
- }
78
+ initialized = true
98
79
 
99
- googleMaps()
80
+ return {
81
+ open
82
+ }
100
83
 
101
- function googleMaps() {
84
+ // 구글 초기화
85
+ function initGoogleMapsAPI() {
102
86
  // https://developers.google.com/maps/documentation/javascript/load-maps-js-api?hl=ko#dynamic-library-import
103
87
  // prettier-ignore
104
88
  ;(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
@@ -111,19 +95,27 @@
111
95
  });
112
96
  }
113
97
 
114
- env.set({
115
- target,
116
- accessToken: token.accessToken,
117
- refreshToken: token.refreshToken,
118
- viewOnly,
119
- locale,
120
- isDev
121
- })
98
+ // 언어셋 설정
99
+ function setLocale(locale: Locale) {
100
+ if (locale) {
101
+ i18nInit({ fallbackLocale: 'en', initialLocale: locale })
102
+ dayjs.locale(locale)
103
+ }
104
+ }
122
105
 
123
- consola.withTag('svelte-schedule-view').info('설정된 env', $env)
124
- initialized = true
125
- return {
126
- open
106
+ // 환경설정
107
+ function setOptions(options: InitOption) {
108
+ const { target, isDev, token, locale, viewOnly = false } = options
109
+ env.set({
110
+ target,
111
+ accessToken: token.accessToken,
112
+ refreshToken: token.refreshToken,
113
+ viewOnly,
114
+ locale,
115
+ isDev
116
+ })
117
+
118
+ consola.withTag('svelte-schedule-view').info('설정된 env', $env)
127
119
  }
128
120
  }
129
121
 
@@ -203,6 +195,9 @@
203
195
  if (resolver) resolver('USER_CLOSE')
204
196
  }
205
197
 
198
+ /**
199
+ * 수정
200
+ */
206
201
  async function edit() {
207
202
  try {
208
203
  loader.show()
@@ -220,6 +215,9 @@
220
215
  }
221
216
  }
222
217
 
218
+ /**
219
+ * 초기화 (이전으로 되돌림)
220
+ */
223
221
  function reset() {
224
222
  $copiedBooking = cloneDeep($originalBooking)
225
223
  }
@@ -280,12 +278,6 @@
280
278
  <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
281
279
  </div>
282
280
  <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
283
- <!-- <select class="indie_select_nor">
284
- <option value="">2023-10-16 (Mon)</option>
285
- <option value="">2023-10-16 (Mon)</option>
286
- </select> -->
287
-
288
- <!-- <button type="button" class="btn_close">닫기</button> -->
289
281
  </div>
290
282
 
291
283
  <div class="contents_b">