@icvdeveloper/common-module 0.0.73 → 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.73"
4
+ "version": "0.0.74"
5
5
  }
@@ -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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icvdeveloper/common-module",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {