@salesforcedevs/dx-components 1.3.66-alpha-031 → 1.3.66-alpha-032

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/lwc.config.json CHANGED
@@ -98,6 +98,7 @@
98
98
  "dxUtils/analytics",
99
99
  "dxUtils/async",
100
100
  "dxUtils/constants",
101
+ "dxUtils/contentTypes",
101
102
  "dxUtils/coveo",
102
103
  "dxUtils/dates",
103
104
  "dxUtils/highlight",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.66-alpha-031",
3
+ "version": "1.3.66-alpha-032",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -2,7 +2,7 @@ import { LightningElement, api, track } from "lwc";
2
2
  import type * as CoveoSDK from "coveo-search-ui";
3
3
  import { track as trackGTM } from "dxUtils/analytics";
4
4
  import { CONTENT_TYPE_LABELS } from "dxConstants/contentTypes";
5
- import { getContentTypeColorVariables } from "dxUtilsInternal/contentTypes";
5
+ import { getContentTypeColorVariables } from "dxUtils/contentTypes";
6
6
 
7
7
  interface CoveoSearch {
8
8
  state: typeof CoveoSDK.state;
@@ -14,7 +14,7 @@ import {
14
14
  isContentType,
15
15
  getContentTypeColorScope,
16
16
  getContentTypeColorVariables
17
- } from "dxUtilsInternal/contentTypes";
17
+ } from "dxUtils/contentTypes";
18
18
  import {
19
19
  CONTENT_TYPE_LABELS,
20
20
  CONTENT_TYPE_ICONS
@@ -0,0 +1,30 @@
1
+ import { CONTENT_TYPES } from "dxConstants/contentTypes";
2
+ import { BRANDS } from "dxConstants/brands";
3
+ import { ContentType } from "typings/custom";
4
+ import { buildStyleColorVariables } from "dxUtils/css";
5
+
6
+ export const isBrand = (id: string): boolean => {
7
+ return BRANDS.includes(id as ContentType);
8
+ };
9
+
10
+ export const isContentType = (id: string): boolean => {
11
+ return CONTENT_TYPES.includes(id as ContentType);
12
+ };
13
+
14
+ export const getContentTypeColorScope = (id: string): string | null => {
15
+ if (isContentType(id)) {
16
+ return "content-type";
17
+ }
18
+ if (isBrand(id)) {
19
+ return "brand";
20
+ }
21
+ return null;
22
+ };
23
+
24
+ export const getContentTypeColorVariables = (id: string): string => {
25
+ const scope = getContentTypeColorScope(id);
26
+ return buildStyleColorVariables({
27
+ background: `--dx-g-${scope}-${id}-color-background`,
28
+ color: `--dx-g-${scope}-${id}-color`
29
+ });
30
+ }