@icvdeveloper/common-module 1.1.6 → 1.2.0

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
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 1.2.0 - 2023-12-04
11
+
12
+ ## 1.1.7 - 2023-11-15
13
+
10
14
  ## 1.1.6 - 2023-11-14
11
15
 
12
16
  ## 1.1.5 - 2023-11-10
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "v3plus-common-module",
3
3
  "configKey": "v3plusCommonModule",
4
- "version": "1.1.6"
4
+ "version": "1.2.0"
5
5
  }
@@ -89,8 +89,7 @@ onMounted(() => {
89
89
  </div>
90
90
  <!-- V3 email login form -->
91
91
  <div id="uccEmailForm"
92
- class="ucc-form-container ucc-widgets-events"
93
- :class="(conference.state == 'live' || conference.state == 'archive') ? 'block' : 'hidden'"
92
+ class="ucc-form-container ucc-widgets-events block"
94
93
  style="padding-bottom: 0px"
95
94
  >
96
95
  <div>
@@ -148,12 +148,12 @@ const eventPathPrefix = computed(() => {
148
148
  const eventType = computed((): Conference[] => {
149
149
  if (isUpcoming?.value) {
150
150
  if (isReversed?.value) {
151
- return reverse(upcomingEvents.value);
151
+ return reverse(upcomingEvents.value.slice());
152
152
  } else {
153
153
  return upcomingEvents.value;
154
154
  }
155
155
  } else if (isReversed?.value) {
156
- return reverse(pastEvents.value);
156
+ return reverse(pastEvents.value.slice());
157
157
  } else {
158
158
  return pastEvents.value;
159
159
  }
@@ -129,7 +129,7 @@ export const useAgenda = (conference) => {
129
129
  return classes;
130
130
  };
131
131
  onBeforeMount(() => {
132
- if (!affiliateStore.hasFetchedAffilites(conference.value.id)) {
132
+ if (!conference.value.hasOwnProperty("affiliates")) {
133
133
  affiliateStore.getAffiliates(conference.value.id);
134
134
  }
135
135
  if (selectedDay.value === null) {
@@ -76,7 +76,7 @@ export const useUcc = () => {
76
76
  if (window.uccMixin.conference.state == "live") {
77
77
  router.push(window.uccMixin.webcastUrl);
78
78
  } else if (window.uccMixin.conference.state == "archive") {
79
- window.location.reload();
79
+ toggleEmailFormDisplay(false);
80
80
  }
81
81
  };
82
82
  const uccShowEventSignUp = (email) => {
@@ -46,11 +46,11 @@ export default defineNuxtPlugin((nuxtApp) => {
46
46
  // wait for portal config request to complete, then fetch conferences
47
47
  await conferencesStore.getConferences().then(() => NProgress.inc()),
48
48
  // wait for get conferences to complete, then get current conference data.
49
- await conferencesStore.getCurrentConference().then(() => NProgress.inc())
49
+ await conferencesStore.getCurrentConference(true).then(() => NProgress.inc())
50
50
  ]);
51
51
  }
52
52
  if (to.name.includes("events-id") && to.params.id) {
53
- await conferencesStore.getSelectedConference(to.params.id).then(() => {
53
+ await conferencesStore.getSelectedConference(to.params.id, false).then(() => {
54
54
  if (conferencesStore.selectedConference) {
55
55
  docTitle = `${conferencesStore.selectedConference.name}`;
56
56
  if (to.name.includes("webcast-channelid")) {
@@ -8,5 +8,10 @@ export declare const useAffiliatesStore: import("pinia").StoreDefinition<"affili
8
8
  getConferenceAffiliates: (state: AffiliatesState) => (conferenceId: number) => Sponsor[];
9
9
  }, {
10
10
  getAffiliates(conferenceId: number): Promise<unknown>;
11
+ /**
12
+ * no longer in use by nejm-template
13
+ * replaced with conference.value.hasOwnProperty('affiliates')
14
+ * keeping for possible future use by other templates
15
+ */
11
16
  hasFetchedAffilites(conferenceId: number): boolean;
12
17
  }>;
@@ -28,6 +28,11 @@ export const useAffiliatesStore = defineStore("affiliates", {
28
28
  });
29
29
  });
30
30
  },
31
+ /**
32
+ * no longer in use by nejm-template
33
+ * replaced with conference.value.hasOwnProperty('affiliates')
34
+ * keeping for possible future use by other templates
35
+ */
31
36
  hasFetchedAffilites(conferenceId) {
32
37
  return Object.keys(this.affiliates).includes(String(conferenceId));
33
38
  }
@@ -33,10 +33,10 @@ export const useAuthStore = defineStore("auth", {
33
33
  return new Promise((resolve, reject) => {
34
34
  const request = useApi();
35
35
  request(`users/email/${data.email}?with=token`).then((response) => {
36
- let mergedUser = merge(data, response);
36
+ const mergedUser = merge(data, response);
37
37
  this.user = mergedUser;
38
- const { selectedConference, getSelectedConference } = useConferencesStore();
39
- getSelectedConference(selectedConference.id);
38
+ const { updateConferencesAccess } = useConferencesStore();
39
+ updateConferencesAccess(this.user.conferences);
40
40
  resolve(response);
41
41
  }).catch((error) => {
42
42
  reject(error);
@@ -56,7 +56,7 @@ export const useAuthStore = defineStore("auth", {
56
56
  this.user = response;
57
57
  const conferencesStore = useConferencesStore();
58
58
  conferencesStore.getConferences().then(() => {
59
- conferencesStore.getCurrentConference();
59
+ conferencesStore.getCurrentConference(true);
60
60
  });
61
61
  resolve(response);
62
62
  }).catch((error) => {
@@ -69,7 +69,7 @@ export const useAuthStore = defineStore("auth", {
69
69
  this.user = null;
70
70
  const conferencesStore = useConferencesStore();
71
71
  conferencesStore.getConferences().then(() => {
72
- conferencesStore.getCurrentConference();
72
+ conferencesStore.getCurrentConference(true);
73
73
  });
74
74
  resolve();
75
75
  });
@@ -9,6 +9,7 @@ export declare const useConferencesStore: import("pinia").StoreDefinition<"confe
9
9
  pastEvents: (state: ConferencesState) => Conference[];
10
10
  }, {
11
11
  getConferences(): Promise<Conference[]>;
12
- getSelectedConference(id: number): Promise<Conference>;
13
- getCurrentConference(): Promise<Conference>;
12
+ getSelectedConference(id: number, skipDetails?: boolean): Promise<Conference>;
13
+ getCurrentConference(skipDetails?: boolean): Promise<Conference>;
14
+ updateConferencesAccess(userConferences: any): void;
14
15
  }>;
@@ -1,5 +1,5 @@
1
1
  import { defineStore } from "pinia";
2
- import { findLast } from "lodash-es";
2
+ import { findLast, find } 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";
@@ -38,8 +38,16 @@ export const useConferencesStore = defineStore("conferences", {
38
38
  });
39
39
  });
40
40
  },
41
- getSelectedConference(id) {
41
+ getSelectedConference(id, skipDetails) {
42
42
  return new Promise((resolve, reject) => {
43
+ if (skipDetails === true) {
44
+ const selConference = find(this.conferenceList, { id });
45
+ if (selConference !== void 0) {
46
+ this.selectedConference = selConference;
47
+ resolve(this.selectedConference);
48
+ return;
49
+ }
50
+ }
43
51
  const request = useApi();
44
52
  request(`conferences/${id}?with=${conferenceDetailsQueryString()}`).then((response) => {
45
53
  this.selectedConference = response.data;
@@ -49,7 +57,7 @@ export const useConferencesStore = defineStore("conferences", {
49
57
  });
50
58
  });
51
59
  },
52
- getCurrentConference() {
60
+ getCurrentConference(skipDetails) {
53
61
  return new Promise((resolve, reject) => {
54
62
  const request = useApi();
55
63
  let conference = null;
@@ -71,22 +79,34 @@ export const useConferencesStore = defineStore("conferences", {
71
79
  }
72
80
  if (!conference) {
73
81
  reject(new Error("could not determine current conference."));
82
+ return;
74
83
  }
75
- request(
76
- `conferences/${conference.id}?with=${conferenceDetailsQueryString()}`
77
- ).then((response) => {
78
- const {
79
- data: { template_config, ...data }
80
- } = response;
81
- if (template_config) {
82
- const templateConfigsStore = useTemplateConfigsStore();
83
- templateConfigsStore.setCurrentConferenceConfig(
84
- template_config.config
85
- );
86
- }
87
- this.currentConference = data;
84
+ if (skipDetails === true) {
85
+ this.currentConference = conference;
88
86
  resolve(this.currentConference);
89
- });
87
+ } else {
88
+ request(
89
+ `conferences/${conference.id}?with=${conferenceDetailsQueryString()}`
90
+ ).then((response) => {
91
+ const {
92
+ data: { template_config, ...data }
93
+ } = response;
94
+ if (template_config) {
95
+ const templateConfigsStore = useTemplateConfigsStore();
96
+ templateConfigsStore.setCurrentConferenceConfig(
97
+ template_config.config
98
+ );
99
+ }
100
+ this.currentConference = data;
101
+ resolve(this.currentConference);
102
+ });
103
+ }
104
+ });
105
+ },
106
+ updateConferencesAccess(userConferences) {
107
+ userConferences.forEach((userConf) => {
108
+ const conf = find(this.conferenceList, { id: userConf.id });
109
+ conf.access = true;
90
110
  });
91
111
  }
92
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icvdeveloper/common-module",
3
- "version": "1.1.6",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {