@icvdeveloper/common-module 0.0.100 → 0.0.102
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/dist/module.json
CHANGED
|
@@ -4,11 +4,13 @@ import { useRouter } from "vue-router";
|
|
|
4
4
|
import { useApi } from "./useApi.mjs";
|
|
5
5
|
import { useAuthStore } from "../store/auth.mjs";
|
|
6
6
|
import { useTemplateConfigsStore } from "../store/templateConfigs.mjs";
|
|
7
|
+
import { useConferencesStore } from "../store/conferences.mjs";
|
|
7
8
|
import { useConferenceHelpers } from "../composables/useConferenceHelpers.mjs";
|
|
8
9
|
export const useUcc = () => {
|
|
9
10
|
const { globalConfigValue } = useTemplateConfigsStore();
|
|
10
11
|
const { user, isLoggedIn } = storeToRefs(useAuthStore());
|
|
11
|
-
const {
|
|
12
|
+
const { loginEmailOnly } = useAuthStore();
|
|
13
|
+
const { selectedConference } = storeToRefs(useConferencesStore());
|
|
12
14
|
const router = useRouter();
|
|
13
15
|
const loadUccScript = (conference, eventPathPrefix) => {
|
|
14
16
|
console.log("conference", conference);
|
|
@@ -32,13 +34,18 @@ export const useUcc = () => {
|
|
|
32
34
|
ucc.onload = () => {
|
|
33
35
|
console.log("UCC onload");
|
|
34
36
|
console.log("isLoggedIn", isLoggedIn.value);
|
|
35
|
-
if (
|
|
36
|
-
console.log("onload auth user.value", user.value);
|
|
37
|
-
let hasAccess = find(get(user, "value.conferences", []), { id: window.uccMixin.conference.id });
|
|
38
|
-
toggleEmailFormDisplay(!hasAccess);
|
|
39
|
-
} else if (window.uccMixin.conference) {
|
|
37
|
+
if (window.uccMixin.conference) {
|
|
40
38
|
if (window.uccMixin.conference.state == "upcoming") {
|
|
41
39
|
window.uccMixin.uccShowEventSignUp();
|
|
40
|
+
} else if (window.uccMixin.conference.state == "archive") {
|
|
41
|
+
if (isLoggedIn.value) {
|
|
42
|
+
console.log("onload auth user.value", user.value);
|
|
43
|
+
let hasAccess = find(
|
|
44
|
+
get(user, "value.conferences", []),
|
|
45
|
+
{ id: window.uccMixin.conference.id }
|
|
46
|
+
);
|
|
47
|
+
toggleEmailFormDisplay(!hasAccess);
|
|
48
|
+
}
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
mmsWidgets.init({
|
|
@@ -106,10 +113,12 @@ export const useUcc = () => {
|
|
|
106
113
|
console.log("hasAccess", hasAccess);
|
|
107
114
|
if (hasAccess) {
|
|
108
115
|
console.log("isLoggedIn", isLoggedIn.value);
|
|
109
|
-
|
|
116
|
+
loginEmailOnly(response.data).then(() => {
|
|
117
|
+
console.log("selectedConference", selectedConference.value);
|
|
118
|
+
postAuthRedirect();
|
|
119
|
+
});
|
|
110
120
|
console.log("auth user", user);
|
|
111
121
|
console.log("isLoggedIn", isLoggedIn.value);
|
|
112
|
-
postAuthRedirect();
|
|
113
122
|
} else {
|
|
114
123
|
uccShowEventSignUp(email);
|
|
115
124
|
}
|
|
@@ -10,7 +10,7 @@ export type LoginParams = {
|
|
|
10
10
|
export declare const useAuthStore: import("pinia").StoreDefinition<"auth", AuthStoreState, {
|
|
11
11
|
isLoggedIn: (state: AuthStoreState) => boolean;
|
|
12
12
|
}, {
|
|
13
|
-
|
|
13
|
+
loginEmailOnly(data: object): Promise<AuthUser>;
|
|
14
14
|
login(params: LoginParams): Promise<AuthUser>;
|
|
15
15
|
logout(): Promise<void>;
|
|
16
16
|
update(data: AuthUser): Promise<void>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineStore } from "pinia";
|
|
2
|
+
import { merge } from "lodash-es";
|
|
2
3
|
import { useApi } from "../composables/useApi.mjs";
|
|
4
|
+
import { useConferencesStore } from "./conferences.mjs";
|
|
3
5
|
export const useAuthStore = defineStore("auth", {
|
|
4
6
|
persist: true,
|
|
5
7
|
state: () => ({
|
|
@@ -12,9 +14,24 @@ export const useAuthStore = defineStore("auth", {
|
|
|
12
14
|
}
|
|
13
15
|
},
|
|
14
16
|
actions: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
loginEmailOnly(data) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const request = useApi();
|
|
20
|
+
request(
|
|
21
|
+
`users/email/${data.email}?with=token`
|
|
22
|
+
).then((response) => {
|
|
23
|
+
console.log("data", data);
|
|
24
|
+
let mergedUser = merge(data, response);
|
|
25
|
+
console.log("merged user", mergedUser);
|
|
26
|
+
this.user = mergedUser;
|
|
27
|
+
const { selectedConference, getSelectedConference } = useConferencesStore();
|
|
28
|
+
console.log("refreshing selected conference", selectedConference.id);
|
|
29
|
+
getSelectedConference(selectedConference.id);
|
|
30
|
+
resolve(response);
|
|
31
|
+
}).catch((error) => {
|
|
32
|
+
reject(error);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
18
35
|
},
|
|
19
36
|
login(params) {
|
|
20
37
|
return new Promise((resolve, reject) => {
|