@salesforcedevs/dx-components 1.17.4 → 1.17.8-search-alpha

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/lwc.config.json CHANGED
@@ -136,6 +136,7 @@
136
136
  "dxUtils/normalizers",
137
137
  "dxUtils/queryCoordinator",
138
138
  "dxUtils/recentSearches",
139
+ "dxUtils/regexps",
139
140
  "dxUtils/withTypedRefs",
140
141
  "dxUtils/wordpress"
141
142
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.17.4",
3
+ "version": "1.17.8-search-alpha",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -44,6 +44,5 @@
44
44
  },
45
45
  "volta": {
46
46
  "node": "20.19.0"
47
- },
48
- "gitHead": "748e5cc77814f8354de211225adb147deff9124f"
47
+ }
49
48
  }
@@ -33,7 +33,7 @@
33
33
  class={className}
34
34
  href={href}
35
35
  target={target}
36
- onclick={handleClick}
36
+ onclick={handleCardClick}
37
37
  lwc:if={isPrimary}
38
38
  >
39
39
  <template if:true={topText}>
@@ -121,7 +121,7 @@
121
121
  class={className}
122
122
  href={href}
123
123
  target={target}
124
- onclick={handleClick}
124
+ onclick={handleCardClick}
125
125
  lwc:if={isSecondary}
126
126
  >
127
127
  <div class="badge-container" lwc:if={badgeSymbol}>
@@ -174,6 +174,7 @@
174
174
  font="sans"
175
175
  icon-symbol={buttonOneIcon}
176
176
  icon-size={buttonOneIconSize}
177
+ onclick={handleCtaClick}
177
178
  >
178
179
  {buttonOneCta}
179
180
  </dx-button>
@@ -187,6 +188,7 @@
187
188
  target={buttonOneTarget}
188
189
  icon-symbol={buttonOneIcon}
189
190
  icon-size={buttonOneIconSize}
191
+ onclick={handleCtaClick}
190
192
  >
191
193
  {buttonOneCta}
192
194
  </dx-button>
@@ -102,24 +102,39 @@ export default class CardTrial extends LightningElement {
102
102
  return cx("details", this.hasButtons && "details_top-margin");
103
103
  }
104
104
 
105
- private openModal() {
105
+ private openModal(event: any) {
106
106
  this._modalOpen = true;
107
+ this.handleCtaClick(event);
107
108
  }
108
109
 
109
110
  private closeModal() {
110
111
  this._modalOpen = false;
111
112
  }
112
113
 
113
- private handleClick(e: PointerEvent) {
114
+ private handleCardClick(event: PointerEvent) {
114
115
  // card is clickable only if it doesn't contain buttons (for accessibility reasons)
115
116
  if (!this.hasButtons) {
116
117
  window.location.assign(this.href);
117
118
  if (this.href.includes("signup")) {
118
- this.handleSignUpClick(e);
119
+ this.handleSignUpClick(event);
119
120
  }
120
121
  }
121
122
  }
122
123
 
124
+ private handleCtaClick(event: any) {
125
+ track(document, "custEv_ctaButtonClick", {
126
+ click_text: event.currentTarget.innerText,
127
+ item_title: event.currentTarget.innerText,
128
+ click_url: `${
129
+ event.currentTarget.href.includes("http")
130
+ ? event.currentTarget.href
131
+ : window.location.origin + event.currentTarget.href
132
+ }`,
133
+ element_type: "button",
134
+ content_category: "cta"
135
+ });
136
+ }
137
+
123
138
  private handleSignUpClick(e: PointerEvent) {
124
139
  const payload = {
125
140
  click_text: this.label,
@@ -58,6 +58,7 @@
58
58
  value={searchText}
59
59
  onchange={onSearchChange}
60
60
  shortcut-key="j"
61
+ clearable
61
62
  ></dx-input>
62
63
  </div>
63
64
  <slot name="version-picker"></slot>
@@ -4,6 +4,7 @@ import { api } from "lwc";
4
4
  import { TreeNode } from "typings/custom";
5
5
  import { toJson } from "dxUtils/normalizers";
6
6
  import { SidebarBase } from "dxBaseElements/sidebarBase";
7
+ import { escapeRegExp } from "dxUtils/regexps";
7
8
 
8
9
  const WAIT_TIME = 500;
9
10
  const MOBILE_SIZE_MATCH = "768px";
@@ -119,7 +120,11 @@ export default class Sidebar extends SidebarBase {
119
120
  key: this.makeKey(),
120
121
  tree: this.searchText
121
122
  ? this.findMatch(
122
- new RegExp(this.searchText.toLowerCase().trim()),
123
+ new RegExp(
124
+ escapeRegExp(
125
+ this.searchText.toLowerCase().trim()
126
+ )
127
+ ),
123
128
  singleTree
124
129
  )!
125
130
  : singleTree
@@ -1,5 +1,6 @@
1
1
  import { logCoveoPageView } from "docUtils/utils";
2
2
  import { LightningElement, api } from "lwc";
3
+ import { escapeRegExp } from "dxUtils/regexps";
3
4
 
4
5
  const REDUNDANT_INSTANCE_ERROR_MESSAGE =
5
6
  "Multiple <dx-traffic-labeler>s detected, this should never be the case.";
@@ -36,7 +37,7 @@ export default class TrafficLabeler extends LightningElement {
36
37
  const internalIps = this.internalIps?.split(",");
37
38
 
38
39
  const isInternal = internalIps?.some((value) => {
39
- const regex = new RegExp(value);
40
+ const regex = new RegExp(escapeRegExp(value));
40
41
  return regex.test(result.ip);
41
42
  });
42
43
 
@@ -1,4 +1,4 @@
1
- const escapeRegExp = (text: string) =>
1
+ export const escapeRegExp = (text: string) =>
2
2
  text.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&");
3
3
 
4
4
  export const createSearchRegExp = (searchTerm: string): RegExp =>
package/LICENSE DELETED
@@ -1,12 +0,0 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
-
8
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
-
10
- * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.