@icvdeveloper/common-module 1.0.7 → 1.1.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,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 1.1.0 - 2023-10-05
11
+
10
12
  ## 1.0.7 - 2023-10-04
11
13
 
12
14
  ## 1.0.6 - 2023-09-25
@@ -0,0 +1,28 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ declare enum ConferenceState {
4
+ LIVE = "live",
5
+ MIXED = "mixed",
6
+ ARCHIVED = "archive",
7
+ UPCOMING = "upcoming",
8
+ HIDDEN = "hidden"
9
+ }
10
+ declare enum PresentationType {
11
+ ZOOM = "zoom",
12
+ VIDEO_SLIDE = "video_slide",
13
+ VIDEO = "video",
14
+ AUDIO_SLIDE = "audio_slide",
15
+ AUDIO = "audio",
16
+ EMBED = "embed",
17
+ LINK = "link"
18
+ }
19
+
20
+ interface ModuleOptions {
21
+ portalHash?: null | string;
22
+ apiUrl?: null | string;
23
+ tailwindConfigPath?: null | string;
24
+ compileCss?: boolean;
25
+ }
26
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
27
+
28
+ export { ConferenceState, type ModuleOptions, PresentationType, _default as default };
package/dist/module.d.ts CHANGED
@@ -25,4 +25,4 @@ interface ModuleOptions {
25
25
  }
26
26
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
27
27
 
28
- export { ConferenceState, ModuleOptions, PresentationType, _default as default };
28
+ export { ConferenceState, type ModuleOptions, PresentationType, _default as default };
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "v3plus-common-module",
3
3
  "configKey": "v3plusCommonModule",
4
- "version": "1.0.7"
4
+ "version": "1.1.0"
5
5
  }
package/dist/module.mjs CHANGED
@@ -45,17 +45,6 @@ const module = defineNuxtModule({
45
45
  async setup(options, nuxt) {
46
46
  const logger = useLogger();
47
47
  const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
48
- if (nuxt.options.ssr) {
49
- throw new Error("V3plusCommonModule does not support SSR");
50
- }
51
- if (!options.portalHash) {
52
- throw new Error(
53
- "v3plusCommonModule.portalHash is not set in nuxt.config.ts"
54
- );
55
- }
56
- if (!options.apiUrl) {
57
- throw new Error("v3plusCommonModule.apiUrl is not set in nuxt.config.ts");
58
- }
59
48
  nuxt.options.runtimeConfig.public.v3plusCommonModule = {
60
49
  version: require("../package.json").version,
61
50
  apiUrl: options.apiUrl,
@@ -12,5 +12,5 @@ declare const _default: import("vue").DefineComponent<{
12
12
  };
13
13
  }>>, {
14
14
  template: string;
15
- }>;
15
+ }, {}>;
16
16
  export default _default;
@@ -71,16 +71,10 @@ const { classBinding } = useClassBinding();
71
71
  cursor: pointer;
72
72
  }
73
73
  .switch-button-control .switch-button .button {
74
- height: calc(
75
- 1.6em - (2 * 2px)
76
- );
77
- width: calc(
78
- 1.6em - (2 * 2px)
79
- );
74
+ height: calc(1.6em - 2 * 2px);
75
+ width: calc(1.6em - 2 * 2px);
80
76
  border: 2px solid var(--color);
81
- border-radius: calc(
82
- 1.6em - (2 * 2px)
83
- );
77
+ border-radius: calc(1.6em - 2 * 2px);
84
78
  background: var(--color);
85
79
  transition: all 0.3s ease-in-out;
86
80
  }
@@ -90,7 +84,7 @@ const { classBinding } = useClassBinding();
90
84
  }
91
85
  .switch-button-control .switch-button.enabled .button {
92
86
  background: white;
93
- transform: translateX(calc(calc( 1.6em - (2 * 2px) ) + (2 *2px)));
87
+ transform: translateX(calc(calc(1.6em - 2 * 2px) + 2 * 2px));
94
88
  }
