@plentymarkets/shop-core 1.17.1 → 1.18.1
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/README.md +19 -10
- package/dist/module.d.mts +1 -13
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -0
- package/dist/runtime/composables/localization/useEditorLocalizationLocales.d.ts +2 -2
- package/dist/runtime/composables/localization/useEditorLocalizationLocales.js +4 -4
- package/dist/runtime/composables/useNotification.js +5 -6
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/module.d.ts +12 -0
- package/dist/runtime/types/module.js +0 -0
- package/dist/runtime/utils/sdk/sdk.client.js +2 -1
- package/dist/types.d.mts +6 -2
- package/package.json +19 -7
package/README.md
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
# Shop Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Core nuxt module for PlentyONE shops enabling essential functionalities and integrations.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- EventBus to emit and listen to PlentyONE Shop events
|
|
8
|
-
- Register cookies
|
|
9
|
-
- React to cookie consent changes
|
|
5
|
+
- [📚 Documentation](https://pwa-docs.plentyone.com/guide/modules/shop-core/)
|
|
10
6
|
|
|
11
7
|
## Quick Setup
|
|
12
8
|
|
|
@@ -18,12 +14,18 @@ npx nuxi module add @plentymarkets/shop-core
|
|
|
18
14
|
|
|
19
15
|
## Contribution
|
|
20
16
|
|
|
17
|
+
To use the playground for developement and testing, follow these steps:
|
|
18
|
+
- Rename `.env.example` to `.env` and set your API security token:
|
|
19
|
+
```API_SECURITY_TOKEN="your-token-here"```
|
|
20
|
+
- Adjust `playground/nuxt.config.ts` if needed.
|
|
21
|
+
|
|
22
|
+
|
|
21
23
|
```bash
|
|
22
24
|
# Install dependencies
|
|
23
25
|
npm install
|
|
24
26
|
|
|
25
|
-
#
|
|
26
|
-
npm run
|
|
27
|
+
# Build the module and prepare
|
|
28
|
+
npm run go
|
|
27
29
|
|
|
28
30
|
# Develop with the playground
|
|
29
31
|
npm run dev
|
|
@@ -32,11 +34,18 @@ npm run dev
|
|
|
32
34
|
npm run dev:build
|
|
33
35
|
|
|
34
36
|
# Run ESLint
|
|
35
|
-
npm run lint
|
|
37
|
+
npm run lint:fix
|
|
36
38
|
|
|
37
|
-
# Run
|
|
39
|
+
# Run Prettier
|
|
40
|
+
npm run format:fix
|
|
41
|
+
|
|
42
|
+
# Run Vitest unit tests
|
|
38
43
|
npm run test
|
|
39
44
|
npm run test:watch
|
|
45
|
+
|
|
46
|
+
# Run playwright E2E tests
|
|
47
|
+
npm run test:e2e
|
|
48
|
+
npm run test:e2e:dev
|
|
40
49
|
```
|
|
41
50
|
|
|
42
51
|
<!-- Badges -->
|
package/dist/module.d.mts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { ModuleOptions } from '../dist/runtime/types/module.js';
|
|
2
3
|
export { Cookie, CookieGroup, CookieGroupFromNuxtConfig, Events, JsonCookie, LocalizationMessage, Notification, PaymentButtonComponent, PaymentButtonComponentProps } from '../dist/runtime/types/index.js';
|
|
3
4
|
|
|
4
|
-
interface ModuleOptions {
|
|
5
|
-
apiUrl: string;
|
|
6
|
-
apiEndpoint: string;
|
|
7
|
-
configId: number;
|
|
8
|
-
logger?: {
|
|
9
|
-
sdkPlugin?: {
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
verbose: boolean;
|
|
12
|
-
serverOnly: boolean;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
5
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
17
6
|
|
|
18
7
|
export { _default as default };
|
|
19
|
-
export type { ModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -80,6 +80,11 @@ const module$1 = defineNuxtModule({
|
|
|
80
80
|
as: "useSdk",
|
|
81
81
|
from: resolver.resolve("./runtime/composables/useSdk")
|
|
82
82
|
});
|
|
83
|
+
addImports({
|
|
84
|
+
name: "useCsrfToken",
|
|
85
|
+
as: "useCsrfToken",
|
|
86
|
+
from: resolver.resolve("./runtime/composables/useCsrfToken")
|
|
87
|
+
});
|
|
83
88
|
addImports({
|
|
84
89
|
name: "useNotification",
|
|
85
90
|
as: "useNotification",
|
|
@@ -7,7 +7,6 @@ export declare const allLanguages: {
|
|
|
7
7
|
es: string;
|
|
8
8
|
tr: string;
|
|
9
9
|
nl: string;
|
|
10
|
-
pl: string;
|
|
11
10
|
pt: string;
|
|
12
11
|
nn: string;
|
|
13
12
|
ro: string;
|
|
@@ -15,6 +14,7 @@ export declare const allLanguages: {
|
|
|
15
14
|
se: string;
|
|
16
15
|
cz: string;
|
|
17
16
|
ru: string;
|
|
17
|
+
pl: string;
|
|
18
18
|
sk: string;
|
|
19
19
|
cn: string;
|
|
20
20
|
vn: string;
|
|
@@ -29,7 +29,6 @@ export declare const useEditorLocalizationLocales: () => {
|
|
|
29
29
|
es: string;
|
|
30
30
|
tr: string;
|
|
31
31
|
nl: string;
|
|
32
|
-
pl: string;
|
|
33
32
|
pt: string;
|
|
34
33
|
nn: string;
|
|
35
34
|
ro: string;
|
|
@@ -37,6 +36,7 @@ export declare const useEditorLocalizationLocales: () => {
|
|
|
37
36
|
se: string;
|
|
38
37
|
cz: string;
|
|
39
38
|
ru: string;
|
|
39
|
+
pl: string;
|
|
40
40
|
sk: string;
|
|
41
41
|
cn: string;
|
|
42
42
|
vn: string;
|
|
@@ -9,7 +9,6 @@ export const allLanguages = {
|
|
|
9
9
|
es: "Spanish",
|
|
10
10
|
tr: "Turkish",
|
|
11
11
|
nl: "Dutch",
|
|
12
|
-
pl: "Polish",
|
|
13
12
|
pt: "Portuguese",
|
|
14
13
|
nn: "Norwegian",
|
|
15
14
|
ro: "Romanian",
|
|
@@ -17,9 +16,10 @@ export const allLanguages = {
|
|
|
17
16
|
se: "Swedish",
|
|
18
17
|
cz: "Czech",
|
|
19
18
|
ru: "Russian",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
pl: "Polish (No Item Search)",
|
|
20
|
+
sk: "Slovak (No Item Search)",
|
|
21
|
+
cn: "Chinese (No Item Search)",
|
|
22
|
+
vn: "Vietnamese (No Item Search)"
|
|
23
23
|
/*
|
|
24
24
|
fi: 'Finnish',
|
|
25
25
|
ga: 'Irish',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState } from "nuxt/app";
|
|
2
|
-
import { toRefs
|
|
2
|
+
import { toRefs } from "vue";
|
|
3
|
+
import { tryOnScopeDispose } from "@vueuse/core";
|
|
3
4
|
const maxVisibleNotifications = 5;
|
|
4
5
|
export const useNotification = (defaultDismissTimeout = 5e3) => {
|
|
5
6
|
const state = useState(`useNotification`, () => ({
|
|
@@ -39,11 +40,9 @@ export const useNotification = (defaultDismissTimeout = 5e3) => {
|
|
|
39
40
|
clearTimeouts();
|
|
40
41
|
state.value.data = [];
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
}
|
|
43
|
+
tryOnScopeDispose(() => {
|
|
44
|
+
clearTimeouts();
|
|
45
|
+
});
|
|
47
46
|
return {
|
|
48
47
|
send,
|
|
49
48
|
clear,
|
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { ApiError } from "@plentymarkets/shop-api";
|
|
3
|
+
import { isServer } from "../runtime.js";
|
|
3
4
|
export const handleHttpError = (error) => {
|
|
4
5
|
const axiosError = error;
|
|
5
6
|
const data = axiosError?.response?.data?.data || axiosError?.response?.data;
|
|
@@ -20,7 +21,7 @@ export const httpClient = async (url, params, config) => {
|
|
|
20
21
|
if (response.headers["x-csrf-token"] && response.data) {
|
|
21
22
|
response.data.csrfToken = response.headers["x-csrf-token"];
|
|
22
23
|
}
|
|
23
|
-
if (
|
|
24
|
+
if (isServer() && response.headers["set-cookie"] && response.data && typeof response.data === "object" && response.data !== null) {
|
|
24
25
|
response.data.setCookie = response.headers["set-cookie"];
|
|
25
26
|
}
|
|
26
27
|
return response.data;
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import type { NuxtModule } from '@nuxt/schema'
|
|
2
|
+
|
|
3
|
+
import type { default as Module } from './module.mjs'
|
|
4
|
+
|
|
5
|
+
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
|
+
|
|
1
7
|
export { type Cookie, type CookieGroup, type CookieGroupFromNuxtConfig, type Events, type JsonCookie, type LocalizationMessage, type Notification, type PaymentButtonComponent, type PaymentButtonComponentProps } from '../dist/runtime/types/index.js'
|
|
2
8
|
|
|
3
9
|
export { default } from './module.mjs'
|
|
4
|
-
|
|
5
|
-
export { type ModuleOptions } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plentymarkets/shop-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "Core module for PlentyONE Shop",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
"scripts": {
|
|
32
32
|
"go": "npm run dev:prepare && npm run prepack",
|
|
33
33
|
"prepack": "nuxt-module-build build",
|
|
34
|
-
"dev": "nuxi dev playground",
|
|
34
|
+
"dev": "concurrently -k -s first --names \"middleware,nuxt\" \"npm run middleware\" \"nuxi dev playground\"",
|
|
35
|
+
"start": "npm run dev:build && concurrently -k -s first --names \"middleware,nuxt\" \"npm run middleware\" \"nuxi start playground\"",
|
|
36
|
+
"middleware": "tsx playground/middleware-server.ts",
|
|
35
37
|
"dev:build": "nuxi build playground",
|
|
36
38
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
37
39
|
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
@@ -42,7 +44,9 @@
|
|
|
42
44
|
"test": "vitest run",
|
|
43
45
|
"test:coverage": "vitest run --coverage",
|
|
44
46
|
"test:watch": "vitest watch",
|
|
45
|
-
"test:types": "vue-tsc --noEmit"
|
|
47
|
+
"test:types": "vue-tsc --noEmit",
|
|
48
|
+
"test:e2e": "concurrently -k -s first --names \"server,playwright\" \"npm run start\" \"npx wait-on http-get://localhost:3000 && playwright test\"",
|
|
49
|
+
"test:e2e:dev": "concurrently -k -s first --names \"server,playwright\" \"npm run start\" \"npx wait-on http-get://localhost:3000 && playwright test --ui\""
|
|
46
50
|
},
|
|
47
51
|
"dependencies": {
|
|
48
52
|
"@plentymarkets/shop-api": "^0.152.2",
|
|
@@ -56,6 +60,7 @@
|
|
|
56
60
|
"prettier": "^3.6.2"
|
|
57
61
|
},
|
|
58
62
|
"devDependencies": {
|
|
63
|
+
"@testing-library/vue": "^8.1.0",
|
|
59
64
|
"@nuxt/devtools": "^3.1.0",
|
|
60
65
|
"@nuxt/eslint-config": "^0.7.6",
|
|
61
66
|
"@nuxt/kit": "^4.1.3",
|
|
@@ -63,23 +68,30 @@
|
|
|
63
68
|
"@nuxt/schema": "^4.1.3",
|
|
64
69
|
"@nuxt/test-utils": "^3.19.0",
|
|
65
70
|
"@nuxtjs/i18n": "9.5.4",
|
|
71
|
+
"@playwright/test": "^1.57.0",
|
|
66
72
|
"@types/node": "latest",
|
|
67
73
|
"@typescript-eslint/parser": "^8.47.0",
|
|
68
74
|
"@vitest/coverage-v8": "^3.2.4",
|
|
75
|
+
"@vue-storefront/middleware": "5.4.1",
|
|
69
76
|
"@vue/test-utils": "^2.4.6",
|
|
70
|
-
"
|
|
77
|
+
"@vueuse/core": "^14.1.0",
|
|
78
|
+
"changelogen": "^0.6.2",
|
|
79
|
+
"concurrently": "^9.2.1",
|
|
80
|
+
"dotenv": "16.6.1",
|
|
71
81
|
"eslint": "^9.24.0",
|
|
72
82
|
"eslint-config-prettier": "^9.1.0",
|
|
73
|
-
"eslint-plugin-ceviz": "^0.0.
|
|
83
|
+
"eslint-plugin-ceviz": "^0.0.6",
|
|
74
84
|
"eslint-plugin-vuejs-accessibility": "^2.4.1",
|
|
75
85
|
"happy-dom": "^20.0.2",
|
|
76
|
-
"nuxi": "3.
|
|
86
|
+
"nuxi": "3.32.0",
|
|
77
87
|
"nuxt": "^4.1.3",
|
|
78
88
|
"prettier": "^3.6.2",
|
|
89
|
+
"tsx": "^4.21.0",
|
|
79
90
|
"typescript": "~5.9.2",
|
|
80
91
|
"typescript-eslint": "^8.47.0",
|
|
81
92
|
"vitest": "^3.2.4",
|
|
82
93
|
"vue-eslint-parser": "^10.2.0",
|
|
83
|
-
"vue-tsc": "^2.2.8"
|
|
94
|
+
"vue-tsc": "^2.2.8",
|
|
95
|
+
"wait-on": "^9.0.3"
|
|
84
96
|
}
|
|
85
97
|
}
|