@salesforcedevs/dx-components 1.3.266 → 1.3.269

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
@@ -42,6 +42,7 @@
42
42
  "dx/emptyState",
43
43
  "dx/faq",
44
44
  "dx/feature",
45
+ "dx/featureFlag",
45
46
  "dx/featureGrid",
46
47
  "dx/featuredContentHeader",
47
48
  "dx/featuresList",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.266",
3
+ "version": "1.3.269",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -12,6 +12,7 @@
12
12
  "dependencies": {
13
13
  "@coveo/headless": "2.16.5",
14
14
  "@floating-ui/dom": "1.5.1",
15
+ "@optimizely/optimizely-sdk": "^5.3.0",
15
16
  "@salesforcedevs/sfdocs-wires": "0.6.98",
16
17
  "@types/throttle-debounce": "^5.0.0",
17
18
  "@vimeo/player": "^2.16.4",
@@ -45,5 +46,5 @@
45
46
  "volta": {
46
47
  "node": "16.19.1"
47
48
  },
48
- "gitHead": "c4e5e744777871657aca0f2977421b39a4ef5340"
49
+ "gitHead": "e1806b617e4c5f5c2c1fbb129c159fbd316a7793"
49
50
  }
@@ -0,0 +1,3 @@
1
+ .hidden {
2
+ display: none;
3
+ }
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <slot class="hidden"></slot>
3
+ </template>
@@ -0,0 +1,41 @@
1
+ import { api, LightningElement } from "lwc";
2
+ import optimizelySdk from "@optimizely/optimizely-sdk";
3
+
4
+ // This is needed to specify user context (such as logged in, admin, ...etc).
5
+ // leave this as hard-coded for now until we create audiences in Optimizely.
6
+ const userId = "user123";
7
+
8
+ export default class FeatureFlag extends LightningElement {
9
+ @api flag!: string;
10
+
11
+ private optimizelyInstance: any;
12
+
13
+ private showElements(slot: any) {
14
+ slot.classList.remove("hidden");
15
+ }
16
+
17
+ connectedCallback(): void {
18
+ this.optimizelyInstance = optimizelySdk.createInstance({
19
+ sdkKey: process.env.OPTIMIZELY_SDK_KEY
20
+ });
21
+ }
22
+
23
+ renderedCallback(): void {
24
+ const slotEl = this.template.querySelector("slot") as any;
25
+
26
+ this.optimizelyInstance?.onReady().then(({ success, reason }: any) => {
27
+ if (!success) {
28
+ console.log(
29
+ `Optimizely client initialization unsuccessful, reason: ${reason}`
30
+ );
31
+ return;
32
+ }
33
+ const user = this.optimizelyInstance?.createUserContext(userId);
34
+ const decision = user?.decide(this.flag);
35
+
36
+ if (decision?.enabled) {
37
+ this.showElements(slotEl);
38
+ }
39
+ });
40
+ }
41
+ }
@@ -22,6 +22,8 @@
22
22
  translateY(14px);
23
23
  --dx-c-featured-content-header-swoop-display: block;
24
24
  --dx-c-featured-content-header-swoop-height: 30%;
25
+ --dx-c-featured-content-header-background-image-position: top right;
26
+ --dx-c-featured-content-header-background-image-size: contain;
25
27
  }
26
28
 
27
29
  .container {
@@ -50,8 +52,10 @@
50
52
  var(--dx-c-featured-content-header-padding-horizontal);
51
53
  background-image: var(--background-image);
52
54
  background-repeat: no-repeat;
53
- background-position: top right;
54
- background-size: contain;
55
+ background-position: var(
56
+ --dx-c-featured-content-header-background-image-position
57
+ );
58
+ background-size: var(--dx-c-featured-content-header-background-image-size);
55
59
  }
56
60
 
57
61
  /* LAYOUTS */
@@ -11,6 +11,7 @@ import {
11
11
  formattedDateWeekday,
12
12
  formattedDateYear
13
13
  } from "typings/custom";
14
+ import { DateTime } from "luxon";
14
15
 
15
16
  export default class FormattedDateTime extends LightningElement {
16
17
  @api weekday: formattedDateWeekday;
@@ -49,10 +50,11 @@ export default class FormattedDateTime extends LightningElement {
49
50
 
50
51
  formatDate(unformattedDate: Date, options: formattedDateOptions) {
51
52
  const locale = navigator.language;
52
- let formattedDateTime = Intl.DateTimeFormat(
53
- locale,
54
- options as any
55
- ).format(unformattedDate) as string;
53
+
54
+ let formattedDateTime = DateTime.fromISO(unformattedDate?.toISOString())
55
+ .setLocale(locale)
56
+ .toLocaleString(options as any);
57
+
56
58
  formattedDateTime = this.updateDayPeriodFormatting(formattedDateTime);
57
59
  return formattedDateTime;
58
60
  }