95
89
  .switch-button-control .switch-button-label {
96
90
  margin-left: 10px;
@@ -10,18 +10,18 @@ declare namespace _default {
10
10
  function data(): {};
11
11
  namespace props {
12
12
  namespace currentPresentation {
13
- export const type: ObjectConstructor;
13
+ export let type: ObjectConstructor;
14
14
  function _default(): {};
15
15
  export { _default as default };
16
16
  }
17
17
  namespace tabArray {
18
- const type_1: ArrayConstructor;
18
+ let type_1: ArrayConstructor;
19
19
  export { type_1 as type };
20
20
  function _default_1(): never[];
21
21
  export { _default_1 as default };
22
22
  }
23
23
  }
24
- const computed: any;
25
- const methods: {};
24
+ let computed: any;
25
+ let methods: {};
26
26
  }
27
27
  export default _default;
@@ -1,8 +1,8 @@
1
1
  declare namespace _default {
2
2
  namespace props {
3
3
  namespace url {
4
- const type: StringConstructor;
5
- const required: boolean;
4
+ let type: StringConstructor;
5
+ let required: boolean;
6
6
  }
7
7
  function ajaxLoadingOptions(): {
8
8
  progress: boolean;
@@ -1,20 +1,20 @@
1
1
  declare namespace _default {
2
2
  namespace props {
3
3
  namespace itemWidth {
4
- export const type: StringConstructor;
5
- const _default: string;
4
+ export let type: StringConstructor;
5
+ let _default: string;
6
6
  export { _default as default };
7
7
  }
8
8
  namespace layoutFormat {
9
- const type_1: StringConstructor;
9
+ let type_1: StringConstructor;
10
10
  export { type_1 as type };
11
- const _default_1: string;
11
+ let _default_1: string;
12
12
  export { _default_1 as default };
13
13
  }
14
14
  namespace isCompact {
15
- const _default_2: boolean;
15
+ let _default_2: boolean;
16
16
  export { _default_2 as default };
17
- const type_2: BooleanConstructor;
17
+ let type_2: BooleanConstructor;
18
18
  export { type_2 as type };
19
19
  }
20
20
  }
@@ -9,12 +9,12 @@ declare namespace _default {
9
9
  };
10
10
  namespace props {
11
11
  namespace tabArray {
12
- export const type: ArrayConstructor;
13
- const _default: never[];
12
+ export let type: ArrayConstructor;
13
+ let _default: never[];
14
14
  export { _default as default };
15
15
  }
16
16
  namespace startSize {
17
- const type_1: ObjectConstructor;
17
+ let type_1: ObjectConstructor;
18
18
  export { type_1 as type };
19
19
  function _default_1(): {
20
20
  width: number;
@@ -23,7 +23,7 @@ declare namespace _default {
23
23
  export { _default_1 as default };
24
24
  }
25
25
  namespace startPosition {
26
- const type_2: ObjectConstructor;
26
+ let type_2: ObjectConstructor;
27
27
  export { type_2 as type };
28
28
  function _default_2(): {
29
29
  x: number;
@@ -32,7 +32,7 @@ declare namespace _default {
32
32
  export { _default_2 as default };
33
33
  }
34
34
  namespace currentPresentation {
35
- const type_3: ObjectConstructor;
35
+ let type_3: ObjectConstructor;
36
36
  export { type_3 as type };
37
37
  function _default_3(): {};
38
38
  export { _default_3 as default };
@@ -4,12 +4,12 @@ declare namespace _default {
4
4
  };
5
5
  namespace props {
6
6
  namespace slide {
7
- export const type: StringConstructor;
8
- const _default: string;
7
+ export let type: StringConstructor;
8
+ let _default: string;
9
9
  export { _default as default };
10
10
  }
11
11
  namespace startSize {
12
- const type_1: ObjectConstructor;
12
+ let type_1: ObjectConstructor;
13
13
  export { type_1 as type };
14
14
  function _default_1(): {
15
15
  width: number;
@@ -18,7 +18,7 @@ declare namespace _default {
18
18
  export { _default_1 as default };
19
19
  }
20
20
  namespace startPosition {
21
- const type_2: ObjectConstructor;
21
+ let type_2: ObjectConstructor;
22
22
  export { type_2 as type };
23
23
  function _default_2(): {
24
24
  width: number;
@@ -9,7 +9,7 @@ import {
9
9
  useTemplateConfigsStore,
10
10
  useConferencesStore,
11
11
  useAuthStore
12
- } from "../store";
12
+ } from "../store/index.mjs";
13
13
  const config = useRuntimeConfig();
14
14
  const getConferenceConfigMainValue = (_conference, _name) => {
15
15
  const configPages = get(_conference, "template_config.config.pages", []);
@@ -5,7 +5,7 @@ import {
5
5
  useConferencesStore,
6
6
  useAuthStore,
7
7
  useTemplateConfigsStore
8
- } from "../store";
8
+ } from "../store/index.mjs";
9
9
  import { useConferenceHelpers } from "./useConferenceHelpers.mjs";
10
10
  export const useLogin = (conference) => {
11
11
  const { login } = useAuthStore();
@@ -3,7 +3,7 @@ import { DateTime } from "luxon";
3
3
  import { useTemplateConfigsStore } from "../store/index.mjs";
4
4
  import {
5
5
  ConferenceState
6
- } from "../models/conference";
6
+ } from "../models/conference.mjs";
7
7
  import { useConferenceHelpers } from "./useConferenceHelpers.mjs";
8
8
  export const usePresentation = (conference) => {
9
9
  const { pagesConfigValue } = useTemplateConfigsStore();
@@ -1,5 +1,5 @@
1
- import { defineNuxtPlugin } from "#app";
2
- import { computed } from "vue";
1
+ import { defineNuxtPlugin, useRouter } from "#app";
2
+ import { useSeoMeta, useHead } from "#imports";
3
3
  import { storeToRefs } from "pinia";
4
4
  import { get, find } from "lodash-es";
5
5
  import NProgress from "nprogress";
@@ -11,6 +11,7 @@ import { useNavigationConfigStore } from "./store/navigationConfig.mjs";
11
11
  import { useConferencesStore } from "./store/conferences.mjs";
12
12
  import { usePresentationsStore } from "./store/presentations.mjs";
13
13
  export default defineNuxtPlugin((nuxtApp) => {
14
+ const router = useRouter();
14
15
  const { version, portalHash, apiUrl } = nuxtApp.payload.config.public.v3plusCommonModule;
15
16
  const v3plusCommonModule = createV3plusCommonPlugin({
16
17
  version,
@@ -18,20 +19,15 @@ export default defineNuxtPlugin((nuxtApp) => {
18
19
  apiUrl
19
20
  });
20
21
  nuxtApp.$pinia.use(piniaPluginPersistedstate);
21
- nuxtApp.$router.beforeEach(async (to, from) => {
22
+ router.beforeEach(async (to, from) => {
22
23
  NProgress.start();
23
24
  const portalStore = usePortalStore();
24
25
  const conferencesStore = useConferencesStore();
25
26
  const presentationsStore = usePresentationsStore();
27
+ const { data: navigation } = storeToRefs(useNavigationConfigStore());
26
28
  const { data: portal, errors: portalErrors } = storeToRefs(
27
29
  usePortalStore()
28
30
  );
29
- const { selectedConference } = storeToRefs(
30
- useConferencesStore()
31
- );
32
- const { data: navigation } = storeToRefs(
33
- useNavigationConfigStore()
34
- );
35
31
  const stripHtml = (html) => {
36
32
  const div = document.createElement("div");
37
33
  div.innerHTML = html;
@@ -39,7 +35,7 @@ export default defineNuxtPlugin((nuxtApp) => {
39
35
  return text;
40
36
  };
41
37
  let docTitle = "";
42
- let routeArray = to.name.toLowerCase().split("-");
38
+ const routeArray = to.name.toLowerCase().split("-");
43
39
  if (portal.value === null) {
44
40
  Promise.all([
45
41
  // fetch portal config then increment loading indicator
@@ -78,68 +74,42 @@ export default defineNuxtPlugin((nuxtApp) => {
78
74
  if (!docTitle && portal.value) {
79
75
  docTitle = portal.value.name;
80
76
  if (to.name != "index") {
81
- let navObj = find(
82
- navigation.value,
83
- function(nav) {
84
- return nav.slug == to.name || nav.url == to.path;
85
- }
86
- );
77
+ const navObj = find(navigation.value, function(nav) {
78
+ return nav.slug == to.name || nav.url == to.path;
79
+ });
87
80
  if (navObj) {
88
81
  docTitle += ` | ${navObj.label}`;
89
82
  } else {
90
- let routeName = routeArray.map(
91
- function(word) {
92
- return word.charAt(0).toUpperCase() + word.slice(1);
93
- }
94
- ).join(" ");
83
+ const routeName = routeArray.map(function(word) {
84
+ return word.charAt(0).toUpperCase() + word.slice(1);
85
+ }).join(" ");
95
86
  docTitle += ` | ${routeName}`;
96
87
  }
97
88
  }
98
89
  }
99
- document.title = docTitle;
100
- let canonicalUrl = "https://" + portal.value.domain + to.path;
101
- if (document.querySelector("link[rel='canonical']")) {
102
- document.querySelector("link[rel='canonical']").setAttribute("href", canonicalUrl);
103
- } else {
104
- let canonicalTag = document.createElement("link");
105
- canonicalTag.rel = "canonical";
106
- canonicalTag.href = canonicalUrl;
107
- document.querySelector("head").appendChild(canonicalTag);
108
- }
90
+ useHead({
91
+ title: docTitle
92
+ });
93
+ const canonicalUrl = "https://" + portal.value.domain + to.path;
109
94
  let metaDesc = portal.value.description;
110
95
  if (get(presentationsStore, "selectedPresentation.description.length", 0) > 0) {
111
96
  metaDesc = stripHtml(presentationsStore.selectedPresentation.description);
112
97
  } else if (get(conferencesStore, "selectedConference.description.length", 0) > 0) {
113
98
  metaDesc = stripHtml(conferencesStore.selectedConference.description);
114
99
  }
115
- if (document.querySelector("meta[name='description']")) {
116
- document.querySelector("meta[name='description']").setAttribute("content", metaDesc);
117
- } else {
118
- let metaTag = document.createElement("meta");
119
- metaTag.name = "description";
120
- metaTag.content = metaDesc;
121
- document.querySelector("head").appendChild(metaTag);
122
- }
123
- let ogTitleTag = document.createElement("meta");
124
- ogTitleTag.name = "og:title";
125
- ogTitleTag.content = docTitle;
126
- document.querySelector("head").appendChild(ogTitleTag);
127
- let ogTypeTag = document.createElement("meta");
128
- ogTypeTag.name = "og:type";
129
- ogTypeTag.content = "website";
130
- document.querySelector("head").appendChild(ogTypeTag);
100
+ useSeoMeta({
101
+ description: metaDesc,
102
+ ogTitle: docTitle,
103
+ ogType: "website",
104
+ ogUrl: canonicalUrl
105
+ });
131
106
  if (get(conferencesStore, "selectedConference.photo.length", 0) > 0) {
132
- let ogImageTag = document.createElement("meta");
133
- ogImageTag.name = "og:image";
134
- ogImageTag.content = get(conferencesStore, "selectedConference.photo");
135
- document.querySelector("head").appendChild(ogImageTag);
107
+ useSeoMeta({
108
+ ogImage: get(conferencesStore, "selectedConference.photo")
109
+ });
136
110
  }
137
- let ogUrlTag = document.createElement("meta");
138
- ogUrlTag.name = "og:url";
139
- ogUrlTag.content = canonicalUrl;
140
- document.querySelector("head").appendChild(ogUrlTag);
141
111
  });
142
- nuxtApp.$router.afterEach(() => {
112
+ router.afterEach(() => {
143
113
  NProgress.done();
144
114
  });
145
115
  nuxtApp.hook("app:created", (app) => {
@@ -148,25 +118,20 @@ export default defineNuxtPlugin((nuxtApp) => {
148
118
  let customCss = globalConfigValue("custom_css") || "";
149
119
  customCss = customCss.length > 0 ? customCss.replace(/\n/g, "") : "";
150
120
  if (portal.value) {
151
- app.config.globalProperties.$head.addHeadObjs(
152
- computed(() => {
153
- return {
154
- link: [
155
- {
156
- rel: "icon",
157
- type: "image/x-icon",
158
- href: portal.value.favicon
159
- }
160
- ],
161
- style: [
162
- {
163
- type: "text/css",
164
- children: customCss
165
- }
166
- ]
167
- };
168
- })
169
- );
121
+ useHead({
122
+ link: [
123
+ {
124
+ rel: "icon",
125
+ type: "image/x-icon",
126
+ href: portal.value.favicon
127
+ }
128
+ ],
129
+ style: [
130
+ {
131
+ children: customCss
132
+ }
133
+ ]
134
+ });
170
135
  } else {
171
136
  console.warn(
172
137
  "[V3Plus Common Module]: Portal has not been fetched. Could not set Meta Data"
@@ -2,24 +2,7 @@ import { defineStore } from "pinia";
2
2
  import { merge } from "lodash-es";
3
3
  import { useApi } from "../composables/useApi.mjs";
4
4
  import { useConferencesStore } from "./conferences.mjs";
5
- import { DateTime } from "luxon";
6
5
  export const useAuthStore = defineStore("auth", {
7
- persist: {
8
- afterRestore(context) {
9
- if (context.store.$state.user) {
10
- const user = context.store.$state.user;
11
- const now = DateTime.now().setZone("utc");
12
- const expiration = DateTime.fromFormat(
13
- user.expires_at,
14
- "yyyy-MM-dd HH:mm:ss",
15
- { zone: "utc" }
16
- ).minus({ hours: 2 });
17
- if (now >= expiration) {
18
- context.store.reset();
19
- }
20
- }
21
- }
22
- },
23
6
  state: () => ({
24
7
  user: null
25
8
  }),
@@ -0,0 +1,15 @@
1
+
2
+ import { ModuleOptions } from './module'
3
+
4
+ declare module '@nuxt/schema' {
5
+ interface NuxtConfig { ['v3plusCommonModule']?: Partial<ModuleOptions> }
6
+ interface NuxtOptions { ['v3plusCommonModule']?: ModuleOptions }
7
+ }
8
+
9
+ declare module 'nuxt/schema' {
10
+ interface NuxtConfig { ['v3plusCommonModule']?: Partial<ModuleOptions> }
11
+ interface NuxtOptions { ['v3plusCommonModule']?: ModuleOptions }
12
+ }
13
+
14
+
15
+ export { ConferenceState, ModuleOptions, PresentationType, default } from './module'
package/dist/types.d.ts CHANGED
@@ -6,5 +6,10 @@ declare module '@nuxt/schema' {
6
6
  interface NuxtOptions { ['v3plusCommonModule']?: ModuleOptions }
7
7
  }
8
8
 
9
+ declare module 'nuxt/schema' {
10
+ interface NuxtConfig { ['v3plusCommonModule']?: Partial<ModuleOptions> }
11
+ interface NuxtOptions { ['v3plusCommonModule']?: ModuleOptions }
12
+ }
13
+
9
14
 
10
15
  export { ConferenceState, ModuleOptions, PresentationType, default } from './module'
package/package.json CHANGED
@@ -1,29 +1,30 @@
1
1
  {
2
2
  "name": "@icvdeveloper/common-module",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
+ "types": "./dist/types.d.ts",
8
9
  "import": "./dist/module.mjs",
9
10
  "require": "./dist/module.cjs"
10
11
  }
11
12
  },
12
- "main": "./dist/module.mjs",
13
+ "main": "./dist/module.cjs",
13
14
  "types": "./dist/types.d.ts",
14
15
  "files": [
15
16
  "dist"
16
17
  ],
17
18
  "scripts": {
18
- "prepack": "nuxt-module-build",
19
+ "prepack": "nuxt-module-build build",
19
20
  "dev": "nuxi dev playground",
20
21
  "dev:build": "nuxi build playground",
21
22
  "dev:docker": "rm -rf /tmp/nitro && nuxi dev --host 0.0.0.0 --port 3005 playground",
22
- "dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
23
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground"
23
24
  },
24
25
  "dependencies": {
25
26
  "@analytics/google-analytics": "^1.0.3",
26
- "@nuxt/kit": "^3.0.0",
27
+ "@nuxt/kit": "^3.7.4",
27
28
  "@nuxtjs/tailwindcss": "^6.1.3",
28
29
  "@pinia/nuxt": "^0.3.1",
29
30
  "@ts-pro/vue-eternal-loading": "^1.3.1",
@@ -43,13 +44,20 @@
43
44
  "vite-svg-loader": "^3.4.0"
44
45
  },
45
46
  "devDependencies": {
46
- "@nuxt/module-builder": "^0.2.1",
47
+ "@nuxt/devtools": "latest",
48
+ "@nuxt/eslint-config": "^0.2.0",
49
+ "@nuxt/module-builder": "^0.5.2",
50
+ "@nuxt/schema": "^3.7.4",
51
+ "@nuxt/test-utils": "^3.7.4",
47
52
  "@nuxtjs/eslint-config-typescript": "^12.0.0",
48
53
  "@tailwindcss/typography": "^0.5.4",
49
54
  "@types/lodash-es": "^4.17.7",
55
+ "@types/luxon": "^3.3.2",
56
+ "@types/node": "^18.18.1",
50
57
  "eslint": "^8.22.0",
51
58
  "eslint-config-prettier": "^8.5.0",
52
- "nuxt": "^3.0.0"
59
+ "nuxt": "^3.7.4",
60
+ "vitest": "^0.33.0"
53
61
  },
54
62
  "description": "## Development",
55
63
  "repository": {