@clerk/chrome-extension 2.8.2-canary.v20251115211334 → 2.8.2-canary.v20251117114651

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.
@@ -429,7 +429,7 @@ var BrowserStorageCache = createBrowserStorageCache();
429
429
  var clerk;
430
430
  noRhc.Clerk.sdkMetadata = {
431
431
  name: "@clerk/chrome-extension",
432
- version: "2.8.2-canary.v20251115211334"
432
+ version: "2.8.2-canary.v20251117114651"
433
433
  };
434
434
  async function createClerkClient({
435
435
  __experimental_syncHostListener = false,
package/dist/cjs/index.js CHANGED
@@ -1823,6 +1823,23 @@ Possible fixes:
1823
1823
  Learn more: https://clerk.com/docs/components/clerk-provider`.trim());
1824
1824
  }
1825
1825
  }
1826
+ function createCacheKeys(params) {
1827
+ return {
1828
+ queryKey: [
1829
+ params.stablePrefix,
1830
+ params.authenticated,
1831
+ params.tracked,
1832
+ params.untracked
1833
+ ],
1834
+ invalidationKey: [
1835
+ params.stablePrefix,
1836
+ params.authenticated,
1837
+ params.tracked
1838
+ ],
1839
+ stableKey: params.stablePrefix,
1840
+ authenticated: params.authenticated
1841
+ };
1842
+ }
1826
1843
  var useWithSafeValues = (params, defaultValues) => {
1827
1844
  var _a5, _b, _c;
1828
1845
  const shouldUseDefaults = typeof params === "boolean" && params;
@@ -1859,19 +1876,21 @@ var cachingSWRInfiniteOptions = {
1859
1876
  ...cachingSWROptions,
1860
1877
  revalidateFirstPage: false
1861
1878
  };
1862
- var usePagesOrInfinite = (params, fetcher, config, cacheKeys) => {
1879
+ var usePagesOrInfinite = (params) => {
1863
1880
  var _a5, _b, _c, _d, _e, _f, _g;
1864
- const [paginatedPage, setPaginatedPage] = React7.useState((_a5 = params.initialPage) != null ? _a5 : 1);
1865
- const initialPageRef = React7.useRef((_b = params.initialPage) != null ? _b : 1);
1866
- const pageSizeRef = React7.useRef((_c = params.pageSize) != null ? _c : 10);
1881
+ const { fetcher, config, keys } = params;
1882
+ const [paginatedPage, setPaginatedPage] = React7.useState((_a5 = config.initialPage) != null ? _a5 : 1);
1883
+ const initialPageRef = React7.useRef((_b = config.initialPage) != null ? _b : 1);
1884
+ const pageSizeRef = React7.useRef((_c = config.pageSize) != null ? _c : 10);
1867
1885
  const enabled = (_d = config.enabled) != null ? _d : true;
1868
1886
  const cacheMode = config.__experimental_mode === "cache";
1869
1887
  const triggerInfinite = (_e = config.infinite) != null ? _e : false;
1870
1888
  const keepPreviousData = (_f = config.keepPreviousData) != null ? _f : false;
1871
1889
  const isSignedIn = config.isSignedIn;
1872
1890
  const pagesCacheKey = {
1873
- ...cacheKeys,
1874
- ...params,
1891
+ type: keys.queryKey[0],
1892
+ ...keys.queryKey[2],
1893
+ ...keys.queryKey[3].args,
1875
1894
  initialPage: paginatedPage,
1876
1895
  pageSize: pageSizeRef.current
1877
1896
  };
@@ -1879,11 +1898,10 @@ var usePagesOrInfinite = (params, fetcher, config, cacheKeys) => {
1879
1898
  const shouldFetch = !triggerInfinite && enabled && (!cacheMode ? !!fetcher : true);
1880
1899
  const { data: swrData, isValidating: swrIsValidating, isLoading: swrIsLoading, error: swrError, mutate: swrMutate } = useSWR(typeof isSignedIn === "boolean" ? previousIsSignedIn === true && isSignedIn === false ? pagesCacheKey : isSignedIn ? shouldFetch ? pagesCacheKey : null : null : shouldFetch ? pagesCacheKey : null, !cacheMode && !!fetcher ? (cacheKeyParams) => {
1881
1900
  if (isSignedIn === false || shouldFetch === false) return null;
1882
- const requestParams = getDifferentKeys(cacheKeyParams, cacheKeys);
1883
- return fetcher({
1884
- ...params,
1885
- ...requestParams
1886
- });
1901
+ return fetcher(getDifferentKeys(cacheKeyParams, {
1902
+ type: keys.queryKey[0],
1903
+ ...keys.queryKey[2]
1904
+ }));
1887
1905
  } : null, {
1888
1906
  keepPreviousData,
1889
1907
  ...cachingSWROptions
@@ -1891,17 +1909,18 @@ var usePagesOrInfinite = (params, fetcher, config, cacheKeys) => {
1891
1909
  const { data: swrInfiniteData, isLoading: swrInfiniteIsLoading, isValidating: swrInfiniteIsValidating, error: swrInfiniteError, size, setSize, mutate: swrInfiniteMutate } = useSWRInfinite((pageIndex) => {
1892
1910
  if (!triggerInfinite || !enabled || isSignedIn === false) return null;
1893
1911
  return {
1894
- ...params,
1895
- ...cacheKeys,
1912
+ type: keys.queryKey[0],
1913
+ ...keys.queryKey[2],
1914
+ ...keys.queryKey[3].args,
1896
1915
  initialPage: initialPageRef.current + pageIndex,
1897
1916
  pageSize: pageSizeRef.current
1898
1917
  };
1899
1918
  }, (cacheKeyParams) => {
1900
- const requestParams = getDifferentKeys(cacheKeyParams, cacheKeys);
1901
- return fetcher == null ? void 0 : fetcher({
1902
- ...params,
1903
- ...requestParams
1919
+ const requestParams = getDifferentKeys(cacheKeyParams, {
1920
+ type: keys.queryKey[0],
1921
+ ...keys.queryKey[2]
1904
1922
  });
1923
+ return fetcher == null ? void 0 : fetcher(requestParams);
1905
1924
  }, cachingSWRInfiniteOptions);
1906
1925
  const page = React7.useMemo(() => {
1907
1926
  if (triggerInfinite) return size;
@@ -2040,37 +2059,73 @@ function useOrganization(params) {
2040
2059
  pageSize: invitationsSafeValues.pageSize,
2041
2060
  status: invitationsSafeValues.status
2042
2061
  };
2043
- const domains = usePagesOrInfinite({ ...domainParams }, organization == null ? void 0 : organization.getDomains, {
2044
- keepPreviousData: domainSafeValues.keepPreviousData,
2045
- infinite: domainSafeValues.infinite,
2046
- enabled: !!domainParams
2047
- }, {
2048
- type: "domains",
2049
- organizationId: organization == null ? void 0 : organization.id
2062
+ const domains = usePagesOrInfinite({
2063
+ fetcher: organization == null ? void 0 : organization.getDomains,
2064
+ config: {
2065
+ keepPreviousData: domainSafeValues.keepPreviousData,
2066
+ infinite: domainSafeValues.infinite,
2067
+ enabled: !!domainParams,
2068
+ isSignedIn: Boolean(organization),
2069
+ initialPage: domainSafeValues.initialPage,
2070
+ pageSize: domainSafeValues.pageSize
2071
+ },
2072
+ keys: createCacheKeys({
2073
+ stablePrefix: "domains",
2074
+ authenticated: Boolean(organization),
2075
+ tracked: { organizationId: organization == null ? void 0 : organization.id },
2076
+ untracked: { args: domainParams }
2077
+ })
2050
2078
  });
2051
- const membershipRequests = usePagesOrInfinite({ ...membershipRequestParams }, organization == null ? void 0 : organization.getMembershipRequests, {
2052
- keepPreviousData: membershipRequestSafeValues.keepPreviousData,
2053
- infinite: membershipRequestSafeValues.infinite,
2054
- enabled: !!membershipRequestParams
2055
- }, {
2056
- type: "membershipRequests",
2057
- organizationId: organization == null ? void 0 : organization.id
2079
+ const membershipRequests = usePagesOrInfinite({
2080
+ fetcher: organization == null ? void 0 : organization.getMembershipRequests,
2081
+ config: {
2082
+ keepPreviousData: membershipRequestSafeValues.keepPreviousData,
2083
+ infinite: membershipRequestSafeValues.infinite,
2084
+ enabled: !!membershipRequestParams,
2085
+ isSignedIn: Boolean(organization),
2086
+ initialPage: membershipRequestSafeValues.initialPage,
2087
+ pageSize: membershipRequestSafeValues.pageSize
2088
+ },
2089
+ keys: createCacheKeys({
2090
+ stablePrefix: "membershipRequests",
2091
+ authenticated: Boolean(organization),
2092
+ tracked: { organizationId: organization == null ? void 0 : organization.id },
2093
+ untracked: { args: membershipRequestParams }
2094
+ })
2058
2095
  });
2059
- const memberships = usePagesOrInfinite(membersParams || {}, organization == null ? void 0 : organization.getMemberships, {
2060
- keepPreviousData: membersSafeValues.keepPreviousData,
2061
- infinite: membersSafeValues.infinite,
2062
- enabled: !!membersParams
2063
- }, {
2064
- type: "members",
2065
- organizationId: organization == null ? void 0 : organization.id
2096
+ const memberships = usePagesOrInfinite({
2097
+ fetcher: organization == null ? void 0 : organization.getMemberships,
2098
+ config: {
2099
+ keepPreviousData: membersSafeValues.keepPreviousData,
2100
+ infinite: membersSafeValues.infinite,
2101
+ enabled: !!membersParams,
2102
+ isSignedIn: Boolean(organization),
2103
+ initialPage: membersSafeValues.initialPage,
2104
+ pageSize: membersSafeValues.pageSize
2105
+ },
2106
+ keys: createCacheKeys({
2107
+ stablePrefix: "members",
2108
+ authenticated: Boolean(organization),
2109
+ tracked: { organizationId: organization == null ? void 0 : organization.id },
2110
+ untracked: { args: membersParams }
2111
+ })
2066
2112
  });
2067
- const invitations = usePagesOrInfinite({ ...invitationsParams }, organization == null ? void 0 : organization.getInvitations, {
2068
- keepPreviousData: invitationsSafeValues.keepPreviousData,
2069
- infinite: invitationsSafeValues.infinite,
2070
- enabled: !!invitationsParams
2071
- }, {
2072
- type: "invitations",
2073
- organizationId: organization == null ? void 0 : organization.id
2113
+ const invitations = usePagesOrInfinite({
2114
+ fetcher: organization == null ? void 0 : organization.getInvitations,
2115
+ config: {
2116
+ keepPreviousData: invitationsSafeValues.keepPreviousData,
2117
+ infinite: invitationsSafeValues.infinite,
2118
+ enabled: !!invitationsParams,
2119
+ isSignedIn: Boolean(organization),
2120
+ initialPage: invitationsSafeValues.initialPage,
2121
+ pageSize: invitationsSafeValues.pageSize
2122
+ },
2123
+ keys: createCacheKeys({
2124
+ stablePrefix: "invitations",
2125
+ authenticated: Boolean(organization),
2126
+ tracked: { organizationId: organization == null ? void 0 : organization.id },
2127
+ untracked: { args: invitationsParams }
2128
+ })
2074
2129
  });
2075
2130
  if (organization === void 0) return {
2076
2131
  isLoaded: false,
@@ -2168,29 +2223,56 @@ function useOrganizationList(params) {
2168
2223
  status: userSuggestionsSafeValues.status
2169
2224
  };
2170
2225
  const isClerkLoaded = !!(clerk2.loaded && user);
2171
- const memberships = usePagesOrInfinite(userMembershipsParams || {}, user == null ? void 0 : user.getOrganizationMemberships, {
2172
- keepPreviousData: userMembershipsSafeValues.keepPreviousData,
2173
- infinite: userMembershipsSafeValues.infinite,
2174
- enabled: !!userMembershipsParams
2175
- }, {
2176
- type: "userMemberships",
2177
- userId: user == null ? void 0 : user.id
2226
+ const memberships = usePagesOrInfinite({
2227
+ fetcher: user == null ? void 0 : user.getOrganizationMemberships,
2228
+ config: {
2229
+ keepPreviousData: userMembershipsSafeValues.keepPreviousData,
2230
+ infinite: userMembershipsSafeValues.infinite,
2231
+ enabled: !!userMembershipsParams,
2232
+ isSignedIn: Boolean(user),
2233
+ initialPage: userMembershipsSafeValues.initialPage,
2234
+ pageSize: userMembershipsSafeValues.pageSize
2235
+ },
2236
+ keys: createCacheKeys({
2237
+ stablePrefix: "userMemberships",
2238
+ authenticated: Boolean(user),
2239
+ tracked: { userId: user == null ? void 0 : user.id },
2240
+ untracked: { args: userMembershipsParams }
2241
+ })
2178
2242
  });
2179
- const invitations = usePagesOrInfinite({ ...userInvitationsParams }, user == null ? void 0 : user.getOrganizationInvitations, {
2180
- keepPreviousData: userInvitationsSafeValues.keepPreviousData,
2181
- infinite: userInvitationsSafeValues.infinite,
2182
- enabled: !!userInvitationsParams
2183
- }, {
2184
- type: "userInvitations",
2185
- userId: user == null ? void 0 : user.id
2243
+ const invitations = usePagesOrInfinite({
2244
+ fetcher: user == null ? void 0 : user.getOrganizationInvitations,
2245
+ config: {
2246
+ keepPreviousData: userInvitationsSafeValues.keepPreviousData,
2247
+ infinite: userInvitationsSafeValues.infinite,
2248
+ enabled: !!userInvitationsParams,
2249
+ isSignedIn: Boolean(user),
2250
+ initialPage: userInvitationsSafeValues.initialPage,
2251
+ pageSize: userInvitationsSafeValues.pageSize
2252
+ },
2253
+ keys: createCacheKeys({
2254
+ stablePrefix: "userInvitations",
2255
+ authenticated: Boolean(user),
2256
+ tracked: { userId: user == null ? void 0 : user.id },
2257
+ untracked: { args: userInvitationsParams }
2258
+ })
2186
2259
  });
2187
- const suggestions = usePagesOrInfinite({ ...userSuggestionsParams }, user == null ? void 0 : user.getOrganizationSuggestions, {
2188
- keepPreviousData: userSuggestionsSafeValues.keepPreviousData,
2189
- infinite: userSuggestionsSafeValues.infinite,
2190
- enabled: !!userSuggestionsParams
2191
- }, {
2192
- type: "userSuggestions",
2193
- userId: user == null ? void 0 : user.id
2260
+ const suggestions = usePagesOrInfinite({
2261
+ fetcher: user == null ? void 0 : user.getOrganizationSuggestions,
2262
+ config: {
2263
+ keepPreviousData: userSuggestionsSafeValues.keepPreviousData,
2264
+ infinite: userSuggestionsSafeValues.infinite,
2265
+ enabled: !!userSuggestionsParams,
2266
+ isSignedIn: Boolean(user),
2267
+ initialPage: userSuggestionsSafeValues.initialPage,
2268
+ pageSize: userSuggestionsSafeValues.pageSize
2269
+ },
2270
+ keys: createCacheKeys({
2271
+ stablePrefix: "userSuggestions",
2272
+ authenticated: Boolean(user),
2273
+ tracked: { userId: user == null ? void 0 : user.id },
2274
+ untracked: { args: userSuggestionsParams }
2275
+ })
2194
2276
  });
2195
2277
  if (!isClerkLoaded) return {
2196
2278
  isLoaded: false,
@@ -4317,7 +4399,7 @@ if (typeof globalThis.__BUILD_DISABLE_RHC__ === "undefined") {
4317
4399
  }
4318
4400
  var SDK_METADATA = {
4319
4401
  name: "@clerk/clerk-react",
4320
- version: "5.56.0-canary.v20251115211334",
4402
+ version: "5.56.0-canary.v20251117114651",
4321
4403
  environment: process.env.NODE_ENV
4322
4404
  };
4323
4405
  var _status;
@@ -5861,7 +5943,7 @@ var BrowserStorageCache = createBrowserStorageCache();
5861
5943
  var clerk;
5862
5944
  noRhc.Clerk.sdkMetadata = {
5863
5945
  name: "@clerk/chrome-extension",
5864
- version: "2.8.2-canary.v20251115211334"
5946
+ version: "2.8.2-canary.v20251117114651"
5865
5947
  };
5866
5948
  async function createClerkClient({
5867
5949
  __experimental_syncHostListener = false,