@amp-labs/react 2.7.13 → 2.8.0

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
@@ -2,7 +2,6 @@ import { default as default_2 } from 'react';
2
2
  import { Dispatch } from 'react';
3
3
  import { JSX as JSX_2 } from 'react/jsx-runtime';
4
4
  import { SetStateAction } from 'react';
5
- import { UseQueryResult } from '@tanstack/react-query';
6
5
 
7
6
  export declare const AmpersandContext: default_2.Context<null>;
8
7
 
@@ -78,12 +77,28 @@ declare interface BaseProxyConfig {
78
77
  enabled?: boolean;
79
78
  }
80
79
 
80
+ /**
81
+ *
82
+ * @export
83
+ * @interface BaseReadConfig
84
+ */
85
+ declare interface BaseReadConfig {
86
+ /**
87
+ * This is a map of object names to their configuration.
88
+ * @type {{ [key: string]: BaseReadConfigObject; }}
89
+ * @memberof BaseReadConfig
90
+ */
91
+ objects?: {
92
+ [key: string]: BaseReadConfigObject;
93
+ };
94
+ }
95
+
81
96
  /**
82
97
  *
83
98
  * @export
84
99
  * @interface BaseReadConfigObject
85
100
  */
86
- declare interface BaseReadConfigObject {
101
+ export declare interface BaseReadConfigObject {
87
102
  /**
88
103
  * The name of the object to read from.
89
104
  * @type {string}
@@ -142,12 +157,28 @@ declare interface BaseReadConfigObject {
142
157
  backfill?: BackfillConfig;
143
158
  }
144
159
 
160
+ /**
161
+ *
162
+ * @export
163
+ * @interface BaseWriteConfig
164
+ */
165
+ declare interface BaseWriteConfig {
166
+ /**
167
+ * This is a map of object names to their configuration.
168
+ * @type {{ [key: string]: BaseWriteConfigObject; }}
169
+ * @memberof BaseWriteConfig
170
+ */
171
+ objects?: {
172
+ [key: string]: BaseWriteConfigObject;
173
+ };
174
+ }
175
+
145
176
  /**
146
177
  *
147
178
  * @export
148
179
  * @interface BaseWriteConfigObject
149
180
  */
150
- declare interface BaseWriteConfigObject {
181
+ export declare interface BaseWriteConfigObject {
151
182
  /**
152
183
  * The name of the object to write to.
153
184
  * @type {string}
@@ -216,7 +247,7 @@ export declare interface Config {
216
247
  * @export
217
248
  * @interface ConfigContent
218
249
  */
219
- declare interface ConfigContent {
250
+ export declare interface ConfigContent {
220
251
  /**
221
252
  * The SaaS API that we are integrating with.
222
253
  * @type {string}
@@ -671,7 +702,7 @@ export declare type FieldMappingEntry = {
671
702
  * @export
672
703
  * @interface FieldMetadata
673
704
  */
674
- declare interface FieldMetadata {
705
+ export declare interface FieldMetadata {
675
706
  /**
676
707
  * The name of the field from the provider API.
677
708
  * @type {string}
@@ -732,7 +763,7 @@ declare type FieldMetadataValueTypeEnum = typeof FieldMetadataValueTypeEnum[keyo
732
763
  * @export
733
764
  * @interface FieldSetting
734
765
  */
735
- declare interface FieldSetting {
766
+ export declare interface FieldSetting {
736
767
  /**
737
768
  *
738
769
  * @type {FieldSettingDefault}
@@ -769,7 +800,7 @@ declare interface FieldSetting {
769
800
  * @export
770
801
  * @interface FieldSettingDefault
771
802
  */
772
- declare interface FieldSettingDefault {
803
+ export declare interface FieldSettingDefault {
773
804
  /**
774
805
  * The default string value to apply to a field
775
806
  * @type {string}
@@ -793,22 +824,22 @@ declare interface FieldSettingDefault {
793
824
  /**
794
825
  * @export
795
826
  */
796
- declare const FieldSettingWriteOnCreateEnum: {
827
+ export declare const FieldSettingWriteOnCreateEnum: {
797
828
  readonly Always: "always";
798
829
  readonly Never: "never";
799
830
  };
800
831
 
801
- declare type FieldSettingWriteOnCreateEnum = typeof FieldSettingWriteOnCreateEnum[keyof typeof FieldSettingWriteOnCreateEnum];
832
+ export declare type FieldSettingWriteOnCreateEnum = typeof FieldSettingWriteOnCreateEnum[keyof typeof FieldSettingWriteOnCreateEnum];
802
833
 
803
834
  /**
804
835
  * @export
805
836
  */
806
- declare const FieldSettingWriteOnUpdateEnum: {
837
+ export declare const FieldSettingWriteOnUpdateEnum: {
807
838
  readonly Always: "always";
808
839
  readonly Never: "never";
809
840
  };
810
841
 
811
- declare type FieldSettingWriteOnUpdateEnum = typeof FieldSettingWriteOnUpdateEnum[keyof typeof FieldSettingWriteOnUpdateEnum];
842
+ export declare type FieldSettingWriteOnUpdateEnum = typeof FieldSettingWriteOnUpdateEnum[keyof typeof FieldSettingWriteOnUpdateEnum];
812
843
 
813
844
  /**
814
845
  * Ampersand public API
@@ -939,7 +970,7 @@ declare interface HydratedIntegration {
939
970
  *
940
971
  * @export
941
972
  */
942
- declare type HydratedIntegrationField = HydratedIntegrationFieldExistent | IntegrationFieldMapping;
973
+ export declare type HydratedIntegrationField = HydratedIntegrationFieldExistent | IntegrationFieldMapping;
943
974
 
944
975
  /**
945
976
  * Ampersand public API
@@ -989,7 +1020,7 @@ declare interface HydratedIntegrationFieldExistent {
989
1020
  * @export
990
1021
  * @interface HydratedIntegrationObject
991
1022
  */
992
- declare interface HydratedIntegrationObject {
1023
+ export declare interface HydratedIntegrationObject {
993
1024
  /**
994
1025
  * Error message if there was an issue hydrating this object.
995
1026
  * @type {string}
@@ -1156,7 +1187,7 @@ declare interface HydratedIntegrationWriteObject {
1156
1187
  * @export
1157
1188
  * @interface HydratedRevision
1158
1189
  */
1159
- declare interface HydratedRevision {
1190
+ export declare interface HydratedRevision {
1160
1191
  /**
1161
1192
  * The revision ID.
1162
1193
  * @type {string}
@@ -1188,7 +1219,7 @@ declare interface HydratedRevision {
1188
1219
  * @export
1189
1220
  * @interface Installation
1190
1221
  */
1191
- declare interface Installation {
1222
+ export declare interface Installation {
1192
1223
  /**
1193
1224
  * The installation ID.
1194
1225
  * @type {string}
@@ -1258,7 +1289,7 @@ declare interface Installation {
1258
1289
  */
1259
1290
  export declare type InstallationConfigContent = Partial<ConfigContent>;
1260
1291
 
1261
- declare interface InstallationContextValue {
1292
+ export declare interface InstallationContextValue {
1262
1293
  integrationNameOrId: string;
1263
1294
  consumerRef: string;
1264
1295
  consumerName?: string;
@@ -1353,6 +1384,20 @@ declare interface IntegrationFieldMapping {
1353
1384
  prompt?: string;
1354
1385
  }
1355
1386
 
1387
+ export declare interface Manifest {
1388
+ getReadObject: (objectName: string) => {
1389
+ object: HydratedIntegrationObject | null;
1390
+ getRequiredFields: () => HydratedIntegrationField[] | null;
1391
+ getOptionalFields: () => HydratedIntegrationField[] | null;
1392
+ };
1393
+ getCustomerFieldsForObject: (objectName: string) => {
1394
+ allFields: {
1395
+ [key: string]: FieldMetadata;
1396
+ } | null;
1397
+ getField: (field: string) => FieldMetadata | null;
1398
+ };
1399
+ }
1400
+
1356
1401
  declare interface MappedValue {
1357
1402
  mappedValue: string;
1358
1403
  mappedDisplayValue: string;
@@ -1663,6 +1708,20 @@ declare interface ReadConfigObject {
1663
1708
  backfill?: BackfillConfig;
1664
1709
  }
1665
1710
 
1711
+ export declare type ReadObjectHandlers = {
1712
+ object: BaseReadConfigObject | undefined;
1713
+ getSelectedField: (fieldName: string) => boolean;
1714
+ setSelectedField: (params: {
1715
+ fieldName: string;
1716
+ selected: boolean;
1717
+ }) => void;
1718
+ getFieldMapping: (fieldName: string) => string | undefined;
1719
+ setFieldMapping: (params: {
1720
+ fieldName: string;
1721
+ mapToName: string;
1722
+ }) => void;
1723
+ };
1724
+
1666
1725
  /**
1667
1726
  * If selectedFieldsAuto is set to all, all fields will be read.
1668
1727
  * @export
@@ -1733,6 +1792,38 @@ declare interface SubscribeConfigObject {
1733
1792
  deleteEvent?: ConfigDeleteEvent;
1734
1793
  }
1735
1794
 
1795
+ /**
1796
+ *
1797
+ * @export
1798
+ * @interface UpdateInstallationConfigContent
1799
+ */
1800
+ export declare interface UpdateInstallationConfigContent {
1801
+ /**
1802
+ * The SaaS API that we are integrating with.
1803
+ * @type {string}
1804
+ * @memberof UpdateInstallationConfigContent
1805
+ */
1806
+ provider?: string;
1807
+ /**
1808
+ *
1809
+ * @type {BaseReadConfig}
1810
+ * @memberof UpdateInstallationConfigContent
1811
+ */
1812
+ read?: BaseReadConfig;
1813
+ /**
1814
+ *
1815
+ * @type {BaseWriteConfig}
1816
+ * @memberof UpdateInstallationConfigContent
1817
+ */
1818
+ write?: BaseWriteConfig;
1819
+ /**
1820
+ *
1821
+ * @type {BaseProxyConfig}
1822
+ * @memberof UpdateInstallationConfigContent
1823
+ */
1824
+ proxy?: BaseProxyConfig;
1825
+ }
1826
+
1736
1827
  export declare function useAmpersandProvider(): never;
1737
1828
 
1738
1829
  export declare function useConfig(): {
@@ -1740,45 +1831,8 @@ export declare function useConfig(): {
1740
1831
  get: () => Partial<ConfigContent>;
1741
1832
  reset: () => void;
1742
1833
  setDraft: Dispatch<SetStateAction<Partial<ConfigContent>>>;
1743
- readObject: (objectName: string) => {
1744
- object: BaseReadConfigObject | undefined;
1745
- getSelectedField: (fieldName: string) => boolean;
1746
- setSelectedField: (params: {
1747
- fieldName: string;
1748
- selected: boolean;
1749
- }) => void;
1750
- getFieldMapping: (fieldName: string) => string | undefined;
1751
- setFieldMapping: (params: {
1752
- fieldName: string;
1753
- mapToName: string;
1754
- }) => void;
1755
- };
1756
- writeObject: (objectName: string) => {
1757
- object: BaseWriteConfigObject | undefined;
1758
- setEnableWrite: () => void;
1759
- setDisableWrite: () => void;
1760
- getWriteObject: () => BaseWriteConfigObject | undefined;
1761
- getSelectedFieldSettings: (fieldName: string) => FieldSetting | undefined;
1762
- setSelectedFieldSettings: (params: {
1763
- fieldName: string;
1764
- settings: FieldSetting;
1765
- }) => void;
1766
- getDefaultValues: (fieldName: string) => FieldSettingDefault | undefined;
1767
- setDefaultValues: (params: {
1768
- fieldName: string;
1769
- value: FieldSettingDefault;
1770
- }) => void;
1771
- getWriteOnCreateSetting: (fieldName: string) => FieldSettingWriteOnCreateEnum | undefined;
1772
- setWriteOnCreateSetting: (params: {
1773
- fieldName: string;
1774
- value: FieldSettingWriteOnCreateEnum;
1775
- }) => void;
1776
- getWriteOnUpdateSetting: (fieldName: string) => FieldSettingWriteOnUpdateEnum | undefined;
1777
- setWriteOnUpdateSetting: (params: {
1778
- fieldName: string;
1779
- value: FieldSettingWriteOnUpdateEnum;
1780
- }) => void;
1781
- };
1834
+ readObject: (objectName: string) => ReadObjectHandlers;
1835
+ writeObject: (objectName: string) => WriteObjectHandlers;
1782
1836
  };
1783
1837
 
1784
1838
  /**
@@ -1837,12 +1891,6 @@ export declare function useDeleteInstallation(): {
1837
1891
  errorMsg: string | null;
1838
1892
  };
1839
1893
 
1840
- /**
1841
- * gets hydrated revision using headless hooks to fill in details
1842
- * @returns
1843
- */
1844
- export declare const useHydratedRevisionQuery: () => UseQueryResult<HydratedRevision, Error>;
1845
-
1846
1894
  /**
1847
1895
  * useInstallation hook
1848
1896
  * @returns {Object} An object containing:
@@ -1863,8 +1911,6 @@ export declare function useInstallation(): {
1863
1911
  error: Error | null;
1864
1912
  };
1865
1913
 
1866
- export declare function useInstallationProps(): InstallationContextValue;
1867
-
1868
1914
  export declare const useIsIntegrationInstalled: (integration: string, groupRef: string) => UseIsIntegrationInstalledResult;
1869
1915
 
1870
1916
  declare interface UseIsIntegrationInstalledResult {
@@ -1879,7 +1925,7 @@ declare interface UseIsIntegrationInstalledResult {
1879
1925
  * @returns Manifest object
1880
1926
  *
1881
1927
  * if object is not found, returns null for the object, getRequiredFields, getOptionalFields,
1882
- * getCustomerFieldsForObject, getCustomerFieldsMetadataForObject
1928
+ * getCustomerFieldsForObject.
1883
1929
  *
1884
1930
  */
1885
1931
  export declare function useManifest(): {
@@ -1893,9 +1939,8 @@ export declare function useManifest(): {
1893
1939
  getRequiredFields: () => HydratedIntegrationField[] | null;
1894
1940
  getOptionalFields: () => HydratedIntegrationField[] | null;
1895
1941
  };
1896
- getCustomerFieldsForObject: (objectName: string) => HydratedIntegrationField[] | null;
1897
- getCustomerFieldsMetadataForObject: (objectName: string) => {
1898
- allFieldsMetaData: {
1942
+ getCustomerFieldsForObject: (objectName: string) => {
1943
+ allFields: {
1899
1944
  [key: string]: FieldMetadata;
1900
1945
  } | null;
1901
1946
  getField: (field: string) => FieldMetadata | null;
@@ -2139,4 +2184,31 @@ declare interface WriteConfigObject {
2139
2184
  };
2140
2185
  }
2141
2186
 
2187
+ export declare type WriteObjectHandlers = {
2188
+ object: BaseWriteConfigObject | undefined;
2189
+ setEnableWrite: () => void;
2190
+ setDisableWrite: () => void;
2191
+ getWriteObject: () => BaseWriteConfigObject | undefined;
2192
+ getSelectedFieldSettings: (fieldName: string) => FieldSetting | undefined;
2193
+ setSelectedFieldSettings: (params: {
2194
+ fieldName: string;
2195
+ settings: FieldSetting;
2196
+ }) => void;
2197
+ getDefaultValues: (fieldName: string) => FieldSettingDefault | undefined;
2198
+ setDefaultValues: (params: {
2199
+ fieldName: string;
2200
+ value: FieldSettingDefault;
2201
+ }) => void;
2202
+ getWriteOnCreateSetting: (fieldName: string) => FieldSettingWriteOnCreateEnum | undefined;
2203
+ setWriteOnCreateSetting: (params: {
2204
+ fieldName: string;
2205
+ value: FieldSettingWriteOnCreateEnum;
2206
+ }) => void;
2207
+ getWriteOnUpdateSetting: (fieldName: string) => FieldSettingWriteOnUpdateEnum | undefined;
2208
+ setWriteOnUpdateSetting: (params: {
2209
+ fieldName: string;
2210
+ value: FieldSettingWriteOnUpdateEnum;
2211
+ }) => void;
2212
+ };
2213
+
2142
2214
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amp-labs/react",
3
- "version": "2.7.13",
3
+ "version": "2.8.0",
4
4
  "description": "Ampersand React library.",
5
5
  "author": {
6
6
  "name": "Ampersand Labs",