@icvdeveloper/common-module 0.0.99 → 0.0.101
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);
|
|
@@ -23,6 +25,7 @@ export const useUcc = () => {
|
|
|
23
25
|
brandCode
|
|
24
26
|
};
|
|
25
27
|
window.uccMixin.webcastUrl = getConferenceWebcastUrl(conference, eventPathPrefix);
|
|
28
|
+
window.uccMixin.loginV3 = loginV3;
|
|
26
29
|
window.uccMixin.postAuthRedirect = postAuthRedirect;
|
|
27
30
|
window.uccMixin.uccShowEventSignUp = uccShowEventSignUp;
|
|
28
31
|
window.uccMixin.handleUCCCallback = handleUCCCallback;
|
|
@@ -34,7 +37,8 @@ export const useUcc = () => {
|
|
|
34
37
|
if (isLoggedIn.value) {
|
|
35
38
|
console.log("onload auth user.value", user.value);
|
|
36
39
|
let hasAccess = find(get(user, "value.conferences", []), { id: window.uccMixin.conference.id });
|
|
37
|
-
|
|
40
|
+
if (window.uccMixin.conference.state == "archive")
|
|
41
|
+
toggleEmailFormDisplay(!hasAccess);
|
|
38
42
|
} else if (window.uccMixin.conference) {
|
|
39
43
|
if (window.uccMixin.conference.state == "upcoming") {
|
|
40
44
|
window.uccMixin.uccShowEventSignUp();
|
|
@@ -57,7 +61,7 @@ export const useUcc = () => {
|
|
|
57
61
|
},
|
|
58
62
|
onRegistrationSuccess: function(ssoEvent) {
|
|
59
63
|
console.log("UCC reg success");
|
|
60
|
-
|
|
64
|
+
window.uccMixin.loginV3({ email: ssoEvent.profile.email });
|
|
61
65
|
},
|
|
62
66
|
onLogoutSuccess: function(ssoEvent) {
|
|
63
67
|
console.log("UCC logout success");
|
|
@@ -105,10 +109,12 @@ export const useUcc = () => {
|
|
|
105
109
|
console.log("hasAccess", hasAccess);
|
|
106
110
|
if (hasAccess) {
|
|
107
111
|
console.log("isLoggedIn", isLoggedIn.value);
|
|
108
|
-
|
|
112
|
+
loginEmailOnly(response.data).then(() => {
|
|
113
|
+
console.log("selectedConference", selectedConference.value);
|
|
114
|
+
postAuthRedirect();
|
|
115
|
+
});
|
|
109
116
|
console.log("auth user", user);
|
|
110
117
|
console.log("isLoggedIn", isLoggedIn.value);
|
|
111
|
-
postAuthRedirect();
|
|
112
118
|
} else {
|
|
113
119
|
uccShowEventSignUp(email);
|
|
114
120
|
}
|
|
@@ -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) => {
|