@salesforcedevs/dw-components 0.79.1 → 1.0.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.
Files changed (76) hide show
  1. package/lwc.config.json +10 -1
  2. package/package.json +16 -12
  3. package/src/modules/dw/blogsGrid/blogsGrid.css +14 -7
  4. package/src/modules/dw/blogsGrid/blogsGrid.html +15 -12
  5. package/src/modules/dw/blogsGrid/blogsGrid.ts +23 -9
  6. package/src/modules/dw/browseTrials/browseTrials.css +35 -0
  7. package/src/modules/dw/browseTrials/browseTrials.html +86 -0
  8. package/src/modules/dw/browseTrials/browseTrials.ts +116 -0
  9. package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.css +2 -0
  10. package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.html +3 -3
  11. package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.css +2 -0
  12. package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.html +2 -1
  13. package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.css +85 -9
  14. package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.html +74 -112
  15. package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.ts +14 -376
  16. package/src/modules/dw/contentArchive/contentArchive.css +5 -4
  17. package/src/modules/dw/contentArchive/contentArchive.html +58 -24
  18. package/src/modules/dw/contentArchive/contentArchive.ts +46 -8
  19. package/src/modules/dw/contentArchive/contentArchive.types.ts +8 -4
  20. package/src/modules/dw/contentArchive/utils.ts +30 -14
  21. package/src/modules/dw/deSignupForm/deSignupForm.css +11 -10
  22. package/src/modules/dw/deSignupForm/deSignupForm.html +39 -25
  23. package/src/modules/dw/deSignupForm/deSignupForm.ts +205 -133
  24. package/src/modules/dw/deSignupForm/submitForm.ts +7 -3
  25. package/src/modules/dw/docsGrid/docsGrid.css +0 -1
  26. package/src/modules/dw/docsGrid/docsGrid.html +6 -2
  27. package/src/modules/dw/docsGrid/docsGrid.ts +103 -38
  28. package/src/modules/dw/eventsList/eventsList.css +4 -4
  29. package/src/modules/dw/eventsList/eventsList.html +5 -5
  30. package/src/modules/dw/eventsList/eventsList.ts +47 -48
  31. package/src/modules/dw/j2sCardSequence/j2sCardSequence.css +14 -0
  32. package/src/modules/dw/j2sCardSequence/j2sCardSequence.html +41 -0
  33. package/src/modules/dw/j2sCardSequence/j2sCardSequence.ts +487 -0
  34. package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.css +76 -0
  35. package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.html +64 -0
  36. package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.ts +157 -0
  37. package/src/modules/dw/j2sForm/j2sForm.css +65 -0
  38. package/src/modules/dw/j2sForm/j2sForm.html +217 -0
  39. package/src/modules/dw/j2sForm/j2sForm.ts +371 -0
  40. package/src/modules/dw/j2sForm/mockProps.ts +3102 -0
  41. package/src/modules/dw/languageSelector/languageSelector.css +86 -0
  42. package/src/modules/dw/languageSelector/languageSelector.html +36 -0
  43. package/src/modules/dw/languageSelector/languageSelector.ts +119 -0
  44. package/src/modules/dw/newsletterForm/newsletterForm.css +2 -2
  45. package/src/modules/dw/newsletterForm/newsletterForm.html +35 -10
  46. package/src/modules/dw/newsletterForm/newsletterForm.ts +107 -78
  47. package/src/modules/dw/podcastSubscription/podcastSubscription.css +8 -8
  48. package/src/modules/dw/podcastSubscription/podcastSubscription.html +2 -2
  49. package/src/modules/dw/podcastSubscription/podcastSubscription.ts +4 -4
  50. package/src/modules/dw/podcastsGrid/podcastsGrid.css +7 -0
  51. package/src/modules/dw/podcastsGrid/podcastsGrid.html +6 -1
  52. package/src/modules/dw/podcastsGrid/podcastsGrid.ts +3 -3
  53. package/src/modules/dw/podcastsPromo/podcastsPromo.css +14 -0
  54. package/src/modules/dw/podcastsPromo/podcastsPromo.html +16 -8
  55. package/src/modules/dw/podcastsPromo/podcastsPromo.ts +11 -2
  56. package/src/modules/dw/rcgTable/altData.ts +72 -9
  57. package/src/modules/dw/rcgTable/getTableData.ts +1 -1
  58. package/src/modules/dw/rcgTable/rcgTable.ts +3 -3
  59. package/src/modules/dw/slackCta/slackCta.css +5 -6
  60. package/src/modules/dw/slackCta/slackCta.html +1 -1
  61. package/src/modules/dw/slackSuccess/slackSuccess.css +1 -1
  62. package/src/modules/dw/slackSuccess/slackSuccess.html +2 -2
  63. package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.css +119 -0
  64. package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.html +192 -0
  65. package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.ts +148 -0
  66. package/src/modules/dw/videoGrid/types.ts +12 -0
  67. package/src/modules/dw/videoGrid/videoGrid.css +24 -0
  68. package/src/modules/dw/videoGrid/videoGrid.html +41 -0
  69. package/src/modules/dw/videoGrid/videoGrid.ts +41 -0
  70. package/src/modules/dw/youtubeVideoGrid/types.ts +8 -0
  71. package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.css +18 -0
  72. package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.html +40 -0
  73. package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.ts +66 -0
  74. package/src/modules/dwHelpers/mobileDividers/mobileDividers.css +19 -0
  75. package/src/modules/dwUtils/forms/forms.ts +514 -0
  76. package/src/modules/{dwBaseElements → dwUtils}/postsGrid/postsGrid.ts +10 -13
