@enfyra/sdk-nuxt 0.3.8 → 0.3.10

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.cjs CHANGED
@@ -13,8 +13,12 @@ const module$1 = kit.defineNuxtModule({
13
13
  apiUrl: ""
14
14
  },
15
15
  setup(options, nuxt) {
16
+ const normalizedOptions = {
17
+ ...options,
18
+ apiUrl: typeof options.apiUrl === "string" ? options.apiUrl.replace(/\/+$/, "") : options.apiUrl
19
+ };
16
20
  const { resolve } = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.cjs', document.baseURI).href)));
17
- if (!options.apiUrl) {
21
+ if (!normalizedOptions.apiUrl) {
18
22
  console.warn(
19
23
  `[Enfyra SDK Nuxt] Missing required configuration:
20
24
  - apiUrl is required
@@ -24,18 +28,18 @@ enfyraSDK: {
24
28
  }`
25
29
  );
26
30
  nuxt.options.runtimeConfig.public.enfyraSDK = {
27
- ...options,
31
+ ...normalizedOptions,
28
32
  apiPrefix: config_mjs.ENFYRA_API_PREFIX,
29
33
  configError: true,
30
34
  configErrorMessage: "Enfyra SDK: apiUrl is required. Please configure it in nuxt.config.ts"
31
35
  };
32
36
  } else {
33
37
  nuxt.options.runtimeConfig.public.enfyraSDK = {
34
- ...options,
38
+ ...normalizedOptions,
35
39
  apiPrefix: config_mjs.ENFYRA_API_PREFIX
36
40
  };
37
41
  }
38
- if (!options.apiUrl) {
42
+ if (!normalizedOptions.apiUrl) {
39
43
  kit.addPlugin({
40
44
  src: resolve("./runtime/plugin/config-error.client"),
41
45
  mode: "client"
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enfyra/sdk-nuxt",
3
3
  "configKey": "enfyraSDK",
4
- "version": "0.3.8",
4
+ "version": "0.3.10",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -10,8 +10,12 @@ const module = defineNuxtModule({
10
10
  apiUrl: ""
11
11
  },
12
12
  setup(options, nuxt) {
13
+ const normalizedOptions = {
14
+ ...options,
15
+ apiUrl: typeof options.apiUrl === "string" ? options.apiUrl.replace(/\/+$/, "") : options.apiUrl
16
+ };
13
17
  const { resolve } = createResolver(import.meta.url);
14
- if (!options.apiUrl) {
18
+ if (!normalizedOptions.apiUrl) {
15
19
  console.warn(
16
20
  `[Enfyra SDK Nuxt] Missing required configuration:
17
21
  - apiUrl is required
@@ -21,18 +25,18 @@ enfyraSDK: {
21
25
  }`
22
26
  );
23
27
  nuxt.options.runtimeConfig.public.enfyraSDK = {
24
- ...options,
28
+ ...normalizedOptions,
25
29
  apiPrefix: ENFYRA_API_PREFIX,
26
30
  configError: true,
27
31
  configErrorMessage: "Enfyra SDK: apiUrl is required. Please configure it in nuxt.config.ts"
28
32
  };
29
33
  } else {
30
34
  nuxt.options.runtimeConfig.public.enfyraSDK = {
31
- ...options,
35
+ ...normalizedOptions,
32
36
  apiPrefix: ENFYRA_API_PREFIX
33
37
  };
34
38
  }
35
- if (!options.apiUrl) {
39
+ if (!normalizedOptions.apiUrl) {
36
40
  addPlugin({
37
41
  src: resolve("./runtime/plugin/config-error.client"),
38
42
  mode: "client"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/sdk-nuxt",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "Nuxt SDK for Enfyra CMS",
5
5
  "repository": {
6
6
  "type": "git",
package/src/module.ts CHANGED
@@ -16,9 +16,17 @@ export default defineNuxtModule({
16
16
  apiUrl: "",
17
17
  },
18
18
  setup(options, nuxt) {
19
+ const normalizedOptions = {
20
+ ...options,
21
+ apiUrl:
22
+ typeof options.apiUrl === "string"
23
+ ? options.apiUrl.replace(/\/+$/, "")
24
+ : options.apiUrl,
25
+ };
26
+
19
27
  const { resolve } = createResolver(import.meta.url);
20
28
 
21
- if (!options.apiUrl) {
29
+ if (!normalizedOptions.apiUrl) {
22
30
  console.warn(
23
31
  `[Enfyra SDK Nuxt] Missing required configuration:\n` +
24
32
  `- apiUrl is required\n` +
@@ -29,20 +37,20 @@ export default defineNuxtModule({
29
37
  );
30
38
 
31
39
  nuxt.options.runtimeConfig.public.enfyraSDK = {
32
- ...options,
40
+ ...normalizedOptions,
33
41
  apiPrefix: ENFYRA_API_PREFIX,
34
42
  configError: true,
35
43
  configErrorMessage: 'Enfyra SDK: apiUrl is required. Please configure it in nuxt.config.ts'
36
44
  };
37
45
  } else {
38
46
  nuxt.options.runtimeConfig.public.enfyraSDK = {
39
- ...options,
47
+ ...normalizedOptions,
40
48
  apiPrefix: ENFYRA_API_PREFIX,
41
49
  };
42
50
  }
43
51
 
44
52
 
45
- if (!options.apiUrl) {
53
+ if (!normalizedOptions.apiUrl) {
46
54
  addPlugin({
47
55
  src: resolve("./runtime/plugin/config-error.client"),
48
56
  mode: 'client'