@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
@@ -15,6 +15,7 @@ const MOBILE_MATCH = "767px";
15
15
  enum FilterNames {
16
16
  QUERY_CONTENT_FILTER = "contentType",
17
17
  QUERY_AUTHOR_FILTER = "authors",
18
+ QUERY_LANGUAGE_FILTER = "language",
18
19
  QUERY_DATES_FILTER = "dates",
19
20
  QUERY_CATEGORIES_FILTER = "categories"
20
21
  }
@@ -38,6 +39,7 @@ export default class ContentArchive extends LightningElement {
38
39
  private postsByDate: {} = {};
39
40
  private dateList: any[] = [];
40
41
  private authorList: any[] = [];
42
+ private languagesList: any[] = [];
41
43
  private categoryList: any[] = [];
42
44
 
43
45
  private isMobile: boolean = false;
@@ -47,7 +49,8 @@ export default class ContentArchive extends LightningElement {
47
49
  contentType: [],
48
50
  dates: [],
49
51
  authors: [],
50
- categories: []
52
+ categories: [],
53
+ language: []
51
54
  };
52
55
 
53
56
  private posts: any[] = [];
@@ -56,6 +59,18 @@ export default class ContentArchive extends LightningElement {
56
59
  return this.totalResults === 0 && !this.loading;
57
60
  }
58
61
 
62
+ get emptyStateSubtitle() {
63
+ return "Sorry, no results were found for your search";
64
+ }
65
+
66
+ get emptyStateBody() {
67
+ return "Search Tips:";
68
+ }
69
+
70
+ get emptyStateSuggestions() {
71
+ return JSON.stringify(["Try a different filter selection"]);
72
+ }
73
+
59
74
  get currentPageLength() {
60
75
  if (this.loading) {
61
76
  return "Loading Results...";
@@ -78,7 +93,7 @@ export default class ContentArchive extends LightningElement {
78
93
  if (this.currentPage !== 1) {
79
94
  pageInfo = `- Page ${this.currentPage}`;
80
95
  }
81
- return this.totalResults ? `Archive Results ${pageInfo}` : "No results";
96
+ return this.totalResults ? `Archive Results ${pageInfo}` : "";
82
97
  }
83
98
 
84
99
  get spinnerSize() {
@@ -135,6 +150,15 @@ export default class ContentArchive extends LightningElement {
135
150
  : ""
136
151
  }`;
137
152
  }
153
+
154
+ get languageTitle() {
155
+ return `Language ${
156
+ this.selectedFilterMenuData.language.length > 0
157
+ ? `(${this.selectedFilterMenuData.language.length})`
158
+ : ""
159
+ }`;
160
+ }
161
+
138
162
  get categoryTitle() {
139
163
  return `Topic ${
140
164
  this.selectedFilterMenuData.categories.length > 0
@@ -232,7 +256,8 @@ export default class ContentArchive extends LightningElement {
232
256
  contentType: [...copy.contentType],
233
257
  categories: [...copy.categories],
234
258
  dates: [...copy.dates],
235
- authors: []
259
+ authors: [],
260
+ language: []
236
261
  };
237
262
  }
238
263
 
@@ -243,7 +268,8 @@ export default class ContentArchive extends LightningElement {
243
268
  contentType: [{ id: 1, name: "Blogs" }],
244
269
  categories: [...copy.categories],
245
270
  dates: [...copy.dates],
246
- authors: [...copy.authors]
271
+ authors: [...copy.authors],
272
+ language: [...copy.language]
247
273
  };
248
274
  }
249
275
 
@@ -319,6 +345,7 @@ export default class ContentArchive extends LightningElement {
319
345
  contentType: [],
320
346
  dates: [],
321
347
  authors: [],
348
+ language: [],
322
349
  categories: []
323
350
  };
324
351
 
@@ -328,6 +355,7 @@ export default class ContentArchive extends LightningElement {
328
355
  setUrlParamValue({
329
356
  [FilterNames.QUERY_CONTENT_FILTER]: [],
330
357
  [FilterNames.QUERY_AUTHOR_FILTER]: [],
358
+ [FilterNames.QUERY_LANGUAGE_FILTER]: [],
331
359
  [FilterNames.QUERY_CATEGORIES_FILTER]: [],
332
360
  [FilterNames.QUERY_DATES_FILTER]: []
333
361
  });
@@ -362,8 +390,16 @@ export default class ContentArchive extends LightningElement {
362
390
  this.authorList = authors;
363
391
  this.categoryList = categories;
364
392
  this.filtersLoading = false;
365
-
366
- requestAnimationFrame(() => this.updateAllFiltersFromUrl());
393
+ this.languagesList = [
394
+ { id: "english", name: "English" },
395
+ { id: "japanese", name: "日本語" }
396
+ ];
397
+
398
+ // note... this is super hacky... but necessary in order to both
399
+ // 1. actually filter the content
400
+ // 2. update the filter checkboxes to show that we filtered the content
401
+ this.updateAllFiltersFromUrl();
402
+ requestAnimationFrame(() => this.updateCheckedStatus());
367
403
  }
368
404
  }
369
405
 
@@ -465,8 +501,9 @@ export default class ContentArchive extends LightningElement {
465
501
  this.mobileMatchMedia.addEventListener("change", this.onMobileChange);
466
502
 
467
503
  if (this.posts.length === 0) {
468
- this.fetchArchiveFilterList();
469
- this.fetchPostsByCardType();
504
+ this.fetchArchiveFilterList().then(() => {
505
+ this.fetchPostsByCardType();
506
+ });
470
507
  }
471
508
  }
472
509
 
@@ -489,6 +526,7 @@ export default class ContentArchive extends LightningElement {
489
526
  private updateAllFiltersFromUrl() {
490
527
  const filters: FilterMenuData = {
491
528
  [FilterNames.QUERY_AUTHOR_FILTER]: this.authorList,
529
+ [FilterNames.QUERY_LANGUAGE_FILTER]: this.languagesList,
492
530
  [FilterNames.QUERY_DATES_FILTER]: this.dateList,
493
531
  [FilterNames.QUERY_CATEGORIES_FILTER]: this.categoryList,
494
532
  [FilterNames.QUERY_CONTENT_FILTER]: this.contentTypeList
@@ -4,9 +4,7 @@ export type ArchivePostAuthor = {
4
4
  name: string;
5
5
  slug: string;
6
6
  url: string;
7
- avatar_urls: {
8
- [key: string]: string;
9
- };
7
+ image_src: string;
10
8
  };
11
9
 
12
10
  export type ArchivePost = {
@@ -15,6 +13,9 @@ export type ArchivePost = {
15
13
  title: {
16
14
  rendered: string;
17
15
  };
16
+ acf: {
17
+ language: string;
18
+ };
18
19
  type: string;
19
20
  link: string;
20
21
  excerpt: string;
@@ -23,6 +24,7 @@ export type ArchivePost = {
23
24
  audio_url: string;
24
25
  duration: string;
25
26
  };
27
+ authors: any; // I'm not sure if this field actually exists, but we're trying to use it so let's include it in the type
26
28
  _embedded: {
27
29
  author: Array<ArchivePostAuthor>;
28
30
  ["wp:term"]: Array<
@@ -70,7 +72,8 @@ export type FilterMenuNames =
70
72
  | "contentType"
71
73
  | "dates"
72
74
  | "authors"
73
- | "categories";
75
+ | "categories"
76
+ | "language";
74
77
 
75
78
  export type Filters = {
76
79
  [key in FilterMenuNames]: any[];
@@ -95,4 +98,5 @@ export type FilterMenuData = {
95
98
  dates: Array<FilterMenuItem>;
96
99
  categories: Array<FilterMenuItem>;
97
100
  authors: Array<FilterMenuItem>;
101
+ language: Array<FilterMenuItem>;
98
102
  };
@@ -15,6 +15,18 @@ 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
+ const normalizePostLink = (post: {
19
+ acf: { language: string };
20
+ link: string;
21
+ }) => {
22
+ switch (post.acf.language) {
23
+ case "japanese":
24
+ return post.link.replace("/blogs/", "/jpblogs/");
25
+ default:
26
+ return post.link;
27
+ }
28
+ };
29
+
18
30
  async function postsFetchHandler(url: string) {
19
31
  if (postsController) {
20
32
  postsController.abort();
@@ -36,7 +48,7 @@ async function postsFetchHandler(url: string) {
36
48
  console.error("Error fetching posts");
37
49
 
38
50
  return {
39
- posts: [],
51
+ posts: [] as Array<ArchivePost>,
40
52
  totalResults: 0,
41
53
  totalPages: 0
42
54
  };
@@ -60,19 +72,17 @@ function normalizePosts(posts: Array<ArchivePost>, contentType: string) {
60
72
  id: post.id,
61
73
  title: post.title.rendered,
62
74
  date: post.date,
63
- contentType: post.sitename,
64
- href: post.link,
75
+ contentType: post.sitename.toLowerCase(),
76
+ href: normalizePostLink(post),
65
77
  ...(contentType === "expanded" && {
66
78
  excerpt: post.excerpt,
67
79
  duration: getAudioDuration(post.podcast_audio.duration),
68
- ...(post._embedded &&
69
- post._embedded.author[0].id && {
70
- author: post._embedded.author[0],
71
- authorImgSrc: post._embedded.author[0].avatar_urls["24"],
72
- topics: post._embedded["wp:term"][0].map(
73
- (term: any) => term.name
74
- )
75
- })
80
+ authors: post.authors,
81
+ ...(post._embedded && {
82
+ topics: post._embedded["wp:term"][0].map(
83
+ (term: any) => term.name
84
+ )
85
+ })
76
86
  })
77
87
  }));
78
88
  }
@@ -85,7 +95,8 @@ export async function getArchivePosts({
85
95
  contentType: [],
86
96
  dates: [],
87
97
  authors: [],
88
- categories: []
98
+ categories: [],
99
+ language: []
89
100
  }
90
101
  }: {
91
102
  count: number;
@@ -105,6 +116,9 @@ export async function getArchivePosts({
105
116
  ),
106
117
  category: filterMenuData.categories.map(
107
118
  (category: FilterMenuItem) => category.id
119
+ ),
120
+ language: filterMenuData.language.map(
121
+ (language: FilterMenuItem) => language.id
108
122
  )
109
123
  };
110
124
 
@@ -114,7 +128,9 @@ export async function getArchivePosts({
114
128
  "date",
115
129
  "sitename",
116
130
  "link",
117
- "podcast_audio"
131
+ "acf",
132
+ "podcast_audio",
133
+ "authors"
118
134
  ];
119
135
  const EXPANDED_FIELDS = [
120
136
  "excerpt",
@@ -125,7 +141,7 @@ export async function getArchivePosts({
125
141
 
126
142
  const query: any = {
127
143
  ...filterQuery,
128
- _fields: ["id", "title", "date", "sitename", "link"],
144
+ _fields: ["id", "title", "date", "sitename", "link", "acf"],
129
145
  per_page: count,
130
146
  page
131
147
  };
@@ -1,4 +1,11 @@
1
1
  :host {
2
+ --dx-c-button-custom-background: var(--dx-g-blue-vibrant-50);
3
+ --dx-c-button-custom-color: white;
4
+ --dx-c-button-custom-border: var(--dx-g-blue-vibrant-50);
5
+ --dx-c-button-custom-color-hover: white;
6
+ --dx-c-button-custom-background-hover: var(--dx-g-blue-vibrant-40);
7
+ --dx-c-button-custom-border-hover: var(--dx-g-blue-vibrant-40);
8
+
2
9
  display: block;
3
10
  }
4
11
 
@@ -25,7 +32,10 @@ span {
25
32
  }
26
33
 
27
34
  dx-checkbox,
28
- :not(dx-checkbox) > span {
35
+ .privacy-notice,
36
+ span.privacy-terms,
37
+ span.marketing-terms {
38
+ width: 100%;
29
39
  margin-bottom: var(--dx-g-spacing-lg);
30
40
  }
31
41
 
@@ -48,19 +58,10 @@ form > .full-name-field {
48
58
  width: calc(50% - var(--dx-g-spacing-lg) / 2);
49
59
  }
50
60
 
51
- .legal-terms {
52
- margin-top: var(--dx-g-spacing-lg);
53
- }
54
-
55
61
  .submit-button {
56
62
  width: 100%;
57
63
  }
58
64
 
59
- .form-submit:hover {
60
- background-color: var(--dx-g-blue-vibrant-40);
61
- border-color: var(--dx-g-blue-vibrant-40);
62
- }
63
-
64
65
  @media screen and (min-width: 641px) {
65
66
  form > .full-name-field:first-of-type {
66
67
  margin-right: var(--dx-g-spacing-lg);
@@ -51,8 +51,18 @@
51
51
  options={countries}
52
52
  placeholder="Select Country/Region"
53
53
  required
54
- value=""
55
- onchange={handleCountryChange}
54
+ value={country}
55
+ onchange={handleConsent}
56
+ ></dx-select>
57
+ <dx-select
58
+ if:true={showStateSelect}
59
+ label="State/Province"
60
+ message-when-value-missing="Select your state/province"
61
+ name="state"
62
+ options={states}
63
+ placeholder="Select State/Province"
64
+ required
65
+ value={state}
56
66
  ></dx-select>
57
67
  <dx-input
58
68
  label="Postal Code"
@@ -76,36 +86,40 @@
76
86
  validity-on-blur={checkUsernameValidity}
77
87
  onchange={handleUsernameChange}
78
88
  ></dx-input>
79
- <dx-checkbox
80
- if:true={showMarketingField}
81
- name="opt_in"
82
- value="explicit"
83
- >
84
- <span lwc:dom="manual" class="marketing-terms"></span>
89
+
90
+ <dx-checkbox required name="eula" value="accepted" if:true={legalText}>
91
+ <span lwc:dom="manual" class="legal-terms"></span>
85
92
  </dx-checkbox>
93
+
94
+ <template if:false={showMarketingCheckbox}>
95
+ <span lwc:dom="manual" class="marketing-terms"></span>
96
+ </template>
97
+ <template if:true={showMarketingCheckbox}>
98
+ <dx-checkbox
99
+ name="marketingCheckbox"
100
+ class="marketing-terms"
101
+ value="false"
102
+ onchange={handleMarketingCheckbox}
103
+ >
104
+ <span>{marketingText}</span>
105
+ </dx-checkbox>
106
+ </template>
107
+
108
+ <template if:false={showLegalCheckbox}>
109
+ <span lwc:dom="manual" class="legal-checkbox privacy-terms"></span>
110
+ </template>
86
111
  <dx-checkbox
87
112
  if:true={showLegalCheckbox}
88
- required
89
- name="eula"
90
- value="accepted"
113
+ class="privacy-terms"
114
+ value={legalCheckbox}
115
+ required="true"
91
116
  >
92
- <span lwc:dom="manual" class="legal-terms"></span>
93
- <span
94
- if:true={learnMore}
95
- lwc:dom="manual"
96
- class="learn-more"
97
- ></span>
117
+ <span lwc:dom="manual" class="legal-checkbox privacy-terms"></span>
98
118
  </dx-checkbox>
99
- <template if:false={showLegalCheckbox}>
100
- <span lwc:dom="manual" class="legal-terms"></span>
101
- <span
102
- if:true={learnMore}
103
- lwc:dom="manual"
104
- class="learn-more"
105
- ></span>
106
- </template>
119
+
107
120
  <dx-button
108
121
  class="submit-button"
122
+ variant="custom"
109
123
  disabled={disableSubmit}
110
124
  size="large"
111
125
  type="submit"