@startinblox/components-ds4go 3.1.0 → 3.1.2

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/index.js CHANGED
@@ -1 +1 @@
1
- import "./index-BSwVRtNS.js";
1
+ import "./index-juyC2UdH.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/components-ds4go",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Startin'blox DS4GO",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -147,6 +147,12 @@ export class Ds4goFactBundleHolder extends ComponentObjectsHandler {
147
147
  type: "information",
148
148
  },
149
149
  ];
150
+ if(displayObj.category) {
151
+ tags.push({
152
+ name: displayObj.category,
153
+ type: "default",
154
+ });
155
+ }
150
156
  return html`<ds4go-card-catalog
151
157
  .object=${import.meta.env.DEV ? displayObj : nothing}
152
158
  type=${"bill-image"}
@@ -22,7 +22,7 @@ const formatCase = (str: string) => {
22
22
  .replace(/([A-Z])/g, " $1")
23
23
  .replace(/^./, (str) => str.toUpperCase())
24
24
  .trim();
25
- }
25
+ };
26
26
 
27
27
  @customElement("solid-fact-bundle-creation")
28
28
  export class SolidFactBundle extends OrbitComponent {
@@ -184,6 +184,17 @@ export class SolidFactBundle extends OrbitComponent {
184
184
  }
185
185
  }
186
186
 
187
+ _reset() {
188
+ this.bundleName = "";
189
+ this.bundleDescription = "";
190
+ this.bundleCategory = "";
191
+ this.bundleLanguage = "en";
192
+ this.bundleAccessPolicy = this.policyTemplates[0].id;
193
+ this.bundleContractPolicy = this.policyTemplates[0].id;
194
+ this.selectedFacts = [];
195
+ this.step = 0;
196
+ }
197
+
187
198
  async _createFactBundle() {
188
199
  if (!this.bundleName || !(this.selectedFacts.length > 0)) {
189
200
  return;
@@ -242,8 +253,8 @@ export class SolidFactBundle extends OrbitComponent {
242
253
  bundleSize: this.selectedFacts.length,
243
254
  offeredAccess: "40",
244
255
  pricingTier: "premium",
245
- // "dcat:endpointUrl": "https://api.stg.ds4go.startinblox.com/facts/", // ?
246
- previewLinks: this.selectedFacts.slice(0, 3).join(", "),
256
+ "dcat:endpointUrl": newFactBundleId,
257
+ previewLinks: this.selectedFacts.slice(0, 3).map(fact => fact["@id"]).join(", "),
247
258
  "dsif:pricing": {
248
259
  "dsif:costPerAPICall": 0.15,
249
260
  "dsif:setupFee": 50,
@@ -320,11 +331,7 @@ export class SolidFactBundle extends OrbitComponent {
320
331
  }
321
332
  }
322
333
 
323
- this.bundleName = "";
324
- this.bundleDescription = "";
325
- this.bundleDescription = "";
326
- this.step = 0;
327
- this.selectedFacts = [];
334
+ this._reset();
328
335
 
329
336
  const factbundleComponent: any = this.orbit?.components.find(
330
337
  (c) => c.type === "fact-bundle",
@@ -420,12 +427,19 @@ export class SolidFactBundle extends OrbitComponent {
420
427
  label=${msg("Set bundle informations")}
421
428
  @click=${this._nextStep}
422
429
  ></tems-button>`
423
- : html`<tems-button
424
- type="primary"
425
- disabled=${!allowCreation || nothing}
426
- label=${msg("Create bundle")}
427
- @click=${this._createFactBundle}
428
- ></tems-button>`}
430
+ : html`<div class="flex">
431
+ <tems-button
432
+ type="link-color"
433
+ label=${msg("Cancel bundle creation")}
434
+ @click=${this._reset}
435
+ ></tems-button
436
+ ><tems-button
437
+ type="primary"
438
+ disabled=${!allowCreation || nothing}
439
+ label=${msg("Create bundle")}
440
+ @click=${this._createFactBundle}
441
+ ></tems-button>
442
+ </div>`}
429
443
  </div>
430
444
  </tems-header>
431
445
  <div slot="content">
@@ -582,8 +596,8 @@ export class SolidFactBundle extends OrbitComponent {
582
596
  ${Array.from(
583
597
  new Set(
584
598
  this.selectedFacts.flatMap((fact) =>
585
- fact.categories.map(
586
- (category: Resource) => formatCase(category.name),
599
+ fact.categories.map((category: Resource) =>
600
+ formatCase(category.name),
587
601
  ),
588
602
  ),
589
603
  ),
@@ -49,6 +49,7 @@ export class SolidFactBundle extends OrbitComponent {
49
49
  { key: "created_at", value: "created_at", cast: formatDate },
50
50
  { key: "updated_at", value: "updated_at", cast: formatDate },
51
51
  { key: "name", value: "name" },
52
+ { key: "category", value: "category" },
52
53
  { key: "description", value: "description" },
53
54
  ];
54
55