@startinblox/components-ds4go 3.3.8 → 4.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.
Files changed (31) hide show
  1. package/dist/components-ds4go.css +1 -1
  2. package/dist/index.js +3534 -3602
  3. package/locales/en.xlf +187 -3
  4. package/package.json +2 -2
  5. package/src/component.d.ts +0 -5
  6. package/src/components/cards/ds4go-card-dataspace-catalog.ts +82 -227
  7. package/src/components/cards/ds4go-card-fact.ts +128 -0
  8. package/src/components/catalog/ds4go-catalog-data-holder.ts +158 -0
  9. package/src/components/catalog/ds4go-fact-holder.ts +149 -0
  10. package/src/components/modal/catalog-modal/agreement-info.ts +110 -0
  11. package/src/components/modal/catalog-modal/index.ts +4 -0
  12. package/src/components/modal/catalog-modal/negotiation-button.ts +111 -0
  13. package/src/components/modal/catalog-modal/policy-display.ts +66 -0
  14. package/src/components/modal/catalog-modal/policy-selection.ts +71 -0
  15. package/src/components/modal/ds4go-catalog-modal.ts +158 -1105
  16. package/src/components/modal/ds4go-fact-modal.ts +217 -0
  17. package/src/components/odrl/policy-composer.ts +1 -1
  18. package/src/components/odrl-policy-viewer.ts +0 -21
  19. package/src/components/solid-dsp-catalog.ts +2 -43
  20. package/src/components/solid-fact-list.ts +307 -0
  21. package/src/ds4go.d.ts +78 -1
  22. package/src/helpers/dsp/agreementStorage.ts +243 -0
  23. package/src/helpers/dsp/policyHelpers.ts +223 -0
  24. package/src/helpers/index.ts +7 -0
  25. package/src/styles/cards/ds4go-card-catalog.scss +1 -1
  26. package/src/styles/cards/ds4go-card-dataspace-catalog.scss +22 -165
  27. package/src/styles/cards/ds4go-card-fact.scss +112 -0
  28. package/src/styles/index.scss +42 -0
  29. package/src/styles/modal/ds4go-catalog-modal.scss +1 -1
  30. package/src/styles/modal/ds4go-fact-modal.scss +161 -0
  31. package/src/components/modal/ds4go-catalog-data-holder.ts +0 -349
