@dvrd/dvr-controls 1.1.5 → 1.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvrd/dvr-controls",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Custom web controls",
5
5
  "main": "index.ts",
6
6
  "files": [
@@ -24,10 +24,6 @@
24
24
  "ie >= 11"
25
25
  ]
26
26
  },
27
- "peerDependencies": {
28
- "react": "*",
29
- "react-router": "*"
30
- },
31
27
  "dependencies": {
32
28
  "@dvrd/idate": "^1.8.8",
33
29
  "@fortawesome/fontawesome-svg-core": "6.5.2",
@@ -43,20 +39,24 @@
43
39
  "@types/lodash.merge": "^4.6.7",
44
40
  "@types/lodash.mergewith": "^4.6.7",
45
41
  "@types/node": "18.14.0",
46
- "@types/react": "^19.0.8",
42
+ "@types/react": "^19.0.12",
47
43
  "@types/react-color": "3.0.13",
48
- "@types/react-dom": "^19.0.3",
44
+ "@types/react-dom": "^19.0.4",
45
+ "@types/react-router": "^5.1.20",
49
46
  "@types/uuid": "9.0.0",
50
47
  "classnames": "2.5.1",
51
- "dompurify": "3.0.0",
48
+ "dompurify": "3.2.4",
52
49
  "js-cookie": "3.0.1",
53
50
  "lodash.defer": "^4.1.0",
54
51
  "lodash.delay": "^4.1.1",
55
52
  "lodash.isequal": "^4.5.0",
56
53
  "lodash.merge": "^4.6.2",
57
54
  "lodash.mergewith": "^4.6.2",
55
+ "react": "^19.1.0",
58
56
  "react-color": "2.19.3",
57
+ "react-dom": "^19.1.0",
59
58
  "react-rnd": "10.4.1",
59
+ "react-router": "7.4.1",
60
60
  "swiper": "^11.1.4",
61
61
  "typescript": "5.6.3",
62
62
  "uuid": "9.0.0"
@@ -38,6 +38,7 @@ export default function DVRDPasswordInput(props: Props) {
38
38
 
39
39
  function renderOrnament() {
40
40
  const iconName = inputType === 'password' ? 'eye' : 'eye-slash';
41
+ console.debug(iconName);
41
42
  return {
42
43
  placement: ElementPosition.RIGHT,
43
44
  element: <AwesomeIcon name={iconName} onClick={onClickOrnament} className='dvrd-password-toggle'/>
@@ -64,4 +65,6 @@ export default function DVRDPasswordInput(props: Props) {
64
65
  {renderStrength()}
65
66
  </div>
66
67
  );
67
- }
68
+ }
69
+
70
+ DVRDPasswordInput.displayName = 'DVRDPasswordInput';
@@ -19,7 +19,28 @@ export const getJwt = (): string | null => {
19
19
  return null;
20
20
  };
21
21
 
22
- export const setJwt = (token: string | null, preserveOnNull: boolean = false, includeStorage: boolean = true, _options?: CookieAttributes) => {
22
+ export function setJWT(token: string | null, options?: {
23
+ preserveNull?: boolean; useStorage?: boolean, cookieName?: string; attributes?: CookieAttributes
24
+ }) {
25
+ jwtToken = token;
26
+ const preserveNull = options?.preserveNull ?? false;
27
+ const useStorage = options?.useStorage ?? true;
28
+ if (window.allowCookies || !token) {
29
+ if (token) {
30
+ let cookieOptions: CookieAttributes = {expires: 1, sameSite: 'strict', ...options?.attributes};
31
+ if (getSetting('mode') !== 'dev') {
32
+ cookieOptions.secure = true;
33
+ cookieOptions.sameSite = 'strict';
34
+ }
35
+ const cookieName = options?.cookieName ?? 'JWT';
36
+ Cookies.set(cookieName, token, options);
37
+ } else if (!preserveNull) removeJwtCookie();
38
+ if (useStorage) setJwtToStorage(token, preserveNull);
39
+ }
40
+ }
41
+
42
+ export const setJwt = (token: string | null, preserveOnNull: boolean = false, includeStorage: boolean = true,
43
+ _options?: CookieAttributes) => {
23
44
  console.debug('Settings JWT token', {token, preserveOnNull, includeStorage, allowCookies: window.allowCookies});
24
45
  jwtToken = token;
25
46
  if (window.allowCookies || !token) {
@@ -138,8 +138,8 @@ export const shuffleArray = (arr: any[]): any[] => {
138
138
 
139
139
  export function nullify<T extends string | Array<any> | Set<any> | number | bigint>(value?: T | null): T | null {
140
140
  if (typeof value === 'number' || typeof value === 'bigint') {
141
- if (value === 0) return value;
142
- return null;
141
+ if (value === 0) return null;
142
+ return value;
143
143
  }
144
144
  if (!value) return null;
145
145
  else if (Array.isArray(value) || typeof value === 'string')