@abyss-project/main 40.2.0 → 40.3.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.
@@ -8,6 +8,7 @@ export interface IStatusPageMailPayload {
8
8
  message?: string;
9
9
  startsAt?: string;
10
10
  endsAt?: string;
11
+ timeZone?: string;
11
12
  confirmUrl?: string;
12
13
  }
13
14
  export interface IStatusPageMailRecipient {
@@ -45,6 +45,7 @@ export interface IUpdateSettingsUserBody {
45
45
  dismissNewsletter?: boolean;
46
46
  setAbyssConsoleFirstVisitDate?: boolean;
47
47
  theme?: 'light' | 'dark';
48
+ timeZone?: string;
48
49
  units?: {
49
50
  length?: MeasurementSystem;
50
51
  weight?: MeasurementSystem;
@@ -12,6 +12,7 @@ export interface IUserSetting {
12
12
  newsletterDismissedAt?: Date | null;
13
13
  abyssConsoleFirstVisitDate?: Date | null;
14
14
  theme?: 'light' | 'dark';
15
+ timeZone?: string;
15
16
  units?: {
16
17
  length?: MeasurementSystem;
17
18
  weight?: MeasurementSystem;
@@ -31,3 +31,4 @@ export * from './pricing.utils';
31
31
  export * from './plan-capacity.utils';
32
32
  export * from './billing-deep-link.utils';
33
33
  export * from './board-card-due.utils';
34
+ export * from './time-zone.utils';
@@ -47,4 +47,5 @@ __exportStar(require("./pricing.utils"), exports);
47
47
  __exportStar(require("./plan-capacity.utils"), exports);
48
48
  __exportStar(require("./billing-deep-link.utils"), exports);
49
49
  __exportStar(require("./board-card-due.utils"), exports);
50
+ __exportStar(require("./time-zone.utils"), exports);
50
51
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,gDAA8B;AAC9B,0DAAwC;AACxC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,0DAAwC;AACxC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,6DAA2C;AAC3C,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C;AAI/C,kDAAgC;AAChC,wDAAsC;AACtC,4DAA0C;AAC1C,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,gDAA8B;AAC9B,0DAAwC;AACxC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,0DAAwC;AACxC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,6DAA2C;AAC3C,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C;AAI/C,kDAAgC;AAChC,wDAAsC;AACtC,4DAA0C;AAC1C,yDAAuC;AACvC,oDAAkC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const time_zone_utils_1 = require("../time-zone.utils");
4
+ describe('isIanaTimeZone', () => {
5
+ it.each([
6
+ 'UTC',
7
+ 'Europe/Paris',
8
+ 'America/New_York',
9
+ 'Asia/Tokyo',
10
+ 'America/Argentina/Buenos_Aires',
11
+ 'Etc/GMT+5',
12
+ ])('accepts the IANA zone %s', (zone) => {
13
+ expect((0, time_zone_utils_1.isIanaTimeZone)(zone)).toBe(true);
14
+ });
15
+ it.each([
16
+ '',
17
+ 'Paris',
18
+ '+02:00',
19
+ 'CEST',
20
+ 'GMT+2',
21
+ 'Europe/Atlantis',
22
+ 'europe paris',
23
+ ' Europe/Paris',
24
+ ])('refuses %p', (zone) => {
25
+ expect((0, time_zone_utils_1.isIanaTimeZone)(zone)).toBe(false);
26
+ });
27
+ it('refuses a value that is not a string', () => {
28
+ expect((0, time_zone_utils_1.isIanaTimeZone)(undefined)).toBe(false);
29
+ expect((0, time_zone_utils_1.isIanaTimeZone)(null)).toBe(false);
30
+ expect((0, time_zone_utils_1.isIanaTimeZone)(42)).toBe(false);
31
+ });
32
+ it('defaults to a zone it accepts', () => {
33
+ expect((0, time_zone_utils_1.isIanaTimeZone)(time_zone_utils_1.DEFAULT_USER_TIME_ZONE)).toBe(true);
34
+ });
35
+ });
36
+ describe('isRenderableTimeZone', () => {
37
+ it.each(['GMT', 'CET', 'EST5EDT', 'Europe/Paris', 'UTC'])('accepts %s, a zone Intl renders', (zone) => {
38
+ expect((0, time_zone_utils_1.isRenderableTimeZone)(zone)).toBe(true);
39
+ });
40
+ it.each(['', 'Nowhere', 'Europe/Atlantis'])('refuses %p', (zone) => {
41
+ expect((0, time_zone_utils_1.isRenderableTimeZone)(zone)).toBe(false);
42
+ });
43
+ it('refuses a value that is not a string', () => {
44
+ expect((0, time_zone_utils_1.isRenderableTimeZone)(42)).toBe(false);
45
+ expect((0, time_zone_utils_1.isRenderableTimeZone)(undefined)).toBe(false);
46
+ expect((0, time_zone_utils_1.isRenderableTimeZone)(null)).toBe(false);
47
+ });
48
+ it('accepts the legacy names isIanaTimeZone refuses', () => {
49
+ expect((0, time_zone_utils_1.isIanaTimeZone)('GMT')).toBe(false);
50
+ expect((0, time_zone_utils_1.isIanaTimeZone)('EST5EDT')).toBe(false);
51
+ });
52
+ });
53
+ //# sourceMappingURL=time-zone.utils.spec.js.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@@
1
+ export declare const DEFAULT_USER_TIME_ZONE = "Europe/Paris";
2
+ export declare const isRenderableTimeZone: (value: unknown) => value is string;
3
+ export declare const isIanaTimeZone: (value: unknown) => value is string;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIanaTimeZone = exports.isRenderableTimeZone = exports.DEFAULT_USER_TIME_ZONE = void 0;
4
+ exports.DEFAULT_USER_TIME_ZONE = 'Europe/Paris';
5
+ const IANA_ZONE_SHAPE = /^[A-Za-z]+(?:\/[A-Za-z0-9_+-]+)+$/;
6
+ const isRenderableTimeZone = (value) => {
7
+ if (typeof value !== 'string' || value === '') {
8
+ return false;
9
+ }
10
+ try {
11
+ new Intl.DateTimeFormat('en-US', { timeZone: value });
12
+ return true;
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ };
18
+ exports.isRenderableTimeZone = isRenderableTimeZone;
19
+ const isIanaTimeZone = (value) => value === 'UTC' ||
20
+ (typeof value === 'string' && IANA_ZONE_SHAPE.test(value) && (0, exports.isRenderableTimeZone)(value));
21
+ exports.isIanaTimeZone = isIanaTimeZone;
22
+ //# sourceMappingURL=time-zone.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-zone.utils.js","sourceRoot":"","sources":["../../src/utils/time-zone.utils.ts"],"names":[],"mappings":";;;AAIa,QAAA,sBAAsB,GAAG,cAAc,CAAC;AAGrD,MAAM,eAAe,GAAG,mCAAmC,CAAC;AAOrD,MAAM,oBAAoB,GAAG,CAAC,KAAc,EAAmB,EAAE;IACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,oBAAoB,wBAU/B;AAOK,MAAM,cAAc,GAAG,CAAC,KAAc,EAAmB,EAAE,CAChE,KAAK,KAAK,KAAK;IACf,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAA,4BAAoB,EAAC,KAAK,CAAC,CAAC,CAAC;AAF/E,QAAA,cAAc,kBAEiE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/main",
3
- "version": "40.2.0",
3
+ "version": "40.3.0",
4
4
  "description": "Core package to interact with Abyss-Project",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",