@salesforcedevs/dw-components 1.3.197-canary.0 → 1.3.206

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/LICENSE ADDED
@@ -0,0 +1,12 @@
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.3.197-canary.0",
3
+ "version": "1.3.206",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -23,5 +23,6 @@
23
23
  "@types/lodash.uniqby": "^4.7.7",
24
24
  "@types/setimmediate": "^1.0.2",
25
25
  "setimmediate": "^1.0.5"
26
- }
26
+ },
27
+ "gitHead": "64dfbe7681c227a3ff1aa409decf2c079c848715"
27
28
  }
@@ -4,7 +4,6 @@
4
4
  communicate-step-changes="true"
5
5
  force-initially-visible={forceInitiallyVisible}
6
6
  initial-step-index={initialStepIndex}
7
- lwc:ref="stepSequence"
8
7
  onstepsequencechange={handleStepSequenceChange}
9
8
  optimize-position-after-animation="true"
10
9
  session-storage-id={sessionStorageId}
@@ -79,8 +79,8 @@ export default class J2sCardSequence extends LightningElement {
79
79
  _recaptchaResetTimeoutId: number | null = null;
80
80
  _stepsData: StepDatum[] = [];
81
81
  @api drmDomain: string = "https://drm.my.salesforce-sites.com";
82
- @api drmHandlerBaseUrl: string =
83
- "https://dev-sapi-th-ms-infra-form-handler-proxy.us-w2.cloudhub.io";
82
+ @api formHandler: string =
83
+ "https://formhandlermule-1s9xrb.5sc6y6-4.usa-e2.cloudhub.io/form_handler";
84
84
  @api tbidApiBaseUrl: string | undefined;
85
85
  @api useHistory: boolean = false;
86
86
 
@@ -128,14 +128,6 @@ export default class J2sCardSequence extends LightningElement {
128
128
  return Boolean(this.tbidUserInfo);
129
129
  }
130
130
 
131
- private get drmEmailUrl() {
132
- return `${this.drmHandlerBaseUrl}/getEmail`;
133
- }
134
-
135
- private get formHandlerUrl() {
136
- return `${this.drmHandlerBaseUrl}/form_handler`;
137
- }
138
-
139
131
  private get formIncomingUserInfo() {
140
132
  if (!this.tbidUserInfo) {
141
133
  return {} as DrmFormData;
@@ -149,8 +141,8 @@ export default class J2sCardSequence extends LightningElement {
149
141
  Company__c: this.tbidUserInfo.custom_attributes?.CompanyName,
150
142
  MailingCountry: this.tbidUserInfo.custom_attributes?.Country,
151
143
  MailingState: this.tbidUserInfo.address?.region,
152
- RelationshipToSalesforce:
153
- this.tbidUserInfo.custom_attributes?.RelationshipToSalesforce
144
+ RelationshipToSalesforce: this.tbidUserInfo.custom_attributes
145
+ ?.RelationshipToSalesforce
154
146
  };
155
147
 
156
148
  // Return above object but only with keys that have a truthy value, and with any URI-encoded values decoded
@@ -227,16 +219,18 @@ export default class J2sCardSequence extends LightningElement {
227
219
 
228
220
  renderedCallback() {
229
221
  if (!this.isLoading) {
230
- (this.refs.stepSequence as StepSequence)?.remeasureSteps();
222
+ ((this.template.querySelector(
223
+ "dx-step-sequence"
224
+ ) as unknown) as StepSequence)?.remeasureSteps();
231
225
  }
232
226
 
233
227
  if (
234
228
  this.formSubmissionFailureState &&
235
229
  this.stepsData[this.currentSequenceStep].formData
236
230
  ) {
237
- const j2sCardStep = this.template.querySelectorAll(
231
+ const j2sCardStep = (this.template.querySelectorAll(
238
232
  "dw-j2s-card-sequence-step"
239
- ) as unknown as J2sCardSequenceStep[];
233
+ ) as unknown) as J2sCardSequenceStep[];
240
234
  j2sCardStep[this.currentSequenceStep]?.notifyFormSubmitFailure(
241
235
  this.formSubmissionFailureState
242
236
  );
@@ -291,14 +285,14 @@ export default class J2sCardSequence extends LightningElement {
291
285
  }
292
286
 
293
287
  async handleFormSubmit({ detail: formData }: CustomEvent<DrmFormData>) {
294
- if (!this.formHandlerUrl || !this.isLoggedIn) {
288
+ if (!this.formHandler || !this.isLoggedIn) {
295
289
  return;
296
290
  }
297
291
 
298
292
  this._isFormSubmitting = true;
299
293
 
300
294
  try {
301
- const res = await fetch(this.formHandlerUrl, {
295
+ const res = await fetch(this.formHandler, {
302
296
  method: "POST",
303
297
  headers: {
304
298
  "Content-Type": "application/json",
@@ -380,7 +374,9 @@ export default class J2sCardSequence extends LightningElement {
380
374
  if (andStoreIndex) {
381
375
  this.initialStepIndex = stepIndex; // update sessionStorage value
382
376
  }
383
- (this.refs.stepSequence as StepSequence)?.jumpToStep(stepIndex);
377
+ ((this.template.querySelector(
378
+ "dx-step-sequence"
379
+ ) as unknown) as StepSequence)?.jumpToStep(stepIndex);
384
380
  }
385
381
 
386
382
  private async getCountryList() {
@@ -413,16 +409,7 @@ export default class J2sCardSequence extends LightningElement {
413
409
  try {
414
410
  const res = await fetch(`${this.tbidApiBaseUrl}/userinfo`);
415
411
  if (res.ok) {
416
- const userInfo = await res.json();
417
- const emailOverride = await this.getDrmEmailOverride(
418
- userInfo?.user_id
419
- );
420
- this.tbidUserInfo = !emailOverride
421
- ? userInfo
422
- : {
423
- ...userInfo,
424
- email: emailOverride
425
- };
412
+ this.tbidUserInfo = await res.json();
426
413
  this.selectedCountry = this.formIncomingUserInfo.MailingCountry;
427
414
  }
428
415
  } catch (ex) {
@@ -437,30 +424,4 @@ export default class J2sCardSequence extends LightningElement {
437
424
 
438
425
  this._isTbidLoading = false;
439
426
  }
440
-
441
- private async getDrmEmailOverride(
442
- tbid: string
443
- ): Promise<string | undefined> {
444
- let resolvedEmail = "";
445
-
446
- if (!tbid) {
447
- return resolvedEmail;
448
- }
449
-
450
- try {
451
- const res = await fetch(`${this.drmEmailUrl}?tbid=${tbid}`);
452
- if (res.ok) {
453
- const resData = await res.json();
454
- if (resData.message === "success") {
455
- resolvedEmail = resData.Email;
456
- }
457
- }
458
- } catch (ex) {
459
- console.warn(
460
- `Could not fetch email address from DRM, defaulting to TBID info. (Exception: ${ex})`
461
- );
462
- }
463
-
464
- return resolvedEmail;
465
- }
466
427
  }
@@ -53,6 +53,7 @@
53
53
  <div class="form-row">
54
54
  <dx-input
55
55
  name="Email"
56
+ description-markup="All program emails will be sent to this address. Be sure to check it for essential info and links."
56
57
  type="email"
57
58
  placeholder="Your email address"
58
59
  label="Email"
@@ -101,6 +102,7 @@
101
102
  <div class="form-row">
102
103
  <dx-input
103
104
  name="Email"
105
+ description-markup="All program emails will be sent to this address. Be sure to check it for essential info and links."
104
106
  class="full-width-input-field"
105
107
  type="email"
106
108
  placeholder="Your email address"