@icvdeveloper/common-module 0.0.72 → 0.0.74

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
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "v3plus-common-module",
3
3
  "configKey": "v3plusCommonModule",
4
- "version": "0.0.72"
4
+ "version": "0.0.74"
5
5
  }
@@ -2,6 +2,6 @@ export type adobeLaunchFunctions = {
2
2
  /**
3
3
  * load script
4
4
  */
5
- loadAdobeLaunch: (scriptSrc: string) => void;
5
+ loadAdobeLaunch: () => void;
6
6
  };
7
7
  export declare const useAdobeLaunch: () => adobeLaunchFunctions;
@@ -1,17 +1,26 @@
1
1
  import { useRouter } from "vue-router";
2
2
  import { get } from "lodash-es";
3
+ import { usePortalStore } from "../store/portal.mjs";
3
4
  export const useAdobeLaunch = () => {
4
5
  const router = useRouter();
5
- const loadAdobeLaunch = (scriptSrc) => {
6
- let adtm = document.createElement("script");
7
- adtm.setAttribute("src", scriptSrc);
8
- document.head.appendChild(adtm);
9
- router.afterEach((to, from) => {
10
- if (get(window, "_satellite.track", false)) {
11
- window._satellite.setDebug(true);
12
- window._satellite.track("spaPageView");
13
- }
14
- });
6
+ const portalStore = usePortalStore();
7
+ const loadAdobeLaunch = () => {
8
+ if (portalStore.data.adobe_launch_url) {
9
+ let adtm = document.createElement("script");
10
+ adtm.setAttribute("src", portalStore.data.adobe_launch_url);
11
+ document.head.appendChild(adtm);
12
+ adtm.onload = () => {
13
+ if (get(window, "_satellite.track", false)) {
14
+ window._satellite.setDebug(true);
15
+ window._satellite.track("spaPageView");
16
+ }
17
+ };
18
+ router.afterEach((to, from) => {
19
+ if (get(window, "_satellite.track", false)) {
20
+ window._satellite.track("spaPageView");
21
+ }
22
+ });
23
+ }
15
24
  };
16
25
  return {
17
26
  loadAdobeLaunch
@@ -1,9 +1,9 @@
1
1
  export const useScripts = () => {
2
2
  const loadScripts = (scripts) => {
3
3
  scripts.forEach((src) => {
4
- let ucc = document.createElement("script");
5
- ucc.setAttribute("src", src);
6
- document.head.appendChild(ucc);
4
+ let _script = document.createElement("script");
5
+ _script.setAttribute("src", src);
6
+ document.head.appendChild(_script);
7
7
  });
8
8
  };
9
9
  return {
@@ -1,40 +1,45 @@
1
1
  import { get } from "lodash-es";
2
2
  import { useApi } from "./useApi.mjs";
3
+ import { useTemplateConfigsStore } from "../store/templateConfigs.mjs";
3
4
  export const useUcc = () => {
5
+ const { globalConfigValue } = useTemplateConfigsStore();
4
6
  const loadUccScript = (eventId) => {
5
- window.uccMixin = {};
6
- window.uccMixin.eventId = eventId;
7
- window.uccMixin.uccShowEventSignUp = uccShowEventSignUp;
8
- let ucc = document.createElement("script");
9
- ucc.setAttribute("src", "https://cssjs.nejm-qa.org/mmsWidgets.js");
10
- ucc.onload = () => {
11
- mmsWidgets.init({
12
- clientId: "6gw22dzjxwmgj6kekxkgwdshvyrx2uuz",
13
- // Akamai client id
14
- origin: "NEJMGroupEvents",
15
- debug: true,
16
- // set this false for production
17
- onReady: function() {
18
- console.log("UCC ready");
19
- },
20
- onLoginSuccess: function(ssoEvent) {
21
- console.log("UCC login success");
22
- },
23
- onAuthStateReady: function(ssoEvent) {
24
- console.log("UCC auth state ready");
25
- if (window.uccMixin.eventId) {
26
- window.uccMixin.uccShowEventSignUp(window.uccMixin.eventId);
7
+ if (globalConfigValue("ucc_url")) {
8
+ window.uccMixin = {};
9
+ window.uccMixin.clientId = globalConfigValue("ucc_client_id");
10
+ window.uccMixin.eventId = eventId;
11
+ window.uccMixin.uccShowEventSignUp = uccShowEventSignUp;
12
+ let ucc = document.createElement("script");
13
+ ucc.setAttribute("src", globalConfigValue("ucc_url"));
14
+ ucc.onload = () => {
15
+ mmsWidgets.init({
16
+ clientId: window.uccMixin.clientId,
17
+ // Akamai client id
18
+ origin: "NEJMGroupEvents",
19
+ debug: true,
20
+ // set this false for production
21
+ onReady: function() {
22
+ console.log("UCC ready");
23
+ },
24
+ onLoginSuccess: function(ssoEvent) {
25
+ console.log("UCC login success");
26
+ },
27
+ onAuthStateReady: function(ssoEvent) {
28
+ console.log("UCC auth state ready");
29
+ if (window.uccMixin.eventId) {
30
+ window.uccMixin.uccShowEventSignUp(window.uccMixin.eventId);
31
+ }
32
+ },
33
+ onRegistrationSuccess: function(ssoEvent) {
34
+ console.log("UCC reg success");
35
+ },
36
+ onLogoutSuccess: function(ssoEvent) {
37
+ console.log("UCC logout success");
27
38
  }
28
- },
29
- onRegistrationSuccess: function(ssoEvent) {
30
- console.log("UCC reg success");
31
- },
32
- onLogoutSuccess: function(ssoEvent) {
33
- console.log("UCC logout success");
34
- }
35
- });
36
- };
37
- document.head.appendChild(ucc);
39
+ });
40
+ };
41
+ document.head.appendChild(ucc);
42
+ }
38
43
  };
39
44
  const uccShowEventSignUp = (eventId) => {
40
45
  return new Promise((resolve, reject) => {
@@ -3,6 +3,7 @@ export type Portal = {
3
3
  name?: string;
4
4
  gtm_id?: string | null;
5
5
  ga_id?: string | null;
6
+ adobe_launch_url?: string | null;
6
7
  favicon?: string;
7
8
  description?: string | null;
8
9
  };
@@ -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,favicon,ga_id,gtm_id&with=template_config,navigation_config"
17
+ "portals/1?fields=id,name,description,favicon,ga_id,gtm_id,adobe_launch_url&with=template_config,navigation_config"
18
18
  ).then((response) => {
19
19
  const {
20
20
  data: { navigation_config, template_config, ...data }
@@ -80,8 +80,6 @@ export const useTemplateConfigsStore = defineStore("templateConfigs", {
80
80
  };
81
81
  },
82
82
  setConferenceConfig(conference) {
83
- console.log("setConferenceConfig conference", conference);
84
- console.log("setConferenceConfig conferences", this.conferences);
85
83
  const newPagesConfig = this.portalConfig.pages;
86
84
  const confPagesConfig = {};
87
85
  const conferenceTemplateConfig = conference.template_config ?? {};
@@ -98,7 +96,6 @@ export const useTemplateConfigsStore = defineStore("templateConfigs", {
98
96
  }
99
97
  });
100
98
  this.conferences[conference.id] = newPagesConfig;
101
- console.log("setConferenceConfig conference", conference);
102
99
  }
103
100
  }
104
101
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icvdeveloper/common-module",
3
- "version": "0.0.72",
3
+ "version": "0.0.74",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {