@lilaquadrat/design-core 0.2.1 → 0.3.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/README.md +76 -3
- package/html/index.server.html +1 -8
- package/package.json +54 -54
- package/src/client-entry.ts +8 -8
- package/src/components/partials/error.partial.vue +19 -19
- package/src/components/partials/main-components.partial.vue +75 -70
- package/src/components/partials/qrcode.partial.vue +8 -8
- package/src/functions/AuthProviderFactory.ts +30 -0
- package/src/functions/PaymenyProviderFactory.ts +11 -11
- package/src/functions/auth0.provider.ts +75 -0
- package/src/functions/keycloak.provider.ts +228 -0
- package/src/functions/lila-dom.ts +50 -50
- package/src/functions/shopify.provider.ts +176 -154
- package/src/functions/stripe.provider.ts +120 -108
- package/src/globals.d.ts +1 -2
- package/src/index.ts +9 -7
- package/src/interfaces/AuthCallbackResult.interface.ts +5 -0
- package/src/interfaces/AuthConfig.interface.ts +13 -0
- package/src/interfaces/AuthProvider.interface.ts +15 -0
- package/src/interfaces/FrontendConfig.interface.ts +11 -40
- package/src/interfaces/GenericEvents.interface.ts +1 -1
- package/src/interfaces/IdTokenExtended.interface.ts +13 -4
- package/src/interfaces/PaymentProvider.interface.ts +2 -2
- package/src/interfaces/RenderOptions.interface.ts +12 -0
- package/src/libs/ActionNotice.ts +125 -125
- package/src/libs/Models.class.ts +219 -221
- package/src/main.ts +41 -36
- package/src/mixins/createCookieString.ts +50 -36
- package/src/mixins/createModelDeclaration.ts +22 -19
- package/src/mixins/createRouter.ts +12 -12
- package/src/mixins/date.ts +4 -2
- package/src/mixins/formatSize.ts +5 -5
- package/src/mixins/getAnchor.ts +1 -1
- package/src/mixins/getRoutes.ts +13 -25
- package/src/mixins/hasSlotContent.ts +22 -16
- package/src/mixins/hooks.ts +101 -60
- package/src/mixins/loadComponents.ts +60 -58
- package/src/mixins/logger.ts +17 -13
- package/src/mixins/replaceVariables.ts +10 -8
- package/src/mixins/scroll.ts +61 -45
- package/src/models/Address.model.ts +7 -7
- package/src/models/Contact.model.ts +14 -14
- package/src/plugins/analytics.ts +198 -0
- package/src/plugins/auth.ts +74 -60
- package/src/plugins/currency.ts +10 -10
- package/src/plugins/events.ts +101 -97
- package/src/plugins/filters.ts +21 -18
- package/src/plugins/replacer.ts +7 -6
- package/src/plugins/signupFlow.ts +45 -43
- package/src/plugins/traceable.ts +28 -26
- package/src/plugins/translations.ts +9 -9
- package/src/plugins/youtube.ts +39 -34
- package/src/routes.ts +108 -108
- package/src/server-entry.ts +75 -77
- package/src/stores/calls.store.ts +14 -14
- package/src/stores/cart.store.ts +116 -107
- package/src/stores/content.store.ts +87 -45
- package/src/stores/editor.store.ts +16 -16
- package/src/stores/files.store.ts +72 -72
- package/src/stores/main.store.ts +155 -109
- package/src/stores/user.store.ts +72 -68
- package/src/translations/de.ts +127 -127
- package/src/views/content.view.vue +81 -143
- package/src/views/download.view.vue +25 -23
- package/src/views/editor.view.vue +150 -125
- package/src/views/login.view.vue +35 -36
- package/src/views/signup-account.view.vue +14 -14
- package/tooling/cypress/config.ts +68 -54
- package/tooling/cypress/manifest-utils.mjs +34 -22
- package/tooling/cypress/run-parallel.mjs +41 -35
- package/tooling/cypress/support/commands.ts +458 -300
- package/tooling/eslint.config.js +1 -223
- package/tooling/preview.plugin.js +132 -0
- package/tooling/ssr-test/index.mjs +205 -203
- package/tooling/vite.d.ts +36 -0
- package/tooling/vite.js +234 -0
- package/src/interfaces/EditorConfiguration.interface.ts +0 -15
- package/tooling/preview.plugin.ts +0 -134
- package/tooling/stylelint.config.mjs +0 -24
- package/tooling/vite.ts +0 -260
package/src/libs/ActionNotice.ts
CHANGED
|
@@ -19,31 +19,31 @@ export interface ErrorsObject {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export default class ActionNotice {
|
|
22
|
-
|
|
22
|
+
error: any;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
static parse(errors: ErrorObject[], translationPre: string | undefined, structureMappings: Record<string, string> | undefined): ErrorsObject {
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
const parsedErrors: ErrorsObject = {};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
errors?.forEach((single) => {
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
ActionNotice.parseSingle(single, translationPre, parsedErrors, structureMappings);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
});
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
return parsedErrors;
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
static parseSingle(error: ErrorObject, translationPre: string | undefined, errors: ErrorsObject, structureMappings: Record<string, string> | undefined) {
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
const pathArray = error.instancePath.split('/').filter((single) => single);
|
|
41
|
+
// check if the second element is a number, to determine if we are inside of a array
|
|
42
|
+
const arrayElementIndex = !Number.isNaN(pathArray[1]) ? +pathArray[1] + 1 : null;
|
|
43
|
+
const messageResponse = ActionNotice.getParsedError(error, pathArray[0], undefined, translationPre, structureMappings);
|
|
44
|
+
const path = messageResponse.path || pathArray[0];
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
47
|
pathArray has a number as second element and a element after this number
|
|
48
48
|
only a numbers would mean that the array needs to have a valid element
|
|
49
49
|
```JSON
|
|
@@ -55,181 +55,181 @@ export default class ActionNotice {
|
|
|
55
55
|
```
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
if (arrayElementIndex) {
|
|
59
|
+
|
|
60
|
+
const arrayMessageResponse = ActionNotice.getParsedError(error, pathArray[0], pathArray[0], translationPre, structureMappings);
|
|
61
|
+
const useKey = `${pathArray[0]}-elements`;
|
|
62
|
+
const useIndex = (arrayElementIndex - 1).toString();
|
|
63
|
+
let useError = errors[useKey] as unknown as Record<string, Record<string, ParsedError>>;
|
|
59
64
|
|
|
60
|
-
|
|
61
|
-
const useKey = `${pathArray[0]}-elements`;
|
|
62
|
-
const useIndex = (arrayElementIndex - 1).toString();
|
|
63
|
-
let useError = errors[useKey] as unknown as Record<string, Record<string, ParsedError>>;
|
|
65
|
+
if (!useError) useError = {} as Record<string, Record<string, ParsedError>>;
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
if (!useError[useIndex]) useError[useIndex] = {};
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
useError[useIndex][path] = arrayMessageResponse;
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
} else {
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
errors[path] = messageResponse;
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
}
|
|
74
76
|
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
static getParsedError(error: ErrorObject, usePath: string, basePath: string | undefined, translationPre: string | undefined, structureMappings: Record<string, string> | undefined): ParsedError {
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
let message: string = '';
|
|
82
|
+
let path = usePath;
|
|
83
|
+
let translatedPath: string = '';
|
|
84
|
+
const mappedErrorParams = ActionNotice.mapErrorParams(Object.values(error.params), structureMappings);
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
let path = usePath;
|
|
83
|
-
let translatedPath: string = '';
|
|
84
|
-
const mappedErrorParams = ActionNotice.mapErrorParams(Object.values(error.params), structureMappings);
|
|
86
|
+
console.log('error', mappedErrorParams);
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
console.log('error', Object.values(error.params));
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
if (error.keyword === 'type') {
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
message = t(
|
|
93
|
+
`validation-error-type-${error.params.type}`,
|
|
94
|
+
);
|
|
91
95
|
|
|
92
|
-
|
|
93
|
-
`validation-error-type-${error.params.type}`,
|
|
94
|
-
);
|
|
96
|
+
}
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
if (error.keyword === 'minLength' || error.keyword === 'maxLength') {
|
|
97
99
|
|
|
98
|
-
|
|
100
|
+
message = t(
|
|
101
|
+
`validation-error-${error.keyword}`,
|
|
102
|
+
mappedErrorParams
|
|
103
|
+
);
|
|
99
104
|
|
|
100
|
-
|
|
101
|
-
`validation-error-${error.keyword}`,
|
|
102
|
-
mappedErrorParams
|
|
103
|
-
);
|
|
105
|
+
}
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
if (error.keyword === 'maxItems' || error.keyword === 'minItems') {
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
message = t(
|
|
110
|
+
`validation-error-${error.keyword}`,
|
|
111
|
+
mappedErrorParams
|
|
112
|
+
);
|
|
108
113
|
|
|
109
|
-
|
|
110
|
-
`validation-error-${error.keyword}`,
|
|
111
|
-
mappedErrorParams
|
|
112
|
-
);
|
|
114
|
+
}
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
if (error.keyword === 'contains') {
|
|
115
117
|
|
|
116
|
-
|
|
118
|
+
message = t(
|
|
119
|
+
`validation-error-${error.keyword}`,
|
|
120
|
+
mappedErrorParams
|
|
121
|
+
);
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
`validation-error-${error.keyword}`,
|
|
120
|
-
mappedErrorParams
|
|
121
|
-
);
|
|
123
|
+
}
|
|
122
124
|
|
|
123
|
-
|
|
125
|
+
if (error.keyword === 'additionalProperties') {
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
message = t(
|
|
128
|
+
`validation-error-${error.keyword}`,
|
|
129
|
+
mappedErrorParams,
|
|
130
|
+
);
|
|
126
131
|
|
|
127
|
-
|
|
128
|
-
`validation-error-${error.keyword}`,
|
|
129
|
-
mappedErrorParams,
|
|
130
|
-
);
|
|
132
|
+
translatedPath = 'main';
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
}
|
|
133
135
|
|
|
134
|
-
|
|
136
|
+
if (error.keyword === 'required') {
|
|
135
137
|
|
|
136
|
-
|
|
138
|
+
message = t(
|
|
139
|
+
`validation-error-${error.keyword}`,
|
|
140
|
+
mappedErrorParams
|
|
141
|
+
);
|
|
137
142
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
mappedErrorParams
|
|
141
|
-
);
|
|
143
|
+
translatedPath = '';
|
|
144
|
+
path = error.params.missingProperty;
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
path = error.params.missingProperty;
|
|
146
|
+
}
|
|
145
147
|
|
|
146
|
-
|
|
148
|
+
if (error.keyword === 'enum') {
|
|
147
149
|
|
|
148
|
-
|
|
150
|
+
message = t(
|
|
151
|
+
`validation-error-${error.keyword}`,
|
|
152
|
+
[mappedErrorParams.join(',')],
|
|
153
|
+
);
|
|
149
154
|
|
|
150
|
-
|
|
151
|
-
`validation-error-${error.keyword}`,
|
|
152
|
-
[mappedErrorParams.join(',')],
|
|
153
|
-
);
|
|
155
|
+
}
|
|
154
156
|
|
|
155
|
-
|
|
157
|
+
if (error.keyword === 'invalidId') {
|
|
156
158
|
|
|
157
|
-
|
|
159
|
+
message = t(
|
|
160
|
+
`validation-error-${error.keyword}`,
|
|
161
|
+
[error.params.invalid],
|
|
162
|
+
);
|
|
158
163
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
[error.params.invalid],
|
|
162
|
-
);
|
|
164
|
+
translatedPath = '';
|
|
165
|
+
path = error.params.invalid;
|
|
163
166
|
|
|
164
|
-
|
|
165
|
-
path = error.params.invalid;
|
|
167
|
+
}
|
|
166
168
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (error.keyword === 'DOCUMENT_ALREADY_EXISTS') {
|
|
169
|
+
if (error.keyword === 'DOCUMENT_ALREADY_EXISTS') {
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
message = t(
|
|
172
|
+
`validation-error-${error.keyword}`,
|
|
173
|
+
mappedErrorParams
|
|
174
|
+
);
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
translatedPath = 'main';
|
|
177
|
+
path = 'id';
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
}
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
if (!message) {
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
message = t(
|
|
184
|
+
`validation-error-${error.keyword}`,
|
|
185
|
+
);
|
|
186
|
+
translatedPath = 'main';
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
}
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
if (!translatedPath) {
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
const combinedPath = basePath ? `${basePath}-${path}` : path;
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
translatedPath = translationPre ? `${translationPre}-${combinedPath}` : combinedPath as string;
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
}
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
198
|
+
return {
|
|
199
|
+
error: message,
|
|
200
|
+
path,
|
|
201
|
+
translatedPath: { path: translatedPath, values: Object.values(error.params) },
|
|
202
|
+
keyword: error.keyword,
|
|
203
|
+
};
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
}
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
static reset() {
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
return {};
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
}
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
static mapErrorParams(keys: string[], mappings: Record<string, string> | undefined): string[] {
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
console.log('keys', keys, mappings);
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
if (!mappings) return keys;
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
const mappedKeys = keys.map((key) => {
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
if (mappings[key]) {
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
return mappings[key];
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
}
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
return key;
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
});
|
|
230
230
|
|
|
231
|
-
|
|
231
|
+
return mappedKeys;
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
}
|
|
234
234
|
|
|
235
235
|
}
|