@7365admin1/layer-common 4.97.1-staging.611 → 4.97.1-staging.612
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.
|
@@ -45,9 +45,7 @@
|
|
|
45
45
|
@refresh="reload"
|
|
46
46
|
@update:page="page = $event"
|
|
47
47
|
>
|
|
48
|
-
<!--
|
|
49
|
-
<!-- Contacts are reader objects, so adding one is the readers right.
|
|
50
|
-
The web call is a member level call and stays for everyone. -->
|
|
48
|
+
<!-- Contacts are reader objects, so adding one is the readers right. -->
|
|
51
49
|
<template #actions>
|
|
52
50
|
<AppButton
|
|
53
51
|
v-if="activeTab === 'contacts' && canManageHidReaders"
|
|
@@ -56,15 +54,6 @@
|
|
|
56
54
|
>
|
|
57
55
|
Add Contacts
|
|
58
56
|
</AppButton>
|
|
59
|
-
<AppButton
|
|
60
|
-
v-else-if="activeTab !== 'contacts'"
|
|
61
|
-
icon="mdi-phone-in-talk-outline"
|
|
62
|
-
class="web-call-button"
|
|
63
|
-
:class="webPhoneButtonClass"
|
|
64
|
-
@click="openWebPhoneDialog()"
|
|
65
|
-
>
|
|
66
|
-
{{ webPhone.callState.value === 'incoming' ? 'Incoming Call' : 'Web Call' }}
|
|
67
|
-
</AppButton>
|
|
68
57
|
</template>
|
|
69
58
|
|
|
70
59
|
<!-- Was `v-tabs`/`v-tab`, whose selected state is drawn from Vuetify's
|
|
@@ -588,13 +577,13 @@
|
|
|
588
577
|
<v-card class="form-dialog contact-dialog" rounded="lg">
|
|
589
578
|
<v-card-title class="dialog-title">{{ contactForm.id ? 'Edit Contact' : 'Add Contact' }}</v-card-title>
|
|
590
579
|
<v-card-text class="dialog-body">
|
|
591
|
-
<
|
|
580
|
+
<div class="field-label">HID Reader <span>*</span></div>
|
|
592
581
|
<AppSelect
|
|
593
582
|
v-model="contactForm.readerId"
|
|
594
583
|
:items="readerOptions"
|
|
595
584
|
:disabled="Boolean(contactForm.id)"
|
|
596
585
|
/>
|
|
597
|
-
<
|
|
586
|
+
<div class="field-label">Name <span>*</span></div>
|
|
598
587
|
<!-- The name is picked from the site's SIP accounts (`hid-sip-accounts`)
|
|
599
588
|
rather than typed, so a contact always names a person who holds an
|
|
600
589
|
extension. The model stays the plain name string the reader stores,
|
|
@@ -617,7 +606,7 @@
|
|
|
617
606
|
<p v-else-if="!sipAccountsLoading && !sipAccounts.length" class="field-hint">
|
|
618
607
|
No SIP accounts on this site yet. An account is created the first time a user opens Web Call.
|
|
619
608
|
</p>
|
|
620
|
-
<
|
|
609
|
+
<div class="field-label">Address <span>*</span></div>
|
|
621
610
|
<!-- Always read-only: it shows the extension of the chosen SIP account
|
|
622
611
|
and is never typed into. -->
|
|
623
612
|
<AppField
|
|
@@ -626,6 +615,7 @@
|
|
|
626
615
|
disabled
|
|
627
616
|
/>
|
|
628
617
|
<p class="field-hint">{{ contactAddressHint }}</p>
|
|
618
|
+
<p v-if="contactError" class="field-hint field-hint--error contact-error" role="alert">{{ contactError }}</p>
|
|
629
619
|
</v-card-text>
|
|
630
620
|
<v-card-actions class="dialog-actions pa-0">
|
|
631
621
|
<v-btn class="text-none action-cancel" variant="flat" height="44" @click="contactDialog = false">Cancel</v-btn>
|
|
@@ -787,6 +777,8 @@ const contactsLoaded = ref(false);
|
|
|
787
777
|
const loading = ref(false);
|
|
788
778
|
const saving = ref(false);
|
|
789
779
|
const contactsSaving = ref(false);
|
|
780
|
+
/** Shown inside the contact dialog: a page message would sit behind its overlay. */
|
|
781
|
+
const contactError = ref("");
|
|
790
782
|
const calling = ref(false);
|
|
791
783
|
const hangingUp = ref(false);
|
|
792
784
|
const search = ref("");
|
|
@@ -1055,12 +1047,6 @@ const visiblePageRows = computed(() =>
|
|
|
1055
1047
|
: paginatedContacts.value
|
|
1056
1048
|
);
|
|
1057
1049
|
|
|
1058
|
-
/** The web-call button turns green when registered and amber on an incoming
|
|
1059
|
-
call - the same two states the old `.web-call-button` modifiers drew. */
|
|
1060
|
-
const webPhoneButtonClass = computed(() => ({
|
|
1061
|
-
"is-connected": webPhone.isRegistered.value,
|
|
1062
|
-
"has-incoming-call": webPhone.callState.value === "incoming",
|
|
1063
|
-
}));
|
|
1064
1050
|
const isPeerToPeerMode = computed(() => sipForm.operatingMode === "peer-to-peer");
|
|
1065
1051
|
|
|
1066
1052
|
/**
|
|
@@ -1179,6 +1165,11 @@ watch([activeTab, search, statusFilter], () => {
|
|
|
1179
1165
|
page.value = 1;
|
|
1180
1166
|
});
|
|
1181
1167
|
|
|
1168
|
+
// A contact dialog error is about the values that were saved; changing them clears it.
|
|
1169
|
+
watch(() => [contactForm.readerId, contactForm.name], () => {
|
|
1170
|
+
contactError.value = "";
|
|
1171
|
+
});
|
|
1172
|
+
|
|
1182
1173
|
watch(pages, () => {
|
|
1183
1174
|
if (page.value > pages.value) page.value = pages.value;
|
|
1184
1175
|
});
|
|
@@ -1682,6 +1673,7 @@ function openContactDialog(contact?: ContactRow) {
|
|
|
1682
1673
|
const selectedReader = readers.value.find((reader) => reader._id === contactForm.readerId);
|
|
1683
1674
|
contactForm.location = contact?.location === "N/A" ? "" : contact?.location || selectedReader?.location || "";
|
|
1684
1675
|
contactForm.serverAddress = contact?.serverAddress === "N/A" ? "" : contact?.serverAddress || "";
|
|
1676
|
+
contactError.value = "";
|
|
1685
1677
|
contactDialog.value = true;
|
|
1686
1678
|
// Fetched on every open, not cached: an account is provisioned the first
|
|
1687
1679
|
// time a user opens Web Call, so the list can grow between two dialogs.
|
|
@@ -1935,18 +1927,30 @@ async function savePjsip(readerId: string, payload: Record<string, string>, opti
|
|
|
1935
1927
|
}
|
|
1936
1928
|
|
|
1937
1929
|
async function saveContact() {
|
|
1930
|
+
contactError.value = "";
|
|
1938
1931
|
if (!contactForm.readerId || !contactForm.name.trim() || !contactForm.serverAddress.trim()) {
|
|
1939
|
-
|
|
1932
|
+
contactError.value = "Please complete the required contact fields.";
|
|
1940
1933
|
return;
|
|
1941
1934
|
}
|
|
1942
1935
|
|
|
1943
1936
|
if (!isContactAddress(contactForm.serverAddress, isContactReaderPeerToPeer.value)) {
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1937
|
+
contactError.value = isContactReaderPeerToPeer.value
|
|
1938
|
+
? "Enter the contact's local IPv4 address for a Peer-to-Peer reader."
|
|
1939
|
+
: "Enter a valid extension number or SIP address.";
|
|
1940
|
+
return;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
// The reader accepts duplicates, so the same person or extension could be
|
|
1944
|
+
// listed twice on one reader. Edits skip the contact being edited.
|
|
1945
|
+
const name = contactForm.name.trim().toLowerCase();
|
|
1946
|
+
const number = contactForm.serverAddress.trim();
|
|
1947
|
+
const duplicate = contacts.value.find((contact) =>
|
|
1948
|
+
contact.readerId === contactForm.readerId
|
|
1949
|
+
&& contact.id !== contactForm.id
|
|
1950
|
+
&& (contact.name.trim().toLowerCase() === name || contact.serverAddress.trim() === number),
|
|
1951
|
+
);
|
|
1952
|
+
if (duplicate) {
|
|
1953
|
+
contactError.value = `${duplicate.name} is already a contact on this HID reader.`;
|
|
1950
1954
|
return;
|
|
1951
1955
|
}
|
|
1952
1956
|
|
|
@@ -1991,7 +1995,7 @@ async function saveContact() {
|
|
|
1991
1995
|
await loadContacts();
|
|
1992
1996
|
showMessage("Intercom contact saved.", "success");
|
|
1993
1997
|
} catch (error: unknown) {
|
|
1994
|
-
|
|
1998
|
+
contactError.value = getErrorMessage(error);
|
|
1995
1999
|
} finally {
|
|
1996
2000
|
contactsSaving.value = false;
|
|
1997
2001
|
}
|
|
@@ -2097,40 +2101,6 @@ function toNumber(value: unknown, fallback?: number) {
|
|
|
2097
2101
|
}
|
|
2098
2102
|
</script>
|
|
2099
2103
|
|
|
2100
|
-
<script lang="ts">
|
|
2101
|
-
export default {
|
|
2102
|
-
components: {
|
|
2103
|
-
FieldLabel: {
|
|
2104
|
-
props: {
|
|
2105
|
-
text: String,
|
|
2106
|
-
required: Boolean,
|
|
2107
|
-
},
|
|
2108
|
-
template: `
|
|
2109
|
-
<div class="field-label">{{ text }} <span v-if="required">*</span></div>
|
|
2110
|
-
`,
|
|
2111
|
-
},
|
|
2112
|
-
ToggleField: {
|
|
2113
|
-
props: {
|
|
2114
|
-
modelValue: Boolean,
|
|
2115
|
-
label: String,
|
|
2116
|
-
},
|
|
2117
|
-
emits: ["update:modelValue"],
|
|
2118
|
-
template: `
|
|
2119
|
-
<div class="toggle-field">
|
|
2120
|
-
<span>{{ label }}</span>
|
|
2121
|
-
<v-switch
|
|
2122
|
-
:model-value="modelValue"
|
|
2123
|
-
class="app-switch"
|
|
2124
|
-
density="compact"
|
|
2125
|
-
hide-details
|
|
2126
|
-
@update:model-value="$emit('update:modelValue', $event)"
|
|
2127
|
-
/>
|
|
2128
|
-
</div>
|
|
2129
|
-
`,
|
|
2130
|
-
},
|
|
2131
|
-
},
|
|
2132
|
-
};
|
|
2133
|
-
</script>
|
|
2134
2104
|
|
|
2135
2105
|
<style scoped>
|
|
2136
2106
|
.hid-intercom-management {
|
|
@@ -2166,26 +2136,6 @@ export default {
|
|
|
2166
2136
|
max-width: 320px;
|
|
2167
2137
|
}
|
|
2168
2138
|
|
|
2169
|
-
/*
|
|
2170
|
-
The web-call button is the card's PRIMARY action, so its resting state is
|
|
2171
|
-
`AppButton`'s own accent - it was a flat `#e5e7eb` grey, which read as
|
|
2172
|
-
disabled next to every other screen's primary. Only the two STATE colours
|
|
2173
|
-
are the screen's own, because the handoff draws no such states.
|
|
2174
|
-
*/
|
|
2175
|
-
.web-call-button {
|
|
2176
|
-
min-width: 160px;
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
.web-call-button.is-connected {
|
|
2180
|
-
background: var(--ok);
|
|
2181
|
-
color: var(--on-accent-strong);
|
|
2182
|
-
}
|
|
2183
|
-
|
|
2184
|
-
.web-call-button.has-incoming-call {
|
|
2185
|
-
background: var(--warn);
|
|
2186
|
-
color: var(--on-accent-strong);
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
2139
|
|
|
2190
2140
|
|
|
2191
2141
|
|
|
@@ -2278,6 +2228,11 @@ export default {
|
|
|
2278
2228
|
color: var(--err);
|
|
2279
2229
|
}
|
|
2280
2230
|
|
|
2231
|
+
/* Set apart from the address hint above it, so it reads as the form's error. */
|
|
2232
|
+
.contact-error {
|
|
2233
|
+
margin-top: 12px;
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2281
2236
|
.sip-settings-dialog .field-label {
|
|
2282
2237
|
margin-top: 14px;
|
|
2283
2238
|
}
|
|
@@ -3043,10 +2998,6 @@ export default {
|
|
|
3043
2998
|
max-width: none;
|
|
3044
2999
|
}
|
|
3045
3000
|
|
|
3046
|
-
.web-call-button {
|
|
3047
|
-
width: 100%;
|
|
3048
|
-
}
|
|
3049
|
-
|
|
3050
3001
|
.web-phone-body {
|
|
3051
3002
|
grid-template-columns: minmax(0, 1fr);
|
|
3052
3003
|
min-height: 0;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.612",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|