@salesforcedevs/dx-components 0.53.12-loading-img-update-3 → 0.54.0-alpha01

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 (46) hide show
  1. package/lwc.config.json +15 -17
  2. package/package.json +2 -4
  3. package/src/modules/base-elements/headerBase/headerBase.ts +1 -1
  4. package/src/modules/dx/cardCallout/cardCallout.ts +4 -4
  5. package/src/modules/dx/cardNews/cardNews.ts +1 -1
  6. package/src/modules/dx/codeBlock/codeBlock.ts +1 -1
  7. package/src/modules/dx/dropdownOption/dropdownOption.ts +1 -1
  8. package/src/modules/dx/footer/footer.ts +1 -1
  9. package/src/modules/dx/footerOption/footerOption.ts +1 -1
  10. package/src/modules/dx/formattedDateTime/formattedDateTime.ts +5 -0
  11. package/src/modules/dx/groupText/groupText.ts +1 -1
  12. package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.ts +1 -1
  13. package/src/modules/dx/pagination/pagination.ts +1 -1
  14. package/src/modules/dx/sidebar/sidebar.ts +1 -1
  15. package/src/modules/dx/sidebarOld/sidebarOld.ts +1 -1
  16. package/src/modules/dx/tab/tab.ts +1 -1
  17. package/src/modules/dx/treeItem/treeItem.ts +1 -1
  18. package/src/modules/utils/analytics/analytics.ts +24 -0
  19. package/src/modules/utils/normalizers/normalizers.ts +9 -21
  20. package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.css +0 -3
  21. package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.html +0 -16
  22. package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.ts +0 -29
  23. package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.css +0 -3
  24. package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.html +0 -12
  25. package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +0 -29
  26. package/src/modules/dx/contentArchive/contentArchive.css +0 -242
  27. package/src/modules/dx/contentArchive/contentArchive.html +0 -337
  28. package/src/modules/dx/contentArchive/contentArchive.ts +0 -457
  29. package/src/modules/dx/contentArchive/contentArchive.types.ts +0 -6
  30. package/src/modules/dx/instrumentation/instrumentation.html +0 -1
  31. package/src/modules/dx/instrumentation/instrumentation.ts +0 -116
  32. package/src/modules/dx/newsletterForm/newsletterForm.css +0 -73
  33. package/src/modules/dx/newsletterForm/newsletterForm.html +0 -73
  34. package/src/modules/dx/newsletterForm/newsletterForm.ts +0 -238
  35. package/src/modules/dx/podcastSubscription/podcastSubscription.css +0 -91
  36. package/src/modules/dx/podcastSubscription/podcastSubscription.html +0 -24
  37. package/src/modules/dx/podcastSubscription/podcastSubscription.ts +0 -52
  38. package/src/modules/dx/searchResults/coveo.css +0 -18989
  39. package/src/modules/dx/searchResults/searchResults.css +0 -387
  40. package/src/modules/dx/searchResults/searchResults.html +0 -104
  41. package/src/modules/dx/searchResults/searchResults.ts +0 -186
  42. package/src/modules/dx/slackCta/slackCta.css +0 -47
  43. package/src/modules/dx/slackCta/slackCta.html +0 -17
  44. package/src/modules/dx/slackCta/slackCta.ts +0 -12
  45. package/src/modules/utils/contentArchive/altData.js +0 -3
  46. package/src/modules/utils/contentArchive/contentArchive.ts +0 -163
