@salesforcedevs/dw-components 1.3.302 → 1.3.304-alpha.1

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.302",
3
+ "version": "1.3.304-alpha.1",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -25,6 +25,5 @@
25
25
  "@types/lodash.uniqby": "^4.7.7",
26
26
  "@types/setimmediate": "^1.0.2",
27
27
  "setimmediate": "^1.0.5"
28
- },
29
- "gitHead": "c3601af5d8b2307e904fcbf63e4ae0ab997f5eaf"
28
+ }
30
29
  }
@@ -3,6 +3,7 @@ import StepSequence from "dx/stepSequence";
3
3
  import { getListWithUuids } from "dxUtils/list";
4
4
  import { toJson } from "dxUtils/normalizers";
5
5
  import J2sCardSequenceStep from "dw/j2sCardSequenceStep";
6
+ import { AlertInfo } from "typings/custom";
6
7
 
7
8
  const DRM_SUCCESS_STRING = "success";
8
9
 
@@ -18,8 +19,8 @@ export type StepDatum = {
18
19
  formId?: string;
19
20
  j2sTerms?: string;
20
21
  notAvailableAlertInfo?: {
21
- title: string;
22
- body: string;
22
+ default: AlertInfo;
23
+ [key: string]: AlertInfo;
23
24
  };
24
25
  participatingCountryCodes?: string[];
25
26
  salesforceEmployeeAlertInfo?: {
@@ -45,6 +45,7 @@
45
45
  </div>
46
46
  <div slot="primary-action-section">
47
47
  <dx-button
48
+ if:true={showPrimaryAction}
48
49
  class="primary-action"
49
50
  disabled={isPrimaryActionDisabled}
50
51
  href={primaryActionLink}
@@ -16,15 +16,17 @@ export default class J2sCardSequenceStep extends LightningElement {
16
16
 
17
17
  @api
18
18
  public notifyFormSubmitFailure(formFailureData: Partial<DrmFormData>) {
19
- (
20
- this.template.querySelector("dw-j2s-form") as unknown as J2sForm
21
- )?.notifySubmitFailure(formFailureData);
19
+ ((this.template.querySelector(
20
+ "dw-j2s-form"
21
+ ) as unknown) as J2sForm)?.notifySubmitFailure(formFailureData);
22
22
  }
23
23
 
24
24
  private isJ2sFormInvalid = false;
25
25
 
26
26
  private get stepClassName() {
27
- return this.stepIndex === 2 ? "final-card-with-action" : "";
27
+ return this.stepIndex === 2 && this.selectedCountry === "IN"
28
+ ? "final-card-with-action"
29
+ : "";
28
30
  }
29
31
 
30
32
  private get isPrimaryActionDisabled() {
@@ -58,6 +60,14 @@ export default class J2sCardSequenceStep extends LightningElement {
58
60
  return this.stepDatum.primaryAction.linkTarget || "_blank";
59
61
  }
60
62
 
63
+ private get showPrimaryAction() {
64
+ return this.stepIndex !== 2 || this.selectedCountry === "IN";
65
+ }
66
+
67
+ private get showSecondaryAction() {
68
+ return this.showPrimaryAction; // same requirement as above for now
69
+ }
70
+
61
71
  renderedCallback() {
62
72
  this.updateStaticInnerHtml();
63
73
  }
@@ -76,9 +86,9 @@ export default class J2sCardSequenceStep extends LightningElement {
76
86
  if (this.stepIndex === 0) {
77
87
  this.dispatchEvent(new CustomEvent("getstarted"));
78
88
  } else if (this.stepIndex === 1) {
79
- const j2sFormEl = this.template.querySelector(
89
+ const j2sFormEl = (this.template.querySelector(
80
90
  "dw-j2s-form"
81
- ) as unknown as J2sForm;
91
+ ) as unknown) as J2sForm;
82
92
  const formData = j2sFormEl.formDataForDrm;
83
93
 
84
94
  // For some countries, explicit approvals will be present; for others, it is implicitly assumed
@@ -99,8 +109,9 @@ export default class J2sCardSequenceStep extends LightningElement {
99
109
 
100
110
  private updateStaticInnerHtml() {
101
111
  const { bodyHtml, secondaryActionHtml } = this.stepDatum;
102
- const bodyMarkupContainer =
103
- this.template.querySelector("span.body-markup");
112
+ const bodyMarkupContainer = this.template.querySelector(
113
+ "span.body-markup"
114
+ );
104
115
  const secondaryActionMarkupContainer = this.template.querySelector(
105
116
  "span.secondary-action-markup"
106
117
  );
@@ -124,7 +135,11 @@ export default class J2sCardSequenceStep extends LightningElement {
124
135
  }
125
136
 
126
137
  if (secondaryActionMarkupContainer) {
127
- secondaryActionMarkupContainer.innerHTML = secondaryActionHtml || "";
138
+ // new special exception on step 2 to only show secondary action for IN
139
+ secondaryActionMarkupContainer.innerHTML =
140
+ secondaryActionHtml && this.showSecondaryAction
141
+ ? secondaryActionHtml
142
+ : "";
128
143
  }
129
144
  }
130
145
 
@@ -1,10 +1,15 @@
1
1
  import { toJson } from "dxUtils/normalizers";
2
2
  import { stateMap } from "dwUtils/forms";
3
+ import { DateTime } from "luxon";
3
4
  import { api } from "lwc";
4
5
  import debounce from "debounce";
5
6
  import { LightningElementWithState } from "dxBaseElements/lightningElementWithState";
6
7
  import { DrmFormData } from "dw/j2sCardSequence";
7
8
 
9
+ const closingTimeUSCanada = DateTime.fromISO("2024-05-09", {
10
+ zone: "America/Los_Angeles"
11
+ });
12
+
8
13
  // Hard-coding for now because we can't get information about an endpoint for this
9
14
  const tbidValidRoles = [
10
15
  "Developer",
@@ -96,11 +101,17 @@ export default class J2sForm extends LightningElementWithState<J2sFormState> {
96
101
  }
97
102
  }
98
103
 
99
- private participatingCountryCodes = ["US", "CA", "IN"];
100
- private countriesWithReferralInput = ["US", "CA", "IN"];
104
+ private countriesWithReferralInput = ["IN"];
101
105
  private requiredFormFields: HTMLElement[] = [];
102
106
  private showSubmitFailureAlert = false;
103
107
 
108
+ get participatingCountryCodes() {
109
+ if (DateTime.local() >= closingTimeUSCanada) {
110
+ return ["IN"];
111
+ }
112
+ return ["US", "CA", "IN"];
113
+ }
114
+
104
115
  get isNotParticipatingCountry() {
105
116
  return !this.isParticipatingCountry(this.state.MailingCountry);
106
117
  }
@@ -124,7 +135,9 @@ export default class J2sForm extends LightningElementWithState<J2sFormState> {
124
135
  }
125
136
 
126
137
  get notAvailableAlertInfo() {
127
- return this.formMetadata.notAvailableAlertInfo;
138
+ return this.formMetadata.notAvailableAlertInfo[
139
+ this.state.MailingCountry || "default"
140
+ ];
128
141
  }
129
142
 
130
143
  get salesforceEmployeeAlertInfo() {
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <dx-select
3
- if:false={noTranslationsAvailable}
4
3
  options={languages}
5
4
  onchange={handleLanguageChange}
6
5
  placement="bottom-end"
7
6
  value={selectedLanguage}
8
7
  disabled={noTranslationsAvailable}
8
+ loading={loading}
9
9
  ></dx-select>
10
10
  </template>
@@ -26,7 +26,8 @@ export const normalizePostLink = (post: {
26
26
 
27
27
  export default class LanguageSelector extends LightningElement {
28
28
  @track languages = [] as SelectOption[];
29
- @track selectedLanguage?: string;
29
+ selectedLanguage?: string;
30
+ loading = true;
30
31
  @api postAcf!: string;
31
32
  @api postId?: string;
32
33
 
@@ -69,6 +70,8 @@ export default class LanguageSelector extends LightningElement {
69
70
  });
70
71
  } catch (e) {
71
72
  console.error(e);
73
+ } finally {
74
+ this.loading = false;
72
75
  }
73
76
 
74
77
  this.selectedLanguage =
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.