@lilaquadrat/design-core 0.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/README.md +236 -0
- package/html/index.html +25 -0
- package/html/index.mail.html +15 -0
- package/html/index.server.html +29 -0
- package/package.json +148 -0
- package/src/client-entry.ts +28 -0
- package/src/components/partials/action.partial.vue +30 -0
- package/src/components/partials/client-only.partial.vue +11 -0
- package/src/components/partials/error.partial.vue +73 -0
- package/src/components/partials/main-components.partial.vue +167 -0
- package/src/components/partials/mediadetection.partial.vue +71 -0
- package/src/components/partials/qrcode.partial.vue +35 -0
- package/src/customs.ts +12 -0
- package/src/env.d.ts +1 -0
- package/src/functions/PaymenyProviderFactory.ts +27 -0
- package/src/functions/lila-dom.ts +100 -0
- package/src/functions/shopify.provider.ts +378 -0
- package/src/functions/stripe.provider.ts +181 -0
- package/src/globals.d.ts +19 -0
- package/src/index.ts +47 -0
- package/src/interfaces/AppState.interface.ts +4 -0
- package/src/interfaces/EditorConfiguration.interface.ts +15 -0
- package/src/interfaces/EventDeclaration.interface.ts +19 -0
- package/src/interfaces/FrontendConfig.interface.ts +42 -0
- package/src/interfaces/GenericEvents.interface.ts +6 -0
- package/src/interfaces/GenericState.interface.ts +5 -0
- package/src/interfaces/IconsPartial.ts +9 -0
- package/src/interfaces/IdTokenExtended.interface.ts +7 -0
- package/src/interfaces/ModuleBaseProps.interface.ts +8 -0
- package/src/interfaces/PaymentProvider.interface.ts +13 -0
- package/src/libs/ActionNotice.ts +235 -0
- package/src/libs/Models.class.ts +482 -0
- package/src/main.ts +84 -0
- package/src/mixins/createCookieString.ts +78 -0
- package/src/mixins/createModelDeclaration.ts +29 -0
- package/src/mixins/createRouter.ts +30 -0
- package/src/mixins/date.ts +23 -0
- package/src/mixins/formatSize.ts +12 -0
- package/src/mixins/getAnchor.ts +14 -0
- package/src/mixins/getRoutes.ts +50 -0
- package/src/mixins/hasSlotContent.ts +32 -0
- package/src/mixins/hooks.ts +104 -0
- package/src/mixins/loadComponents.ts +107 -0
- package/src/mixins/logger.ts +32 -0
- package/src/mixins/replaceVariables.ts +19 -0
- package/src/mixins/scroll.ts +83 -0
- package/src/models/Address.model.ts +24 -0
- package/src/models/Contact.model.ts +22 -0
- package/src/models.ts +2 -0
- package/src/plugins/auth.ts +121 -0
- package/src/plugins/currency.ts +26 -0
- package/src/plugins/events.ts +156 -0
- package/src/plugins/filters.ts +43 -0
- package/src/plugins/inview.ts +351 -0
- package/src/plugins/replacer.ts +18 -0
- package/src/plugins/resize.ts +128 -0
- package/src/plugins/signupFlow.ts +89 -0
- package/src/plugins/traceable.ts +53 -0
- package/src/plugins/translations.ts +29 -0
- package/src/plugins/youtube.ts +80 -0
- package/src/routes.ts +132 -0
- package/src/server-entry.ts +113 -0
- package/src/stores/calls.store.ts +33 -0
- package/src/stores/cart.store.ts +186 -0
- package/src/stores/content.store.ts +83 -0
- package/src/stores/editor.store.ts +27 -0
- package/src/stores/files.store.ts +166 -0
- package/src/stores/main.store.ts +184 -0
- package/src/stores/user.store.ts +124 -0
- package/src/translations/de.ts +138 -0
- package/src/views/content.view.vue +219 -0
- package/src/views/download.view.vue +143 -0
- package/src/views/editor.view.vue +243 -0
- package/src/views/login.view.vue +82 -0
- package/src/views/signup-account.view.vue +64 -0
- package/tooling/cypress/config.ts +80 -0
- package/tooling/cypress/generate-manifest.js +5 -0
- package/tooling/cypress/manifest-utils.mjs +40 -0
- package/tooling/cypress/run-parallel.mjs +77 -0
- package/tooling/cypress/support/commands.ts +436 -0
- package/tooling/cypress/support/e2e.ts +17 -0
- package/tooling/eslint.config.js +223 -0
- package/tooling/preview.plugin.ts +134 -0
- package/tooling/ssr-test/index.mjs +391 -0
- package/tooling/stylelint.config.mjs +24 -0
- package/tooling/vite.ts +246 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default interface IconsPartial {
|
|
2
|
+
type: 'arrow-right' | 'arrow-left' | 'arrow-right-long' | 'chevron-down' | 'chevron-up' | 'chevron-left' | 'chevron-right'
|
|
3
|
+
| 'mouse' | 'checked' | 'close' | 'zoom-in' | 'zoom-out' | 'warning' | 'location' | 'play' | 'pause' | 'muted' | 'unmuted' | 'calendar' | 'cart'
|
|
4
|
+
| 'image' | 'document' | 'trash' | 'download' | 'replay'
|
|
5
|
+
colorScheme?: 'colorScheme1' | 'colorScheme2' | 'colorScheme4' |'white' | 'grey' | 'red' | 'bright' | 'dark' | 'textColor'
|
|
6
|
+
size?: 'small' | 'smaller' | 'medium' | 'large' | 'larger' | 'big' | 'xl'
|
|
7
|
+
rotate?: number
|
|
8
|
+
animate?: boolean
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default interface PaymentProvider {
|
|
2
|
+
|
|
3
|
+
getCart(attributes?: Record<string, string>): Promise<{id: string, checkourUrl?: string}>;
|
|
4
|
+
updateCartAttributes(cartId: string, attributes?: Record<string, string>): Promise<{id: string, checkourUrl?: string}>;
|
|
5
|
+
getCartWithProducts(cartId: string): Promise<any[]>;
|
|
6
|
+
getProduct(productId: string): Promise<any>;
|
|
7
|
+
addToCart(cartId: string, product: any, amount: number): Promise<any>;
|
|
8
|
+
removeFromCart(cartId: string, product: any): Promise<any>;
|
|
9
|
+
updateQuantity(cartId: string, cartProduct: any, amount: number): Promise<any>;
|
|
10
|
+
finalize(cartId: string): Promise<any>;
|
|
11
|
+
getFinishedCart(cartId: string): Promise<any>;
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { t } from '../plugins/translations';
|
|
2
|
+
import type { ErrorObject } from 'ajv';
|
|
3
|
+
|
|
4
|
+
export interface TranslatedPath {
|
|
5
|
+
path?: string,
|
|
6
|
+
values?: string[]|number[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ParsedError {
|
|
10
|
+
path: string
|
|
11
|
+
translatedPath: TranslatedPath
|
|
12
|
+
parentPath?: TranslatedPath
|
|
13
|
+
error: string
|
|
14
|
+
keyword: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ErrorsObject {
|
|
18
|
+
[key: string]: ParsedError
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default class ActionNotice {
|
|
22
|
+
error: any;
|
|
23
|
+
|
|
24
|
+
static parse (errors: ErrorObject[], translationPre: string | undefined, structureMappings: Record<string, string> | undefined): ErrorsObject {
|
|
25
|
+
|
|
26
|
+
const parsedErrors: ErrorsObject = {};
|
|
27
|
+
|
|
28
|
+
errors?.forEach((single) => {
|
|
29
|
+
|
|
30
|
+
ActionNotice.parseSingle(single, translationPre, parsedErrors, structureMappings);
|
|
31
|
+
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return parsedErrors;
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static parseSingle (error: ErrorObject, translationPre: string | undefined, errors: ErrorsObject, structureMappings: Record<string, string> | undefined) {
|
|
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];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
pathArray has a number as second element and a element after this number
|
|
48
|
+
only a numbers would mean that the array needs to have a valid element
|
|
49
|
+
```JSON
|
|
50
|
+
{
|
|
51
|
+
instancePath: "/categories/0",
|
|
52
|
+
schemaPath: "#/properties/categories/items/required",
|
|
53
|
+
keyword: "required"
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
*/
|
|
57
|
+
|
|
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>>;
|
|
64
|
+
|
|
65
|
+
if (!useError) useError = {} as Record<string, Record<string, ParsedError>>;
|
|
66
|
+
|
|
67
|
+
if (!useError[useIndex]) useError[useIndex] = {};
|
|
68
|
+
|
|
69
|
+
useError[useIndex][path] = arrayMessageResponse;
|
|
70
|
+
|
|
71
|
+
} else {
|
|
72
|
+
|
|
73
|
+
errors[path] = messageResponse;
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static getParsedError (error: ErrorObject, usePath: string, basePath: string | undefined, translationPre: string | undefined, structureMappings: Record<string, string> | undefined): ParsedError {
|
|
80
|
+
|
|
81
|
+
let message: string = '';
|
|
82
|
+
let path = usePath;
|
|
83
|
+
let translatedPath: string = '';
|
|
84
|
+
const mappedErrorParams = ActionNotice.mapErrorParams(Object.values(error.params), structureMappings);
|
|
85
|
+
|
|
86
|
+
console.log('error', mappedErrorParams);
|
|
87
|
+
|
|
88
|
+
console.log('error', Object.values(error.params));
|
|
89
|
+
|
|
90
|
+
if (error.keyword === 'type') {
|
|
91
|
+
|
|
92
|
+
message = t(
|
|
93
|
+
`validation-error-type-${error.params.type}`,
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (error.keyword === 'minLength' || error.keyword === 'maxLength') {
|
|
99
|
+
|
|
100
|
+
message = t(
|
|
101
|
+
`validation-error-${error.keyword}`,
|
|
102
|
+
mappedErrorParams
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (error.keyword === 'maxItems' || error.keyword === 'minItems') {
|
|
108
|
+
|
|
109
|
+
message = t(
|
|
110
|
+
`validation-error-${error.keyword}`,
|
|
111
|
+
mappedErrorParams
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (error.keyword === 'contains') {
|
|
117
|
+
|
|
118
|
+
message = t(
|
|
119
|
+
`validation-error-${error.keyword}`,
|
|
120
|
+
mappedErrorParams
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (error.keyword === 'additionalProperties') {
|
|
126
|
+
|
|
127
|
+
message = t(
|
|
128
|
+
`validation-error-${error.keyword}`,
|
|
129
|
+
mappedErrorParams,
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
translatedPath = 'main';
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (error.keyword === 'required') {
|
|
137
|
+
|
|
138
|
+
message = t(
|
|
139
|
+
`validation-error-${error.keyword}`,
|
|
140
|
+
mappedErrorParams
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
translatedPath = '';
|
|
144
|
+
path = error.params.missingProperty;
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (error.keyword === 'enum') {
|
|
149
|
+
|
|
150
|
+
message = t(
|
|
151
|
+
`validation-error-${error.keyword}`,
|
|
152
|
+
[mappedErrorParams.join(',')],
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (error.keyword === 'invalidId') {
|
|
158
|
+
|
|
159
|
+
message = t(
|
|
160
|
+
`validation-error-${error.keyword}`,
|
|
161
|
+
[error.params.invalid],
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
translatedPath = '';
|
|
165
|
+
path = error.params.invalid;
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (error.keyword === 'DOCUMENT_ALREADY_EXISTS') {
|
|
170
|
+
|
|
171
|
+
message = t(
|
|
172
|
+
`validation-error-${error.keyword}`,
|
|
173
|
+
mappedErrorParams
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
translatedPath = 'main';
|
|
177
|
+
path = 'id';
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!message) {
|
|
182
|
+
|
|
183
|
+
message = t(
|
|
184
|
+
`validation-error-${error.keyword}`,
|
|
185
|
+
);
|
|
186
|
+
translatedPath = 'main';
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (!translatedPath) {
|
|
191
|
+
|
|
192
|
+
const combinedPath = basePath ? `${basePath}-${path}` : path;
|
|
193
|
+
|
|
194
|
+
translatedPath = translationPre ? `${translationPre}-${combinedPath}` : combinedPath as string;
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
error : message,
|
|
200
|
+
path,
|
|
201
|
+
translatedPath: { path: translatedPath, values: Object.values(error.params) },
|
|
202
|
+
keyword : error.keyword,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
static reset () {
|
|
208
|
+
|
|
209
|
+
return {};
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
static mapErrorParams (keys: string[], mappings: Record<string, string> | undefined): string[] {
|
|
214
|
+
|
|
215
|
+
console.log('keys', keys, mappings);
|
|
216
|
+
|
|
217
|
+
if (!mappings) return keys;
|
|
218
|
+
|
|
219
|
+
const mappedKeys = keys.map((key) => {
|
|
220
|
+
|
|
221
|
+
if (mappings[key]) {
|
|
222
|
+
|
|
223
|
+
return mappings[key];
|
|
224
|
+
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return key;
|
|
228
|
+
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
return mappedKeys;
|
|
232
|
+
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
}
|