@salesforcedevs/dw-components 1.3.311 → 1.3.315

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.311",
3
+ "version": "1.3.315",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -26,5 +26,5 @@
26
26
  "@types/setimmediate": "^1.0.2",
27
27
  "setimmediate": "^1.0.5"
28
28
  },
29
- "gitHead": "8fd492d08f22c6ce74ebed62b3c35772f6c6075f"
29
+ "gitHead": "34d3cd484a1021e0d46ab30391a433076018b87e"
30
30
  }
@@ -15,7 +15,7 @@ const ARCHIVE_CONTENT_URL = `${ARCHIVE_BASE_URL}/latest-post-per-site`;
15
15
  const ARCHIVE_FILTER_LIST_URL = `${ARCHIVE_BASE_URL}/archives-filters?order=DESC`;
16
16
  export const PER_PAGE_COUNT = 10;
17
17
 
18
- export const normalizePostLink = (post: {
18
+ const normalizePostLink = (post: {
19
19
  acf: { language: string };
20
20
  link: string;
21
21
  }) => {
@@ -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,7 +1,6 @@
1
1
  import { track as trackClick } from "dxUtils/analytics";
2
2
  import { api, LightningElement, track } from "lwc";
3
3
  import { SelectOption } from "typings/custom";
4
- import { normalizePostLink } from "../contentArchive/utils";
5
4
 
6
5
  const ANALYTICS_INFO = {
7
6
  element_title: "Select Language",
@@ -13,6 +12,18 @@ const language_local_names_map: any = {
13
12
  english: "English"
14
13
  };
15
14
 
15
+ const normalizePostLink = (post: {
16
+ acf: { language: string };
17
+ link: string;
18
+ }) => {
19
+ switch (post.acf.language) {
20
+ case "japanese":
21
+ return post.link.replace("/blogs/", "/jpblogs/");
22
+ default:
23
+ return post.link;
24
+ }
25
+ };
26
+
16
27
  export default class LanguageSelector extends LightningElement {
17
28
  @track languages = [] as SelectOption[];
18
29
  selectedLanguage?: string;