genesys-spark 4.182.0 → 4.182.2

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/dist/index.d.ts CHANGED
@@ -1,46 +1,4 @@
1
- /**
2
- * Provides an [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat)
3
- * object for formatting dates and times. Unlike the native version, `locale` is
4
- * an optional argument. If not provided, the function will try to determine the
5
- * locale from the DOM, where it should be set for a11y reasons.
6
- * @param locale optional locale to use for formatting
7
- * @param options options to pass to the Intl.DateTimeFormat constructor
8
- * @returns a new DateTimeFormat
9
- */
10
- declare function dateTimeFormat(localeOrOptions: string | Intl.DateTimeFormatOptions, options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
11
- /**
12
- * Provides an [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat)
13
- * object for formatting dates and times. Unlike the native version, `locale` is
14
- * an optional argument. If not provided, the function will try to determine the
15
- * locale from the DOM, where it should be set for a11y reasons.
16
- * @param locale optional locale to use for formatting
17
- * @param options options to pass to the Intl.RelativeTimeFormat constructor
18
- * @returns a new RelativeTimeFormat
19
- */
20
- declare function relativeTimeFormat(localeOrOptions: string | Intl.RelativeTimeFormatOptions, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat;
21
- /**
22
- * Makes a best effort to return the locale that should be used for a given element
23
- * by checking language tags on ancestors. If no element is provided, it will
24
- * start with the document's <body> tag. If no locale can be found, it will use
25
- * the browser's locale preference. It will also try to add a region to regionless
26
- * locales when there is a partial match with the browser's locale.
27
- * @returns a locale string (e.g. 'en-US', 'en', 'de-DE', etc)
28
- */
29
- declare function determineDisplayLocale(element?: HTMLElement): string;
30
- declare function getFormat(locale: string): string;
31
-
32
- declare const intl_dateTimeFormat: typeof dateTimeFormat;
33
- declare const intl_determineDisplayLocale: typeof determineDisplayLocale;
34
- declare const intl_getFormat: typeof getFormat;
35
- declare const intl_relativeTimeFormat: typeof relativeTimeFormat;
36
- declare namespace intl {
37
- export {
38
- intl_dateTimeFormat as dateTimeFormat,
39
- intl_determineDisplayLocale as determineDisplayLocale,
40
- intl_getFormat as getFormat,
41
- intl_relativeTimeFormat as relativeTimeFormat,
42
- };
43
- }
1
+ export { sparkIntl as Intl } from 'genesys-spark-utils';
44
2
 
45
3
  interface registerOptions {
46
4
  /**
@@ -69,4 +27,4 @@ declare function registerSparkComponents(opts?: registerOptions): Promise<void>;
69
27
  */
70
28
  declare function registerSparkChartComponents(opts?: registerOptions): Promise<void>;
71
29
 
72
- export { intl as Intl, loadSparkFonts, registerSparkChartComponents, registerSparkComponents };
30
+ export { loadSparkFonts, registerSparkChartComponents, registerSparkComponents };
package/dist/index.js CHANGED
@@ -157,7 +157,7 @@ function relativeTimeFormat(localeOrOptions, options) {
157
157
  }
158
158
  function determineDisplayLocale(element = document.body) {
159
159
  var _a;
160
- const domLocale = (_a = getClosestElement(element, "*[lang]")) == null ? void 0 : _a.lang;
160
+ const domLocale = (_a = getClosestElement(element, "*[lang]")) === null || _a === void 0 ? void 0 : _a.lang;
161
161
  const domLocaleWithOverride = domLocaleOverride(domLocale);
162
162
  if (!domLocaleWithOverride || browserHasRegionData(domLocaleWithOverride)) {
163
163
  return navigator.language;
@@ -167,10 +167,10 @@ function determineDisplayLocale(element = document.body) {
167
167
  }
168
168
  function browserHasRegionData(localeString) {
169
169
  var _a;
170
- return browserLocaleOverride(localeString) || localeString.length == 2 && ((_a = navigator.language) == null ? void 0 : _a.startsWith(`${localeString}-`));
170
+ return browserLocaleOverride(localeString) || localeString.length == 2 && ((_a = navigator.language) === null || _a === void 0 ? void 0 : _a.startsWith(`${localeString}-`));
171
171
  }
172
172
  function domLocaleOverride(localeString) {
173
- if ((localeString == null ? void 0 : localeString.toLowerCase()) === "en-us") {
173
+ if ((localeString === null || localeString === void 0 ? void 0 : localeString.toLowerCase()) === "en-us") {
174
174
  return "en";
175
175
  } else {
176
176
  return localeString;
@@ -180,9 +180,9 @@ function browserLocaleOverride(localeString) {
180
180
  var _a, _b;
181
181
  switch (localeString.toLowerCase()) {
182
182
  case "zh-cn":
183
- return Boolean((_a = navigator.language) == null ? void 0 : _a.toLowerCase().startsWith("zh-sg"));
183
+ return Boolean((_a = navigator.language) === null || _a === void 0 ? void 0 : _a.toLowerCase().startsWith("zh-sg"));
184
184
  case "zh-tw":
185
- return Boolean((_b = navigator.language) == null ? void 0 : _b.toLowerCase().startsWith("zh-hk"));
185
+ return Boolean((_b = navigator.language) === null || _b === void 0 ? void 0 : _b.toLowerCase().startsWith("zh-hk"));
186
186
  default:
187
187
  return false;
188
188
  }
@@ -194,10 +194,7 @@ function getFormat(locale) {
194
194
  month: "numeric",
195
195
  day: "numeric"
196
196
  };
197
- const dateTimeFormat2 = new Intl.DateTimeFormat(
198
- locale,
199
- options
200
- );
197
+ const dateTimeFormat2 = new Intl.DateTimeFormat(locale, options);
201
198
  const parts = dateTimeFormat2.formatToParts(date);
202
199
  const dateString = parts.map(({ type, value }) => {
203
200
  switch (type) {
@@ -214,7 +211,7 @@ function getFormat(locale) {
214
211
  return dateString.replace(/\s/g, "").replace(/‏/g, "");
215
212
  }
216
213
 
217
- var intl = /*#__PURE__*/Object.freeze({
214
+ var sparkIntl = /*#__PURE__*/Object.freeze({
218
215
  __proto__: null,
219
216
  dateTimeFormat: dateTimeFormat,
220
217
  determineDisplayLocale: determineDisplayLocale,
@@ -222,8 +219,8 @@ var intl = /*#__PURE__*/Object.freeze({
222
219
  relativeTimeFormat: relativeTimeFormat
223
220
  });
224
221
 
225
- const COMPONENT_ASSET_PREFIX = "/spark-components/build-assets/4.182.0-829/genesys-webcomponents/";
226
- const CHART_COMPONENT_ASSET_PREFIX = "/spark-components/build-assets/4.182.0-829/chart/genesys-chart-webcomponents/";
222
+ const COMPONENT_ASSET_PREFIX = "/spark-components/build-assets/4.182.2-839/genesys-webcomponents/";
223
+ const CHART_COMPONENT_ASSET_PREFIX = "/spark-components/build-assets/4.182.2-839/chart/genesys-chart-webcomponents/";
227
224
  function loadSparkFonts(opts) {
228
225
  const fontOrigin = getFontOrigin();
229
226
  const flareFonts = {
@@ -271,4 +268,4 @@ function registerSparkChartComponents(opts) {
271
268
  return Promise.all([checkAndLoadScript(SCRIPT_SRC)]).then();
272
269
  }
273
270
 
274
- export { intl as Intl, loadSparkFonts, registerSparkChartComponents, registerSparkComponents };
271
+ export { sparkIntl as Intl, loadSparkFonts, registerSparkChartComponents, registerSparkComponents };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genesys-spark",
3
- "version": "4.182.0",
3
+ "version": "4.182.2",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -34,10 +34,14 @@
34
34
  "version-sync": "npm version --no-git-tag-version --allow-same-version"
35
35
  },
36
36
  "types": "dist/index.d.ts",
37
+ "dependencies": {
38
+ "genesys-spark-utils": "file:../genesys-spark-utils"
39
+ },
37
40
  "optionalDependencies": {
38
41
  "@rollup/rollup-linux-x64-gnu": "^4.24.3"
39
42
  },
40
43
  "devDependencies": {
44
+ "@rollup/plugin-node-resolve": "^16.0.2",
41
45
  "@rollup/plugin-replace": "^6.0.2",
42
46
  "@tsconfig/strictest": "^2.0.6",
43
47
  "dir-compare": "^5.0.0",