@quiltt/core 3.6.0 → 3.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @quiltt/core
2
2
 
3
+ ## 3.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#232](https://github.com/quiltt/quiltt-js/pull/232) [`7a119af`](https://github.com/quiltt/quiltt-js/commit/7a119af8b0ba826b8df81f5eb242c002379b4e56) Thanks [@sirwolfgang](https://github.com/sirwolfgang)! - Improve typeof checks for mobile environments
8
+
3
9
  ## 3.6.0
4
10
 
5
11
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { ApolloLink, Observable as Observable$1 } from '@apollo/client/core/index.js';
3
3
  import { print } from 'graphql';
4
- import { c as createConsumer } from './index-client-C87sSU05.js';
4
+ import { c as createConsumer } from './index-client-BExxNScK.js';
5
5
 
6
6
  /**
7
7
  * An error and type safe wrapper for localStorage.
@@ -22,7 +22,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
22
22
  };
23
23
  this.isDisabled = ()=>!this.isEnabled();
24
24
  this.get = (key)=>{
25
- if (typeof window === 'undefined' || !!window.expo) return undefined;
25
+ if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return undefined;
26
26
  try {
27
27
  const state = window.localStorage.getItem(`quiltt.${key}`);
28
28
  return state ? JSON.parse(state) : state;
@@ -32,7 +32,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
32
32
  }
33
33
  };
34
34
  this.set = (key, state)=>{
35
- if (typeof window === 'undefined' || !!window.expo) return;
35
+ if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return;
36
36
  try {
37
37
  if (state) {
38
38
  window.localStorage.setItem(`quiltt.${key}`, JSON.stringify(state));
@@ -44,6 +44,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
44
44
  }
45
45
  };
46
46
  this.remove = (key)=>{
47
+ if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return;
47
48
  try {
48
49
  window.localStorage.removeItem(`quiltt.${key}`);
49
50
  } catch (error) {
@@ -71,7 +72,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
71
72
  });
72
73
  }
73
74
  };
74
- if (typeof window !== 'undefined' && !window?.expo) {
75
+ if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
75
76
  window.addEventListener('storage', this.handleStorageEvent.bind(this));
76
77
  }
77
78
  }
@@ -203,7 +204,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
203
204
  */ const GlobalStorage = new Storage();
204
205
 
205
206
  var name = "@quiltt/core";
206
- var version$1 = "3.6.0";
207
+ var version$1 = "3.6.1";
207
208
 
208
209
  /**
209
210
  * Retrieves the environment variable by key, with fallback and type conversion,
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { d as debugging } from './SubscriptionLink-client-Bf6n9gzT.js';
2
+ import { d as debugging } from './SubscriptionLink-client-DOcfhNgq.js';
3
3
 
4
4
  var adapters = {
5
5
  logger: typeof globalThis !== 'undefined' ? globalThis.console : undefined,
package/dist/index.d.ts CHANGED
@@ -301,11 +301,6 @@ type DeepPartial<T> = T extends object ? {
301
301
  type DeepReadonly<T> = T extends object ? {
302
302
  [P in keyof T]: DeepReadonly<T[P]>;
303
303
  } : T;
304
- declare global {
305
- interface Window {
306
- expo: any;
307
- }
308
- }
309
304
 
310
305
  type Observer<T> = Dispatch<SetStateAction<Maybe<T> | undefined>>;
311
306
  /**
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ApolloLink, ApolloClient } from '@apollo/client/index.js';
2
2
  export { InMemoryCache, gql, useMutation, useQuery, useSubscription } from '@apollo/client/index.js';
3
- import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth } from './SubscriptionLink-client-Bf6n9gzT.js';
4
- export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets, g as getEnv } from './SubscriptionLink-client-Bf6n9gzT.js';
3
+ import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth } from './SubscriptionLink-client-DOcfhNgq.js';
4
+ export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets, g as getEnv } from './SubscriptionLink-client-DOcfhNgq.js';
5
5
  import { BatchHttpLink as BatchHttpLink$1 } from '@apollo/client/link/batch-http/index.js';
6
6
  import crossfetch from 'cross-fetch';
7
7
  import { onError } from '@apollo/client/link/error/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quiltt/core",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Javascript API client and utilities for Quiltt",
5
5
  "keywords": [
6
6
  "quiltt",
@@ -0,0 +1 @@
1
+ This is a patched version of @rails/actioncable now that https://github.com/rails/rails/pull/47939 has been merged in and released.
@@ -11,7 +11,7 @@ export class LocalStorage<T> {
11
11
  private observers: { [key: string]: Observer<T>[] } = {}
12
12
 
13
13
  constructor() {
14
- if (typeof window !== 'undefined' && !window?.expo) {
14
+ if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
15
15
  window.addEventListener('storage', this.handleStorageEvent.bind(this))
16
16
  }
17
17
  }
@@ -29,7 +29,7 @@ export class LocalStorage<T> {
29
29
  isDisabled = (): boolean => !this.isEnabled()
30
30
 
31
31
  get = (key: string): Maybe<T> | undefined => {
32
- if (typeof window === 'undefined' || !!window.expo) return undefined
32
+ if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return undefined
33
33
 
34
34
  try {
35
35
  const state = window.localStorage.getItem(`quiltt.${key}`)
@@ -41,7 +41,7 @@ export class LocalStorage<T> {
41
41
  }
42
42
 
43
43
  set = (key: string, state: Maybe<T> | undefined): void => {
44
- if (typeof window === 'undefined' || !!window.expo) return
44
+ if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return
45
45
 
46
46
  try {
47
47
  if (state) {
@@ -55,6 +55,8 @@ export class LocalStorage<T> {
55
55
  }
56
56
 
57
57
  remove = (key: string) => {
58
+ if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return
59
+
58
60
  try {
59
61
  window.localStorage.removeItem(`quiltt.${key}`)
60
62
  } catch (error) {
package/src/types.ts CHANGED
@@ -8,8 +8,3 @@ export type Nullable<T> = { [K in keyof T]: T[K] | null }
8
8
  export type Mutable<Type> = { -readonly [Key in keyof Type]: Type[Key] }
9
9
  export type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T
10
10
  export type DeepReadonly<T> = T extends object ? { [P in keyof T]: DeepReadonly<T[P]> } : T
11
- declare global {
12
- interface Window {
13
- expo: any
14
- }
15
- }