expo-sharing 55.0.2 → 55.0.4

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +3 -1
  3. package/android/build.gradle +2 -2
  4. package/build/plugin/src/sharingPlugin.types.d.ts +85 -0
  5. package/build/plugin/src/sharingPlugin.types.d.ts.map +1 -0
  6. package/build/plugin/src/sharingPlugin.types.js +2 -0
  7. package/build/plugin/src/sharingPlugin.types.js.map +1 -0
  8. package/build/{Sharing.d.ts → src/Sharing.d.ts} +18 -0
  9. package/build/src/Sharing.d.ts.map +1 -0
  10. package/build/{Sharing.js → src/Sharing.js} +18 -0
  11. package/build/src/Sharing.js.map +1 -0
  12. package/build/src/Sharing.types.d.ts +165 -0
  13. package/build/src/Sharing.types.d.ts.map +1 -0
  14. package/build/src/Sharing.types.js.map +1 -0
  15. package/build/src/SharingNativeModule.d.ts.map +1 -0
  16. package/build/src/SharingNativeModule.js.map +1 -0
  17. package/build/src/SharingNativeModule.web.d.ts.map +1 -0
  18. package/build/src/SharingNativeModule.web.js.map +1 -0
  19. package/build/{index.d.ts → src/index.d.ts} +1 -0
  20. package/build/src/index.d.ts.map +1 -0
  21. package/build/src/index.js.map +1 -0
  22. package/build/src/useIncomingShare.d.ts +6 -0
  23. package/build/src/useIncomingShare.d.ts.map +1 -0
  24. package/build/{useIncomingShare.js → src/useIncomingShare.js} +2 -2
  25. package/build/src/useIncomingShare.js.map +1 -0
  26. package/expo-module.config.json +1 -1
  27. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2.module → 55.0.4/expo.modules.sharing-55.0.4.module} +7 -7
  28. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.4/expo.modules.sharing-55.0.4.module.md5 +1 -0
  29. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.4/expo.modules.sharing-55.0.4.module.sha1 +1 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.4/expo.modules.sharing-55.0.4.module.sha256 +1 -0
  31. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.4/expo.modules.sharing-55.0.4.module.sha512 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2.pom → 55.0.4/expo.modules.sharing-55.0.4.pom} +1 -1
  33. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.4/expo.modules.sharing-55.0.4.pom.md5 +1 -0
  34. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.4/expo.modules.sharing-55.0.4.pom.sha1 +1 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.4/expo.modules.sharing-55.0.4.pom.sha256 +1 -0
  36. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.4/expo.modules.sharing-55.0.4.pom.sha512 +1 -0
  37. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/maven-metadata.xml +4 -4
  38. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/maven-metadata.xml.md5 +1 -1
  39. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/maven-metadata.xml.sha1 +1 -1
  40. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/maven-metadata.xml.sha256 +1 -1
  41. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/maven-metadata.xml.sha512 +1 -1
  42. package/package.json +7 -7
  43. package/plugin/build/sharingPlugin.types.d.ts +44 -0
  44. package/plugin/src/sharingPlugin.types.ts +44 -0
  45. package/src/Sharing.ts +18 -0
  46. package/src/Sharing.types.ts +71 -13
  47. package/src/index.ts +2 -0
  48. package/src/useIncomingShare.ts +4 -4
  49. package/build/Sharing.d.ts.map +0 -1
  50. package/build/Sharing.js.map +0 -1
  51. package/build/Sharing.types.d.ts +0 -108
  52. package/build/Sharing.types.d.ts.map +0 -1
  53. package/build/Sharing.types.js.map +0 -1
  54. package/build/SharingNativeModule.d.ts.map +0 -1
  55. package/build/SharingNativeModule.js.map +0 -1
  56. package/build/SharingNativeModule.web.d.ts.map +0 -1
  57. package/build/SharingNativeModule.web.js.map +0 -1
  58. package/build/index.d.ts.map +0 -1
  59. package/build/index.js.map +0 -1
  60. package/build/useIncomingShare.d.ts +0 -14
  61. package/build/useIncomingShare.d.ts.map +0 -1
  62. package/build/useIncomingShare.js.map +0 -1
  63. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.2/expo.modules.sharing-55.0.2.module.md5 +0 -1
  64. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.2/expo.modules.sharing-55.0.2.module.sha1 +0 -1
  65. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.2/expo.modules.sharing-55.0.2.module.sha256 +0 -1
  66. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.2/expo.modules.sharing-55.0.2.module.sha512 +0 -1
  67. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.2/expo.modules.sharing-55.0.2.pom.md5 +0 -1
  68. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.2/expo.modules.sharing-55.0.2.pom.sha1 +0 -1
  69. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.2/expo.modules.sharing-55.0.2.pom.sha256 +0 -1
  70. package/local-maven-repo/host/exp/exponent/expo.modules.sharing/55.0.2/expo.modules.sharing-55.0.2.pom.sha512 +0 -1
  71. /package/build/{Sharing.types.js → src/Sharing.types.js} +0 -0
  72. /package/build/{SharingNativeModule.d.ts → src/SharingNativeModule.d.ts} +0 -0
  73. /package/build/{SharingNativeModule.js → src/SharingNativeModule.js} +0 -0
  74. /package/build/{SharingNativeModule.web.d.ts → src/SharingNativeModule.web.d.ts} +0 -0
  75. /package/build/{SharingNativeModule.web.js → src/SharingNativeModule.web.js} +0 -0
  76. /package/build/{index.js → src/index.js} +0 -0
  77. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2-sources.jar → 55.0.4/expo.modules.sharing-55.0.4-sources.jar} +0 -0
  78. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2-sources.jar.md5 → 55.0.4/expo.modules.sharing-55.0.4-sources.jar.md5} +0 -0
  79. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2-sources.jar.sha1 → 55.0.4/expo.modules.sharing-55.0.4-sources.jar.sha1} +0 -0
  80. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2-sources.jar.sha256 → 55.0.4/expo.modules.sharing-55.0.4-sources.jar.sha256} +0 -0
  81. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2-sources.jar.sha512 → 55.0.4/expo.modules.sharing-55.0.4-sources.jar.sha512} +0 -0
  82. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2.aar → 55.0.4/expo.modules.sharing-55.0.4.aar} +0 -0
  83. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2.aar.md5 → 55.0.4/expo.modules.sharing-55.0.4.aar.md5} +0 -0
  84. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2.aar.sha1 → 55.0.4/expo.modules.sharing-55.0.4.aar.sha1} +0 -0
  85. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2.aar.sha256 → 55.0.4/expo.modules.sharing-55.0.4.aar.sha256} +0 -0
  86. /package/local-maven-repo/host/exp/exponent/expo.modules.sharing/{55.0.2/expo.modules.sharing-55.0.2.aar.sha512 → 55.0.4/expo.modules.sharing-55.0.4.aar.sha512} +0 -0
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "expo-sharing",
3
- "version": "55.0.2",
3
+ "version": "55.0.4",
4
4
  "description": "Provides a way to share files directly with other compatible applications.",