package/lwc.config.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "modules": [{ "dir": "src/modules" }],
3
3
  "expose": [
4
+ "base-elements/headerBase",
5
+ "base-elements/matchMediaElement",
6
+ "dx/banner",
4
7
  "dx/brandThemeProvider",
5
8
  "dx/breadcrumbs",
6
9
  "dx/button",
7
10
  "dx/cardBlogPost",
8
- "dx/cardBlogPostProvider",
9
11
  "dx/cardCallout",
10
12
  "dx/cardContent",
11
13
  "dx/cardDemo",
@@ -15,25 +17,21 @@
15
17
  "dx/cardMinimal",
16
18
  "dx/cardNews",
17
19
  "dx/cardPodcastEpisode",
18
- "dx/cardPodcastEpisodeProvider",
19
20
  "dx/cardSmall",
20
21
  "dx/cardTrailheadModule",
21
22
  "dx/cardTrial",
22
23
  "dx/cardVideoPreview",
23
24
  "dx/checkbox",
24
- "dx/checkboxNative",
25
25
  "dx/checkboxGroup",
26
+ "dx/checkboxNative",
26
27
  "dx/codeBlock",
27
- "dx/contentArchive",
28
28
  "dx/dropdown",
29
29
  "dx/emptyState",
30
30
  "dx/feature",
31
31
  "dx/featuredContentHeader",
32
32
  "dx/featuresList",
33
33
  "dx/filterMenu",
34
- "dx/banner",
35
34
  "dx/footer",
36
- "dx/newsletterForm",
37
35
  "dx/formattedDateTime",
38
36
  "dx/grid",
39
37
  "dx/groupText",
@@ -47,17 +45,14 @@
47
45
  "dx/iconBadge",
48
46
  "dx/imageAndLabel",
49
47
  "dx/input",
50
- "dx/instrumentation",
51
48
  "dx/logo",
52
49
  "dx/modalDrawer",
53
50
  "dx/pagination",
54
51
  "dx/podcastHost",
55
52
  "dx/podcastPlayer",
56
- "dx/podcastSubscription",
57
53
  "dx/popover",
58
54
  "dx/radioGroup",
59
55
  "dx/relativeDateTime",
60
- "dx/searchResults",
61
56
  "dx/section",
62
57
  "dx/sectionSignup",
63
58
  "dx/sectionSmall",
@@ -65,28 +60,31 @@
65
60
  "dx/sidebar",
66
61
  "dx/sidebarOld",
67
62
  "dx/skipNavLink",
68
- "dx/slackCta",
69
63
  "dx/socials",
64
+ "dx/spinner",
65
+ "dx/toc",
70
66
  "dx/toc",
71
- "dx/tree",
72
67
  "dx/tooltip",
68
+ "dx/tree",
73
69
  "dx/typeBadge",
74
70
  "dx/typeBadgeGroup",
75
- "dx/toc",
76
71
  "dx/vimeoPlayer",
77
72
  "helpers/animations",
73
+ "helpers/button",
78
74
  "helpers/card",
79
75
  "helpers/code",
80
76
  "helpers/commonHeader",
81
77
  "helpers/reset",
82
78
  "helpers/table",
83
79
  "helpers/text",
84
- "base-elements/headerBase",
85
- "base-elements/matchMediaElement",
80
+ "utils/analytics",
86
81
  "utils/constants",
87
- "utils/normalizers",
82
+ "utils/coveo",
83
+ "utils/dates",
88
84
  "utils/highlight",
89
- "utils/contentArchive",
90
- "utils/dates"
85
+ "utils/normalizers",
86
+ "utils/queryCoordinator",
87
+ "utils/recentSearches",
88
+ "utils/wordpress"
91
89
  ]
92
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "0.53.12-loading-img-update-3",
3
+ "version": "0.54.0-alpha01",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -15,12 +15,10 @@
15
15
  "@sfdocs-internal/wires": "^0.6.3",
16
16
  "@vimeo/player": "^2.16.4",
17
17
  "classnames": "^2.2.6",
18
- "coveo-search-ui": "^2.10082.5",
19
18
  "debounce": "^1.2.0",
20
19
  "lightning-base-components": "1.12.3-alpha",
21
20
  "lodash.get": "^4.4.2",
22
- "microtip": "0.2.2",
23
- "query-string": "^7.1.1"
21
+ "microtip": "0.2.2"
24
22
  },
