@salesforcedevs/dw-components 1.3.33 → 1.3.45-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.3.33",
3
+ "version": "1.3.45-alpha.0",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -23,6 +23,5 @@
23
23
  "@types/lodash.uniqby": "^4.7.7",
24
24
  "@types/setimmediate": "^1.0.2",
25
25
  "setimmediate": "^1.0.5"
26
- },
27
- "gitHead": "bc1e71ba19a01c9479ba93b8f827cc152c359c33"
26
+ }
28
27
  }
@@ -1,7 +1,11 @@
1
1
  <template>
2
2
  <div class="panel-list-container">
3
3
  <h2 class="title">{title}</h2>
4
- <dx-tab-panel-list tabs={tabLabels} onchange={handleTabChange}>
4
+ <dx-tab-panel-list
5
+ tabs={tabLabels}
6
+ onchange={handleTabChange}
7
+ initial-index={storedTabIndex}
8
+ >
5
9
  <template for:each={trials} for:item="trial">
6
10
  <dx-tab-panel key={trial.label}>
7
11
  <div
@@ -1,6 +1,8 @@
1
1
  import { LightningElement, api, track } from "lwc";
2
2
  import { toJson } from "dxUtils/normalizers";
3
3
 
4
+ const LOCAL_STORAGE_KEY = "storedTabIndex";
5
+
4
6
  export default class BrowseTrials extends LightningElement {
5
7
  @api title = "Browse Trials";
6
8
 
@@ -51,6 +53,7 @@ export default class BrowseTrials extends LightningElement {
51
53
  private _filteredCategories!: Array<any>;
52
54
 
53
55
  private activeTabIndex = 0;
56
+ private storedTabIndex;
54
57
  private buttonLabels!: string[][];
55
58
  private _filteredTitles!: string[][];
56
59
  private tabLabels!: Array<{ label: string }>;
@@ -63,8 +66,15 @@ export default class BrowseTrials extends LightningElement {
63
66
  }
64
67
  ];
65
68
 
69
+ connectedCallback() {
70
+ this.storedTabIndex = window.localStorage.getItem(LOCAL_STORAGE_KEY);
71
+ window.localStorage.removeItem(LOCAL_STORAGE_KEY);
72
+ }
73
+
66
74
  handleTabChange(e: CustomEvent) {
67
75
  this.activeTabIndex = e.detail;
76
+ window.localStorage.setItem(LOCAL_STORAGE_KEY, e.detail);
77
+ console.log("handleTabChange", e.detail);
68
78
  }
69
79
 
70
80
  filterCategories() {
@@ -31,18 +31,6 @@ const DUPLICATE_USERNAME_MESSAGE =
31
31
  const ACCEPTED = "accepted";
32
32
  const SIGN_UP_LABEL = "Sign me Up";
33
33
 
34
- const ANALYTICS_INFO = {
35
- clickText: "Sign me Up",
36
- itemTitle: "Dev Edition Sign Up Button",
37
- formType: "Dev Edition Sign Up",
38
- formName: "DEVELOPER:xx:signup:Developer-Edition",
39
- method: "email",
40
- clickUrl: "/signup/success",
41
- elementType: "button",
42
- destinationType: "internal",
43
- ctaClick: true,
44
- offerType: "Free Trial"
45
- };
46
34
  export default class DeSignupForm extends LightningElement {
47
35
  @api
48
36
  get countries() {
@@ -163,10 +151,12 @@ export default class DeSignupForm extends LightningElement {
163
151
  submitForm(formData)
164
152
  .then(() => {
165
153
  trackGtm(event.target!, "custEv_signUp", {
166
- ...ANALYTICS_INFO,
167
- formId: "form-builder|DEVELOPER:xx:signup|<null>"
154
+ authenticationMethod: "dev edition sign up form",
155
+ authenticationType: "dev edition",
156
+ userId: this.username,
157
+ newRegistration: true
168
158
  });
169
- window.location.href = ANALYTICS_INFO.clickUrl;
159
+ window.location.href = "/signup/success";
170
160
  })
171
161
  .catch((error) => {
172
162
  if (error.message === ErrorCode.DUPLICATE) {
@@ -2,17 +2,7 @@ import { LightningElement, api } from "lwc";
2
2
  import { track } from "dxUtils/analytics";
3
3
  import { CountryOptions, CheckboxTextSet } from "typings/custom";
4
4
 
5
- const ANALYTICS_INFO = {
6
- itemTitle: "newsletter sign up submit",
7
- formName: "newsletter",
8
- formType: "newsletter",
9
- method: "email",
10
- destinationType: "internal",
11
- clickText: "Subscribe Now",
12
- clickUrl: "/newsletter/success",
13
- elementType: "button",
14
- ctaClick: true
15
- };
5
+ const LOCAL_STORAGE_KEY = "subscriberEmail";
16
6
 
17
7
  export default class Form extends LightningElement {
18
8
  @api checkboxTextSet: string = "";
@@ -104,14 +94,11 @@ export default class Form extends LightningElement {
104
94
  }
105
95
 
106
96
  setInitialEmail() {
107
- // Set email if provided in the query param
108
- const queryString = window.location.search;
109
- const urlParams = new URLSearchParams(queryString);
110
-
111
- const subscriberEmail = urlParams.get("subscriberEmail");
112
-
97
+ // Set email if provided in the local storage
98
+ const subscriberEmail = window.localStorage.getItem(LOCAL_STORAGE_KEY);
113
99
  if (subscriberEmail) {
114
100
  this.email = subscriberEmail;
101
+ window.localStorage.removeItem(LOCAL_STORAGE_KEY);
115
102
  }
116
103
  }
117
104
 
@@ -161,7 +148,17 @@ export default class Form extends LightningElement {
161
148
  }
162
149
 
163
150
  // GTM event
164
- track(submitButtonEl, "custEv_formCompletion", ANALYTICS_INFO);
151
+ track(submitButtonEl, "custEv_formCompletion", {
152
+ itemTitle: "newsletter sign up submit",
153
+ formName: "newsletter",
154
+ formType: "newsletter",
155
+ method: "email",
156
+ destinationType: "internal",
157
+ clickText: "Subscribe Now",
158
+ clickUrl: "/newsletter/success",
159
+ elementType: "button",
160
+ ctaClick: true
161
+ });
165
162
 
166
163
  window.location.assign("/newsletter/success");
167
164
  } catch (error) {
@@ -109,40 +109,31 @@ export default class TbidLoginMenu extends LightningElement {
109
109
  // Shared utility for tracking link clicks.
110
110
  private trackMenuClick = (
111
111
  target: HTMLAnchorElement | null,
112
- eventName: string,
113
- navItemPrefix: string
112
+ eventName: string
114
113
  ) => {
115
- const trackingPayload: any = {
116
- nav_level: "utility",
117
- nav_type: "global",
118
- elementType: "link"
119
- };
120
-
121
- if (target) {
122
- trackingPayload.clickText = target.textContent?.trim() || "";
123
- trackingPayload.clickUrl = target.href;
124
- const [firstWord, ...remainingText] =
125
- trackingPayload.clickText.split(" ");
126
- trackingPayload.nav_item = `${navItemPrefix}${firstWord.toLowerCase()}${remainingText.join()}`;
127
- }
128
-
129
- track(target || document, eventName, trackingPayload);
114
+ track(target || document, eventName, {
115
+ clickText: target.textContent?.trim() || "",
116
+ clickUrl: target.href || "",
117
+ elementTitle: "a",
118
+ elementType: "link",
119
+ contentCategory: "tbid"
120
+ });
130
121
  };
131
122
 
132
123
  // Track link clicks on the "logged out" version of the dropdown.
133
124
  private trackLoginMenuClick = (event: Event) => {
134
125
  const target = event.currentTarget as HTMLAnchorElement | null;
135
- this.trackMenuClick(target, "custEv_loginClick", "login:salesforce:");
126
+ this.trackMenuClick(target, "custEv_loginClick");
136
127
  };
137
128
 
138
129
  // Track link clicks on the "logged in" version of the dropdown.
139
130
  private trackLoggedInMenuClick = (event: Event) => {
140
131
  const target = event.currentTarget as HTMLAnchorElement | null;
141
- this.trackMenuClick(target, "custEv_loginMenuClick", "login:tbid:");
132
+ this.trackMenuClick(target, "custEv_loginMenuClick");
142
133
  };
143
134
 
144
135
  // Special tracking for clicking on "Logout" specifically
145
136
  private trackLogoutClick = (target: HTMLAnchorElement | null) => {
146
- this.trackMenuClick(target, "custEv_userLogout", "login:tbid:");
137
+ this.trackMenuClick(target, "custEv_userLogout");
147
138
  };
148
139
  }
@@ -48,14 +48,18 @@ export abstract class PostsGrid extends LightningElement {
48
48
  track(e.target, "custEv_ctaLinkClick", {
49
49
  ...ANALYTICS_INFO,
50
50
  clickText: "show more",
51
- itemTitle: "show more"
51
+ elementTitle: "dx-button",
52
+ elementType: "button",
53
+ contentCategory: "cta"
52
54
  });
53
55
  } else {
54
56
  track(e.target, "custEv_ctaLinkClick", {
55
57
  ...ANALYTICS_INFO,
56
58
  clickText: "view archives",
57
- itemTitle: "view archives",
58
- clickUrl: "https://developer.salesforce.com/content-archive"
59
+ clickUrl: "https://developer.salesforce.com/content-archive",
60
+ elementTitle: "dx-button",
61
+ elementType: "button",
62
+ contentCategory: "cta"
59
63
  });
60
64
  }
61
65
  }
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.