@@ -0,0 +1,157 @@
1
+ import { api, LightningElement } from "lwc";
2
+ import { DrmFormData, StepDatum } from "dw/j2sCardSequence";
3
+ import { track } from "dxUtils/analytics";
4
+ import J2sForm from "dw/j2sForm";
5
+
6
+ export default class J2sCardSequenceStep extends LightningElement {
7
+ @api countryOptions: any[] = [];
8
+ @api hasAlreadyRegistered = false;
9
+ @api isLoading = false;
10
+ @api recaptchaToken = "";
11
+ @api selectedCountry = "";
12
+ @api stepDatum!: StepDatum;
13
+ @api stepIndex = 0;
14
+ @api stepTotalCount = 0;
15
+ @api userInfo: any = {};
16
+
17
+ @api
18
+ public notifyFormSubmitFailure(formFailureData: Partial<DrmFormData>) {
19
+ ((this.template.querySelector(
20
+ "dw-j2s-form"
21
+ ) as unknown) as J2sForm)?.notifySubmitFailure(formFailureData);
22
+ }
23
+
24
+ private isJ2sFormInvalid = false;
25
+
26
+ private get stepClassName() {
27
+ return this.stepIndex === 2 && this.selectedCountry === "IN"
28
+ ? "final-card-with-action"
29
+ : "";
30
+ }
31
+
32
+ private get isPrimaryActionDisabled() {
33
+ return (
34
+ this.stepIndex === 1 &&
35
+ (this.hasAlreadyRegistered || this.isJ2sFormInvalid)
36
+ );
37
+ }
38
+
39
+ private get primaryActionLink() {
40
+ const { link } = this.stepDatum.primaryAction;
41
+ return typeof link === "string"
42
+ ? link
43
+ : link?.[this.selectedCountry] || link?.default;
44
+ }
45
+
46
+ private get primaryActionText() {
47
+ const { text } = this.stepDatum.primaryAction;
48
+ return typeof text === "string"
49
+ ? text
50
+ : text[this.selectedCountry] || text.default;
51
+ }
52
+
53
+ private get primaryActionVariant() {
54
+ return this.isPrimaryActionDisabled
55
+ ? "custom"
56
+ : this.stepDatum.primaryAction.variant;
57
+ }
58
+
59
+ private get primaryActionLinkTarget() {
60
+ return this.stepDatum.primaryAction.linkTarget || "_blank";
61
+ }
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
+
71
+ renderedCallback() {
72
+ this.updateStaticInnerHtml();
73
+ }
74
+
75
+ handleFormValidityChange({ detail }: CustomEvent) {
76
+ this.isJ2sFormInvalid = !detail.isValid;
77
+ }
78
+
79
+ handlePrimaryAction(evt: Event) {
80
+ if (this.isPrimaryActionDisabled) {
81
+ return;
82
+ }
83
+
84
+ this.track(evt);
85
+
86
+ if (this.stepIndex === 0) {
87
+ this.dispatchEvent(new CustomEvent("getstarted"));
88
+ } else if (this.stepIndex === 1) {
89
+ const j2sFormEl = (this.template.querySelector(
90
+ "dw-j2s-form"
91
+ ) as unknown) as J2sForm;
92
+ const formData = j2sFormEl.formDataForDrm;
93
+
94
+ // For some countries, explicit approvals will be present; for others, it is implicitly assumed
95
+ if (typeof formData.Opt_In__c !== "boolean") {
96
+ formData.Opt_In__c = true;
97
+ }
98
+ if (typeof formData.Privacy_Statement__c !== "boolean") {
99
+ formData.Privacy_Statement__c = true;
100
+ }
101
+
102
+ this.dispatchEvent(
103
+ new CustomEvent("formsubmit", {
104
+ detail: formData
105
+ })
106
+ );
107
+ }
108
+ }
109
+
110
+ private updateStaticInnerHtml() {
111
+ const { bodyHtml, secondaryActionHtml } = this.stepDatum;
112
+ const bodyMarkupContainer = this.template.querySelector(
113
+ "span.body-markup"
114
+ );
115
+ const secondaryActionMarkupContainer = this.template.querySelector(
116
+ "span.secondary-action-markup"
117
+ );
118
+
119
+ if (bodyMarkupContainer) {
120
+ let markup =
121
+ typeof bodyHtml === "string"
122
+ ? bodyHtml
123
+ : bodyHtml?.[this.selectedCountry] || bodyHtml?.default;
124
+
125
+ if (this.stepIndex === 2) {
126
+ // User's email is supposed to show on final step
127
+ markup = `${markup}${
128
+ !this.userInfo.Email
129
+ ? ""
130
+ : `<span class="final-email-address">${this.userInfo.Email}</span>`
131
+ }`;
132
+ }
133
+
134
+ bodyMarkupContainer.innerHTML = markup || "";
135
+ }
136
+
137
+ if (secondaryActionMarkupContainer) {
138
+ // new special exception on step 2 to only show secondary action for IN
139
+ secondaryActionMarkupContainer.innerHTML =
140
+ secondaryActionHtml && this.showSecondaryAction
141
+ ? secondaryActionHtml
142
+ : "";
143
+ }
144
+ }
145
+
146
+ private track(evt: Event) {
147
+ const target = evt.target as HTMLButtonElement;
148
+
149
+ track(target, "custEv_ctaButtonClick", {
150
+ click_text: target.textContent,
151
+ element_title: this.stepDatum.stepTitle,
152
+ click_url: this.stepDatum.primaryAction.link || "",
153
+ element_type: "button",
154
+ content_category: "cta"
155
+ });
156
+ }
157
+ }
@@ -0,0 +1,65 @@
1
+ .hidden {
2
+ display: none;
3
+ }
4
+
5
+ .form-row {
6
+ display: flex;
7
+ justify-content: space-between;
8
+ padding-bottom: var(--dx-g-spacing-md);
9
+ }
10
+
11
+ .form-row > * {
12
+ --dx-c-input-width: 100%;
13
+
14
+ font-family: var(--dx-g-font-sans);
15
+ width: calc(50% - 20px);
16
+ }
17
+
18
+ .form-row > :only-child {
19
+ max-width: 100%;
20
+ width: 100%;
21
+ }
22
+
23
+ .form-row .terms {
24
+ --dx-c-checkbox-text-line-height: var(--dx-g-text-lg);
25
+ --dx-c-checkbox-font-size: var(--dx-g-text-sm);
26
+
27
+ font-family: var(--dx-g-font-sans);
28
+ font-size: var(--dx-c-checkbox-font-size);
29
+ font-weight: var(--dx-g-font-normal);
30
+ }
31
+
32
+ .form-row .legal-terms-learn-more:not(.hidden) {
33
+ display: block;
34
+ padding-top: var(--dx-g-spacing-md);
35
+ }
36
+
37
+ .form-row .legal-terms.no-checkbox {
38
+ font-family: var(--dx-g-font-sans);
39
+ font-size: var(--dx-g-text-xs);
40
+ font-weight: var(--dx-g-font-normal);
41
+ margin-left: 28px;
42
+ }
43
+
44
+ .form-terms-container {
45
+ padding-top: var(--dx-g-spacing-sm);
46
+ }
47
+
48
+ .form-captcha-slot {
49
+ align-items: center;
50
+ display: flex;
51
+ justify-content: center;
52
+ }
53
+
54
+ /* Small Devices */
55
+ @media screen and (max-width: 480px) {
56
+ .form-row {
57
+ flex-wrap: wrap;
58
+ padding-bottom: unset;
59
+ }
60
+
61
+ .form-row > * {
62
+ padding-bottom: var(--dx-g-spacing-md);
63
+ width: 100%;
64
+ }
65
+ }
@@ -0,0 +1,217 @@
1
+ <template>
2
+ <!-- For the names of the form fields, see: https://salesforce.quip.com/daInAFETbPGm -->
3
+ <form class="j2s-form">
4
+ <div class="form-row">
5
+ <dx-input
6
+ class="first-name-field"
7
+ label="First Name"
8
+ missing-error-message="Enter your first name"
9
+ name="FirstName"
10
+ placeholder="Your first name"
11
+ required
12
+ validity-on-blur
13
+ onchange={handleFormFieldChange}
14
+ value={state.FirstName}
15
+ ></dx-input>
16
+ <dx-input
17
+ class="last-name-field"
18
+ label="Last Name"
19
+ missing-error-message="Enter your last name"
20
+ name="LastName"
21
+ placeholder="Your last name"
22
+ required
23
+ validity-on-blur
24
+ onchange={handleFormFieldChange}
25
+ value={state.LastName}
26
+ ></dx-input>
27
+ </div>
28
+ <div class="form-row">
29
+ <dx-input
30
+ class="company-name-field"
31
+ label="Company Name"
32
+ missing-error-message="Enter your company name"
33
+ name="Company__c"
34
+ placeholder="Your company name"
35
+ required
36
+ validity-on-blur
37
+ value={state.Company__c}
38
+ onchange={handleFormFieldChange}
39
+ ></dx-input>
40
+ <dx-select
41
+ class="job-role-field"
42
+ label="Job Role"
43
+ message-when-value-missing="Select your job role"
44
+ name="DRM_Role__c"
45
+ options={jobRoles}
46
+ placeholder="Select Job Role"
47
+ required
48
+ value={state.DRM_Role__c}
49
+ onchange={handleFormFieldChange}
50
+ ></dx-select>
51
+ </div>
52
+ <template if:false={showStateProvince}>
53
+ <div class="form-row">
54
+ <dx-input
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."
57
+ type="email"
58
+ placeholder="Your email address"
59
+ label="Email"
60
+ missing-error-message="Enter your email address"
61
+ validity-on-blur="true"
62
+ disabled
63
+ readonly
64
+ required
65
+ value={state.Email}
66
+ ></dx-input>
67
+ <dx-select
68
+ label="Country/Region"
69
+ message-when-value-missing="Select your country/region"
70
+ name="MailingCountry"
71
+ options={countries}
72
+ placeholder="Select Country/Region"
73
+ required
74
+ value={state.MailingCountry}
75
+ onchange={handleFormFieldChange}
76
+ ></dx-select>
77
+ </div>
78
+ </template>
79
+ <template if:true={showStateProvince}>
80
+ <div class="form-row">
81
+ <dx-select
82
+ label="Country/Region"
83
+ message-when-value-missing="Select your country/region"
84
+ name="MailingCountry"
85
+ options={countries}
86
+ placeholder="Select Country/Region"
87
+ required
88
+ value={state.MailingCountry}
89
+ onchange={handleFormFieldChange}
90
+ ></dx-select>
91
+ <dx-select
92
+ label="State/Province"
93
+ message-when-value-missing="Select your state/province"
94
+ name="MailingState"
95
+ options={states}
96
+ placeholder="Select State/Province"
97
+ required
98
+ value={state.MailingState}
99
+ onchange={handleFormFieldChange}
100
+ ></dx-select>
101
+ </div>
102
+ <div class="form-row">
103
+ <dx-input
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."
106
+ class="full-width-input-field"
107
+ type="email"
108
+ placeholder="Your email address"
109
+ label="Email"
110
+ missing-error-message="Enter your email address"
111
+ validity-on-blur="true"
112
+ disabled
113
+ readonly
114
+ required
115
+ value={state.Email}
116
+ ></dx-input>
117
+ </div>
118
+ </template>
119
+ <div class="form-row" if:true={isCountryWithReferralInput}>
120
+ <dx-input
121
+ name="Referral_Email__c"
122
+ class="full-width-input-field"
123
+ label="If anyone has referred you, please share their Email ID below, with their consent."
124
+ validity-on-blur="true"
125
+ type="email"
126
+ value={state.Referral_Email__c}
127
+ onchange={handleFormFieldChange}
128
+ ></dx-input>
129
+ </div>
130
+ <div class="form-row" if:true={isNotParticipatingCountry}>
131
+ <dx-alert
132
+ alert-info={notAvailableAlertInfo}
133
+ type="danger"
134
+ variant="accented"
135
+ ></dx-alert>
136
+ </div>
137
+ <div class="form-row" if:true={hasAlreadyRegistered}>
138
+ <dx-alert
139
+ alert-info={alreadyRegisteredAlertInfo}
140
+ type="danger"
141
+ variant="accented"
142
+ ></dx-alert>
143
+ </div>
144
+ <div class="form-row" if:true={isSalesforceEmployee}>
145
+ <dx-alert
146
+ alert-info={salesforceEmployeeAlertInfo}
147
+ type="danger"
148
+ variant="accented"
149
+ ></dx-alert>
150
+ </div>
151
+ <div class="form-row" if:true={showSubmitFailureAlert}>
152
+ <dx-alert
153
+ alert-info={formSubmitFailureAlertInfo}
154
+ type="danger"
155
+ variant="accented"
156
+ ></dx-alert>
157
+ </div>
158
+ <div class="form-terms-container">
159
+ <div class="form-row" if:true={state.showMarketingText}>
160
+ <dx-checkbox
161
+ value="marketing-terms"
162
+ name="Opt_In__c"
163
+ required
164
+ class="terms"
165
+ onchange={handleFormFieldChange}
166
+ disabled={disableCheckboxes}
167
+ >
168
+ <span lwc:dom="manual" class="marketing-terms"></span>
169
+ </dx-checkbox>
170
+ </div>
171
+ <div class="form-row">
172
+ <dx-checkbox
173
+ value="j2s-terms"
174
+ name="j2s_terms"
175
+ required
176
+ class="terms"
177
+ onchange={handleFormFieldChange}
178
+ disabled={disableCheckboxes}
179
+ >
180
+ <span lwc:dom="manual" class="j2s-terms"></span>
181
+ </dx-checkbox>
182
+ </div>
183
+ <div class="form-row">
184
+ <dx-checkbox
185
+ if:true={state.showLegalCheckbox}
186
+ value="legal-terms"
187
+ name="Privacy_Statement__c"
188
+ required
189
+ class="terms"
190
+ onchange={handleFormFieldChange}
191
+ disabled={disableCheckboxes}
192
+ >
193
+ <span lwc:dom="manual" class="legal-terms"></span>
194
+ <template if:true={state.learnMore}>
195
+ &nbsp;
196
+ <dx-button
197
+ variant="inline-inherit"
198
+ onclick={handleLearnMore}
199
+ >
200
+ Learn more.
201
+ </dx-button>
202
+ <span
203
+ lwc:dom="manual"
204
+ class="legal-terms-learn-more hidden"
205
+ ></span>
206
+ </template>
207
+ </dx-checkbox>
208
+ <span
209
+ if:false={state.showLegalCheckbox}
210
+ lwc:dom="manual"
211
+ class="legal-terms no-checkbox"
212
+ ></span>
213
+ </div>
214
+ <slot class="form-captcha-slot" name="form-captcha-slot"></slot>
215
+ </div>
216
+ </form>
217
+ </template>