25
23
  "devDependencies": {
26
24
  "@types/classnames": "^2.2.10",
@@ -2,7 +2,7 @@ import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
3
  import { Brand, Option } from "typings/custom";
4
4
  import { toJson } from "utils/normalizers";
5
- import { track } from "dx/instrumentation";
5
+ import { track } from "utils/analytics";
6
6
 
7
7
  const VALID_BRANDS = [
8
8
  "analytics",
@@ -1,14 +1,14 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
3
  import { toDxColor } from "utils/css";
4
- import { track } from "dx/instrumentation";
4
+ import { track } from "utils/analytics";
5
5
 
6
6
  export default class CardCallout extends LightningElement {
7
- @api backgroundColor?: string = "indigo-vibrant-40";
8
- @api color?: string = "white";
7
+ @api backgroundColor: string = "indigo-vibrant-40";
8
+ @api color: string = "white";
9
9
  @api href!: string;
10
10
  @api label: string = "";
11
- @api target?: string | null = null;
11
+ @api target?: string;
12
12
  @api title!: string;
13
13
 
14
14
  private get style(): string {
@@ -9,7 +9,7 @@ import {
9
9
  CardNewsSize,
10
10
  CardNewsTextContainerSize
11
11
  } from "typings/custom";
12
- import { track } from "dx/instrumentation";
12
+ import { track } from "utils/analytics";
13
13
 
14
14
  export default class CardNews extends LightningElement {
15
15
  @api backgroundColor?: string = "indigo-vibrant-40";
@@ -6,7 +6,7 @@ import {
6
6
  getLocalStorageData,
7
7
  setLocalStorageData
8
8
  } from "@sfdocs-internal/wires";
9
- import { track as gtmTrack } from "dx/instrumentation";
9
+ import { track as gtmTrack } from "utils/analytics";
10
10
 
11
11
  // Used por remove enclosing <pre> tag's (if occurs)
12
12
  const preTagRegexp: RegExp = /^<pre.*?>(.*)<\/pre>$/is;
@@ -1,7 +1,7 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
3
  import { Option } from "typings/custom";
4
- import { track } from "dx/instrumentation";
4
+ import { track } from "utils/analytics";
5
5
 
6
6
  export default class DropdownOption extends LightningElement {
7
7
  @api option!: Option;
@@ -9,7 +9,7 @@ import {
9
9
  privacyHref,
10
10
  intellectualHref
11
11
  } from "./links";
12
- import { track } from "dx/instrumentation";
12
+ import { track } from "utils/analytics";
13
13
 
14
14
  const PATH = "/newsletter";
15
15
  const createNewsletterSignupHref = (email: string): string =>
@@ -1,5 +1,5 @@
1
1
  import { LightningElement, api } from "lwc";
2
- import { track } from "dx/instrumentation";
2
+ import { track } from "utils/analytics";
3
3
 
4
4
  export default class FooterOption extends LightningElement {
5
5
  @api href: string | null = null;
@@ -28,6 +28,11 @@ export default class FormattedDateTime extends LightningElement {
28
28
  }
29
29
 
30
30
  this._unformattedDate = new Date(value);
31
+
32
+ if (this._unformattedDate.toString() === "Invalid Date") {
33
+ // this is a fix for Safari since it doesn't support date strings with 'yyyy/mm/dd' patterns
34
+ this._unformattedDate = new Date(value.replace(/-/g, "/"));
35
+ }
31
36
  }
32
37
  get value() {
33
38
  const options = this.getOptions();
@@ -3,7 +3,7 @@ import cx from "classnames";
3
3
  import { LightningSlotElement, Link } from "typings/custom";
4
4
  import { isSlotEmpty } from "utils/slot";
5
5
  import { toJson } from "utils/normalizers";
6
- import { track } from "dx/instrumentation";
6
+ import { track } from "utils/analytics";
7
7
 
8
8
  type OptionalLink = Link | null;
9
9
 
@@ -1,5 +1,5 @@
1
1
  import { LightningElement, api } from "lwc";
2
- import { track } from "dx/instrumentation";
2
+ import { track } from "utils/analytics";
3
3
 
4
4
  export default class HeaderMobileNavMenuOption extends LightningElement {
5
5
  @api href: string | null = null;
@@ -1,6 +1,6 @@
1
1
  import classNames from "classnames";
2
2
  import { LightningElement, api } from "lwc";
3
- import { track } from "dx/instrumentation";
3
+ import { track } from "utils/analytics";
4
4
 
5
5
  const ANALYTICS_INFO = {
6
6
  clickUrl: window.location.href,
@@ -1,5 +1,5 @@
1
1
  import cx from "classnames";
2
- import { track as trackAnalytics } from "dx/instrumentation";
2
+ import { track as trackAnalytics } from "utils/analytics";
3
3
  import { api, track } from "lwc";
4
4
  import {
5
5
  TreeNode,
@@ -1,5 +1,5 @@
1
1
  import cx from "classnames";
2
- import { track } from "dx/instrumentation";
2
+ import { track } from "utils/analytics";
3
3
  import { api } from "lwc";
4
4
 
5
5
  import { TreeNode, SidebarGtmAction } from "typings/custom";
@@ -1,5 +1,5 @@
1
1
  import { LightningElement, api } from "lwc";
2
- import { track } from "dx/instrumentation";
2
+ import { track } from "utils/analytics";
3
3
  import cx from "classnames";
4
4
  import { TabVariant } from "typings/custom";
5
5
  import { normalizeBoolean } from "utils/normalizers";
@@ -1,6 +1,6 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import { InternalTreeNode } from "typings/custom";
3
- import { track } from "dx/instrumentation";
3
+ import { track } from "utils/analytics";
4
4
  import { SidebarGtmAction } from "typings/custom";
5
5
  import { isInViewport } from "utils/browser";
6
6
 
@@ -0,0 +1,24 @@
1
+ export const TRACKING_EVENT_NAME = "developerwebsite_track";
2
+ export const LISTENER_QUEUE = "__DX_INSTRUMENTATION_QUEUE__";
3
+ export const LISTENER_INDICATOR = "__DX_INSTRUMENTATION_IS_INITIALIZED__";
4
+
5
+ export function track(
6
+ element: EventTarget,
7
+ event: string,
8
+ payload: Record<string, unknown>
9
+ ): void {
10
+ const detail = { event, payload };
11
+ // if window.LISTENER_INDICATOR is undefined, `dx-instrumentation` has not
12
+ // been mounted, and the listener hasn't been attached.
13
+ if ((window as any)[LISTENER_INDICATOR] === undefined) {
14
+ (window as any)[LISTENER_QUEUE] = (window as any)[LISTENER_QUEUE] || [];
15
+ (window as any)[LISTENER_QUEUE].push(detail);
16
+ } else {
17
+ const e = new CustomEvent(TRACKING_EVENT_NAME, {
18
+ bubbles: true,
19
+ composed: true,
20
+ detail
21
+ });
22
+ element.dispatchEvent(e);
23
+ }
24
+ }
@@ -1,4 +1,5 @@
1
1
  import get from "lodash.get";
2
+ import { WordpressPodcastEpisode, WordpressBlogPost } from "typings/custom";
2
3
 
3
4
  export const toJson = (value: string | object | null) =>
4
5
  typeof value === "string" ? JSON.parse(value) : value;
@@ -22,16 +23,6 @@ export const normalizeToArray = (
22
23
  return (Array.isArray(value) ? value : [value]) as Array<string>;
23
24
  };
24
25
 
25
- type WordpressPodcastEpisode = {
26
- date: string;
27
- description: string;
28
- id: string;
29
- originalUrl: string;
30
- podcastDuration: string;
31
- title: string;
32
- url: string;
33
- };
34
-
35
26
  const getLength = (duration: string) => {
36
27
  if (!duration || !duration.includes(":")) {
37
28
  return undefined;
@@ -55,17 +46,6 @@ export const normalizeEpisode = ({
55
46
  title
56
47
  });
57
48
 
58
- type WordpressBlogPost = {
59
- date: string;
60
- description: string;
61
- id: string;
62
- originalUrl: string;
63
- title: string;
64
- url: string;
65
- authors: any[];
66
- featuredImage: string;
67
- };
68
-
69
49
  export const normalizePost = ({
70
50
  authors = [],
71
51
  date,
@@ -89,3 +69,11 @@ export const normalizePost = ({
89
69
 
90
70
  export const normalizeBoolean = (value: string | boolean | number): boolean =>
91
71
  typeof value === "string" ? value === "true" : !!value;
72
+
73
+ /**
74
+ * Cleans characters that are invalid for DOM IDs
75
+ * @param {string} id id to normalize
76
+ */
77
+ export const normalizeDomId = (id: string): string => {
78
+ return id.replace(/^[^a-z]+|[^\w.-]+/gi, "");
79
+ };
@@ -1,3 +0,0 @@
1
- :host {
2
- display: contents;
3
- }
@@ -1,16 +0,0 @@
1
- <template>
2
- <template for:each={posts} for:item="post">
3
- <dx-card-blog-post
4
- label="BLOG POST"
5
- author-img-src={post.authorImgSrc}
6
- author-label={post.authorName}
7
- body={post.body}
8
- datetime={post.datetime}
9
- href={post.href}
10
- img-alt={post.imgAlt}
11
- img-src={post.imgSrc}
12
- key={post.id}
13
- title={post.title}
14
- ></dx-card-blog-post>
15
- </template>
16
- </template>
@@ -1,29 +0,0 @@
1
- import { LightningElement, api, track } from "lwc";
2
- import { fetchWordpressPosts } from "utils/wordpress";
3
- import { normalizePost } from "utils/normalizers";
4
-
5
- type BlogPost = {
6
- body: string;
7
- datetime: string;
8
- href: string;
9
- id: string;
10
- title: string;
11
- };
12
-
13
- export default class CardBlogPostProvider extends LightningElement {
14
- @api count?: string;
15
-
16
- @track posts: BlogPost[] = [];
17
-
18
- private fetchPosts = async () => {
19
- this.posts = await fetchWordpressPosts(
20
- "/blogs/api",
21
- normalizePost,
22
- this.count
23
- );
24
- };
25
-
26
- connectedCallback() {
27
- this.fetchPosts();
28
- }
29
- }
@@ -1,3 +0,0 @@
1
- :host {
2
- display: contents;
3
- }
@@ -1,12 +0,0 @@
1
- <template>
2
- <template for:each={episodes} for:item="episode">
3
- <dx-card-podcast-episode
4
- body={episode.body}
5
- datetime={episode.datetime}
6
- href={episode.href}
7
- key={episode.id}
8
- length={episode.length}
9
- title={episode.title}
10
- ></dx-card-podcast-episode>
11
- </template>
12
- </template>
@@ -1,29 +0,0 @@
1
- import { LightningElement, api, track } from "lwc";
2
- import { fetchWordpressPosts } from "utils/wordpress";
3
- import { normalizeEpisode } from "utils/normalizers";
4
-
5
- type PodcastEpisode = {
6
- body: string;
7
- datetime: string;
8
- href: string;
9
- id: string;
10
- length: string;
11
- title: string;
12
- };
13
- export default class CardPodcastEpisodeProvider extends LightningElement {
14
- @api count?: string;
15
-
16
- @track episodes: PodcastEpisode[] = [];
17
-
18
- private fetchEpisodes = async () => {
19
- this.episodes = await fetchWordpressPosts(
20
- "/podcast/api",
21
- normalizeEpisode,
22
- this.count
23
- );
24
- };
25
-
26
- connectedCallback() {
27
- this.fetchEpisodes();
28
- }
29
- }