@@ -0,0 +1,66 @@
1
+ import { localized, msg } from "@lit/localize";
2
+ import { html, nothing, type TemplateResult } from "lit";
3
+ import { customElement, property } from "lit/decorators.js";
4
+ import { LitElement } from "lit";
5
+ import { hasMultiplePolicies } from "@helpers/dsp/policyHelpers";
6
+ import type { ODRLPolicy } from "@src/ds4go";
7
+
8
+ /**
9
+ * Policy display component for showing access policy information
10
+ */
11
+ @customElement("catalog-modal-policy-display")
12
+ @localized()
13
+ export class CatalogModalPolicyDisplay extends LitElement {
14
+ @property({ attribute: false })
15
+ policy?: ODRLPolicy;
16
+
17
+ @property({ attribute: false })
18
+ policies?: ODRLPolicy[];
19
+
20
+ render(): TemplateResult | typeof nothing {
21
+ const hasMultiple = hasMultiplePolicies(this.policies || []);
22
+ const policies = this.policies || [];
23
+
24
+ // Only show if there's a policy
25
+ if (!this.policy && (!this.policies || this.policies.length === 0)) {
26
+ return nothing;
27
+ }
28
+
29
+ return html`<div
30
+ style="margin-top: 24px; padding: 16px; background: #f0f7ff; border-radius: 8px; border: 1px solid #d0e7ff;"
31
+ >
32
+ ${hasMultiple
33
+ ? html`<tems-division type="h4"
34
+ ><div>${msg("Access Policies")}</div></tems-division
35
+ >
36
+ <div style="margin-bottom: 12px; color: #0066cc; font-size: 0.9em;">
37
+ ${msg("Multiple contract policies available for this asset")}
38
+ (${policies.length})
39
+ </div>
40
+ ${policies.map(
41
+ (p: ODRLPolicy, index: number) =>
42
+ html`<div
43
+ style="margin-bottom: 16px; padding: 12px; background: white; border-radius: 6px; border-left: 4px solid #0066cc;"
44
+ >
45
+ <div
46
+ style="font-weight: 600; margin-bottom: 8px; color: #333;"
47
+ >
48
+ ${msg("Policy")} ${index + 1}
49
+ ${p["@id"]
50
+ ? html`<span
51
+ style="font-weight: normal; font-size: 0.85em; color: #666; display: block; margin-top: 4px; word-break: break-all; font-family: monospace;"
52
+ >
53
+ ${p["@id"]}
54
+ </span>`
55
+ : nothing}
56
+ </div>
57
+ <odrl-policy-viewer .policy=${p}></odrl-policy-viewer>
58
+ </div>`,
59
+ )}`
60
+ : html`<tems-division type="h4"
61
+ ><div>${msg("Access Policy")}</div></tems-division
62
+ >
63
+ <odrl-policy-viewer .policy=${this.policy}></odrl-policy-viewer>`}
64
+ </div>`;
65
+ }
66
+ }
@@ -0,0 +1,71 @@
1
+ import { localized, msg } from "@lit/localize";
2
+ import { html, nothing, type TemplateResult } from "lit";
3
+ import { customElement, property } from "lit/decorators.js";
4
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
5
+ import { LitElement } from "lit";
6
+ import { formatPolicyDetails } from "@helpers/dsp/policyHelpers";
7
+ import type { ODRLPolicy } from "@src/ds4go";
8
+
9
+ /**
10
+ * Policy selection component for choosing from multiple available policies
11
+ */
12
+ @customElement("catalog-modal-policy-selection")
13
+ @localized()
14
+ export class CatalogModalPolicySelection extends LitElement {
15
+ @property({ attribute: false })
16
+ policies: ODRLPolicy[] = [];
17
+
18
+ private _handlePolicySelect(index: number): void {
19
+ this.dispatchEvent(
20
+ new CustomEvent("policy-selected", {
21
+ detail: { index },
22
+ bubbles: true,
23
+ composed: true,
24
+ }),
25
+ );
26
+ }
27
+
28
+ private _handleCancel(): void {
29
+ this.dispatchEvent(
30
+ new CustomEvent("policy-cancel", {
31
+ bubbles: true,
32
+ composed: true,
33
+ }),
34
+ );
35
+ }
36
+
37
+ render(): TemplateResult {
38
+ return html`<div class="policy-selection-modal">
39
+ <div class="policy-selection-header">
40
+ <h3>${msg("Select a Policy")}</h3>
41
+ <p>
42
+ ${msg(
43
+ "Multiple policies are available for this dataset. Please select one to proceed with the negotiation.",
44
+ )}
45
+ </p>
46
+ </div>
47
+ <div class="policy-selection-list">
48
+ ${this.policies.map(
49
+ (policy: ODRLPolicy, index: number) =>
50
+ html`<div
51
+ class="policy-option"
52
+ @click=${() => this._handlePolicySelect(index)}
53
+ >
54
+ <div class="policy-option-header">
55
+ <strong>${msg("Policy")} ${index + 1}</strong>
56
+ ${policy["@id"] ? html`<code>${policy["@id"]}</code>` : nothing}
57
+ </div>
58
+ <div class="policy-option-details">
59
+ ${formatPolicyDetails(policy)}
60
+ </div>
61
+ </div>`,
62
+ )}
63
+ </div>
64
+ <div class="policy-selection-actions">
65
+ <tems-button type="outline-gray" @click=${this._handleCancel}>
66
+ ${msg("Cancel")}
67
+ </tems-button>
68
+ </div>
69
+ </div>`;
70
+ }
71
+ }