@startinblox/components-ds4go 3.1.2 → 3.1.4
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/dist/{custom-getter-ZPFnoSjt-BCNOlbJZ-CC58FWc-.js → custom-getter-ZPFnoSjt-BCNOlbJZ-CHZXhUca.js} +1 -1
- package/dist/{index-juyC2UdH.js → index-DQ-N8-vz.js} +30339 -29576
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/component.d.ts +71 -22
- package/src/components/catalog/ds4go-customer-holder.ts +1 -1
- package/src/components/modal/customer-modal/ds4go-contract-modal-part.ts +240 -0
- package/src/components/modal/ds4go-customer-modal.ts +272 -26
- package/src/components/modal/ds4go-fact-bundle-modal.ts +200 -61
- package/src/components/modal/fact-bundle-modal/ds4go-contract-modal-part.ts +145 -0
- package/src/components/modal/fact-bundle-modal/ds4go-negotiations-modal-part.ts +132 -0
- package/src/components/modal/fact-bundle-modal/ds4go-odrl-policy-modal-part.ts +233 -0
- package/src/components/solid-customer-list.ts +9 -1
- package/src/components/solid-dsp-connector.ts +70 -16
- package/src/styles/modal/customer-modal/ds4go-contract-modal-part.scss +105 -0
- package/src/styles/modal/ds4go-customer-modal.scss +3 -1
- package/src/styles/modal/ds4go-fact-bundle-modal.scss +3 -1
- package/src/styles/modal/fact-bundle-modal/ds4go-contract-modal-part.scss +84 -0
- package/src/styles/modal/fact-bundle-modal/ds4go-negotiations-modal-part.scss +15 -0
- package/src/styles/modal/fact-bundle-modal/ds4go-odrl-policy-modal-part.scss +58 -0
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "./index-
|
|
1
|
+
import "./index-DQ-N8-vz.js";
|
package/package.json
CHANGED
package/src/component.d.ts
CHANGED
|
@@ -87,14 +87,20 @@ export interface LiveOrbit extends Orbit {
|
|
|
87
87
|
getRoute: (
|
|
88
88
|
type: string,
|
|
89
89
|
returnFirst?: boolean,
|
|
90
|
-
ignoreError?: boolean
|
|
90
|
+
ignoreError?: boolean,
|
|
91
91
|
) => string | false;
|
|
92
92
|
Swal: any;
|
|
93
93
|
defaultRoute: string;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export type Context = Record<string, string | { "@id": string }>;
|
|
97
|
-
export type Permission =
|
|
97
|
+
export type Permission =
|
|
98
|
+
| "add"
|
|
99
|
+
| "delete"
|
|
100
|
+
| "change"
|
|
101
|
+
| "control"
|
|
102
|
+
| "view"
|
|
103
|
+
| string;
|
|
98
104
|
export type DateTime = string;
|
|
99
105
|
|
|
100
106
|
export interface LimitedResource {
|
|
@@ -231,38 +237,81 @@ export interface PolicyDefinitionInput {
|
|
|
231
237
|
"@type"?: string;
|
|
232
238
|
"@id": string;
|
|
233
239
|
policy: OdrlPolicy;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface AssetSelector {
|
|
243
|
+
"@type": "CriterionDto";
|
|
244
|
+
operandLeft: string;
|
|
245
|
+
operator: string;
|
|
246
|
+
operandRight: any;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export type NegotiationState =
|
|
250
|
+
| "REQUESTING"
|
|
251
|
+
| "REQUESTED"
|
|
252
|
+
| "OFFERING"
|
|
253
|
+
| "OFFERED"
|
|
254
|
+
| "ACCEPTING"
|
|
255
|
+
| "ACCEPTED"
|
|
256
|
+
| "AGREEING"
|
|
257
|
+
| "AGREED"
|
|
258
|
+
| "VERIFYING"
|
|
259
|
+
| "VERIFIED"
|
|
260
|
+
| "FINALIZING"
|
|
261
|
+
| "FINALIZED"
|
|
262
|
+
| "TERMINATING"
|
|
263
|
+
| "TERMINATED";
|
|
264
|
+
|
|
265
|
+
export type NegotiationType = "CONSUMER" | "PROVIDER";
|
|
266
|
+
|
|
267
|
+
export interface ContractNegotiation {
|
|
268
|
+
"@id": string;
|
|
269
|
+
"@type"?: string;
|
|
270
|
+
state: NegotiationState;
|
|
271
|
+
counterPartyId?: string;
|
|
272
|
+
counterPartyAddress?: string;
|
|
273
|
+
contractAgreementId?: string;
|
|
274
|
+
assetId?: string;
|
|
275
|
+
errorDetail?: string;
|
|
276
|
+
createdAt?: number;
|
|
277
|
+
type?: NegotiationType;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface ContractAgreement {
|
|
281
|
+
"@type": "ContractAgreement";
|
|
282
|
+
"@id": string;
|
|
283
|
+
assetId: string;
|
|
284
|
+
policy?: any;
|
|
285
|
+
contractSigningDate?: number;
|
|
286
|
+
consumerId?: string;
|
|
287
|
+
providerId?: string;
|
|
239
288
|
}
|
|
240
289
|
|
|
241
290
|
export interface ContractDefinition {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
291
|
+
"@type": "ContractDefinition";
|
|
292
|
+
"@id": string;
|
|
293
|
+
"@context"?: any;
|
|
294
|
+
accessPolicyId: string;
|
|
295
|
+
contractPolicyId: string;
|
|
296
|
+
assetsSelector?: AssetSelector[] | AssetSelector;
|
|
297
|
+
createdAt?: number;
|
|
249
298
|
}
|
|
250
299
|
|
|
251
300
|
export interface ContractDefinitionInput {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
301
|
+
"@id": string;
|
|
302
|
+
accessPolicyId: string;
|
|
303
|
+
contractPolicyId: string;
|
|
304
|
+
assetsSelector?: AssetSelector[];
|
|
256
305
|
}
|
|
257
306
|
|
|
258
307
|
export interface PolicyDefinition {
|
|
259
|
-
|
|
260
|
-
|
|
308
|
+
"@id": string;
|
|
309
|
+
policy?: OdrlPolicy;
|
|
261
310
|
}
|
|
262
311
|
|
|
263
312
|
export interface Asset {
|
|
264
|
-
|
|
265
|
-
|
|
313
|
+
"@id": string;
|
|
314
|
+
properties?: Record<string, any>;
|
|
266
315
|
}
|
|
267
316
|
|
|
268
317
|
export declare global {
|
|
@@ -143,7 +143,7 @@ export class Ds4goCustomerHolder extends ComponentObjectsHandler {
|
|
|
143
143
|
${this._displayObjects.map((displayObj) => {
|
|
144
144
|
const tags = [
|
|
145
145
|
{
|
|
146
|
-
name: `${msg(str`Balance: ${displayObj.balance}
|
|
146
|
+
name: `${msg(str`Balance: ${displayObj.balance}`)}`,
|
|
147
147
|
type: "information",
|
|
148
148
|
},
|
|
149
149
|
];
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { localized, msg } from "@lit/localize";
|
|
2
|
+
import type {
|
|
3
|
+
Asset,
|
|
4
|
+
ContractAgreement,
|
|
5
|
+
PolicyDefinition,
|
|
6
|
+
Resource,
|
|
7
|
+
} from "@src/component";
|
|
8
|
+
import ComponentStyle from "@styles/modal/customer-modal/ds4go-contract-modal-part.scss?inline";
|
|
9
|
+
import { css, html, LitElement, nothing, unsafeCSS } from "lit";
|
|
10
|
+
import { customElement, state } from "lit/decorators.js";
|
|
11
|
+
|
|
12
|
+
type ExtendedContractAgreement = ContractAgreement & {
|
|
13
|
+
relatedBundle?: Resource;
|
|
14
|
+
relatedAsset?: Asset;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
@customElement("ds4go-customer-contract-modal-part")
|
|
18
|
+
@localized()
|
|
19
|
+
export class DS4GOCustomerContractModalPart extends LitElement {
|
|
20
|
+
static styles = css`
|
|
21
|
+
${unsafeCSS(ComponentStyle)}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
@state()
|
|
25
|
+
agreement?: ExtendedContractAgreement;
|
|
26
|
+
|
|
27
|
+
@state()
|
|
28
|
+
assets?: Asset[] = [];
|
|
29
|
+
|
|
30
|
+
@state()
|
|
31
|
+
bundles?: Resource[] = [];
|
|
32
|
+
|
|
33
|
+
@state()
|
|
34
|
+
policies?: PolicyDefinition[] = [];
|
|
35
|
+
|
|
36
|
+
@state()
|
|
37
|
+
expandedAssets = false;
|
|
38
|
+
|
|
39
|
+
@state()
|
|
40
|
+
expandedPolicies = false;
|
|
41
|
+
|
|
42
|
+
@state()
|
|
43
|
+
expandedFacts = false;
|
|
44
|
+
|
|
45
|
+
_toggleSection(section: "assets" | "policies" | "facts") {
|
|
46
|
+
if (section === "assets") {
|
|
47
|
+
this.expandedAssets = !this.expandedAssets;
|
|
48
|
+
} else if (section === "policies") {
|
|
49
|
+
this.expandedPolicies = !this.expandedPolicies;
|
|
50
|
+
} else if (section === "facts") {
|
|
51
|
+
this.expandedFacts = !this.expandedFacts;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_getRelatedBundle(asset?: Asset): Resource | undefined {
|
|
56
|
+
if (!asset?.dataAddress?.baseUrl) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const baseUrl = asset.dataAddress.baseUrl;
|
|
60
|
+
return this.bundles?.find((bundle: Resource) =>
|
|
61
|
+
bundle["@id"].includes(baseUrl),
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
render() {
|
|
66
|
+
if (!this.agreement || !this.agreement["@id"]) {
|
|
67
|
+
return nothing;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const agreementId = this.agreement["@id"];
|
|
71
|
+
const relatedAsset = this.assets?.find(
|
|
72
|
+
(a: Asset) => a["@id"] === this.agreement?.assetId,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (relatedAsset) {
|
|
76
|
+
this.agreement.relatedAsset = relatedAsset;
|
|
77
|
+
this.agreement.relatedBundle = this._getRelatedBundle(relatedAsset);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const relatedPolicies = this.policies?.filter(
|
|
81
|
+
(p: PolicyDefinition) => p["@id"] === this.agreement?.policy?.["@id"],
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
return html`<div class="contract-section">
|
|
85
|
+
<div class="contract-header">
|
|
86
|
+
<tems-division type="h5">${msg("Contract Agreement")}</tems-division>
|
|
87
|
+
<tems-division type="body-sm"
|
|
88
|
+
>${agreementId.split("/").pop()}</tems-division
|
|
89
|
+
>
|
|
90
|
+
${this.agreement.contractSigningDate
|
|
91
|
+
? html`<tems-division type="body-sm"
|
|
92
|
+
>${msg("Signed")}:
|
|
93
|
+
${new Date(
|
|
94
|
+
this.agreement.contractSigningDate,
|
|
95
|
+
).toLocaleString()}</tems-division
|
|
96
|
+
>`
|
|
97
|
+
: nothing}
|
|
98
|
+
${this.agreement.consumerId
|
|
99
|
+
? html`<tems-division type="body-sm"
|
|
100
|
+
>${msg("Consumer")}:
|
|
101
|
+
${this.agreement.consumerId.split("/").pop()}</tems-division
|
|
102
|
+
>`
|
|
103
|
+
: nothing}
|
|
104
|
+
${this.agreement.providerId
|
|
105
|
+
? html`<tems-division type="body-sm"
|
|
106
|
+
>${msg("Provider")}:
|
|
107
|
+
${this.agreement.providerId.split("/").pop()}</tems-division
|
|
108
|
+
>`
|
|
109
|
+
: nothing}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
${relatedAsset
|
|
113
|
+
? html`<div class="contract-subsection">
|
|
114
|
+
<div
|
|
115
|
+
class="collapsible-header"
|
|
116
|
+
@click=${() => this._toggleSection("assets")}
|
|
117
|
+
>
|
|
118
|
+
<tems-division type="body-m"
|
|
119
|
+
>${msg("Related Asset")}</tems-division
|
|
120
|
+
>
|
|
121
|
+
<icon-material-symbols-expand-more
|
|
122
|
+
class="chevron ${this.expandedAssets ? "expanded" : ""}"
|
|
123
|
+
></icon-material-symbols-expand-more>
|
|
124
|
+
</div>
|
|
125
|
+
<div
|
|
126
|
+
class="collapsible-content ${this.expandedAssets
|
|
127
|
+
? "expanded"
|
|
128
|
+
: ""}"
|
|
129
|
+
>
|
|
130
|
+
<div class="assets-list">
|
|
131
|
+
<div class="asset-item">
|
|
132
|
+
<tems-division type="body-sm"
|
|
133
|
+
>${relatedAsset["@id"].split("/").pop()}</tems-division
|
|
134
|
+
>
|
|
135
|
+
<tems-division type="body-xs"
|
|
136
|
+
>${relatedAsset.dataAddress?.baseUrl ||
|
|
137
|
+
msg("No base URL")}</tems-division
|
|
138
|
+
>
|
|
139
|
+
${relatedAsset.dataAddress?.type
|
|
140
|
+
? html`<tems-division type="body-xs"
|
|
141
|
+
>${msg("Type")}:
|
|
142
|
+
${relatedAsset.dataAddress.type}</tems-division
|
|
143
|
+
>`
|
|
144
|
+
: nothing}
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
</div>`
|
|
149
|
+
: nothing}
|
|
150
|
+
${this.agreement.relatedBundle
|
|
151
|
+
? html`<div class="contract-subsection">
|
|
152
|
+
<div
|
|
153
|
+
class="collapsible-header"
|
|
154
|
+
@click=${() => this._toggleSection("facts")}
|
|
155
|
+
>
|
|
156
|
+
<tems-division type="body-m"
|
|
157
|
+
>${msg("Related Bundle & Facts")}</tems-division
|
|
158
|
+
>
|
|
159
|
+
<icon-material-symbols-expand-more
|
|
160
|
+
class="chevron ${this.expandedFacts ? "expanded" : ""}"
|
|
161
|
+
></icon-material-symbols-expand-more>
|
|
162
|
+
</div>
|
|
163
|
+
<div
|
|
164
|
+
class="collapsible-content ${this.expandedFacts
|
|
165
|
+
? "expanded"
|
|
166
|
+
: ""}"
|
|
167
|
+
>
|
|
168
|
+
<div class="bundle-info">
|
|
169
|
+
<tems-division type="h6"
|
|
170
|
+
>${msg("Bundle")}:
|
|
171
|
+
${this.agreement.relatedBundle.name ||
|
|
172
|
+
this.agreement.relatedBundle["@id"]
|
|
173
|
+
.split("/")
|
|
174
|
+
.pop()}</tems-division
|
|
175
|
+
>
|
|
176
|
+
${this.agreement.relatedBundle.description
|
|
177
|
+
? html`<tems-division type="body-sm"
|
|
178
|
+
>${this.agreement.relatedBundle
|
|
179
|
+
.description}</tems-division
|
|
180
|
+
>`
|
|
181
|
+
: nothing}
|
|
182
|
+
</div>
|
|
183
|
+
<tems-division type="h6"
|
|
184
|
+
>${msg("Facts in this bundle")}</tems-division
|
|
185
|
+
>
|
|
186
|
+
<div class="facts-list">
|
|
187
|
+
${this.agreement.relatedBundle.facts?.map((fact: Resource) => {
|
|
188
|
+
const tags =
|
|
189
|
+
fact.categories?.map((c: Resource) => ({
|
|
190
|
+
name: c.name,
|
|
191
|
+
type: "information",
|
|
192
|
+
})) || [];
|
|
193
|
+
if (tags.length > 3) {
|
|
194
|
+
const overflowTags = tags.length - 3;
|
|
195
|
+
tags.splice(3, overflowTags);
|
|
196
|
+
tags.push({
|
|
197
|
+
name: `+${overflowTags} ${msg("more")}`,
|
|
198
|
+
type: "information",
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return html`<ds4go-card-catalog
|
|
202
|
+
.object=${import.meta.env.DEV ? fact : nothing}
|
|
203
|
+
.tags=${tags}
|
|
204
|
+
.header=${fact.name || nothing}
|
|
205
|
+
.content=${fact.description || nothing}
|
|
206
|
+
date=${fact.updated_at || nothing}
|
|
207
|
+
></ds4go-card-catalog>`;
|
|
208
|
+
})}
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
</div>`
|
|
212
|
+
: nothing}
|
|
213
|
+
${relatedPolicies && relatedPolicies.length > 0
|
|
214
|
+
? html`<div class="contract-subsection">
|
|
215
|
+
<div
|
|
216
|
+
class="collapsible-header"
|
|
217
|
+
@click=${() => this._toggleSection("policies")}
|
|
218
|
+
>
|
|
219
|
+
<tems-division type="body-m">${msg("Policies")}</tems-division>
|
|
220
|
+
<icon-material-symbols-expand-more
|
|
221
|
+
class="chevron ${this.expandedPolicies ? "expanded" : ""}"
|
|
222
|
+
></icon-material-symbols-expand-more>
|
|
223
|
+
</div>
|
|
224
|
+
<div
|
|
225
|
+
class="collapsible-content ${this.expandedPolicies
|
|
226
|
+
? "expanded"
|
|
227
|
+
: ""}"
|
|
228
|
+
>
|
|
229
|
+
${relatedPolicies.map(
|
|
230
|
+
(policy: PolicyDefinition) =>
|
|
231
|
+
html`<ds4go-odrl-policy-modal-part
|
|
232
|
+
.policy=${policy}
|
|
233
|
+
></ds4go-odrl-policy-modal-part>`,
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
</div>`
|
|
237
|
+
: nothing}
|
|
238
|
+
</div>`;
|
|
239
|
+
}
|
|
240
|
+
}
|