@startinblox/components-ds4go 3.0.3 → 3.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/.storybook/preview.ts +1 -0
- package/biome.json +1 -1
- package/dist/custom-getter-ZPFnoSjt-BCNOlbJZ-B4tuxA42.js +338 -0
- package/dist/en-BySYJZMr-CWZl5AwU-CWZl5AwU.js +14 -0
- package/dist/fr-BZZDTsmw-CNDWt66j-CNDWt66j.js +14 -0
- package/dist/index-BSwVRtNS.js +104980 -0
- package/dist/index.js +1 -3032
- package/dist/quill.snow-C_A_QkE8-D-uedtvC-D-uedtvC.js +13 -0
- package/dist/slimselect-NFLzJMfV-DZ7j6Vsj-DZ7j6Vsj.js +5 -0
- package/package.json +9 -8
- package/src/components/cards/ds4go-card-catalog.ts +132 -0
- package/src/components/catalog/ds4go-catalog-filter-holder.ts +459 -0
- package/src/components/catalog/ds4go-customer-holder.ts +162 -0
- package/src/components/catalog/ds4go-fact-bundle-holder.ts +7 -7
- package/src/components/modal/ds4go-customer-modal.ts +134 -0
- package/src/components/modal/ds4go-fact-bundle-modal.ts +2 -2
- package/src/components/solid-customer-list.ts +195 -0
- package/src/components/solid-dsif-explorer-poc.ts +8 -8
- package/src/components/solid-dsp-connector.ts +12 -4
- package/src/components/solid-fact-bundle-creation.ts +244 -151
- package/src/components/solid-fact-bundle.ts +9 -4
- package/src/helpers/components/orbitComponent.ts +12 -13
- package/src/helpers/i18n/configureLocalization.ts +12 -5
- package/src/helpers/index.ts +0 -2
- package/src/styles/cards/ds4go-card-catalog.scss +149 -0
- package/src/styles/fact-bundle-creation.scss +6 -2
- package/src/styles/modal/ds4go-customer-modal.scss +91 -0
- package/src/styles/modal/ds4go-fact-bundle-modal.scss +1 -1
- package/vite.config.ts +7 -7
- package/src/components/solid-boilerplate.ts +0 -76
- package/src/helpers/components/ResourceMapper.ts +0 -469
- package/src/helpers/components/orbitDspComponent.ts +0 -250
- package/src/helpers/mappings/dsp-mapping-config.ts +0 -545
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { OrbitComponent } from "@helpers";
|
|
2
|
+
import { localized, msg, str } from "@lit/localize";
|
|
3
|
+
import { Task } from "@lit/task";
|
|
4
|
+
import type {
|
|
5
|
+
OrbitComponent as OrbitComponentConfig,
|
|
6
|
+
Resource,
|
|
7
|
+
} from "@src/component";
|
|
8
|
+
|
|
9
|
+
import ModalStyle from "@styles/modal/ds4go-customer-modal.scss?inline";
|
|
10
|
+
import { css, html, nothing, unsafeCSS } from "lit";
|
|
11
|
+
import { customElement, state } from "lit/decorators.js";
|
|
12
|
+
|
|
13
|
+
@customElement("ds4go-customer-modal")
|
|
14
|
+
@localized()
|
|
15
|
+
export class Ds4goCustomerModal extends OrbitComponent {
|
|
16
|
+
constructor() {
|
|
17
|
+
super({ setupSubscriptions: false, ignoreRouter: true });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static styles = css`
|
|
21
|
+
${unsafeCSS(ModalStyle)}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
@state()
|
|
25
|
+
dspConnector: OrbitComponentConfig | undefined;
|
|
26
|
+
|
|
27
|
+
async _afterAttach() {
|
|
28
|
+
// use this.dspConnector.instance to reach the connector
|
|
29
|
+
this.dspConnector = this.orbit?.components.find(
|
|
30
|
+
(c) => c.type === "dsp-connector",
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_closeModal() {
|
|
37
|
+
this.dispatchEvent(new CustomEvent("close"));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_getResource = new Task(this, {
|
|
41
|
+
task: async () => {
|
|
42
|
+
if (!this.object) return;
|
|
43
|
+
|
|
44
|
+
if (this.dspConnector?.instance) {
|
|
45
|
+
await this.dspConnector.instance.loadContracts();
|
|
46
|
+
console.log(this.dspConnector.instance.contracts);
|
|
47
|
+
} else {
|
|
48
|
+
console.warn(
|
|
49
|
+
"DSP Connector not found. Please ensure the DSP Connector is properly initialized.",
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return this.object;
|
|
54
|
+
},
|
|
55
|
+
args: () => [this.caching, this.currentRoute],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
render() {
|
|
59
|
+
return this._getResource.render({
|
|
60
|
+
pending: () => nothing,
|
|
61
|
+
complete: (obj?: Resource) => {
|
|
62
|
+
if (!obj) {
|
|
63
|
+
this._closeModal();
|
|
64
|
+
return nothing;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return html`<div class="modal">
|
|
68
|
+
<div class="topbar">
|
|
69
|
+
<tems-button
|
|
70
|
+
@click=${this._closeModal}
|
|
71
|
+
type="outline-gray"
|
|
72
|
+
.iconLeft=${html`<icon-material-symbols-close-rounded></icon-material-symbols-close-rounded>`}
|
|
73
|
+
></tems-button>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="modal-content-wrapper">
|
|
76
|
+
<div class="modal-box">
|
|
77
|
+
<div class="modal-content">
|
|
78
|
+
<tems-division type="h3"
|
|
79
|
+
><div>${String(obj.name || "")}</div></tems-division
|
|
80
|
+
>
|
|
81
|
+
<tems-division type="body-m"
|
|
82
|
+
><div>
|
|
83
|
+
${
|
|
84
|
+
obj.participant_id
|
|
85
|
+
? msg(
|
|
86
|
+
str`Participant ID: ${String(obj.participant_id)}`,
|
|
87
|
+
)
|
|
88
|
+
: ""
|
|
89
|
+
}
|
|
90
|
+
</div></tems-division
|
|
91
|
+
>
|
|
92
|
+
${
|
|
93
|
+
obj.signed_contracts
|
|
94
|
+
? html`<tems-division type="h4"
|
|
95
|
+
><div>
|
|
96
|
+
${msg("Contracts signed with the customer")}
|
|
97
|
+
</div></tems-division
|
|
98
|
+
>
|
|
99
|
+
<div class="card-grid card-grid-vertical">
|
|
100
|
+
${obj.signed_contracts?.map((contract: Resource) => {
|
|
101
|
+
return html`<ds4go-card-catalog
|
|
102
|
+
.object=${import.meta.env.DEV ? contract : nothing}
|
|
103
|
+
.header=${contract.name || nothing}
|
|
104
|
+
.content=${contract.description || nothing}
|
|
105
|
+
date=${contract.updated_at || nothing}
|
|
106
|
+
></ds4go-card-catalog>`;
|
|
107
|
+
})}
|
|
108
|
+
</div>`
|
|
109
|
+
: nothing
|
|
110
|
+
}
|
|
111
|
+
<tems-division type="body-sm"
|
|
112
|
+
><div>
|
|
113
|
+
<div>
|
|
114
|
+
${msg("Customer created on")} ${String(obj.created_at)}
|
|
115
|
+
</div>
|
|
116
|
+
<div>
|
|
117
|
+
${msg("Customer updated on")} ${String(obj.updated_at)}
|
|
118
|
+
</div>
|
|
119
|
+
</div></tems-division
|
|
120
|
+
>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>`;
|
|
125
|
+
},
|
|
126
|
+
error: (e) => {
|
|
127
|
+
if (import.meta.env.DEV) {
|
|
128
|
+
console.error(e, this);
|
|
129
|
+
}
|
|
130
|
+
return nothing;
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -55,13 +55,13 @@ export class Ds4goFactBundleModal extends ComponentObjectHandler {
|
|
|
55
55
|
type: "information",
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
return html`<
|
|
58
|
+
return html`<ds4go-card-catalog
|
|
59
59
|
.object=${import.meta.env.DEV ? fact : nothing}
|
|
60
60
|
.tags=${tags}
|
|
61
61
|
.header=${fact.name || nothing}
|
|
62
62
|
.content=${fact.description || nothing}
|
|
63
63
|
date=${fact.updated_at || nothing}
|
|
64
|
-
></
|
|
64
|
+
></ds4go-card-catalog>`;
|
|
65
65
|
})}
|
|
66
66
|
</div>
|
|
67
67
|
<tems-division type="body-sm"
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatDate,
|
|
3
|
+
OrbitComponent,
|
|
4
|
+
requestNavigation,
|
|
5
|
+
setupCacheInvalidation,
|
|
6
|
+
sort,
|
|
7
|
+
} from "@helpers";
|
|
8
|
+
import { Task } from "@lit/task";
|
|
9
|
+
import type {
|
|
10
|
+
OrbitComponent as OrbitComponentConfig,
|
|
11
|
+
PropertiesPicker,
|
|
12
|
+
Resource,
|
|
13
|
+
SearchObject,
|
|
14
|
+
} from "@src/component";
|
|
15
|
+
import { css, html, nothing } from "lit";
|
|
16
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
17
|
+
|
|
18
|
+
@customElement("solid-customer-list")
|
|
19
|
+
export class SolidCustomerList extends OrbitComponent {
|
|
20
|
+
static styles = css`
|
|
21
|
+
.modal {
|
|
22
|
+
position: fixed;
|
|
23
|
+
top: 0;
|
|
24
|
+
left: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
background-color: rgba(0, 2, 49, 0.2);
|
|
28
|
+
z-index: 9999;
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
@property({ attribute: "header", type: String })
|
|
36
|
+
header?: string = "DS4GO Customer List";
|
|
37
|
+
|
|
38
|
+
@state()
|
|
39
|
+
search: SearchObject[] = [];
|
|
40
|
+
|
|
41
|
+
@state()
|
|
42
|
+
resultCount = this.objects?.length || 0;
|
|
43
|
+
|
|
44
|
+
@state()
|
|
45
|
+
bundleCreationComponent: OrbitComponentConfig | undefined;
|
|
46
|
+
|
|
47
|
+
cherryPickedProperties: PropertiesPicker[] = [
|
|
48
|
+
{ key: "created_at", value: "created_at", cast: formatDate },
|
|
49
|
+
{ key: "updated_at", value: "updated_at", cast: formatDate },
|
|
50
|
+
{ key: "name", value: "name" },
|
|
51
|
+
{ key: "participant_id", value: "participant_id" },
|
|
52
|
+
{ key: "balance", value: "balance" },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
async _afterAttach() {
|
|
56
|
+
setupCacheInvalidation(this, {
|
|
57
|
+
keywords: ["customers"],
|
|
58
|
+
});
|
|
59
|
+
return Promise.resolve();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_getResource = new Task(this, {
|
|
63
|
+
task: async ([dataSrc, objSrc]) => {
|
|
64
|
+
if (
|
|
65
|
+
!dataSrc ||
|
|
66
|
+
!this.orbit ||
|
|
67
|
+
(!this.noRouter &&
|
|
68
|
+
this.route &&
|
|
69
|
+
this.currentRoute &&
|
|
70
|
+
!this.route.startsWith(this.currentRoute))
|
|
71
|
+
)
|
|
72
|
+
return;
|
|
73
|
+
|
|
74
|
+
if (!this.hasCachedDatas || this.oldDataSrc !== dataSrc) {
|
|
75
|
+
if (!dataSrc) return;
|
|
76
|
+
|
|
77
|
+
this.objects = (await this._getProxyValue(dataSrc)) as Resource[];
|
|
78
|
+
this.hasCachedDatas = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this.oldDataSrc !== dataSrc) {
|
|
82
|
+
this.oldDataSrc = dataSrc;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!Array.isArray(this.objects)) {
|
|
86
|
+
this.objects = [];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (objSrc) {
|
|
90
|
+
this.object = this.objects.find(
|
|
91
|
+
(obj: Resource) => obj["@id"] === objSrc,
|
|
92
|
+
);
|
|
93
|
+
} else {
|
|
94
|
+
this.dataSrc = dataSrc;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.objects.length > 0) {
|
|
98
|
+
return sort(this.objects, "name", "asc");
|
|
99
|
+
}
|
|
100
|
+
return [];
|
|
101
|
+
},
|
|
102
|
+
args: () => [
|
|
103
|
+
this.defaultDataSrc,
|
|
104
|
+
this.dataSrc,
|
|
105
|
+
this.caching,
|
|
106
|
+
this.currentRoute,
|
|
107
|
+
],
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
_search(e: Event) {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
this.search = e.detail;
|
|
113
|
+
this.filterCount = this.search.filter((s) => s.name !== "search").length;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
_openModal(e: Event) {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
if (this.route) {
|
|
119
|
+
if ("use-id" in (this.component.routeAttributes || {})) {
|
|
120
|
+
requestNavigation(this.route, e.detail["@id"]);
|
|
121
|
+
} else {
|
|
122
|
+
const rdfType = e.detail["@type"]?.at(-1) ?? e.detail["@type"];
|
|
123
|
+
if (rdfType) {
|
|
124
|
+
const compatibleComponents = window.orbit?.components?.filter(
|
|
125
|
+
(c) => c?.routeAttributes?.["rdf-type"] === rdfType,
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
if (compatibleComponents?.[0]?.route) {
|
|
129
|
+
requestNavigation(compatibleComponents[0]?.route, e.detail["@id"]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
_closeModal(e: Event) {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
if (this.route) requestNavigation(this.route, this.defaultDataSrc);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
_closeModalFromBackground(e: Event) {
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
if (this.route && e.target?.classList.contains("modal"))
|
|
144
|
+
requestNavigation(this.route, this.defaultDataSrc);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
_resultCountUpdate(e: Event) {
|
|
148
|
+
this.resultCount = e.detail ?? 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
render() {
|
|
152
|
+
return (
|
|
153
|
+
this.gatekeeper() ||
|
|
154
|
+
this._getResource.render({
|
|
155
|
+
pending: () => html`<solid-loader></solid-loader>`,
|
|
156
|
+
error: (e) => {
|
|
157
|
+
console.warn("[solid-customer-list] Task error:", e);
|
|
158
|
+
return nothing;
|
|
159
|
+
},
|
|
160
|
+
complete: (datas) => {
|
|
161
|
+
return html`<tems-viewport>
|
|
162
|
+
<tems-header slot="header" heading=${this.header}></tems-header>
|
|
163
|
+
<div slot="content">
|
|
164
|
+
<ds4go-catalog-filter-holder
|
|
165
|
+
.displayFiltering=${this.displayFiltering}
|
|
166
|
+
@search=${this._search}
|
|
167
|
+
.search=${this.search}
|
|
168
|
+
.objects=${datas}
|
|
169
|
+
.resultCount=${this.resultCount}
|
|
170
|
+
.filterCount=${this.filterCount}
|
|
171
|
+
></ds4go-catalog-filter-holder>
|
|
172
|
+
<ds4go-customer-holder
|
|
173
|
+
.objects=${datas}
|
|
174
|
+
.search=${this.search}
|
|
175
|
+
@clicked=${this._openModal}
|
|
176
|
+
@result-count=${this._resultCountUpdate}
|
|
177
|
+
></ds4go-customer-holder>
|
|
178
|
+
${this.object
|
|
179
|
+
? html`<div
|
|
180
|
+
class="modal"
|
|
181
|
+
@click=${this._closeModalFromBackground}
|
|
182
|
+
>
|
|
183
|
+
<ds4go-customer-modal
|
|
184
|
+
.object=${this.object}
|
|
185
|
+
@close=${this._closeModal}
|
|
186
|
+
></ds4go-customer-modal>
|
|
187
|
+
</div>`
|
|
188
|
+
: nothing}
|
|
189
|
+
</div>
|
|
190
|
+
</tems-viewport>`;
|
|
191
|
+
},
|
|
192
|
+
})
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -51,11 +51,11 @@ export class SolidDsifExplorerPoc extends OrbitComponent {
|
|
|
51
51
|
.card-grid-vertical {
|
|
52
52
|
justify-content: stretch;
|
|
53
53
|
}
|
|
54
|
-
.card-grid-vertical
|
|
54
|
+
.card-grid-vertical ds4go-card-catalog {
|
|
55
55
|
width: 354px;
|
|
56
56
|
height: auto;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
ds4go-card-catalog.cursor-pointer {
|
|
59
59
|
cursor: pointer;
|
|
60
60
|
}
|
|
61
61
|
tems-division {
|
|
@@ -313,7 +313,7 @@ export class SolidDsifExplorerPoc extends OrbitComponent {
|
|
|
313
313
|
${this.catalogId
|
|
314
314
|
? html`${(datas as CatalogEntry)["dcat:dataset"].map(
|
|
315
315
|
(dataset: Dataset) =>
|
|
316
|
-
html`<
|
|
316
|
+
html`<ds4go-card-catalog
|
|
317
317
|
.object=${import.meta.env.DEV
|
|
318
318
|
? dataset
|
|
319
319
|
: nothing}
|
|
@@ -321,12 +321,12 @@ export class SolidDsifExplorerPoc extends OrbitComponent {
|
|
|
321
321
|
.header=${dataset["dct:title"] || nothing}
|
|
322
322
|
.content=${dataset["dct:description"] ||
|
|
323
323
|
nothing}
|
|
324
|
-
></
|
|
324
|
+
></ds4go-card-catalog>`,
|
|
325
325
|
)}`
|
|
326
326
|
: this.sectorId
|
|
327
327
|
? html`${datas.map(
|
|
328
328
|
(catalog: Catalog) =>
|
|
329
|
-
html`<
|
|
329
|
+
html`<ds4go-card-catalog
|
|
330
330
|
class="cursor-pointer"
|
|
331
331
|
.object=${import.meta.env.DEV
|
|
332
332
|
? catalog
|
|
@@ -338,11 +338,11 @@ export class SolidDsifExplorerPoc extends OrbitComponent {
|
|
|
338
338
|
nothing}
|
|
339
339
|
@click=${() =>
|
|
340
340
|
this._selectCatalog(catalog.catalogId)}
|
|
341
|
-
></
|
|
341
|
+
></ds4go-card-catalog>`,
|
|
342
342
|
)}`
|
|
343
343
|
: html`${datas.map(
|
|
344
344
|
(sector: Sector) =>
|
|
345
|
-
html`<
|
|
345
|
+
html`<ds4go-card-catalog
|
|
346
346
|
class="cursor-pointer"
|
|
347
347
|
.object=${import.meta.env.DEV
|
|
348
348
|
? sector
|
|
@@ -353,7 +353,7 @@ export class SolidDsifExplorerPoc extends OrbitComponent {
|
|
|
353
353
|
date=${formatDate(sector.lastUpdated) ||
|
|
354
354
|
nothing}
|
|
355
355
|
@click=${() => this._selectSector(sector.id)}
|
|
356
|
-
></
|
|
356
|
+
></ds4go-card-catalog>`,
|
|
357
357
|
)}`}
|
|
358
358
|
</div>
|
|
359
359
|
</div>`
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { dspComponent } from "@helpers";
|
|
2
1
|
import { Task } from "@lit/task";
|
|
3
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
Asset,
|
|
4
|
+
AssetInput,
|
|
5
|
+
ContractDefinition,
|
|
6
|
+
ContractDefinitionInput,
|
|
7
|
+
PolicyDefinition,
|
|
8
|
+
PolicyDefinitionInput,
|
|
9
|
+
Resource,
|
|
10
|
+
} from "@src/component";
|
|
11
|
+
import { OrbitDSPComponent } from "@startinblox/solid-tems-shared";
|
|
4
12
|
import { nothing } from "lit";
|
|
5
13
|
import { customElement, state } from "lit/decorators.js";
|
|
6
14
|
|
|
@@ -12,7 +20,7 @@ export interface DSPProviderConfig {
|
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
@customElement("solid-dsp-connector")
|
|
15
|
-
export class SolidDspConnector extends
|
|
23
|
+
export class SolidDspConnector extends OrbitDSPComponent {
|
|
16
24
|
async _responseAdaptator(response: Resource): Promise<Resource> {
|
|
17
25
|
if (response.providers) {
|
|
18
26
|
if (!Array.isArray(response.providers)) {
|
|
@@ -149,7 +157,7 @@ export class SolidDspConnector extends dspComponent {
|
|
|
149
157
|
if (!this.orbit) return;
|
|
150
158
|
|
|
151
159
|
if (!this.hasCachedDatas) {
|
|
152
|
-
const datasets = await this.fetchFederatedCatalog();
|
|
160
|
+
const datasets = (await this.fetchFederatedCatalog()) as Resource[];
|
|
153
161
|
|
|
154
162
|
if (datasets !== undefined && Array.isArray(datasets)) {
|
|
155
163
|
this.datas = await Promise.all(
|