5
- "main": "build/index.js",
6
- "types": "build/index.d.ts",
5
+ "main": "build/src/index.js",
6
+ "types": "build/src/index.d.ts",
7
7
  "sideEffects": false,
8
8
  "scripts": {
9
9
  "build": "expo-module build",
@@ -35,9 +35,9 @@
35
35
  "license": "MIT",
36
36
  "homepage": "https://docs.expo.dev/versions/latest/sdk/sharing/",
37
37
  "dependencies": {
38
- "@expo/plist": "^0.5.1",
39
- "@expo/config-plugins": "^55.0.2",
40
- "@expo/config-types": "^55.0.2"
38
+ "@expo/plist": "^0.5.2",
39
+ "@expo/config-plugins": "^55.0.3",
40
+ "@expo/config-types": "^55.0.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "expo-module-scripts": "^55.0.2"
@@ -47,5 +47,5 @@
47
47
  "react": "*",
48
48
  "react-native": "*"
49
49
  },
50
- "gitHead": "326a6b473b3d2a90f3f96e9eea8f995bb2677f30"
50
+ "gitHead": "220594d473a3100248087151004ae4acb7282d5f"
51
51
  }
@@ -15,13 +15,57 @@ export type SingleIntentFilter = IntentFilter & {
15
15
  export type MultiIntentFilter = IntentFilter & {
16
16
  action: MultiShareAction;
17
17
  };
18
+ /**
19
+ * Describes a configuration for data types that are possible to share in the application on iOS.
20
+ *
21
+ * @platform ios */
18
22
  export type ActivationRuleOptions = {
23
+ /**
24
+ * Whether the app should accept shared text.
25
+ * @default false
26
+ */
19
27
  supportsText?: boolean;
28
+ /**
29
+ * Determines a maximum number of web URLs that can be shared with the app.
30
+ * When `0` the app will not accept web URL shares.
31
+ *
32
+ * @default 0
33
+ */
20
34
  supportsWebUrlWithMaxCount?: number;
35
+ /**
36
+ * Determines a maximum number of images that can be shared with the app.
37
+ * When `0` the app will not accept shared images.
38
+ *
39
+ * @default 0
40
+ */
21
41
  supportsImageWithMaxCount?: number;
42
+ /**
43
+ * Determines a maximum number of videos that can be shared with the app.
44
+ * When `0` the app will not accept video shares.
45
+ *
46
+ * @default 0
47
+ */
22
48
  supportsMovieWithMaxCount?: number;
49
+ /**
50
+ * Determines a maximum number of files that can be shared with the app.
51
+ * When `0` the app will not accept file shares.
52
+ *
53
+ * @default 0
54
+ */
23
55
  supportsFileWithMaxCount?: number;
56
+ /**
57
+ * Determines a maximum number of webpages that can be shared with the app.
58
+ * When `0` the app will not accept webpage shares.
59
+ *
60
+ * @default 0
61
+ */
24
62
  supportsWebPageWithMaxCount?: number;
63
+ /**
64
+ * Determines a maximum number of attachments that can be shared with the app.
65
+ * When `0` the app will not accept attachment shares.
66
+ *
67
+ * @default 0
68
+ */
25
69
  supportsAttachmentsWithMaxCount?: number;
26
70
  };
27
71
  export type ActivationRule = ActivationRuleOptions | string;
@@ -17,13 +17,57 @@ export type MultiIntentFilter = IntentFilter & {
17
17
  action: MultiShareAction;
18
18
  };
19
19
 
20
+ /**
21
+ * Describes a configuration for data types that are possible to share in the application on iOS.
22
+ *
23
+ * @platform ios */
20
24
  export type ActivationRuleOptions = {
25
+ /**
26
+ * Whether the app should accept shared text.
27
+ * @default false
28
+ */
21
29
  supportsText?: boolean;
30
+ /**
31
+ * Determines a maximum number of web URLs that can be shared with the app.
32
+ * When `0` the app will not accept web URL shares.
33
+ *
34
+ * @default 0
35
+ */
22
36
  supportsWebUrlWithMaxCount?: number;
37
+ /**
38
+ * Determines a maximum number of images that can be shared with the app.
39
+ * When `0` the app will not accept shared images.
40
+ *
41
+ * @default 0
42
+ */
23
43
  supportsImageWithMaxCount?: number;
44
+ /**
45
+ * Determines a maximum number of videos that can be shared with the app.
46
+ * When `0` the app will not accept video shares.
47
+ *
48
+ * @default 0
49
+ */
24
50
  supportsMovieWithMaxCount?: number;
51
+ /**
52
+ * Determines a maximum number of files that can be shared with the app.
53
+ * When `0` the app will not accept file shares.
54
+ *
55
+ * @default 0
56
+ */
25
57
  supportsFileWithMaxCount?: number;
58
+ /**
59
+ * Determines a maximum number of webpages that can be shared with the app.
60
+ * When `0` the app will not accept webpage shares.
61
+ *
62
+ * @default 0
63
+ */
26
64
  supportsWebPageWithMaxCount?: number;
65
+ /**
66
+ * Determines a maximum number of attachments that can be shared with the app.
67
+ * When `0` the app will not accept attachment shares.
68
+ *
69
+ * @default 0
70
+ */
27
71
  supportsAttachmentsWithMaxCount?: number;
28
72
  };
29
73
  export type ActivationRule = ActivationRuleOptions | string;
package/src/Sharing.ts CHANGED
@@ -32,10 +32,28 @@ export async function shareAsync(url: string, options: SharingOptions = {}): Pro
32
32
  return await SharingNativeModule.shareAsync(url, options);
33
33
  }
