@icvdeveloper/common-module 2.2.4 → 2.3.1
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/CHANGELOG.md
CHANGED
package/dist/module.json
CHANGED
package/dist/runtime/plugin.mjs
CHANGED
|
@@ -35,25 +35,36 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
35
35
|
return text;
|
|
36
36
|
};
|
|
37
37
|
let docTitle = "";
|
|
38
|
+
let isNEJM = false;
|
|
38
39
|
const routeName = to.name;
|
|
39
40
|
const routeArray = routeName.toLowerCase().split("-");
|
|
41
|
+
const isRedirectPage = routeName.includes("events-id") && to.params.id == "redirect";
|
|
42
|
+
const isStreamTest = routeName == "stream-test";
|
|
43
|
+
let skipCurrentConf = false;
|
|
40
44
|
if (portal.value === null) {
|
|
41
45
|
Promise.all([
|
|
42
46
|
// fetch portal config then increment loading indicator
|
|
43
47
|
await portalStore.getPortal().then(() => {
|
|
48
|
+
isNEJM = portal.value.template_id == 7;
|
|
49
|
+
skipCurrentConf = isNEJM && !isRedirectPage && !isStreamTest;
|
|
44
50
|
docTitle = portal.value.name;
|
|
45
51
|
NProgress.inc();
|
|
46
|
-
})
|
|
47
|
-
// wait for portal config request to complete, then fetch conferences
|
|
48
|
-
await conferencesStore.getConferences().then(() => NProgress.inc()),
|
|
49
|
-
// wait for get conferences to complete, then get current conference data.
|
|
50
|
-
await conferencesStore.getCurrentConference(true).then(() => NProgress.inc())
|
|
52
|
+
})
|
|
51
53
|
]);
|
|
54
|
+
if (!skipCurrentConf) {
|
|
55
|
+
Promise.all([
|
|
56
|
+
await conferencesStore.getConferences().then(() => NProgress.inc()),
|
|
57
|
+
// wait for get conferences to complete, then get current conference data.
|
|
58
|
+
await conferencesStore.getCurrentConference(true).then(() => NProgress.inc())
|
|
59
|
+
]);
|
|
60
|
+
}
|
|
52
61
|
}
|
|
53
|
-
if (
|
|
62
|
+
if (isRedirectPage) {
|
|
54
63
|
let matchedConfs = conferencesStore.conferenceList;
|
|
55
64
|
if (to.query.custom1) {
|
|
56
|
-
matchedConfs = conferencesStore.searchConferenceAffiliatesCustom1(
|
|
65
|
+
matchedConfs = conferencesStore.searchConferenceAffiliatesCustom1(
|
|
66
|
+
to.query.custom1
|
|
67
|
+
);
|
|
57
68
|
}
|
|
58
69
|
if (matchedConfs.length > 0 && to.query.state) {
|
|
59
70
|
if (to.query.state == "upcoming") {
|
|
@@ -84,7 +95,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
84
95
|
}
|
|
85
96
|
const routeParamId = parseInt(to.params.id);
|
|
86
97
|
if (routeName.includes("events-id") && routeParamId) {
|
|
87
|
-
await conferencesStore.getSelectedConference(routeParamId, false).then(() => {
|
|
98
|
+
await conferencesStore.getSelectedConference(routeParamId, false, isNEJM ? false : true).then(() => {
|
|
88
99
|
if (conferencesStore.selectedConference) {
|
|
89
100
|
docTitle = `${conferencesStore.selectedConference.name}`;
|
|
90
101
|
if (routeName.includes("webcast-channelid")) {
|
|
@@ -129,12 +140,18 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
129
140
|
let metaDesc = portal.value.description;
|
|
130
141
|
let socialImage = "";
|
|
131
142
|
if (get(conferencesStore, "selectedConference.description.length", 0) > 0) {
|
|
132
|
-
metaDesc = stripHtml(
|
|
143
|
+
metaDesc = stripHtml(
|
|
144
|
+
conferencesStore.selectedConference?.description
|
|
145
|
+
);
|
|
133
146
|
} else if (get(portal.value, "social_description.length", 0) > 0) {
|
|
134
147
|
metaDesc = get(portal.value, "social_description");
|
|
135
148
|
}
|
|
136
149
|
if (get(conferencesStore, "selectedConference.photo.length", 0) > 0) {
|
|
137
|
-
socialImage = get(
|
|
150
|
+
socialImage = get(
|
|
151
|
+
conferencesStore,
|
|
152
|
+
"selectedConference.photo",
|
|
153
|
+
""
|
|
154
|
+
);
|
|
138
155
|
} else if (get(portal.value, "social_photo.length", 0) > 0) {
|
|
139
156
|
socialImage = get(portal.value, "social_photo");
|
|
140
157
|
}
|
|
@@ -4,6 +4,7 @@ export interface ConferencesState {
|
|
|
4
4
|
currentConference: null | Conference;
|
|
5
5
|
selectedConference: null | Conference;
|
|
6
6
|
featuredConference: null | Conference;
|
|
7
|
+
liveConference: null | Conference;
|
|
7
8
|
}
|
|
8
9
|
export declare const useConferencesStore: import("pinia").StoreDefinition<"conferences", ConferencesState, {
|
|
9
10
|
upcomingEvents: (state: ConferencesState) => Conference[];
|
|
@@ -11,8 +12,9 @@ export declare const useConferencesStore: import("pinia").StoreDefinition<"confe
|
|
|
11
12
|
}, {
|
|
12
13
|
getConferences(): Promise<Conference[]>;
|
|
13
14
|
searchConferenceAffiliatesCustom1(code: string): Conference[];
|
|
14
|
-
getSelectedConference(id: number, skipDetails?: boolean): Promise<Conference>;
|
|
15
|
-
|
|
15
|
+
getSelectedConference(id: number, skipDetails?: boolean, allDetails?: boolean): Promise<Conference>;
|
|
16
|
+
getLiveConference(): Promise<Conference>;
|
|
17
|
+
getCurrentConference(skipDetails?: boolean, allDetails?: boolean): Promise<Conference>;
|
|
16
18
|
getRegisteredConferences(): Conference[];
|
|
17
19
|
updateConferencesAccess(userConferences: Conference[]): void;
|
|
18
20
|
}>;
|
|
@@ -3,15 +3,19 @@ import { findLast, find, get } from "lodash-es";
|
|
|
3
3
|
import { useApi } from "../composables/useApi.mjs";
|
|
4
4
|
import { ConferenceState } from "../models/conference.mjs";
|
|
5
5
|
import { useTemplateConfigsStore } from "./templateConfigs.mjs";
|
|
6
|
-
const
|
|
6
|
+
const conferenceAllDetailsQueryString = () => {
|
|
7
7
|
return "affiliates.documents,presenters,days.sponsors,days.tracks.sponsors,days.tracks.presentations.presenters,days.tracks.presentations.sponsors,days.tracks.presentations.documents,days.track_groups.tracks.sponsors,days.track_groups.tracks.presentations.presenters,days.track_groups.tracks.presentations.sponsors,days.track_groups.tracks.presentations.documents,groups,days.groups,days.tracks.groups,template_config,ce_credit_config,custom1";
|
|
8
8
|
};
|
|
9
|
+
const conferenceBasicDetailsQueryString = () => {
|
|
10
|
+
return "days.tracks.presentations.presenters,presenters,affiliates,custom1";
|
|
11
|
+
};
|
|
9
12
|
export const useConferencesStore = defineStore("conferences", {
|
|
10
13
|
state: () => ({
|
|
11
14
|
conferenceList: [],
|
|
12
15
|
currentConference: null,
|
|
13
16
|
selectedConference: null,
|
|
14
|
-
featuredConference: null
|
|
17
|
+
featuredConference: null,
|
|
18
|
+
liveConference: null
|
|
15
19
|
}),
|
|
16
20
|
getters: {
|
|
17
21
|
upcomingEvents: (state) => {
|
|
@@ -48,7 +52,7 @@ export const useConferencesStore = defineStore("conferences", {
|
|
|
48
52
|
});
|
|
49
53
|
return matchedConfs;
|
|
50
54
|
},
|
|
51
|
-
getSelectedConference(id, skipDetails) {
|
|
55
|
+
getSelectedConference(id, skipDetails, allDetails = true) {
|
|
52
56
|
return new Promise((resolve, reject) => {
|
|
53
57
|
if (skipDetails === true) {
|
|
54
58
|
const selConference = find(this.conferenceList, { id });
|
|
@@ -59,7 +63,9 @@ export const useConferencesStore = defineStore("conferences", {
|
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
const request = useApi();
|
|
62
|
-
request(
|
|
66
|
+
request(
|
|
67
|
+
`conferences/${id}?with=${allDetails ? conferenceAllDetailsQueryString() : conferenceBasicDetailsQueryString()}`
|
|
68
|
+
).then((response) => {
|
|
63
69
|
this.selectedConference = response.data;
|
|
64
70
|
resolve(this.selectedConference);
|
|
65
71
|
}).catch((error) => {
|
|
@@ -67,9 +73,29 @@ export const useConferencesStore = defineStore("conferences", {
|
|
|
67
73
|
});
|
|
68
74
|
});
|
|
69
75
|
},
|
|
70
|
-
|
|
76
|
+
getLiveConference() {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
if (this.currentConference !== null) {
|
|
79
|
+
if (this.currentConference.state.toLowerCase() == "live") {
|
|
80
|
+
this.liveConference = this.currentConference;
|
|
81
|
+
resolve(this.liveConference);
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
const url = `conferences?filters[state]=live&page=1&pageSize=1&orderBy=start_date&orderDir=asc`;
|
|
85
|
+
const request = useApi();
|
|
86
|
+
request(url).then((response) => {
|
|
87
|
+
if (get(response, "data.length", 0) > 0) {
|
|
88
|
+
this.liveConference = response.data[0];
|
|
89
|
+
resolve(this.liveConference);
|
|
90
|
+
}
|
|
91
|
+
}).catch((error) => {
|
|
92
|
+
reject(error);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
getCurrentConference(skipDetails, allDetails = true) {
|
|
71
98
|
return new Promise((resolve, reject) => {
|
|
72
|
-
const request = useApi();
|
|
73
99
|
let conference;
|
|
74
100
|
const liveConference = this.conferenceList.find(
|
|
75
101
|
(conf) => conf.state === ConferenceState.LIVE || conf.state === ConferenceState.MIXED
|
|
@@ -96,8 +122,9 @@ export const useConferencesStore = defineStore("conferences", {
|
|
|
96
122
|
this.currentConference = conference;
|
|
97
123
|
resolve(this.currentConference);
|
|
98
124
|
} else {
|
|
125
|
+
const request = useApi();
|
|
99
126
|
request(
|
|
100
|
-
`conferences/${conference.id}?with=${
|
|
127
|
+
`conferences/${conference.id}?with=${allDetails ? conferenceAllDetailsQueryString() : conferenceBasicDetailsQueryString}`
|
|
101
128
|
).then((response) => {
|
|
102
129
|
const {
|
|
103
130
|
data: { template_config, ...data }
|
|
@@ -14,7 +14,7 @@ export const usePortalStore = defineStore("portal", {
|
|
|
14
14
|
return new Promise((resolve, reject) => {
|
|
15
15
|
this.loading = true;
|
|
16
16
|
request(
|
|
17
|
-
"portals/1?fields=id,name,description,domain,favicon,ga_id,gtm_id,adobe_launch_url,social_title,social_description,social_photo&with=template_config,navigation_config"
|
|
17
|
+
"portals/1?fields=template_id,id,name,description,domain,favicon,ga_id,gtm_id,adobe_launch_url,social_title,social_description,social_photo&with=template_config,navigation_config,brand_codes_active"
|
|
18
18
|
).then((response) => {
|
|
19
19
|
const {
|
|
20
20
|
data: { navigation_config, template_config, ...data }
|