@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.
- package/README.md +71 -3
- package/html/index.server.html +1 -8
- package/package.json +53 -53
- 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 +68 -68
- package/tooling/ssr-test/index.mjs +205 -203
- package/tooling/vite.d.ts +0 -6
- package/tooling/vite.js +170 -162
- package/src/interfaces/EditorConfiguration.interface.ts +0 -15
- package/tooling/stylelint.config.mjs +0 -24
|
@@ -1,82 +1,124 @@
|
|
|
1
1
|
import { ref } from 'vue'
|
|
2
2
|
import { defineStore } from 'pinia'
|
|
3
|
-
import type { BasicData, Content, Customers, List } from '@lilaquadrat/interfaces';
|
|
3
|
+
import type { BasicData, Cart, Content, Customers, List, WorkingContext } from '@lilaquadrat/interfaces';
|
|
4
4
|
|
|
5
5
|
export const useContentStore = defineStore('content', () => {
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* the content currently rendered.
|
|
9
|
+
*/
|
|
10
|
+
const content = ref<BasicData<Content>>();
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* the layout the rendered page is merged with.
|
|
14
|
+
*/
|
|
15
|
+
const layout = ref<BasicData<Content>>();
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
/**
|
|
18
|
+
* additional content selected in the publish method, e.g. for variables in the
|
|
19
|
+
* rendered content.
|
|
20
|
+
*/
|
|
21
|
+
const contextContent = ref<BasicData<Content>[]>([]);
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
/**
|
|
24
|
+
* the recipient of a mail or pdf publish, the list it was started for and the cart
|
|
25
|
+
* a payment driven publish was started for.
|
|
26
|
+
*/
|
|
27
|
+
const recipient = ref<Customers>();
|
|
28
|
+
const list = ref<List>();
|
|
29
|
+
const cart = ref<Cart>();
|
|
17
30
|
|
|
18
|
-
|
|
31
|
+
/**
|
|
32
|
+
* the document head title and description.
|
|
33
|
+
*/
|
|
34
|
+
const context = ref<Record<string, string | undefined | Record<string, string>>>();
|
|
19
35
|
|
|
20
|
-
|
|
36
|
+
function add(contentToAdd: Content) {
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
contextContent.value.push(contentToAdd)
|
|
23
39
|
|
|
24
|
-
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function addMulti(contentToAdd: Content[]) {
|
|
25
43
|
|
|
26
|
-
|
|
44
|
+
contextContent.value.push(...contentToAdd);
|
|
45
|
+
|
|
46
|
+
}
|
|
27
47
|
|
|
28
|
-
|
|
48
|
+
function findById(id: string) {
|
|
29
49
|
|
|
30
|
-
|
|
50
|
+
return contextContent.value.find((single) => single.id === id);
|
|
31
51
|
|
|
32
|
-
|
|
52
|
+
}
|
|
33
53
|
|
|
34
|
-
|
|
54
|
+
function findByinternalId(internalId: string) {
|
|
35
55
|
|
|
36
|
-
|
|
56
|
+
return contextContent.value.find((single) => single._id?.toString() === internalId);
|
|
37
57
|
|
|
38
|
-
|
|
58
|
+
}
|
|
39
59
|
|
|
40
|
-
|
|
60
|
+
function findByFilename(filename: string) {
|
|
41
61
|
|
|
42
|
-
|
|
62
|
+
return contextContent.value.find((single) => single.settings.filename?.includes(filename));
|
|
43
63
|
|
|
44
|
-
|
|
64
|
+
}
|
|
45
65
|
|
|
46
|
-
|
|
66
|
+
/**
|
|
67
|
+
* seeds a render with every per render value of the working context.
|
|
68
|
+
*/
|
|
69
|
+
function setRender(render: Partial<WorkingContext>) {
|
|
47
70
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
71
|
+
content.value = render.content;
|
|
72
|
+
layout.value = render.layout;
|
|
73
|
+
contextContent.value = render.contextContent ?? [];
|
|
74
|
+
recipient.value = render.recipient;
|
|
75
|
+
list.value = render.list;
|
|
76
|
+
cart.value = render.cart;
|
|
51
77
|
|
|
52
78
|
}
|
|
79
|
+
|
|
80
|
+
function setContext(data: {sitetile?: string, description?: string, [key: string]: string | undefined}) {
|
|
81
|
+
|
|
82
|
+
context.value = data;
|
|
83
|
+
|
|
84
|
+
if(typeof document === 'undefined') return;
|
|
85
|
+
|
|
86
|
+
if(data.sitetitle) {
|
|
87
|
+
|
|
88
|
+
document.title = data.sitetitle;
|
|
89
|
+
|
|
90
|
+
}
|
|
53
91
|
|
|
54
|
-
|
|
92
|
+
if(data.description) {
|
|
55
93
|
|
|
56
|
-
|
|
94
|
+
const metaDescription = document.querySelector('meta[name="description"]');
|
|
57
95
|
|
|
58
|
-
|
|
96
|
+
if (metaDescription) {
|
|
59
97
|
|
|
60
|
-
|
|
98
|
+
metaDescription.setAttribute('content', data.description);
|
|
61
99
|
|
|
62
|
-
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
63
103
|
|
|
64
104
|
}
|
|
65
105
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
106
|
+
return {
|
|
107
|
+
add,
|
|
108
|
+
addMulti,
|
|
109
|
+
findById,
|
|
110
|
+
findByinternalId,
|
|
111
|
+
findByFilename,
|
|
112
|
+
setRender,
|
|
113
|
+
content,
|
|
114
|
+
layout,
|
|
115
|
+
contextContent,
|
|
116
|
+
recipient,
|
|
117
|
+
list,
|
|
118
|
+
cart,
|
|
119
|
+
context,
|
|
120
|
+
setContext
|
|
121
|
+
}
|
|
80
122
|
|
|
81
123
|
})
|
|
82
124
|
|
|
@@ -4,23 +4,23 @@ import type { EditorActiveModule } from '@lilaquadrat/interfaces';
|
|
|
4
4
|
|
|
5
5
|
export const useEditorStore = defineStore('editor', () => {
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const active = ref<EditorActiveModule>({});
|
|
8
|
+
const availableModulesWithRevision = ref<{ revision: number, modules: any[]}>();
|
|
9
|
+
const availableModulesWithRevisionMail = ref<{ revision: number, modules: any[]}>();
|
|
10
|
+
const modulesBrowser = shallowRef<any>();
|
|
11
|
+
const modulesMail = shallowRef<any>();
|
|
12
|
+
const partialsBrowser = shallowRef<any>();
|
|
13
|
+
const partialsMail = shallowRef<any>();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
return {
|
|
16
|
+
active,
|
|
17
|
+
availableModulesWithRevision,
|
|
18
|
+
availableModulesWithRevisionMail,
|
|
19
|
+
modulesBrowser,
|
|
20
|
+
modulesMail,
|
|
21
|
+
partialsBrowser,
|
|
22
|
+
partialsMail,
|
|
23
|
+
}
|
|
24
24
|
|
|
25
25
|
})
|
|
26
26
|
|
|
@@ -57,109 +57,109 @@ export interface UploadContext {
|
|
|
57
57
|
|
|
58
58
|
export const useFilesStore = defineStore('files', () => {
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
const token = ref<TokenData>();
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
function getSdk() {
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
const mainStore = useMainStore();
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
return new StudioSDK(mainStore.apiConfig);
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
async function fetchToken(app: string, scope: 'company' | 'project'): Promise<string> {
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
StudioSDK.flushCache();
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const sdk = getSdk();
|
|
75
|
+
const response = await sdk.members.storage.token(app, scope);
|
|
76
|
+
const data = response?.data;
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
if (data?.token) {
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
token.value = {
|
|
81
|
+
token: data.token,
|
|
82
|
+
expiresAt: data.expiresAt,
|
|
83
|
+
createdAt: data.createdAt,
|
|
84
|
+
expiresIn: data.expiresIn,
|
|
85
|
+
app,
|
|
86
|
+
scope,
|
|
87
|
+
};
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
return data?.token ?? '';
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
function isTokenValid(app: string, scope: 'company' | 'project', bufferSeconds = 30): boolean {
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
if (!token.value) return false;
|
|
98
|
+
if (token.value.app !== app) return false;
|
|
99
|
+
if (token.value.scope !== scope) return false;
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
const now = Date.now() / 1000;
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
console.log(now + bufferSeconds, token.value.expiresAt, (now + bufferSeconds) < token.value.expiresAt);
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
return (now + bufferSeconds) < token.value.expiresAt;
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
}
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
async function listFiles(app: string, assetId?: string, model?: string): Promise<BackendMedia[]> {
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
const options = assetId
|
|
112
|
+
? {assetId: [assetId]}
|
|
113
|
+
: undefined;
|
|
114
|
+
const sdk = getSdk();
|
|
115
|
+
const response = model === 'customers'
|
|
116
|
+
? await sdk.members.storage.listCompany(app, 1, options)
|
|
117
|
+
: await sdk.members.storage.listProject(app, 1, options);
|
|
118
|
+
const payload = response?.data?.data as BackendMedia[] | undefined;
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
return Array.isArray(payload) ? payload : [];
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
}
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const sdk = getSdk();
|
|
132
|
-
const uploadFile: UploadFile = {
|
|
133
|
-
filename: file.name,
|
|
134
|
-
size : file.size,
|
|
135
|
-
mimetype: file.type || 'application/octet-stream',
|
|
136
|
-
data : file,
|
|
137
|
-
};
|
|
124
|
+
async function uploadOne(
|
|
125
|
+
file: File,
|
|
126
|
+
bucket: string,
|
|
127
|
+
options: { list?: string, contentId?: string, moduleUuid?: string, structureInternalId?: string },
|
|
128
|
+
onProgress?: UploadProgressCallback,
|
|
129
|
+
): Promise<UploadResult> {
|
|
138
130
|
|
|
139
|
-
|
|
131
|
+
const sdk = getSdk();
|
|
132
|
+
const uploadFile: UploadFile = {
|
|
133
|
+
filename: file.name,
|
|
134
|
+
size: file.size,
|
|
135
|
+
mimetype: file.type || 'application/octet-stream',
|
|
136
|
+
data: file,
|
|
137
|
+
};
|
|
140
138
|
|
|
141
|
-
|
|
139
|
+
return sdk.members.storage.upload(uploadFile, bucket, options, onProgress);
|
|
140
|
+
|
|
141
|
+
}
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
async function deleteFile(app: string, id: string) {
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
if (!id) return;
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
const sdk = getSdk();
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
await sdk.members.storage.remove(app, id);
|
|
150
|
+
StudioSDK.flushCache('storage', 'listProject');
|
|
151
|
+
StudioSDK.flushCache('storage', 'listCompany');
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
}
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
return {
|
|
156
|
+
token,
|
|
157
|
+
fetchToken,
|
|
158
|
+
isTokenValid,
|
|
159
|
+
listFiles,
|
|
160
|
+
uploadOne,
|
|
161
|
+
deleteFile,
|
|
162
|
+
};
|
|
163
163
|
|
|
164
164
|
});
|
|
165
165
|
|