@amp-labs/react 2.8.4 → 2.8.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/build/index.d.ts CHANGED
@@ -3,13 +3,18 @@ import { Dispatch } from 'react';
3
3
  import { JSX as JSX_2 } from 'react/jsx-runtime';
4
4
  import { SetStateAction } from 'react';
5
5
 
6
- export declare const AmpersandContext: default_2.Context<null>;
6
+ export declare const AmpersandContext: default_2.Context<AmpersandContextValue | null>;
7
+
8
+ declare interface AmpersandContextValue {
9
+ options: AmpersandProviderProps["options"];
10
+ projectIdOrName: string;
11
+ }
7
12
 
8
13
  export declare function AmpersandProvider(props: AmpersandProviderProps): JSX_2.Element;
9
14
 
10
15
  declare interface AmpersandProviderProps {
11
16
  options: {
12
- apiKey: string;
17
+ apiKey?: string;
13
18
  /**
14
19
  * Use `project` instead of `projectId`.
15
20
  * @deprecated
@@ -20,6 +25,14 @@ declare interface AmpersandProviderProps {
20
25
  */
21
26
  project?: string;
22
27
  styles?: object;
28
+ /**
29
+ * Callback function to get a JWT token for authorization.
30
+ * This function should return a Promise that resolves to a JWT token string.
31
+ */
32
+ getToken?: ({ consumerRef, groupRef, }: {
33
+ consumerRef: string;
34
+ groupRef: string;
35
+ }) => Promise<string>;
23
36
  };
24
37
  children: default_2.ReactNode;
25
38
  }
@@ -1635,6 +1648,13 @@ declare const ProviderMetadataInfoSourceEnum: {
1635
1648
 
1636
1649
  declare type ProviderMetadataInfoSourceEnum = typeof ProviderMetadataInfoSourceEnum[keyof typeof ProviderMetadataInfoSourceEnum];
1637
1650
 
1651
+ declare type ProxyHandlers = {
1652
+ object: BaseProxyConfig | undefined;
1653
+ setEnableProxy: () => void;
1654
+ setDisableProxy: () => void;
1655
+ getProxyEnabled: () => boolean;
1656
+ };
1657
+
1638
1658
  /**
1639
1659
  *
1640
1660
  * @export
@@ -1831,7 +1851,7 @@ export declare interface UpdateInstallationConfigContent {
1831
1851
  proxy?: BaseProxyConfig;
1832
1852
  }
1833
1853
 
1834
- export declare function useAmpersandProvider(): never;
1854
+ export declare function useAmpersandProviderProps(): AmpersandContextValue;
1835
1855
 
1836
1856
  export declare function useConfig(): {
1837
1857
  draft: Partial<ConfigContent>;
@@ -1840,6 +1860,7 @@ export declare function useConfig(): {
1840
1860
  setDraft: Dispatch<SetStateAction<Partial<ConfigContent>>>;
1841
1861
  readObject: (objectName: string) => ReadObjectHandlers;
1842
1862
  writeObject: (objectName: string) => WriteObjectHandlers;
1863
+ proxy: () => ProxyHandlers;
1843
1864
  };
1844
1865
 
1845
1866
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amp-labs/react",
3
- "version": "2.8.4",
3
+ "version": "2.8.7",
4
4
  "description": "Ampersand React library.",
5
5
  "author": {
6
6
  "name": "Ampersand Labs",
@@ -99,6 +99,7 @@
99
99
  "eslint-plugin-react-refresh": "^0.4.20",
100
100
  "globals": "^16.0.0",
101
101
  "immer": "^10.0.3",
102
+ "jose": "^6.0.12",
102
103
  "lodash.isequal": "^4.5.0",
103
104
  "react-tooltip": "^5.28.0"
104
105
  },