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