@salesforcedevs/dx-components 1.3.42 → 1.3.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.42",
3
+ "version": "1.3.43",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -40,5 +40,5 @@
40
40
  "eventsourcemock": "^2.0.0",
41
41
  "luxon": "^3.1.0"
42
42
  },
43
- "gitHead": "a5ddc2bf9e25ef6d9c937086335387a23f647e91"
43
+ "gitHead": "de82bbf2fd1ea6664ceed1233ccf4aed43ac19ec"
44
44
  }
@@ -69,6 +69,7 @@
69
69
  size="large"
70
70
  href={buttonOneHref}
71
71
  variant="primary"
72
+ target={buttonOneTarget}
72
73
  font="sans"
73
74
  icon-symbol={buttonOneIcon}
74
75
  icon-size={buttonOneIconSize}
@@ -82,6 +83,7 @@
82
83
  href={buttonOneHref}
83
84
  variant="primary"
84
85
  font="sans"
86
+ target={buttonOneTarget}
85
87
  icon-symbol={buttonOneIcon}
86
88
  icon-size={buttonOneIconSize}
87
89
  >
@@ -71,6 +71,10 @@ export default class CardTrial extends LightningElement {
71
71
  return this.hasButtons ? "menu" : "link";
72
72
  }
73
73
 
74
+ get buttonOneTarget() {
75
+ return this.isExternalURL(this.buttonOneHref) ? "_blank" : null;
76
+ }
77
+
74
78
  private _details!: string[];
75
79
  private _modalDetails!: [{ title: string; subtitle: string }];
76
80
  private _modalOpen = false;
@@ -99,4 +103,17 @@ export default class CardTrial extends LightningElement {
99
103
  window.location.assign(this.href);
100
104
  }
101
105
  }
106
+
107
+ private isExternalURL(url: string | undefined): boolean {
108
+ if (!url) {
109
+ return false;
110
+ }
111
+
112
+ try {
113
+ const value = new URL(url);
114
+ return value.host !== window.location.host;
115
+ } catch (e) {
116
+ return false;
117
+ }
118
+ }
102
119
  }