@salesforcedevs/dw-components 1.3.33 → 1.3.45

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",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -24,5 +24,5 @@
24
24
  "@types/setimmediate": "^1.0.2",
25
25
  "setimmediate": "^1.0.5"
26
26
  },
27
- "gitHead": "bc1e71ba19a01c9479ba93b8f827cc152c359c33"
27
+ "gitHead": "b2340b9de4e809097ee2f5c5d1bff87b5bc3aab6"
28
28
  }
@@ -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
  }