axitech-widget 0.0.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.
- package/README.md +203 -0
- package/dist/Modal-fab2abfa.mjs +4 -0
- package/dist/axitech-widget.es.js +7 -0
- package/dist/axitech-widget.iife.js +698 -0
- package/dist/axitech-widget.umd.js +698 -0
- package/dist/index-2839010c.mjs +30306 -0
- package/dist/style.css +1 -0
- package/dist/types/components/base/ActionCard.vue.d.ts +36 -0
- package/dist/types/components/base/Button.vue.d.ts +9 -0
- package/dist/types/components/base/Collapse.vue.d.ts +2 -0
- package/dist/types/components/base/DatePicker.vue.d.ts +70 -0
- package/dist/types/components/base/GoogleAutocomplete.vue.d.ts +23 -0
- package/dist/types/components/base/GoogleMap.vue.d.ts +26 -0
- package/dist/types/components/base/Input.vue.d.ts +43 -0
- package/dist/types/components/base/Modal.vue.d.ts +55 -0
- package/dist/types/components/base/SelectButton.vue.d.ts +56 -0
- package/dist/types/components/base/Spinner.vue.d.ts +34 -0
- package/dist/types/components/base/uploader/ImageUpload.vue.d.ts +23 -0
- package/dist/types/components/base/uploader/Upload.vue.d.ts +4 -0
- package/dist/types/components/claims-widget/ClaimsWidget.ce.vue.d.ts +2 -0
- package/dist/types/components/claims-widget/components/Error.vue.d.ts +2 -0
- package/dist/types/components/claims-widget/components/SkeletonLoader.vue.d.ts +56 -0
- package/dist/types/components/claims-widget/components/StepConfirm.vue.d.ts +6 -0
- package/dist/types/components/claims-widget/components/StepSelector.vue.d.ts +6 -0
- package/dist/types/components/claims-widget/components/accident/Accident.vue.d.ts +8 -0
- package/dist/types/components/claims-widget/components/accident/ImageSection.vue.d.ts +29 -0
- package/dist/types/components/claims-widget/components/accident/MapSection.vue.d.ts +29 -0
- package/dist/types/components/claims-widget/components/accident/NoteSection.vue.d.ts +21 -0
- package/dist/types/components/claims-widget/components/accident/SectionWrapper.vue.d.ts +23 -0
- package/dist/types/components/claims-widget/components/accident/YourVehicle.vue.d.ts +2 -0
- package/dist/types/components/claims-widget/components/fireWater/FireWater.vue.d.ts +6 -0
- package/dist/types/components/claims-widget/components/illustration/Accident.vue.d.ts +2 -0
- package/dist/types/components/claims-widget/components/illustration/Location.vue.d.ts +2 -0
- package/dist/types/components/claims-widget/components/illustration/SubmittedSuccessfully.vue.d.ts +2 -0
- package/dist/types/components/claims-widget/components/illustration/Unsupported.vue.d.ts +2 -0
- package/dist/types/components/claims-widget/components/windscreen/Windscreen.vue.d.ts +6 -0
- package/dist/types/components/claims-widget/components/windscreen/WindscreenLoading.vue.d.ts +2 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/composables/googleMaps.d.ts +11 -0
- package/dist/types/constants/index.d.ts +1 -0
- package/dist/types/index.d.ts +34 -0
- package/dist/types/plugins/firebase.d.ts +2 -0
- package/dist/types/plugins/firebaseCloudStorage.d.ts +16 -0
- package/dist/types/utils/autocomplete.d.ts +2 -0
- package/dist/types/utils/colorHelpers.d.ts +7 -0
- package/dist/types/utils/config.d.ts +131 -0
- package/dist/types/utils/customElementRegister.d.ts +1 -0
- package/dist/types/utils/fontUtils.d.ts +1 -0
- package/dist/types/utils/index.d.ts +141 -0
- package/dist/types/utils/map.d.ts +21 -0
- package/dist/types/utils/request.d.ts +30 -0
- package/dist/types/utils/svgUtils.d.ts +0 -0
- package/dist/types/utils/themeUtils.d.ts +9 -0
- package/package.json +77 -0
- package/src/assets/fonts/Volvo Novum-Italic.eot +0 -0
- package/src/assets/fonts/Volvo Novum-Italic.svg +723 -0
- package/src/assets/fonts/Volvo Novum-Italic.woff +0 -0
- package/src/assets/fonts/Volvo Novum-Italic.woff2 +0 -0
- package/src/assets/fonts/Volvo Novum-Light.eot +0 -0
- package/src/assets/fonts/Volvo Novum-Light.svg +707 -0
- package/src/assets/fonts/Volvo Novum-Light.woff +0 -0
- package/src/assets/fonts/Volvo Novum-Light.woff2 +0 -0
- package/src/assets/fonts/Volvo Novum-LightItalic.eot +0 -0
- package/src/assets/fonts/Volvo Novum-LightItalic.svg +723 -0
- package/src/assets/fonts/Volvo Novum-LightItalic.woff +0 -0
- package/src/assets/fonts/Volvo Novum-LightItalic.woff2 +0 -0
- package/src/assets/fonts/Volvo Novum-Medium.eot +0 -0
- package/src/assets/fonts/Volvo Novum-Medium.svg +706 -0
- package/src/assets/fonts/Volvo Novum-Medium.woff +0 -0
- package/src/assets/fonts/Volvo Novum-Medium.woff2 +0 -0
- package/src/assets/fonts/Volvo Novum-MediumItalic.eot +0 -0
- package/src/assets/fonts/Volvo Novum-MediumItalic.svg +724 -0
- package/src/assets/fonts/Volvo Novum-MediumItalic.woff +0 -0
- package/src/assets/fonts/Volvo Novum-MediumItalic.woff2 +0 -0
- package/src/assets/fonts/Volvo Novum-Regular.eot +0 -0
- package/src/assets/fonts/Volvo Novum-Regular.svg +707 -0
- package/src/assets/fonts/Volvo Novum-Regular.woff +0 -0
- package/src/assets/fonts/Volvo Novum-Regular.woff2 +0 -0
- package/src/assets/fonts/Volvo Novum-SemiLight.eot +0 -0
- package/src/assets/fonts/Volvo Novum-SemiLight.svg +706 -0
- package/src/assets/fonts/Volvo Novum-SemiLight.woff +0 -0
- package/src/assets/fonts/Volvo Novum-SemiLight.woff2 +0 -0
- package/src/assets/fonts/Volvo Novum-SemiLightItalic.eot +0 -0
- package/src/assets/fonts/Volvo Novum-SemiLightItalic.svg +722 -0
- package/src/assets/fonts/Volvo Novum-SemiLightItalic.woff +0 -0
- package/src/assets/fonts/Volvo Novum-SemiLightItalic.woff2 +0 -0
- package/src/assets/styles/collapse.sass +20 -0
- package/src/assets/styles/datepicker.sass +14 -0
- package/src/assets/styles/main.sass +182 -0
- package/src/assets/styles/map.sass +41 -0
- package/src/assets/styles/togglebutton.sass +4 -0
- package/src/components/base/ActionCard.vue +49 -0
- package/src/components/base/Button.vue +16 -0
- package/src/components/base/Collapse.vue +41 -0
- package/src/components/base/DatePicker.vue +94 -0
- package/src/components/base/GoogleAutocomplete.vue +116 -0
- package/src/components/base/GoogleMap.vue +114 -0
- package/src/components/base/Input.vue +44 -0
- package/src/components/base/Modal.vue +117 -0
- package/src/components/base/SelectButton.vue +67 -0
- package/src/components/base/Spinner.vue +39 -0
- package/src/components/base/uploader/ImageUpload.vue +85 -0
- package/src/components/base/uploader/Upload.vue +14 -0
- package/src/components/claims-widget/ClaimsWidget.ce.vue +117 -0
- package/src/components/claims-widget/assets/accident.svg +181 -0
- package/src/components/claims-widget/assets/car.svg +6 -0
- package/src/components/claims-widget/assets/currentlocation.svg +3 -0
- package/src/components/claims-widget/assets/door.svg +3 -0
- package/src/components/claims-widget/assets/location.svg +20 -0
- package/src/components/claims-widget/assets/marker.svg +1 -0
- package/src/components/claims-widget/assets/unsupported.svg +107 -0
- package/src/components/claims-widget/assets/windscreen.svg +3 -0
- package/src/components/claims-widget/assets/zoomin.svg +3 -0
- package/src/components/claims-widget/assets/zoomout.svg +3 -0
- package/src/components/claims-widget/components/Error.vue +21 -0
- package/src/components/claims-widget/components/SkeletonLoader.vue +77 -0
- package/src/components/claims-widget/components/StepConfirm.vue +85 -0
- package/src/components/claims-widget/components/StepSelector.vue +58 -0
- package/src/components/claims-widget/components/accident/Accident.vue +267 -0
- package/src/components/claims-widget/components/accident/ImageSection.vue +82 -0
- package/src/components/claims-widget/components/accident/MapSection.vue +72 -0
- package/src/components/claims-widget/components/accident/NoteSection.vue +83 -0
- package/src/components/claims-widget/components/accident/SectionWrapper.vue +16 -0
- package/src/components/claims-widget/components/accident/YourVehicle.vue +60 -0
- package/src/components/claims-widget/components/fireWater/FireWater.vue +42 -0
- package/src/components/claims-widget/components/illustration/Accident.vue +735 -0
- package/src/components/claims-widget/components/illustration/Location.vue +74 -0
- package/src/components/claims-widget/components/illustration/SubmittedSuccessfully.vue +2270 -0
- package/src/components/claims-widget/components/illustration/Unsupported.vue +393 -0
- package/src/components/claims-widget/components/windscreen/Windscreen.vue +44 -0
- package/src/components/claims-widget/components/windscreen/WindscreenLoading.vue +34 -0
- package/src/components/index.ts +3 -0
- package/src/composables/googleMaps.ts +157 -0
- package/src/constants/index.ts +1 -0
- package/src/index.ts +76 -0
- package/src/plugins/firebase.ts +18 -0
- package/src/plugins/firebaseCloudStorage.ts +88 -0
- package/src/utils/autocomplete.ts +57 -0
- package/src/utils/colorHelpers.ts +96 -0
- package/src/utils/config.ts +140 -0
- package/src/utils/customElementRegister.ts +40 -0
- package/src/utils/fontUtils.ts +24 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/map.ts +212 -0
- package/src/utils/request.ts +76 -0
- package/src/utils/svgUtils.ts +0 -0
- package/src/utils/themeUtils.ts +40 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="w-full" id="axitech-google-map">
|
|
3
|
+
<div v-if="!location?.latitude" class="w-full flex flex-col items-center gap-6">
|
|
4
|
+
<Location></Location>
|
|
5
|
+
<div class="w-full flex items-center justify-center">
|
|
6
|
+
<Button @click="isMapOpen = true">Submit Collision location</Button>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-else><div ref="previewWidgetMap" id="axitech-preview-map"></div></div>
|
|
10
|
+
<Modal v-model="isMapOpen" size="full" body-class="w-full h-full justify-center items-center flex !p-0">
|
|
11
|
+
<div v-if="isMapLoading" class="w-full h-full flex items-center justify-center">
|
|
12
|
+
<Spinner :size="12" />
|
|
13
|
+
</div>
|
|
14
|
+
<div v-else class="search flex items-center">
|
|
15
|
+
<GoogleAutocomplete
|
|
16
|
+
v-if="!isMapLoading"
|
|
17
|
+
:address="location?.formatted_address"
|
|
18
|
+
@place-changed="locationChange"
|
|
19
|
+
/>
|
|
20
|
+
<Button class="!p-2" @click="confirm" :disabled="!location?.formatted_address">Confirm</Button>
|
|
21
|
+
<Button class="!border-gray-500 !text-fontSecondary-500 !p-2 hover:!bg-gray-200" @click="cancelLocationSelect">
|
|
22
|
+
Cancel
|
|
23
|
+
</Button>
|
|
24
|
+
</div>
|
|
25
|
+
<div v-show="!isMapLoading" class="w-full h-full">
|
|
26
|
+
<div ref="axitechWidgetMap" id="axitech-widget-map"></div>
|
|
27
|
+
</div>
|
|
28
|
+
</Modal>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import { computed, ref, watch } from 'vue';
|
|
34
|
+
import { useGoogleMaps } from 'src/composables/googleMaps';
|
|
35
|
+
import { ILocationInfo } from 'src/utils/map';
|
|
36
|
+
import Spinner from './Spinner.vue';
|
|
37
|
+
import Button from './Button.vue';
|
|
38
|
+
import GoogleAutocomplete from './GoogleAutocomplete.vue';
|
|
39
|
+
import Location from '../claims-widget/components/illustration/Location.vue';
|
|
40
|
+
import Modal from './Modal.vue';
|
|
41
|
+
|
|
42
|
+
const props = defineProps<{
|
|
43
|
+
modelValue?: ILocationInfo;
|
|
44
|
+
title?: string;
|
|
45
|
+
isOpen?: boolean;
|
|
46
|
+
}>();
|
|
47
|
+
|
|
48
|
+
const emit = defineEmits<{
|
|
49
|
+
(e: 'update:modelValue', value: ILocationInfo | undefined): void;
|
|
50
|
+
(e: 'update:isOpen', value: boolean): void;
|
|
51
|
+
}>();
|
|
52
|
+
|
|
53
|
+
const axitechWidgetMap = ref<HTMLElement>();
|
|
54
|
+
const previewWidgetMap = ref<HTMLElement>();
|
|
55
|
+
const location = computed({
|
|
56
|
+
get: () => {
|
|
57
|
+
return props.modelValue;
|
|
58
|
+
},
|
|
59
|
+
set: (value) => {
|
|
60
|
+
emit('update:modelValue', value);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const isMapOpen = computed({
|
|
64
|
+
get: () => props.isOpen,
|
|
65
|
+
set: (value) => emit('update:isOpen', value),
|
|
66
|
+
});
|
|
67
|
+
const isMapLoading = ref(true);
|
|
68
|
+
const { load, getLocation, placeChanged } = useGoogleMaps(axitechWidgetMap, (place) => (location.value = place));
|
|
69
|
+
const { loadPreview, placeChanged: previewPlaceChanged } = useGoogleMaps(previewWidgetMap);
|
|
70
|
+
|
|
71
|
+
function locationChange(place: ILocationInfo) {
|
|
72
|
+
location.value = place;
|
|
73
|
+
placeChanged(place);
|
|
74
|
+
previewPlaceChanged(place);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function confirm() {
|
|
78
|
+
if (!location.value) return;
|
|
79
|
+
isMapOpen.value = false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function cancelLocationSelect() {
|
|
83
|
+
isMapOpen.value = false;
|
|
84
|
+
location.value = undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
watch(axitechWidgetMap, async () => {
|
|
88
|
+
if (!axitechWidgetMap.value) return;
|
|
89
|
+
try {
|
|
90
|
+
isMapLoading.value = true;
|
|
91
|
+
const defaultLocation = location.value?.latitude ? location.value : await getLocation();
|
|
92
|
+
location.value = defaultLocation;
|
|
93
|
+
await load({
|
|
94
|
+
center: new google.maps.LatLng(defaultLocation.latitude, defaultLocation.longitude),
|
|
95
|
+
});
|
|
96
|
+
} finally {
|
|
97
|
+
isMapLoading.value = false;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
watch(previewWidgetMap, async () => {
|
|
102
|
+
if (!previewWidgetMap.value) return;
|
|
103
|
+
const defaultLocation = location.value?.latitude ? location.value : await getLocation();
|
|
104
|
+
await loadPreview({
|
|
105
|
+
center: new google.maps.LatLng(defaultLocation.latitude, defaultLocation.longitude),
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<style scoped lang="css">
|
|
111
|
+
#axitech-google-map {
|
|
112
|
+
display: none;
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<div v-if="prefix" class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
|
4
|
+
<Icon :icon="prefix" height="20"></Icon>
|
|
5
|
+
</div>
|
|
6
|
+
<input
|
|
7
|
+
v-model="input"
|
|
8
|
+
type="text"
|
|
9
|
+
id="input-group-1"
|
|
10
|
+
class="bg-white border w-full border-gray-300 text-fontSecondary-900 text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500 pr-10"
|
|
11
|
+
:placeholder="placeholder"
|
|
12
|
+
:class="{ 'pl-10': prefix }"
|
|
13
|
+
/>
|
|
14
|
+
<div v-if="input" class="absolute inset-y-0 right-0 flex items-center pr-3 cursor-pointer" @click="input = ''">
|
|
15
|
+
<Icon icon="mdi:close-circle" height="20" class="text-fontSecondary-400"></Icon>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { Icon } from '@iconify/vue';
|
|
22
|
+
import { useVModel } from '@vueuse/core';
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(
|
|
25
|
+
defineProps<{
|
|
26
|
+
modelValue: string;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
prefix?: string;
|
|
29
|
+
}>(),
|
|
30
|
+
{
|
|
31
|
+
modelValue: '',
|
|
32
|
+
placeholder: '',
|
|
33
|
+
prefix: '',
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const emit = defineEmits<{
|
|
38
|
+
(event: 'update:modelValue', isOpen: boolean): void;
|
|
39
|
+
}>();
|
|
40
|
+
|
|
41
|
+
const input = useVModel(props, 'modelValue', emit);
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style scoped></style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="isOpen" class="w-0 h-0 absolute">
|
|
3
|
+
<div class="bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40" />
|
|
4
|
+
<div
|
|
5
|
+
tabindex="-1"
|
|
6
|
+
class="overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 w-full md:inset-0 h-screen justify-center items-center flex"
|
|
7
|
+
>
|
|
8
|
+
<Transition name="slide-up" appear>
|
|
9
|
+
<div
|
|
10
|
+
role="dialog"
|
|
11
|
+
v-if="isOpen"
|
|
12
|
+
class="relative p-4 w-full h-full md:h-auto"
|
|
13
|
+
:class="`${modalSizeClasses[size]}`"
|
|
14
|
+
>
|
|
15
|
+
<!-- Modal content -->
|
|
16
|
+
<div
|
|
17
|
+
class="relative bg-white shadow dark:bg-gray-700"
|
|
18
|
+
:class="[{ 'md:rounded-lg': size !== 'full' }, modalSizeClasses[size]]"
|
|
19
|
+
>
|
|
20
|
+
<!-- Modal header -->
|
|
21
|
+
<div
|
|
22
|
+
v-if="$slots.header"
|
|
23
|
+
class="p-4 rounded-t flex justify-between items-center"
|
|
24
|
+
:class="$slots.header ? 'border-b border-gray-200 dark:border-gray-600' : ''"
|
|
25
|
+
>
|
|
26
|
+
<slot name="header" />
|
|
27
|
+
<button
|
|
28
|
+
@click="closeModal"
|
|
29
|
+
type="button"
|
|
30
|
+
class="text-fontSecondary-500 bg-transparent hover:bg-gray-200 hover:text-fontSecondary-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
|
|
31
|
+
>
|
|
32
|
+
<slot name="close-icon">
|
|
33
|
+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
34
|
+
<path
|
|
35
|
+
fill-rule="evenodd"
|
|
36
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
37
|
+
clip-rule="evenodd"
|
|
38
|
+
></path>
|
|
39
|
+
</svg>
|
|
40
|
+
</slot>
|
|
41
|
+
</button>
|
|
42
|
+
</div>
|
|
43
|
+
<!-- Modal body -->
|
|
44
|
+
<div class="p-6" :class="[$slots.header ? '' : 'pt-0', bodyClass]">
|
|
45
|
+
<slot />
|
|
46
|
+
</div>
|
|
47
|
+
<!-- Modal footer -->
|
|
48
|
+
<div v-if="$slots.footer" class="p-6 rounded-b border-gray-200 border-t dark:border-gray-600">
|
|
49
|
+
<slot name="footer" />
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</Transition>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
<script lang="ts" setup>
|
|
58
|
+
import { computed, ref, watch } from 'vue';
|
|
59
|
+
|
|
60
|
+
const props = withDefaults(
|
|
61
|
+
defineProps<{
|
|
62
|
+
modelValue: boolean;
|
|
63
|
+
size?: keyof typeof modalSizeClasses;
|
|
64
|
+
bodyClass?: string;
|
|
65
|
+
}>(),
|
|
66
|
+
{
|
|
67
|
+
size: 'md',
|
|
68
|
+
modelValue: false,
|
|
69
|
+
bodyClass: '',
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const emit = defineEmits<{
|
|
74
|
+
(event: 'close'): void;
|
|
75
|
+
(event: 'update:modelValue', isOpen: boolean): void;
|
|
76
|
+
}>();
|
|
77
|
+
const isOpen = computed({
|
|
78
|
+
get() {
|
|
79
|
+
return props.modelValue;
|
|
80
|
+
},
|
|
81
|
+
set(value) {
|
|
82
|
+
emit('update:modelValue', value);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
const initialOverflow = ref('');
|
|
86
|
+
watch(isOpen, (value) => {
|
|
87
|
+
if (value) {
|
|
88
|
+
initialOverflow.value = document.body.style.getPropertyValue('overflow');
|
|
89
|
+
document.body.style.setProperty('overflow', 'hidden');
|
|
90
|
+
} else {
|
|
91
|
+
if (initialOverflow.value) {
|
|
92
|
+
document.body.style.setProperty('overflow', initialOverflow.value);
|
|
93
|
+
} else {
|
|
94
|
+
document.body.style.removeProperty('overflow');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const modalSizeClasses = {
|
|
100
|
+
xs: 'max-w-xs',
|
|
101
|
+
sm: 'max-w-sm',
|
|
102
|
+
md: 'max-w-md',
|
|
103
|
+
lg: 'max-w-lg',
|
|
104
|
+
xl: 'max-w-xl',
|
|
105
|
+
'2xl': 'max-w-2xl',
|
|
106
|
+
'3xl': 'max-w-3xl',
|
|
107
|
+
'4xl': 'max-w-4xl',
|
|
108
|
+
'5xl': 'max-w-5xl',
|
|
109
|
+
'6xl': 'max-w-6xl',
|
|
110
|
+
'7xl': 'max-w-7xl',
|
|
111
|
+
full: 'w-screen h-screen !p-0',
|
|
112
|
+
};
|
|
113
|
+
function closeModal() {
|
|
114
|
+
emit('close');
|
|
115
|
+
isOpen.value = false;
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="widget-select-button" class="w-full grid grid-cols-2 items-center flex-wrap gap-6">
|
|
3
|
+
<Button
|
|
4
|
+
:class="['transition-all select-button focus:ring-primary-300', buttonClass]"
|
|
5
|
+
v-for="(label, index) in labels"
|
|
6
|
+
:key="String(label)"
|
|
7
|
+
:disabled="disabled"
|
|
8
|
+
:data-selected="value === values[index]"
|
|
9
|
+
@click="setValue(values[index])"
|
|
10
|
+
>{{ label }}</Button
|
|
11
|
+
>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts" generic="T">
|
|
16
|
+
import Button from './Button.vue';
|
|
17
|
+
import { computed, onMounted } from 'vue';
|
|
18
|
+
|
|
19
|
+
const props = defineProps<{
|
|
20
|
+
modelValue: T;
|
|
21
|
+
options: T[] | { label: string; value: T }[];
|
|
22
|
+
buttonClass?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
}>();
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits<{
|
|
27
|
+
(event: 'update:modelValue', value: T): void;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
const value = computed({
|
|
31
|
+
get() {
|
|
32
|
+
return props.modelValue;
|
|
33
|
+
},
|
|
34
|
+
set(v: T) {
|
|
35
|
+
emit('update:modelValue', v);
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
if (!value.value) {
|
|
41
|
+
setValue(values.value[0]);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const labels = computed(() =>
|
|
46
|
+
props.options.map((option) => {
|
|
47
|
+
if (option && typeof option === 'object' && 'label' in option && 'value' in option) {
|
|
48
|
+
return option.label;
|
|
49
|
+
}
|
|
50
|
+
return option;
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
const values = computed(() =>
|
|
54
|
+
props.options.map((option) => {
|
|
55
|
+
if (option && typeof option === 'object' && 'label' in option && 'value' in option) {
|
|
56
|
+
return option.value;
|
|
57
|
+
}
|
|
58
|
+
return option;
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
function setValue(selected: T) {
|
|
63
|
+
value.value = selected;
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<style scoped></style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div role="status">
|
|
3
|
+
<svg
|
|
4
|
+
aria-hidden="true"
|
|
5
|
+
:class="[
|
|
6
|
+
'inline mr-2 text-fontSecondary-500 animate-spin dark:text-fontSecondary600 fill-primary-600',
|
|
7
|
+
`w-${size} h-${size} fill-${color}-600`,
|
|
8
|
+
]"
|
|
9
|
+
viewBox="0 0 100 101"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
|
19
|
+
fill="currentFill"
|
|
20
|
+
/>
|
|
21
|
+
</svg>
|
|
22
|
+
<span class="sr-only">Loading...</span>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
withDefaults(
|
|
28
|
+
defineProps<{
|
|
29
|
+
color?: string;
|
|
30
|
+
size?: number;
|
|
31
|
+
}>(),
|
|
32
|
+
{
|
|
33
|
+
color: 'primary',
|
|
34
|
+
size: 10,
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style scoped></style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal :size="isMobile ? 'full' : 'lg'" :title="title">
|
|
3
|
+
<template #header>
|
|
4
|
+
<h2 class="title2-bold">
|
|
5
|
+
{{ title }}
|
|
6
|
+
</h2>
|
|
7
|
+
</template>
|
|
8
|
+
<div class="w-full h-full">
|
|
9
|
+
<VueDashboard :uppy="uppy" :props="options" :disabled="disabled" />
|
|
10
|
+
</div>
|
|
11
|
+
</Modal>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { onBeforeUnmount, ref } from 'vue';
|
|
16
|
+
import Modal from '../Modal.vue';
|
|
17
|
+
import Uppy from '@uppy/core';
|
|
18
|
+
import { Dashboard as VueDashboard } from '@uppy/vue';
|
|
19
|
+
import DropTarget from '@uppy/drop-target';
|
|
20
|
+
import Compressor from '@uppy/compressor';
|
|
21
|
+
import FirebaseCloudStorage from 'src/plugins/firebaseCloudStorage';
|
|
22
|
+
import { breakpointsTailwind, useBreakpoints } from '@vueuse/core';
|
|
23
|
+
import { config } from 'src/utils/config';
|
|
24
|
+
|
|
25
|
+
defineProps<{
|
|
26
|
+
title: string;
|
|
27
|
+
info: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
}>();
|
|
30
|
+
|
|
31
|
+
const emit = defineEmits<{
|
|
32
|
+
(e: 'imagesAdded', images: string[]): void;
|
|
33
|
+
}>();
|
|
34
|
+
|
|
35
|
+
const previews = ref(new Map<string, string>());
|
|
36
|
+
|
|
37
|
+
const options = {
|
|
38
|
+
hideCancelButton: true,
|
|
39
|
+
hidePauseResumeButton: true,
|
|
40
|
+
hideRetryButton: true,
|
|
41
|
+
showRemoveButtonAfterComplete: true,
|
|
42
|
+
proudlyDisplayPoweredByUppy: false,
|
|
43
|
+
singleFileFullScreen: false,
|
|
44
|
+
doneButtonHandler: onDone,
|
|
45
|
+
note: 'Images only, up to 10 MB per file',
|
|
46
|
+
showProgressDetails: true,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const userId = config.value.user.id || 'unknown-user';
|
|
50
|
+
const clientId = config.value?.id || 'unknown-client';
|
|
51
|
+
|
|
52
|
+
const uppy = new Uppy({
|
|
53
|
+
restrictions: {
|
|
54
|
+
minNumberOfFiles: 1,
|
|
55
|
+
maxFileSize: 10000000,
|
|
56
|
+
allowedFileTypes: ['.jpg', '.jpeg', '.png', '.gif', '.JPG', '.JPEG', '.PNG', '.GIF'],
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
.use(DropTarget, {
|
|
60
|
+
target: document.body,
|
|
61
|
+
})
|
|
62
|
+
.use(Compressor)
|
|
63
|
+
.use(FirebaseCloudStorage, { basePath: `images/${clientId}/${userId}` })
|
|
64
|
+
.on('upload-success', (params: { id: string; downloadUrl: string }) => {
|
|
65
|
+
if (!previews.value.has(params.id)) {
|
|
66
|
+
previews.value.set(params.id, params.downloadUrl);
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
.on('file-removed', (params) => {
|
|
70
|
+
if (previews.value.has(params.id)) {
|
|
71
|
+
previews.value.delete(params.id);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
onBeforeUnmount(() => uppy.close({ reason: 'unmount' }));
|
|
76
|
+
|
|
77
|
+
const breakpoints = useBreakpoints(breakpointsTailwind);
|
|
78
|
+
const isMobile = breakpoints.smaller('lg');
|
|
79
|
+
|
|
80
|
+
function onDone() {
|
|
81
|
+
emit('imagesAdded', [...previews.value.values()]);
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style scoped></style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Dashboard } from '@uppy/vue';
|
|
3
|
+
import Uppy from '@uppy/core';
|
|
4
|
+
import ThumbnailGenerator from '@uppy/thumbnail-generator';
|
|
5
|
+
|
|
6
|
+
import '@uppy/core/dist/style.css';
|
|
7
|
+
import '@uppy/dashboard/dist/style.css';
|
|
8
|
+
|
|
9
|
+
const uppy = new Uppy().use(ThumbnailGenerator);
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<Dashboard :uppy="uppy" :plugins="['Webcam']" />
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="rootElement" :id="CLAIMS_WIDGET_ID" class="w-full h-full">
|
|
3
|
+
<template v-if="!isConfigLoading">
|
|
4
|
+
<template v-if="!configError">
|
|
5
|
+
<div class="w-full h-full">
|
|
6
|
+
<Transition :name="transitionName" mode="out-in">
|
|
7
|
+
<template v-if="selectedStep === 0">
|
|
8
|
+
<StepSelector @select="flowSelected"></StepSelector>
|
|
9
|
+
</template>
|
|
10
|
+
<template v-else-if="selectedStep === 1">
|
|
11
|
+
<component
|
|
12
|
+
:is="components[selectedFlow]"
|
|
13
|
+
class="w-full h-full"
|
|
14
|
+
@back="handleBack"
|
|
15
|
+
@next="nextStep"
|
|
16
|
+
></component>
|
|
17
|
+
</template>
|
|
18
|
+
<template v-else>
|
|
19
|
+
<StepConfirm @back="handleBack"></StepConfirm>
|
|
20
|
+
</template>
|
|
21
|
+
</Transition>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<div class="w-full border-2 border-negative-500 bg-negative-100 text-negative-500 font-bold rounded p-4" v-else>
|
|
25
|
+
{{ configError }}
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<div v-else>
|
|
29
|
+
<div role="status" class="animate-pulse">
|
|
30
|
+
<div class="h-4 bg-gray-200 rounded dark:bg-gray-700 w-full mb-4"></div>
|
|
31
|
+
<div class="h-4 bg-gray-200 rounded dark:bg-gray-700 w-full mb-4"></div>
|
|
32
|
+
<div class="h-[82px] bg-gray-200 rounded dark:bg-gray-700 w-full mb-4"></div>
|
|
33
|
+
<div class="h-[82px] bg-gray-200 rounded dark:bg-gray-700 w-full mb-4"></div>
|
|
34
|
+
<div class="h-[82px] bg-gray-200 rounded dark:bg-gray-700 w-full mb-4"></div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import Windscreen from './components/windscreen/Windscreen.vue';
|
|
42
|
+
import Accident from './components/accident/Accident.vue';
|
|
43
|
+
import FireWater from './components/fireWater/FireWater.vue';
|
|
44
|
+
import StepSelector from './components/StepSelector.vue';
|
|
45
|
+
import StepConfirm from './components/StepConfirm.vue';
|
|
46
|
+
|
|
47
|
+
import { loadFonts } from 'src/utils/fontUtils';
|
|
48
|
+
import { loadAutocompleteStyle } from 'src/utils/autocomplete';
|
|
49
|
+
import { applyTheme } from 'src/utils/themeUtils';
|
|
50
|
+
import { ref, onMounted, watch, computed } from 'vue';
|
|
51
|
+
import { config, onConfigChange } from 'src/utils/config';
|
|
52
|
+
import { CLAIMS_WIDGET_ID } from 'src/constants';
|
|
53
|
+
import { provide } from 'vue';
|
|
54
|
+
|
|
55
|
+
const rootElement = ref<HTMLDivElement>();
|
|
56
|
+
provide(config.value.rootKey, rootElement);
|
|
57
|
+
|
|
58
|
+
const selectedStep = ref(0);
|
|
59
|
+
const selectedFlow = ref(0);
|
|
60
|
+
const transitionName = ref<'slide-left' | 'slide-right'>('slide-left');
|
|
61
|
+
|
|
62
|
+
const components = [Accident, Windscreen, FireWater];
|
|
63
|
+
const isConfigLoading = computed(() => config.value.isConfigLoading);
|
|
64
|
+
const configError = computed(() => config.value.error);
|
|
65
|
+
function flowSelected(index: number) {
|
|
66
|
+
transitionName.value = 'slide-left';
|
|
67
|
+
selectedFlow.value = index;
|
|
68
|
+
selectedStep.value = 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function handleBack() {
|
|
72
|
+
transitionName.value = 'slide-right';
|
|
73
|
+
selectedStep.value = 0;
|
|
74
|
+
selectedFlow.value = 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function nextStep() {
|
|
78
|
+
transitionName.value = 'slide-left';
|
|
79
|
+
selectedStep.value++;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
loadFonts();
|
|
83
|
+
|
|
84
|
+
onMounted(() => {
|
|
85
|
+
if (rootElement.value) {
|
|
86
|
+
applyTheme(config.value.theme, rootElement.value);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const unregister = onConfigChange(() => {
|
|
90
|
+
//load step progress when config is loaded
|
|
91
|
+
unregister();
|
|
92
|
+
const localstorageKey = `${config.value.clientId}-${config.value.user.id}`;
|
|
93
|
+
selectedStep.value = Number(localStorage.getItem(`${localstorageKey}-step`));
|
|
94
|
+
selectedFlow.value = Number(localStorage.getItem(`${localstorageKey}-flow`));
|
|
95
|
+
});
|
|
96
|
+
watch([selectedStep, selectedFlow], () => {
|
|
97
|
+
const localstorageKey = `${config.value.clientId}-${config.value.user.id}`;
|
|
98
|
+
localStorage.setItem(`${localstorageKey}-step`, String(selectedStep.value));
|
|
99
|
+
localStorage.setItem(`${localstorageKey}-flow`, String(selectedFlow.value));
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
watch(
|
|
103
|
+
() => config.value.theme,
|
|
104
|
+
() => {
|
|
105
|
+
if (rootElement.value) {
|
|
106
|
+
applyTheme(config.value.theme, rootElement.value);
|
|
107
|
+
loadAutocompleteStyle(config.value.theme);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<style lang="sass">
|
|
114
|
+
@import "../../assets/styles/main.sass"
|
|
115
|
+
@import '@uppy/core/dist/style.css'
|
|
116
|
+
@import '@uppy/dashboard/dist/style.css'
|
|
117
|
+
</style>
|