@icvdeveloper/common-module 0.0.97 → 0.0.99
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 +1 -1
- package/dist/runtime/components/auth/Ucc.vue +67 -24
- package/dist/runtime/composables/useUcc.d.ts +2 -2
- package/dist/runtime/composables/useUcc.mjs +25 -23
- package/dist/runtime/models/conference.d.ts +1 -0
- package/dist/runtime/store/auth.d.ts +1 -0
- package/dist/runtime/store/auth.mjs +5 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { toRefs, onMounted } from "vue";
|
|
2
|
+
import { toRefs, computed, onMounted } from "vue";
|
|
3
3
|
import { useUcc } from "../../composables/useUcc";
|
|
4
4
|
import { Conference } from "../../models/conference";
|
|
5
5
|
import { useConferencesStore } from "../../store/conferences";
|
|
@@ -15,6 +15,7 @@ interface Props {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
+
eventPathPrefix: "",
|
|
18
19
|
classObject: () => {
|
|
19
20
|
return {
|
|
20
21
|
container: ""
|
|
@@ -23,6 +24,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
const {
|
|
27
|
+
eventPathPrefix,
|
|
26
28
|
classObject,
|
|
27
29
|
} = toRefs(props);
|
|
28
30
|
|
|
@@ -32,50 +34,91 @@ const { classBinding } = useClassBinding();
|
|
|
32
34
|
// reactive data
|
|
33
35
|
const { conference } = toRefs(props);
|
|
34
36
|
|
|
37
|
+
// methods
|
|
35
38
|
const submitLogin = () => {
|
|
36
39
|
let email = document.getElementById('uccEmail').value;
|
|
37
40
|
loginV3({email: email});
|
|
38
41
|
};
|
|
39
42
|
|
|
43
|
+
// computed
|
|
44
|
+
const loginHeader = computed(() => {
|
|
45
|
+
return (conference.value.state == "live")
|
|
46
|
+
? "Live Web Event Streaming Now"
|
|
47
|
+
: (conference.value.state == "archive")
|
|
48
|
+
? "Enter your email address to view event recording"
|
|
49
|
+
: "Join us for a Free Live Web Event"; // fallback (handled by UCC)
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const buttonText = computed(() => {
|
|
53
|
+
return (conference.value.state == "live")
|
|
54
|
+
? "Join the Livestream"
|
|
55
|
+
: (conference.value.state == "archive")
|
|
56
|
+
? "View Event"
|
|
57
|
+
: "Register"; // fallback (handled by UCC)
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const buttonColorClass = computed(() => {
|
|
61
|
+
return (conference.value.state == "live")
|
|
62
|
+
? "v3-ucc-btn-black"
|
|
63
|
+
: "ucc-btn-primary";
|
|
64
|
+
});
|
|
65
|
+
|
|
40
66
|
// on mount
|
|
41
67
|
onMounted(() => {
|
|
42
|
-
loadUccScript(props.conference,
|
|
68
|
+
loadUccScript(props.conference, props.eventPathPrefix);
|
|
43
69
|
});
|
|
44
70
|
|
|
45
71
|
</script>
|
|
46
72
|
|
|
47
73
|
<template>
|
|
48
|
-
<div
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
<div>
|
|
75
|
+
<!-- UCC Widget -->
|
|
76
|
+
<div id="uccTarget"
|
|
77
|
+
:class="
|
|
78
|
+
classBinding(
|
|
79
|
+
classObject,
|
|
80
|
+
'container',
|
|
81
|
+
'p-0 m-0 w-full'
|
|
82
|
+
)
|
|
83
|
+
"
|
|
84
|
+
style="display:block;"
|
|
85
|
+
>
|
|
86
|
+
</div>
|
|
87
|
+
<!-- V3 email login form -->
|
|
88
|
+
<div id="uccEmailForm"
|
|
89
|
+
class="ucc-form-container ucc-widgets-events"
|
|
90
|
+
:class="(conference.state == 'live' || conference.state == 'archive') ? 'block' : 'hidden'"
|
|
91
|
+
style="padding-bottom: 0px"
|
|
92
|
+
>
|
|
59
93
|
<div>
|
|
60
|
-
<h1 class="scala-bold text-red-500 text-xl mb-0">
|
|
61
|
-
|
|
94
|
+
<h1 class="scala-bold text-red-500 text-xl text-center mb-0">
|
|
95
|
+
{{ loginHeader }}
|
|
62
96
|
</h1>
|
|
63
97
|
</div>
|
|
64
|
-
<div
|
|
98
|
+
<div class="text-center">
|
|
65
99
|
<div class="ucc-form-field">
|
|
66
100
|
<div class="ucc-form-field-descr"></div>
|
|
67
|
-
<div class="ucc-input-wrapper required
|
|
68
|
-
|
|
69
|
-
class="ucc-input" type="text" placeholder="Email Address" autocomplete="off" maxlength="70"
|
|
70
|
-
fdprocessedid="tkt2jv">
|
|
71
|
-
<div data-lastpass-icon-root="true"
|
|
72
|
-
style="position: relative !important; height: 0px !important; width: 0px !important; float: left !important;">
|
|
73
|
-
</div>
|
|
101
|
+
<div class="ucc-input-wrapper required">
|
|
102
|
+
<input id="uccEmail" name="uccEmail" class="ucc-input" type="text" placeholder="Enter Email Address" autocomplete="off" maxlength="70">
|
|
74
103
|
</div>
|
|
75
104
|
<div class="ucc-error"></div>
|
|
76
105
|
</div>
|
|
77
|
-
<div class="ucc-form-field ucc-form-btn-row" style="margin-bottom: 0x; margin-top: 0px;"
|
|
106
|
+
<div class="ucc-form-field ucc-form-btn-row" style="margin-bottom: 0x; margin-top: 0px;">
|
|
107
|
+
<a
|
|
108
|
+
@click="submitLogin"
|
|
109
|
+
class="ucc-btn"
|
|
110
|
+
:class="buttonColorClass"
|
|
111
|
+
style="margin-top: 0px;"><span class="btn-text">{{ buttonText }}</span></a>
|
|
112
|
+
</div>
|
|
78
113
|
</div>
|
|
79
114
|
</div>
|
|
80
115
|
</div>
|
|
81
116
|
</template>
|
|
117
|
+
|
|
118
|
+
<style scoped>
|
|
119
|
+
.v3-ucc-btn-black {
|
|
120
|
+
background-color: #000;
|
|
121
|
+
border: 1px solid #000;
|
|
122
|
+
color: #fff;
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
@@ -5,9 +5,9 @@ export type UccFunctions = {
|
|
|
5
5
|
*/
|
|
6
6
|
loadUccScript: (conference: Conference, eventPathPrefix: string) => void;
|
|
7
7
|
/**
|
|
8
|
-
* redirect
|
|
8
|
+
* redirect after successful login or registration
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
postAuthRedirect: () => void;
|
|
11
11
|
/**
|
|
12
12
|
* show UCC Event Sign Up
|
|
13
13
|
*/
|
|
@@ -8,6 +8,7 @@ import { useConferenceHelpers } from "../composables/useConferenceHelpers.mjs";
|
|
|
8
8
|
export const useUcc = () => {
|
|
9
9
|
const { globalConfigValue } = useTemplateConfigsStore();
|
|
10
10
|
const { user, isLoggedIn } = storeToRefs(useAuthStore());
|
|
11
|
+
const { setUser } = useAuthStore();
|
|
11
12
|
const router = useRouter();
|
|
12
13
|
const loadUccScript = (conference, eventPathPrefix) => {
|
|
13
14
|
console.log("conference", conference);
|
|
@@ -21,16 +22,21 @@ export const useUcc = () => {
|
|
|
21
22
|
state: conference.state,
|
|
22
23
|
brandCode
|
|
23
24
|
};
|
|
24
|
-
window.uccMixin.webcastUrl = getConferenceWebcastUrl(conference,
|
|
25
|
-
window.uccMixin.
|
|
25
|
+
window.uccMixin.webcastUrl = getConferenceWebcastUrl(conference, eventPathPrefix);
|
|
26
|
+
window.uccMixin.postAuthRedirect = postAuthRedirect;
|
|
26
27
|
window.uccMixin.uccShowEventSignUp = uccShowEventSignUp;
|
|
27
28
|
window.uccMixin.handleUCCCallback = handleUCCCallback;
|
|
28
29
|
let ucc = document.createElement("script");
|
|
29
30
|
ucc.setAttribute("src", globalConfigValue("ucc_url"));
|
|
30
31
|
ucc.onload = () => {
|
|
31
32
|
console.log("UCC onload");
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
console.log("isLoggedIn", isLoggedIn.value);
|
|
34
|
+
if (isLoggedIn.value) {
|
|
35
|
+
console.log("onload auth user.value", user.value);
|
|
36
|
+
let hasAccess = find(get(user, "value.conferences", []), { id: window.uccMixin.conference.id });
|
|
37
|
+
toggleEmailFormDisplay(!hasAccess);
|
|
38
|
+
} else if (window.uccMixin.conference) {
|
|
39
|
+
if (window.uccMixin.conference.state == "upcoming") {
|
|
34
40
|
window.uccMixin.uccShowEventSignUp();
|
|
35
41
|
}
|
|
36
42
|
}
|
|
@@ -45,16 +51,13 @@ export const useUcc = () => {
|
|
|
45
51
|
},
|
|
46
52
|
onLoginSuccess: function(ssoEvent) {
|
|
47
53
|
console.log("UCC login success");
|
|
48
|
-
window.uccMixin.handleUCCCallback(ssoEvent);
|
|
49
54
|
},
|
|
50
55
|
onAuthStateReady: function(ssoEvent) {
|
|
51
56
|
console.log("UCC auth state ready");
|
|
52
57
|
},
|
|
53
58
|
onRegistrationSuccess: function(ssoEvent) {
|
|
54
59
|
console.log("UCC reg success");
|
|
55
|
-
|
|
56
|
-
window.uccMixin.redirectToWebcast();
|
|
57
|
-
}
|
|
60
|
+
postAuthRedirect();
|
|
58
61
|
},
|
|
59
62
|
onLogoutSuccess: function(ssoEvent) {
|
|
60
63
|
console.log("UCC logout success");
|
|
@@ -64,8 +67,12 @@ export const useUcc = () => {
|
|
|
64
67
|
document.head.appendChild(ucc);
|
|
65
68
|
}
|
|
66
69
|
};
|
|
67
|
-
const
|
|
68
|
-
|
|
70
|
+
const postAuthRedirect = () => {
|
|
71
|
+
if (window.uccMixin.conference.state == "live") {
|
|
72
|
+
router.push(window.uccMixin.webcastUrl);
|
|
73
|
+
} else if (window.uccMixin.conference.state == "archive") {
|
|
74
|
+
window.location.reload();
|
|
75
|
+
}
|
|
69
76
|
};
|
|
70
77
|
const uccShowEventSignUp = (email) => {
|
|
71
78
|
let _conference = window.uccMixin.conference;
|
|
@@ -74,8 +81,8 @@ export const useUcc = () => {
|
|
|
74
81
|
let emailStr = email ? email : "";
|
|
75
82
|
console.log("uccShowEventSignUp _conference", _conference);
|
|
76
83
|
console.log("user", user);
|
|
77
|
-
console.log("isLoggedIn", isLoggedIn);
|
|
78
|
-
|
|
84
|
+
console.log("isLoggedIn", isLoggedIn.value);
|
|
85
|
+
toggleEmailFormDisplay(false);
|
|
79
86
|
if (_conference.brandCode) {
|
|
80
87
|
let mmsResponse = window.mmsWidgets.showEventsSignUp(
|
|
81
88
|
"#uccTarget",
|
|
@@ -97,11 +104,12 @@ export const useUcc = () => {
|
|
|
97
104
|
let hasAccess = find(conferences, { id: _conference.id });
|
|
98
105
|
console.log("hasAccess", hasAccess);
|
|
99
106
|
if (hasAccess) {
|
|
100
|
-
console.log("isLoggedIn", isLoggedIn);
|
|
101
|
-
|
|
107
|
+
console.log("isLoggedIn", isLoggedIn.value);
|
|
108
|
+
setUser(response.data);
|
|
109
|
+
console.log("auth user", user);
|
|
110
|
+
console.log("isLoggedIn", isLoggedIn.value);
|
|
111
|
+
postAuthRedirect();
|
|
102
112
|
} else {
|
|
103
|
-
toggleEmailFormDisplay(false);
|
|
104
|
-
console.log("showing reg?");
|
|
105
113
|
uccShowEventSignUp(email);
|
|
106
114
|
}
|
|
107
115
|
};
|
|
@@ -119,8 +127,6 @@ export const useUcc = () => {
|
|
|
119
127
|
};
|
|
120
128
|
const handleUCCCallback = (ssoEvent) => {
|
|
121
129
|
console.log("ssoEvent", ssoEvent);
|
|
122
|
-
if (!ssoEvent.profile) {
|
|
123
|
-
}
|
|
124
130
|
var options = {
|
|
125
131
|
email: ssoEvent.profile.email,
|
|
126
132
|
ucid: ssoEvent.profile.ucid
|
|
@@ -132,13 +138,9 @@ export const useUcc = () => {
|
|
|
132
138
|
const toggleEmailFormDisplay = (show) => {
|
|
133
139
|
document.getElementById("uccEmailForm").style.display = show ? "block" : "none";
|
|
134
140
|
};
|
|
135
|
-
const toggleEmailFormInputsDisplay = (show) => {
|
|
136
|
-
document.getElementsByClassName("ucc-placeholder-spinner")[0].style.display = show ? "none" : "block";
|
|
137
|
-
document.getElementById("uccEmailFormInputs").style.display = show ? "block" : "none";
|
|
138
|
-
};
|
|
139
141
|
return {
|
|
140
142
|
loadUccScript,
|
|
141
|
-
|
|
143
|
+
postAuthRedirect,
|
|
142
144
|
uccShowEventSignUp,
|
|
143
145
|
handleLoginV3Response,
|
|
144
146
|
loginV3,
|
|
@@ -10,6 +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
|
+
setUser(data: object): void;
|
|
13
14
|
login(params: LoginParams): Promise<AuthUser>;
|
|
14
15
|
logout(): Promise<void>;
|
|
15
16
|
update(data: AuthUser): Promise<void>;
|
|
@@ -7,10 +7,15 @@ export const useAuthStore = defineStore("auth", {
|
|
|
7
7
|
}),
|
|
8
8
|
getters: {
|
|
9
9
|
isLoggedIn: (state) => {
|
|
10
|
+
console.log("isLoggedIn method state", state);
|
|
10
11
|
return state.user !== null;
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
14
|
actions: {
|
|
15
|
+
setUser(data) {
|
|
16
|
+
console.log("setting user", data);
|
|
17
|
+
this.user = data;
|
|
18
|
+
},
|
|
14
19
|
login(params) {
|
|
15
20
|
return new Promise((resolve, reject) => {
|
|
16
21
|
const request = useApi();
|