34
34
 
35
+ /**
36
+ * Returns raw data shared with the app. Returns an empty array if no data has been shared with the app.
37
+ *
38
+ * @platform android
39
+ * @platform ios
40
+ * @experimental
41
+ */
35
42
  export function getSharedPayloads(): SharePayload[] {
36
43
  return SharingNativeModule.getSharedPayloads();
37
44
  }
38
45
 
46
+ /**
47
+ * Returns resolved data shared with the app. Compared to data returned from [`getSharedPayloads`](#sharinggetsharedpayloads) contains additional
48
+ * information useful for reading and displaying the data. For example, when a web `URL` is shared with the app,
49
+ * a resolved payload will contain additional information about the URL contents.
50
+ *
51
+ * > Depending on what has been shared, this method may require a network connection to resolve content details.
52
+ *
53
+ * @platform android
54
+ * @platform ios
55
+ * @experimental
56
+ */
39
57
  export async function getResolvedSharedPayloadsAsync(): Promise<ResolvedSharePayload[]> {
40
58
  return await SharingNativeModule.getResolvedSharedPayloadsAsync();
41
59
  }
@@ -39,18 +39,28 @@ export type SharingOptions = {
39
39
  * - `image`: An image file.
40
40
  * - `video`: A video file.
41
41
  * - `file`: A generic file.
42
+ *
43
+ * @platform android
44
+ * @platform ios
45
+ * @experimental
42
46
  */
43
47
  export type ShareType = 'text' | 'url' | 'audio' | 'image' | 'video' | 'file';
44
48
 
45
49
  /**
46
50
  * Describes the resolved content type.
47
- * This distinguishes between generic URLs and specific web content,
48
- * and categorizes files based on their MIME type.
51
+ *
52
+ * @platform android
53
+ * @platform ios
54
+ * @experimental
49
55
  */
50
56
  export type ContentType = 'text' | 'audio' | 'image' | 'video' | 'file' | 'website';
51
57
 
52
58
  /**
53
- * Represents direct content shared into the app.
59
+ * Represents raw data shared with the app.
60
+ *
61
+ * @platform android
62
+ * @platform ios
63
+ * @experimental
54
64
  */
55
65
  export type SharePayload = {
56
66
  /**
@@ -70,7 +80,7 @@ export type SharePayload = {
70
80
  shareType: ShareType;
71
81
 
72
82
  /**
73
- * The MIME type of the `value` field.
83
+ * The MIME type of the contents of the`value` field.
74
84
  *
75
85
  * @default 'text/plain'
76
86
  */
@@ -79,34 +89,37 @@ export type SharePayload = {
79
89
 
80
90
  export type BaseResolvedSharePayload = SharePayload & {
81
91
  /**
82
- * Uri, which can be used to access the shared content. When resolving contents of a URL with redirects, will contain the redirect target uri.
83
- * Null when resolving for `text` `SharePayload` share type.
92
+ * URI which can be used to access the shared content. When resolving contents of a URL with redirects, contains the redirect target URI.
93
+ * Null when resolving a [`SharePayload`](#sharepayload) with a `text` [`ShareType`](#sharetype).
84
94
  */
85
95
  contentUri: string | null;
86
96
 
87
97
  /**
88
- * Type of the content accessible via the `uri`.
98
+ * Type of the content accessible via the `contentUri`.
89
99
  */
90
100
  contentType: ContentType | null;
91
101
 
92
102
  /**
93
- * Mime type of the content accessible via the `uri`.
103
+ * Mime type of the content accessible via the `contentUri`.
94
104
  */
95
105
  contentMimeType: string | null;
96
106
 
97
107
  /**
98
- * Value of the `suggestedFilename` HTTP header field or the last path component of the `uri` field.
108
+ * If applicable, value of the `suggestedFilename` HTTP header field, otherwise the last path component of the `contentUri` field.
99
109
  */
100
110
  originalName: string | null;
101
111
 
102
112
  /**
103
- * Size of the content accessible via the `uri`
113
+ * Size of the content accessible via the `contentUri`.
104
114
  */
105
115
  contentSize: number | null;
106
116
  };
107
117
 
108
118
  /**
109
- * Information about content for which the data can be fetched through an uri.
119
+ * Represents a resolved payload, for which the data can be accessed through a URI.
120
+ * @platform android
121
+ * @platform ios
122
+ * @experimental
110
123
  */
111
124
  export type UriBasedResolvedSharePayload = BaseResolvedSharePayload & {
112
125
  contentType: 'audio' | 'file' | 'video' | 'image' | 'website';
@@ -114,10 +127,55 @@ export type UriBasedResolvedSharePayload = BaseResolvedSharePayload & {
114
127
  };
115
128
 
116
129
  /**
117
- * Information about shared text.
130
+ * Represents a resolved payload, where a text was shared with the app.
131
+ *
132
+ * @platform android
133
+ * @platform ios
134
+ * @experimental
118
135
  */
119
136
  export type TextBasedResolvedSharePayload = BaseResolvedSharePayload & {
120
- contentType?: Exclude<ContentType, 'audio' | 'file' | 'video' | 'image' | 'website'>;
137
+ contentType?: 'text';
121
138
  };
122
139
 
140
+ /**
141
+ * Represents a payload shared with the app, with additional information about the shared contents.
142
+ *
143
+ * @platform android
144
+ * @platform ios
145
+ * @experimental
146
+ */
123
147
  export type ResolvedSharePayload = UriBasedResolvedSharePayload | TextBasedResolvedSharePayload;
148
+
149
+ /**
150
+ * Object returned by [`useIncomingShare`](#useincomingshare) hook containing information about data shared with the app.
151
+ *
152
+ * @platform android
153
+ * @platform ios
154
+ * @experimental
155
+ */
156
+ export type UseIncomingShareResult = {
157
+ /**
158
+ * Returns unresolved payloads shared with the app. Synchronous and available immediately after creating the hook.
159
+ */
160
+ sharedPayloads: SharePayload[];
161
+ /**
162
+ * Contains an array of resolved payloads shared with the app. Returns an empty array if the shared payloads are being resolved or if the resolving has failed.
163
+ */
164
+ resolvedSharedPayloads: ResolvedSharePayload[];
165
+ /**
166
+ * Clears payloads shared with the app.
167
+ */
168
+ clearSharedPayloads: () => void;
169
+ /**
170
+ * Boolean indicating whether the current shared payloads are being resolved.
171
+ */
172
+ isResolving: boolean;
173
+ /**
174
+ * Contains an error encountered while resolving the shared payload. Null on success.
175
+ */
176
+ error: Error | null;
177
+ /**
178
+ * Forces a refresh of the shared payloads.
179
+ */
180
+ refreshSharePayloads: () => void;
181
+ };
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // We usually don't export any config plugin types, but in this case it allows us to improve the readability of the docs a lot.
2
+ export type { ActivationRuleOptions } from '../plugin/src/sharingPlugin.types';
1
3
  export { useIncomingShare } from './useIncomingShare';
2
4
  export type * from './Sharing.types';
3
5
  export * from './Sharing';
@@ -2,7 +2,7 @@ import { useEffect, useState, useCallback, useRef } from 'react';
2
2
  import { AppState, AppStateStatus } from 'react-native';
3
3
 
4
4
  import { clearSharedPayloads, getResolvedSharedPayloadsAsync, getSharedPayloads } from './Sharing';
5
- import { ResolvedSharePayload, SharePayload } from './Sharing.types';
5
+ import { ResolvedSharePayload, SharePayload, UseIncomingShareResult } from './Sharing.types';
6
6
 
7
7
  function sharePayloadsAreEqual(a: SharePayload[], b: SharePayload[]): boolean {
8
8
  if (a.length !== b.length) {
@@ -32,10 +32,10 @@ function sharePayloadsAreEqual(a: SharePayload[], b: SharePayload[]): boolean {
32
32
  }
33
33
 
34
34
  /**
35
- * TODO: Docs
35
+ * Hook, which returns the data shared with the application and updates the data if the shared payload has changed.
36
36
  */
37
- export function useIncomingShare() {
38
- const [sharedPayloads, setSharedPayloads] = useState<SharePayload[]>([]);
37
+ export function useIncomingShare(): UseIncomingShareResult {
38
+ const [sharedPayloads, setSharedPayloads] = useState<SharePayload[]>(getSharedPayloads());
39
39
  const [resolvedSharedPayloads, setResolvedSharedPayloads] = useState<ResolvedSharePayload[]>([]);
40
40
  const [isResolving, setIsResolving] = useState(false);
41
41
  const [error, setError] = useState<Error | null>(null);
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sharing.d.ts","sourceRoot":"","sources":["../src/Sharing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIrF;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CASzD;AAGD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAKzF;AAED,wBAAgB,iBAAiB,IAAI,YAAY,EAAE,CAElD;AAED,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAEtF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sharing.js","sourceRoot":"","sources":["../src/Sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAExD,cAAc;AACd;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,mBAAmB,EAAE,CAAC;QACxB,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,CAAC;YACzC,OAAO,MAAM,mBAAmB,CAAC,gBAAgB,EAAE,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,UAA0B,EAAE;IACxE,IAAI,CAAC,mBAAmB,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC;QAC5D,MAAM,IAAI,mBAAmB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,MAAM,mBAAmB,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,mBAAmB,CAAC,iBAAiB,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,8BAA8B;IAClD,OAAO,MAAM,mBAAmB,CAAC,8BAA8B,EAAE,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,mBAAmB,CAAC,mBAAmB,EAAE,CAAC;AAC5C,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport { ResolvedSharePayload, SharePayload, SharingOptions } from './Sharing.types';\nimport SharingNativeModule from './SharingNativeModule';\n\n// @needsAudit\n/**\n * Determine if the sharing API can be used in this app.\n * @return A promise that fulfills with `true` if the sharing API can be used, and `false` otherwise.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n if (SharingNativeModule) {\n if (SharingNativeModule.isAvailableAsync) {\n return await SharingNativeModule.isAvailableAsync();\n }\n return true;\n }\n\n return false;\n}\n\n// @needsAudit\n/**\n * Opens action sheet to share file to different applications which can handle this type of file.\n * @param url Local file URL to share.\n * @param options A map of share options.\n */\nexport async function shareAsync(url: string, options: SharingOptions = {}): Promise<void> {\n if (!SharingNativeModule || !SharingNativeModule.shareAsync) {\n throw new UnavailabilityError('Sharing', 'shareAsync');\n }\n return await SharingNativeModule.shareAsync(url, options);\n}\n\nexport function getSharedPayloads(): SharePayload[] {\n return SharingNativeModule.getSharedPayloads();\n}\n\nexport async function getResolvedSharedPayloadsAsync(): Promise<ResolvedSharePayload[]> {\n return await SharingNativeModule.getResolvedSharedPayloadsAsync();\n}\n\n/**\n * Clears the data shared with the app.\n */\nexport function clearSharedPayloads(): void {\n SharingNativeModule.clearSharedPayloads();\n}\n"]}
@@ -1,108 +0,0 @@
1
- export type SharingOptions = {
2
- /**
3
- * Sets `mimeType` for `Intent`.
4
- * @platform android
5
- */
6
- mimeType?: string;
7
- /**
8
- * [Uniform Type Identifier](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html)
9
- * - the type of the target file.
10
- * @platform ios
11
- */
12
- UTI?: string;
13
- /**
14
- * Sets share dialog title.
15
- * @platform android
16
- * @platform web
17
- */
18
- dialogTitle?: string;
19
- /**
20
- * Sets the anchor point for iPad
21
- * @platform ios
22
- */
23
- anchor?: {
24
- x?: number;
25
- y?: number;
26
- width?: number;
27
- height?: number;
28
- };
29
- };
30
- /**
31
- * Determines the type of content being shared.
32
- * - `text`: Plain text content.
33
- * - `url`: A specific URL.
34
- * - `audio`: An audio file.
35
- * - `image`: An image file.
36
- * - `video`: A video file.
37
- * - `file`: A generic file.
38
- */
39
- export type ShareType = 'text' | 'url' | 'audio' | 'image' | 'video' | 'file';
40
- /**
41
- * Describes the resolved content type.
42
- * This distinguishes between generic URLs and specific web content,
43
- * and categorizes files based on their MIME type.
44
- */
45
- export type ContentType = 'text' | 'audio' | 'image' | 'video' | 'file' | 'website';
46
- /**
47
- * Represents direct content shared into the app.
48
- */
49
- export type SharePayload = {
50
- /**
51
- * The primary value of the content.
52
- * - For `text`, this is the message body.
53
- * - For `url`, this is the URL string.
54
- * - For `file`, `image`, `video`, or `audio`, this is typically the file URI.
55
- *
56
- * @default ""
57
- */
58
- value: string;
59
- /**
60
- * The type of the shared content.
61
- * @default 'text'
62
- */
63
- shareType: ShareType;
64
- /**
65
- * The MIME type of the `value` field.
66
- *
67
- * @default 'text/plain'
68
- */
69
- mimeType?: string;
70
- };
71
- export type BaseResolvedSharePayload = SharePayload & {
72
- /**
73
- * Uri, which can be used to access the shared content. When resolving contents of a URL with redirects, will contain the redirect target uri.
74
- * Null when resolving for `text` `SharePayload` share type.
75
- */
76
- contentUri: string | null;
77
- /**
78
- * Type of the content accessible via the `uri`.
79
- */
80
- contentType: ContentType | null;
81
- /**
82
- * Mime type of the content accessible via the `uri`.
83
- */
84
- contentMimeType: string | null;
85
- /**
86
- * Value of the `suggestedFilename` HTTP header field or the last path component of the `uri` field.
87
- */
88
- originalName: string | null;
89
- /**
90
- * Size of the content accessible via the `uri`
91
- */
92
- contentSize: number | null;
93
- };
94
- /**
95
- * Information about content for which the data can be fetched through an uri.
96
- */
97
- export type UriBasedResolvedSharePayload = BaseResolvedSharePayload & {
98
- contentType: 'audio' | 'file' | 'video' | 'image' | 'website';
99
- contentUri: string;
100
- };
101
- /**
102
- * Information about shared text.
103
- */
104
- export type TextBasedResolvedSharePayload = BaseResolvedSharePayload & {
105
- contentType?: Exclude<ContentType, 'audio' | 'file' | 'video' | 'image' | 'website'>;
106
- };
107
- export type ResolvedSharePayload = UriBasedResolvedSharePayload | TextBasedResolvedSharePayload;
108
- //# sourceMappingURL=Sharing.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sharing.types.d.ts","sourceRoot":"","sources":["../src/Sharing.types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAIF;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG;IACpD;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAEhC;;OAEG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,wBAAwB,GAAG;IACpE,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;IAC9D,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,wBAAwB,GAAG;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;CACtF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,4BAA4B,GAAG,6BAA6B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sharing.types.js","sourceRoot":"","sources":["../src/Sharing.types.ts"],"names":[],"mappings":"","sourcesContent":["// @needsAudit\nexport type SharingOptions = {\n /**\n * Sets `mimeType` for `Intent`.\n * @platform android\n */\n mimeType?: string;\n /**\n * [Uniform Type Identifier](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html)\n * - the type of the target file.\n * @platform ios\n */\n UTI?: string;\n /**\n * Sets share dialog title.\n * @platform android\n * @platform web\n */\n dialogTitle?: string;\n /**\n * Sets the anchor point for iPad\n * @platform ios\n */\n anchor?: {\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n };\n};\n\n// MARK: - Share into types\n\n/**\n * Determines the type of content being shared.\n * - `text`: Plain text content.\n * - `url`: A specific URL.\n * - `audio`: An audio file.\n * - `image`: An image file.\n * - `video`: A video file.\n * - `file`: A generic file.\n */\nexport type ShareType = 'text' | 'url' | 'audio' | 'image' | 'video' | 'file';\n\n/**\n * Describes the resolved content type.\n * This distinguishes between generic URLs and specific web content,\n * and categorizes files based on their MIME type.\n */\nexport type ContentType = 'text' | 'audio' | 'image' | 'video' | 'file' | 'website';\n\n/**\n * Represents direct content shared into the app.\n */\nexport type SharePayload = {\n /**\n * The primary value of the content.\n * - For `text`, this is the message body.\n * - For `url`, this is the URL string.\n * - For `file`, `image`, `video`, or `audio`, this is typically the file URI.\n *\n * @default \"\"\n */\n value: string;\n\n /**\n * The type of the shared content.\n * @default 'text'\n */\n shareType: ShareType;\n\n /**\n * The MIME type of the `value` field.\n *\n * @default 'text/plain'\n */\n mimeType?: string;\n};\n\nexport type BaseResolvedSharePayload = SharePayload & {\n /**\n * Uri, which can be used to access the shared content. When resolving contents of a URL with redirects, will contain the redirect target uri.\n * Null when resolving for `text` `SharePayload` share type.\n */\n contentUri: string | null;\n\n /**\n * Type of the content accessible via the `uri`.\n */\n contentType: ContentType | null;\n\n /**\n * Mime type of the content accessible via the `uri`.\n */\n contentMimeType: string | null;\n\n /**\n * Value of the `suggestedFilename` HTTP header field or the last path component of the `uri` field.\n */\n originalName: string | null;\n\n /**\n * Size of the content accessible via the `uri`\n */\n contentSize: number | null;\n};\n\n/**\n * Information about content for which the data can be fetched through an uri.\n */\nexport type UriBasedResolvedSharePayload = BaseResolvedSharePayload & {\n contentType: 'audio' | 'file' | 'video' | 'image' | 'website';\n contentUri: string;\n};\n\n/**\n * Information about shared text.\n */\nexport type TextBasedResolvedSharePayload = BaseResolvedSharePayload & {\n contentType?: Exclude<ContentType, 'audio' | 'file' | 'video' | 'image' | 'website'>;\n};\n\nexport type ResolvedSharePayload = UriBasedResolvedSharePayload | TextBasedResolvedSharePayload;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharingNativeModule.d.ts","sourceRoot":"","sources":["../src/SharingNativeModule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1F,KAAK,aAAa,GAAG;IACnB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,iBAAiB,IAAI,YAAY,EAAE,CAAC;IACpC,8BAA8B,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAClE,mBAAmB,IAAI,IAAI,CAAC;IAC5B,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC,CAAC;;AAEF,wBAAiE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharingNativeModule.js","sourceRoot":"","sources":["../src/SharingNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAYxD,eAAe,mBAAmB,CAAgB,aAAa,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nimport type { SharingOptions, ResolvedSharePayload, SharePayload } from './Sharing.types';\n\ntype SharingModule = {\n shareAsync(url: string, options: SharingOptions): Promise<void>;\n getSharedPayloads(): SharePayload[];\n getResolvedSharedPayloadsAsync(): Promise<ResolvedSharePayload[]>;\n clearSharedPayloads(): void;\n isAvailableAsync(): Promise<boolean>;\n};\n\nexport default requireNativeModule<SharingModule>('ExpoSharing');\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharingNativeModule.web.d.ts","sourceRoot":"","sources":["../src/SharingNativeModule.web.ts"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;;wBAGxC,OAAO,CAAC,OAAO,CAAC;oBAOpB,MAAM,YAAW,YAAY,GAAQ,OAAO,CAAC,IAAI,CAAC;;;;;AAR1E,wBAyBE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharingNativeModule.web.js","sourceRoot":"","sources":["../src/SharingNativeModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,eAAe;IACb,KAAK,CAAC,gBAAgB;QACpB,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC;IAC3B,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,GAAW,EAAE,UAAwB,EAAE;QACtD,sDAAsD;QACtD,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;YACpB,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,iBAAiB;QACf,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,KAAK,CAAC,8BAA8B;QAClC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,mBAAmB;QACjB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;CACF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\ntype ShareOptions = { title?: string; text?: string; url?: string };\n\nexport default {\n async isAvailableAsync(): Promise<boolean> {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n return !!navigator.share;\n },\n async shareAsync(url: string, options: ShareOptions = {}): Promise<void> {\n // NOTE: `navigator.share` is only available via HTTPS\n if (navigator.share) {\n await navigator.share({ ...options, url });\n } else {\n throw new UnavailabilityError('navigator', 'share');\n }\n },\n getSharedPayloads() {\n throw new Error('Receiving share payloads is not supported on web.');\n },\n async getResolvedSharedPayloadsAsync() {\n throw new Error('Receiving share payloads is not supported on web.');\n },\n clearSharedPayloads() {\n throw new Error('Receiving share payloads is not supported on web.');\n },\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,mBAAmB,iBAAiB,CAAC;AACrC,cAAc,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,cAAc,WAAW,CAAC","sourcesContent":["export { useIncomingShare } from './useIncomingShare';\nexport type * from './Sharing.types';\nexport * from './Sharing';\n"]}
@@ -1,14 +0,0 @@
1
- import { clearSharedPayloads } from './Sharing';
2
- import { ResolvedSharePayload, SharePayload } from './Sharing.types';
3
- /**
4
- * TODO: Docs
5
- */
6
- export declare function useIncomingShare(): {
7
- sharedPayloads: SharePayload[];
8
- resolvedSharedPayloads: ResolvedSharePayload[];
9
- clearSharedPayloads: typeof clearSharedPayloads;
10
- isResolving: boolean;
11
- error: Error | null;
12
- refreshSharePayloads: () => Promise<void>;
13
- };
14
- //# sourceMappingURL=useIncomingShare.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useIncomingShare.d.ts","sourceRoot":"","sources":["../src/useIncomingShare.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAqD,MAAM,WAAW,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA6BrE;;GAEG;AACH,wBAAgB,gBAAgB;;;;;;;EA6D/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useIncomingShare.js","sourceRoot":"","sources":["../src/useIncomingShare.ts"],"names":[],"mappings":"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","sourcesContent":["import { useEffect, useState, useCallback, useRef } from 'react';\nimport { AppState, AppStateStatus } from 'react-native';\n\nimport { clearSharedPayloads, getResolvedSharedPayloadsAsync, getSharedPayloads } from './Sharing';\nimport { ResolvedSharePayload, SharePayload } from './Sharing.types';\n\nfunction sharePayloadsAreEqual(a: SharePayload[], b: SharePayload[]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n const counts = new Map<string, number>();\n const getKey = (item: SharePayload) => `${item.value}|${item.mimeType}|${item.shareType}`;\n\n for (const item of a) {\n const key = getKey(item);\n counts.set(key, (counts.get(key) || 0) + 1);\n }\n\n for (const item of b) {\n const key = getKey(item);\n const count = counts.get(key);\n\n if (!count) {\n return false;\n }\n\n counts.set(key, count - 1);\n }\n\n return true;\n}\n\n/**\n * TODO: Docs\n */\nexport function useIncomingShare() {\n const [sharedPayloads, setSharedPayloads] = useState<SharePayload[]>([]);\n const [resolvedSharedPayloads, setResolvedSharedPayloads] = useState<ResolvedSharePayload[]>([]);\n const [isResolving, setIsResolving] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const currentSharedDataRef = useRef<SharePayload[]>([]);\n\n const refreshSharePayloads = useCallback(async () => {\n try {\n const newSharedData: SharePayload[] = getSharedPayloads();\n\n // Do not run `getResolvedSharedDataAsync` if the data hasn't changed to reduce network usage\n if (sharePayloadsAreEqual(newSharedData, currentSharedDataRef.current)) {\n return;\n }\n\n currentSharedDataRef.current = newSharedData;\n setSharedPayloads(newSharedData);\n setResolvedSharedPayloads([]);\n setError(null);\n\n if (newSharedData.length > 0) {\n setIsResolving(true);\n try {\n const resolved = await getResolvedSharedPayloadsAsync();\n setResolvedSharedPayloads(resolved);\n } catch (e) {\n setError(\n e instanceof Error ? e : new Error('Unknown error during shared payload resolution')\n );\n } finally {\n setIsResolving(false);\n }\n }\n } catch (e) {\n setError(e instanceof Error ? e : new Error('Failed to resolve data'));\n }\n }, []);\n\n useEffect(() => {\n refreshSharePayloads();\n\n const subscription = AppState.addEventListener('change', (nextAppState: AppStateStatus) => {\n if (nextAppState === 'active') {\n refreshSharePayloads();\n }\n });\n\n return () => {\n subscription.remove();\n };\n }, [refreshSharePayloads]);\n\n return {\n sharedPayloads,\n resolvedSharedPayloads,\n clearSharedPayloads,\n isResolving,\n error,\n refreshSharePayloads,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- 8a4c61fb331b5cabdd163c764c61e619ab90f87f036fc47c8e92294c729c82fa
@@ -1 +0,0 @@
1
- d618d1a481bbb0a9b76e3e7a4cf69e7567d97e6dc057c53e06c4e8aa28e1234cf3f9c66740788a6043e048cb380fcc3fa4176f2627bcace2cf871d3e435f9a8c
@@ -1 +0,0 @@
1
- 37ee74a0672c129f0025a30ae34b7ece2b4ca78c7ec551b3fd17a1e3b29c88ed
@@ -1 +0,0 @@
1
- 6652f8216f8fe8b4c50c38c4d0fbdfa3643d94d480dd3362a0f37330c4490853d5f10fdfdefd18ecee3dcf1dd062234ab881e748116ebb41bd7c613b6c573fe0
File without changes