@movvjs/svelte-schedule-view 0.4.4 → 0.4.6
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.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script>import { padStart, range } from "lodash-es";
|
|
2
|
-
import toast from "svelte-french-toast";
|
|
3
2
|
import { dayjs } from "../dayjs";
|
|
4
3
|
import { axios } from "../axios";
|
|
5
4
|
import { t } from "../i18n";
|
|
@@ -78,10 +77,10 @@ ${$t("booking.schedule")}`);
|
|
|
78
77
|
scheduleTexts.push(`<${$t("schedule.finish")}> ${$plans.dest.title} (${$plans.dest.address})`);
|
|
79
78
|
texts.push(scheduleTexts.join("\n"));
|
|
80
79
|
const resultTexts = texts.join("\n");
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
navigator.clipboard.writeText(resultTexts).then(() => {
|
|
81
|
+
alert.open({ text: $t("toast.copied") });
|
|
82
|
+
}).catch(() => {
|
|
83
|
+
alert.open({ text: $t("toast.failedToCopy") });
|
|
85
84
|
});
|
|
86
85
|
}
|
|
87
86
|
async function toggleAutoPicket(e) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
4
|
<script>import "./assets/scss/indie_booking.scss";
|
|
5
|
-
import { Toaster } from "svelte-french-toast";
|
|
6
5
|
import { writable } from "svelte/store";
|
|
7
6
|
import { cloneDeep } from "lodash-es";
|
|
8
7
|
import consola from "consola";
|
|
@@ -137,8 +136,17 @@ function open({ code }) {
|
|
|
137
136
|
return new Promise(async (resolve, reject) => {
|
|
138
137
|
try {
|
|
139
138
|
loader.show();
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
let readyView = false;
|
|
140
|
+
while (!readyView) {
|
|
141
|
+
const response = await BookingAPI.getBooking(code);
|
|
142
|
+
if (!response.readyView) {
|
|
143
|
+
console.log("not ready view...");
|
|
144
|
+
await new Promise((resolve2) => setTimeout(resolve2, 1e3));
|
|
145
|
+
} else {
|
|
146
|
+
readyView = true;
|
|
147
|
+
$originalBooking = response.booking;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
142
150
|
on = true;
|
|
143
151
|
} catch (e) {
|
|
144
152
|
alert.open({ title: $t("alert.error"), text: e.message });
|
|
@@ -203,7 +211,6 @@ async function save() {
|
|
|
203
211
|
|
|
204
212
|
<Portal target="body">
|
|
205
213
|
{#if !$isLoading && initialized}
|
|
206
|
-
<Toaster />
|
|
207
214
|
<div id="indie_booking_wrapper">
|
|
208
215
|
<Loader />
|
|
209
216
|
<Alert />
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { BookingViewDTO } from './dto';
|
|
2
2
|
import type { BookingLocation, BookingServiceType, Coordinate } from '../../types';
|
|
3
3
|
export declare class BookingAPI {
|
|
4
|
-
static getBooking(code: string): Promise<
|
|
4
|
+
static getBooking(code: string): Promise<{
|
|
5
|
+
readyView: boolean;
|
|
6
|
+
booking: BookingViewDTO;
|
|
7
|
+
}>;
|
|
5
8
|
static modifyPreview(payload: BookingViewDTO): Promise<BookingViewDTO>;
|
|
6
9
|
static modify(payload: BookingViewDTO): Promise<BookingViewDTO>;
|
|
7
10
|
static searchWaypoints({ type, coordinate, keyword }: {
|
|
@@ -12,7 +12,10 @@ export class BookingAPI {
|
|
|
12
12
|
throw Error(data.msg || data.message || JSON.stringify(data));
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
return
|
|
15
|
+
return {
|
|
16
|
+
readyView: data.readyView,
|
|
17
|
+
booking: data.data
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
else if (target === 'FMS' || target === 'MOVV') {
|
|
@@ -21,7 +24,10 @@ export class BookingAPI {
|
|
|
21
24
|
throw Error(data.msg || data.message || JSON.stringify(data));
|
|
22
25
|
}
|
|
23
26
|
else {
|
|
24
|
-
return
|
|
27
|
+
return {
|
|
28
|
+
readyView: data.readyView,
|
|
29
|
+
booking: data.data
|
|
30
|
+
};
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
else {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
2
|
import { ExtraServiceType, type SearchPriceV2 } from '../types';
|
|
3
|
-
import {
|
|
3
|
+
import type { BookingViewDTO } from '../api/booking/dto';
|
|
4
4
|
export declare const originalBooking: {
|
|
5
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<
|
|
6
|
-
set: (bookingDTO:
|
|
7
|
-
update: (this: void, updater: import("svelte/store").Updater<
|
|
5
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<BookingViewDTO>, invalidate?: import("svelte/store").Invalidator<BookingViewDTO>) => import("svelte/store").Unsubscriber;
|
|
6
|
+
set: (bookingDTO: BookingViewDTO) => void;
|
|
7
|
+
update: (this: void, updater: import("svelte/store").Updater<BookingViewDTO>) => void;
|
|
8
8
|
withPreserveAndPreview: (modifying: Function) => Promise<void>;
|
|
9
9
|
stdt: import("svelte/store").Readable<string>;
|
|
10
10
|
serviceZone: import("svelte/store").Readable<{
|
|
@@ -92,9 +92,9 @@ export declare const originalBooking: {
|
|
|
92
92
|
};
|
|
93
93
|
};
|
|
94
94
|
export declare const copiedBooking: {
|
|
95
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<
|
|
96
|
-
set: (bookingDTO:
|
|
97
|
-
update: (this: void, updater: import("svelte/store").Updater<
|
|
95
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<BookingViewDTO>, invalidate?: import("svelte/store").Invalidator<BookingViewDTO>) => import("svelte/store").Unsubscriber;
|
|
96
|
+
set: (bookingDTO: BookingViewDTO) => void;
|
|
97
|
+
update: (this: void, updater: import("svelte/store").Updater<BookingViewDTO>) => void;
|
|
98
98
|
withPreserveAndPreview: (modifying: Function) => Promise<void>;
|
|
99
99
|
stdt: import("svelte/store").Readable<string>;
|
|
100
100
|
serviceZone: import("svelte/store").Readable<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movvjs/svelte-schedule-view",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"sass": "^1.77.0",
|
|
48
48
|
"svelte": "^4.2.7",
|
|
49
49
|
"svelte-check": "^3.6.0",
|
|
50
|
+
"svelte-french-toast": "^1.2.0",
|
|
50
51
|
"tslib": "^2.4.1",
|
|
51
52
|
"typescript": "^5.0.0",
|
|
52
53
|
"vite": "^5.0.11"
|
|
@@ -63,7 +64,6 @@
|
|
|
63
64
|
"lodash-es": "^4.17.21",
|
|
64
65
|
"qs": "^6.12.1",
|
|
65
66
|
"sortablejs": "^1.15.2",
|
|
66
|
-
"svelte-french-toast": "^1.2.0",
|
|
67
67
|
"svelte-i18n": "^4.0.0",
|
|
68
68
|
"svelte-portal": "^2.2.1"
|
|
69
69
|
},
|