@betterview/integration-toolkit 7.5.4 → 7.5.6

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 (61) hide show
  1. package/lib/Network/axios-error-handling.d.ts +26 -0
  2. package/lib/Network/axios-error-handling.d.ts.map +1 -0
  3. package/lib/Network/axios-error-handling.js +52 -0
  4. package/lib/Network/axios-error-handling.js.map +1 -0
  5. package/lib/Network/index.d.ts +11 -0
  6. package/lib/Network/index.d.ts.map +1 -0
  7. package/lib/Network/index.js +19 -0
  8. package/lib/Network/index.js.map +1 -0
  9. package/lib/Parse/index.d.ts +4 -0
  10. package/lib/Parse/index.d.ts.map +1 -0
  11. package/lib/Parse/index.js +16 -0
  12. package/lib/Parse/index.js.map +1 -0
  13. package/lib/TestHarness/index.d.ts +9 -0
  14. package/lib/TestHarness/index.d.ts.map +1 -0
  15. package/lib/TestHarness/index.js +33 -0
  16. package/lib/TestHarness/index.js.map +1 -0
  17. package/lib/hooks/index.d.ts +3 -0
  18. package/lib/hooks/index.d.ts.map +1 -0
  19. package/lib/hooks/index.js +6 -0
  20. package/lib/hooks/index.js.map +1 -0
  21. package/lib/hooks/useWindowMessge/index.d.ts +7 -0
  22. package/lib/hooks/useWindowMessge/index.d.ts.map +1 -0
  23. package/lib/hooks/useWindowMessge/index.js +28 -0
  24. package/lib/hooks/useWindowMessge/index.js.map +1 -0
  25. package/lib/types/Enrichment.d.ts +80 -0
  26. package/lib/types/Enrichment.d.ts.map +1 -0
  27. package/lib/types/Enrichment.js +3 -0
  28. package/lib/types/Enrichment.js.map +1 -0
  29. package/lib/types/EnrichmentComponentArgs.d.ts +51 -0
  30. package/lib/types/EnrichmentComponentArgs.d.ts.map +1 -0
  31. package/lib/types/EnrichmentComponentArgs.js +3 -0
  32. package/lib/types/EnrichmentComponentArgs.js.map +1 -0
  33. package/lib/types/Events.d.ts +5 -0
  34. package/lib/types/Events.d.ts.map +1 -0
  35. package/lib/types/Events.js +9 -0
  36. package/lib/types/Events.js.map +1 -0
  37. package/lib/types/IPartnerDataSchema.d.ts +32 -0
  38. package/lib/types/IPartnerDataSchema.d.ts.map +1 -0
  39. package/lib/types/IPartnerDataSchema.js +13 -0
  40. package/lib/types/IPartnerDataSchema.js.map +1 -0
  41. package/lib/types/Integration.d.ts +26 -0
  42. package/lib/types/Integration.d.ts.map +1 -0
  43. package/lib/types/Integration.js +41 -0
  44. package/lib/types/Integration.js.map +1 -0
  45. package/lib/types/IntegrationManifest.d.ts +47 -0
  46. package/lib/types/IntegrationManifest.d.ts.map +1 -0
  47. package/lib/types/IntegrationManifest.js +3 -0
  48. package/lib/types/IntegrationManifest.js.map +1 -0
  49. package/lib/types/Storage.d.ts +13 -0
  50. package/lib/types/Storage.d.ts.map +1 -0
  51. package/lib/types/Storage.js +3 -0
  52. package/lib/types/Storage.js.map +1 -0
  53. package/lib/types/index.d.ts +8 -0
  54. package/lib/types/index.d.ts.map +1 -0
  55. package/lib/types/index.js +24 -0
  56. package/lib/types/index.js.map +1 -0
  57. package/lib/utils/index.d.ts +2 -0
  58. package/lib/utils/index.d.ts.map +1 -0
  59. package/lib/utils/index.js +12 -0
  60. package/lib/utils/index.js.map +1 -0
  61. package/package.json +1 -1
@@ -0,0 +1,26 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+ export declare type FriendlyName = 'server error' | 'no response' | 'request init failure' | 'auth error' | 'endpoint not found';
3
+ export interface SimplifiedError {
4
+ /** the status code number (e.g. 500) */
5
+ statusCode?: number;
6
+ data?: any;
7
+ /** the status code name (e.g. ETIMEDOUT) */
8
+ code?: string;
9
+ responseHeaders?: Record<string, string>;
10
+ /**
11
+ * server error: the server responded with an error
12
+ * no repsonse: no response was received from the server
13
+ * request init failure: axios failed to create the request to send
14
+ */
15
+ friendly: FriendlyName;
16
+ }
17
+ /** simplifies an axios error, exposing the properties that are commonly used and friendly name to help decision trees */
18
+ export declare function simplifyError(err: AxiosError): SimplifiedError;
19
+ export interface IWrapResult<T> {
20
+ data?: T;
21
+ headers?: Record<string, string>;
22
+ err?: SimplifiedError;
23
+ }
24
+ /** wraps an axios api call, resulting in a successful promise containing either the requested data or a simplfied error */
25
+ export declare function wrap<T>(axiosApiCall: Promise<AxiosResponse<T> | AxiosError<T>>): Promise<IWrapResult<T>>;
26
+ //# sourceMappingURL=axios-error-handling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios-error-handling.d.ts","sourceRoot":"","sources":["../../src/Network/axios-error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAElD,oBAAY,YAAY,GACpB,cAAc,GACd,aAAa,GACb,sBAAsB,GACtB,YAAY,GACZ,oBAAoB,CAAC;AAEzB,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;;OAIG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED,yHAAyH;AACzH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,eAAe,CAa9D;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB;AAeD,2HAA2H;AAC3H,wBAAsB,IAAI,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAe9G"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrap = exports.simplifyError = void 0;
4
+ /** simplifies an axios error, exposing the properties that are commonly used and friendly name to help decision trees */
5
+ function simplifyError(err) {
6
+ let friendly = 'request init failure';
7
+ const statusCode = `${err.code ?? err.response?.status}`;
8
+ if (err.response)
9
+ friendly = convertStatusCode(statusCode);
10
+ else if (err.request)
11
+ friendly = 'no response';
12
+ return {
13
+ statusCode: err.response?.status,
14
+ data: err.response?.data,
15
+ code: statusCode,
16
+ responseHeaders: err.response?.headers,
17
+ friendly
18
+ };
19
+ }
20
+ exports.simplifyError = simplifyError;
21
+ function convertStatusCode(code) {
22
+ switch (code) {
23
+ case '401':
24
+ return 'auth error';
25
+ case '500':
26
+ return 'server error';
27
+ case '404':
28
+ return 'endpoint not found';
29
+ default:
30
+ return 'no response';
31
+ }
32
+ }
33
+ /** wraps an axios api call, resulting in a successful promise containing either the requested data or a simplfied error */
34
+ async function wrap(axiosApiCall) {
35
+ const result = {};
36
+ try {
37
+ let r = await axiosApiCall;
38
+ if (r.isAxiosError !== undefined) {
39
+ throw r;
40
+ }
41
+ r = r;
42
+ result.headers = r.headers;
43
+ result.data = r.data;
44
+ }
45
+ catch (err) {
46
+ const simple = simplifyError(err);
47
+ result.err = simple;
48
+ }
49
+ return result;
50
+ }
51
+ exports.wrap = wrap;
52
+ //# sourceMappingURL=axios-error-handling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios-error-handling.js","sourceRoot":"","sources":["../../src/Network/axios-error-handling.ts"],"names":[],"mappings":";;;AAwBA,yHAAyH;AACzH,SAAgB,aAAa,CAAC,GAAe;IAC3C,IAAI,QAAQ,GAAiB,sBAAsB,CAAC;IACpD,MAAM,UAAU,GAAG,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACzD,IAAI,GAAG,CAAC,QAAQ;QAAE,QAAQ,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;SACtD,IAAI,GAAG,CAAC,OAAO;QAAE,QAAQ,GAAG,aAAa,CAAC;IAE/C,OAAO;QACL,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM;QAChC,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI;QACxB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,GAAG,CAAC,QAAQ,EAAE,OAAO;QACtC,QAAQ;KACT,CAAC;AACJ,CAAC;AAbD,sCAaC;AAQD,SAAS,iBAAiB,CAAC,IAAY;IACrC,QAAQ,IAAI,EAAE;QACZ,KAAK,KAAK;YACR,OAAO,YAAY,CAAC;QACtB,KAAK,KAAK;YACR,OAAO,cAAc,CAAC;QACxB,KAAK,KAAK;YACR,OAAO,oBAAoB,CAAC;QAC9B;YACE,OAAO,aAAa,CAAC;KACxB;AACH,CAAC;AAED,2HAA2H;AACpH,KAAK,UAAU,IAAI,CAAI,YAAuD;IACnF,MAAM,MAAM,GAAmB,EAAE,CAAC;IAClC,IAAI;QACF,IAAI,CAAC,GAAG,MAAM,YAAY,CAAC;QAC3B,IAAK,CAAgB,CAAC,YAAY,KAAK,SAAS,EAAE;YAChD,MAAM,CAAC,CAAC;SACT;QACD,CAAC,GAAG,CAAqB,CAAC;QAC1B,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;QAC3B,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;KACtB;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,MAAM,GAAG,aAAa,CAAC,GAAsB,CAAC,CAAC;QACrD,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC;KACrB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAfD,oBAeC"}
@@ -0,0 +1,11 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { IWrapResult } from './axios-error-handling';
3
+ export declare function get<T = Record<string, any>>(url: string, config?: AxiosRequestConfig): Promise<{
4
+ request_url: string;
5
+ result: IWrapResult<T>;
6
+ }>;
7
+ export declare function post<T = any, U = Record<string, any>>(url: string, data: T, config?: AxiosRequestConfig): Promise<{
8
+ request_url: string;
9
+ result: IWrapResult<U>;
10
+ }>;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Network/index.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,WAAW,EAAQ,MAAM,wBAAwB,CAAC;AAE3D,wBAAsB,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/C,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAG1D;AAED,wBAAsB,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzD,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,CAAC,EACP,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAG1D"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.post = exports.get = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const axios_error_handling_1 = require("./axios-error-handling");
9
+ async function get(url, config) {
10
+ const result = await (0, axios_error_handling_1.wrap)(axios_1.default.get(url, config));
11
+ return { request_url: url, result };
12
+ }
13
+ exports.get = get;
14
+ async function post(url, data, config) {
15
+ const result = await (0, axios_error_handling_1.wrap)(axios_1.default.post(url, data, config));
16
+ return { request_url: url, result };
17
+ }
18
+ exports.post = post;
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Network/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAkD;AAClD,iEAA2D;AAEpD,KAAK,UAAU,GAAG,CACvB,GAAW,EACX,MAA2B;IAE3B,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAI,EAAC,eAAK,CAAC,GAAG,CAAI,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC;AAND,kBAMC;AAEM,KAAK,UAAU,IAAI,CACxB,GAAW,EACX,IAAO,EACP,MAA2B;IAE3B,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAI,EAAC,eAAK,CAAC,IAAI,CAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC;AAPD,oBAOC"}
@@ -0,0 +1,4 @@
1
+ import { OptionsV2 } from 'xml2js';
2
+ export declare type XmlConversionOptions = OptionsV2;
3
+ export declare function xml2js(xmlToConvert: string, options?: XmlConversionOptions): Promise<string>;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Parse/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEhD,oBAAY,oBAAoB,GAAG,SAAS,CAAC;AAE7C,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CASlG"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.xml2js = void 0;
4
+ const xml2js_1 = require("xml2js");
5
+ async function xml2js(xmlToConvert, options) {
6
+ return new Promise((resolve, reject) => {
7
+ (0, xml2js_1.parseString)(xmlToConvert, options || {}, (err, result) => {
8
+ if (err) {
9
+ return reject(err);
10
+ }
11
+ return resolve(result);
12
+ });
13
+ });
14
+ }
15
+ exports.xml2js = xml2js;
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Parse/index.ts"],"names":[],"mappings":";;;AAAA,mCAAgD;AAIzC,KAAK,UAAU,MAAM,CAAC,YAAoB,EAAE,OAA8B;IAC/E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAA,oBAAW,EAAC,YAAY,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACvD,IAAI,GAAG,EAAE;gBACP,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;aACpB;YACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AATD,wBASC"}
@@ -0,0 +1,9 @@
1
+ import { Enrichment, IEnrichmentIntegrationRequestData } from '../types';
2
+ export default class TestHarness {
3
+ integration: Enrichment;
4
+ requestData: IEnrichmentIntegrationRequestData | undefined;
5
+ constructor(integration: Enrichment, requestData?: IEnrichmentIntegrationRequestData);
6
+ runGetData(): Promise<Record<string, any> | undefined>;
7
+ setMockRequestData(): void;
8
+ }
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TestHarness/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAGzE,MAAM,CAAC,OAAO,OAAO,WAAW;IACvB,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,iCAAiC,GAAG,SAAS,CAAC;gBAEtD,WAAW,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,iCAAiC;IAKvE,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IAU5D,kBAAkB;CAa1B"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ class TestHarness {
5
+ constructor(integration, requestData) {
6
+ this.integration = integration;
7
+ this.requestData = requestData;
8
+ }
9
+ async runGetData() {
10
+ if (!this.requestData) {
11
+ this.setMockRequestData();
12
+ }
13
+ console.log('Request data set to: ', (0, utils_1.jsonLog)(this.requestData));
14
+ const result = await this.integration.getEnrichmentData?.(this.requestData);
15
+ console.log(`Result:`, (0, utils_1.jsonLog)(result));
16
+ return result;
17
+ }
18
+ setMockRequestData() {
19
+ this.requestData = {
20
+ full_address: '100 Pringle Ave. Walnut Creek, CA 94596',
21
+ street: '100 Pringle Ave.',
22
+ city: 'Walnut Creek',
23
+ zip: '94596',
24
+ state: 'CA',
25
+ externalId: 'external1',
26
+ insuredName: 'Jane Doe',
27
+ latitude: 37.90820797421544,
28
+ longitude: -122.067761097756
29
+ };
30
+ }
31
+ }
32
+ exports.default = TestHarness;
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TestHarness/index.ts"],"names":[],"mappings":";;AACA,oCAAmC;AAEnC,MAAqB,WAAW;IAI9B,YAAY,WAAuB,EAAE,WAA+C;QAClF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,kBAAkB,EAAE,CAAC;SAC3B;QACD,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,IAAA,eAAO,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAA,eAAO,EAAC,MAAM,CAAC,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,kBAAkB;QACvB,IAAI,CAAC,WAAW,GAAG;YACjB,YAAY,EAAE,yCAAyC;YACvD,MAAM,EAAE,kBAAkB;YAC1B,IAAI,EAAE,cAAc;YACpB,GAAG,EAAE,OAAO;YACZ,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,WAAW;YACvB,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,iBAAiB;YAC3B,SAAS,EAAE,CAAC,gBAAgB;SAC7B,CAAC;IACJ,CAAC;CACF;AAhCD,8BAgCC"}
@@ -0,0 +1,3 @@
1
+ import { useWindowMessage } from './useWindowMessge';
2
+ export { useWindowMessage };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useWindowMessage = void 0;
4
+ const useWindowMessge_1 = require("./useWindowMessge");
5
+ Object.defineProperty(exports, "useWindowMessage", { enumerable: true, get: function () { return useWindowMessge_1.useWindowMessage; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAE5C,iGAFA,kCAAgB,OAEA"}
@@ -0,0 +1,7 @@
1
+ export declare type WindowMessage = {
2
+ namespace?: string;
3
+ type: string;
4
+ data: Record<string, any>;
5
+ };
6
+ export declare function useWindowMessage(namespace: string): [WindowMessage | null, any];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWindowMessge/index.ts"],"names":[],"mappings":"AAEA,oBAAY,aAAa,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CAAC;AAE5F,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,aAAa,GAAG,IAAI,EAAE,GAAG,CAAC,CAwB/E"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useWindowMessage = void 0;
4
+ const react_1 = require("react");
5
+ function useWindowMessage(namespace) {
6
+ const [message, setMessage] = (0, react_1.useState)(null);
7
+ const handleMessageEvent = (0, react_1.useCallback)(event => {
8
+ if (event.data.namespace !== namespace)
9
+ return;
10
+ setMessage(event.data);
11
+ }, []);
12
+ (0, react_1.useEffect)(() => {
13
+ window.addEventListener('message', handleMessageEvent);
14
+ return () => {
15
+ window.removeEventListener('message', handleMessageEvent);
16
+ };
17
+ }, [handleMessageEvent]);
18
+ const postMessage = (0, react_1.useCallback)((msg, targetOrigin = '*', transfer = undefined) => {
19
+ // eslint-disable-next-line no-console
20
+ if (!msg.type)
21
+ console.error('message object must contain properties "type" and "data"');
22
+ msg.namespace = namespace;
23
+ window.postMessage(msg, targetOrigin, transfer);
24
+ }, []);
25
+ return [message, postMessage];
26
+ }
27
+ exports.useWindowMessage = useWindowMessage;
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/useWindowMessge/index.ts"],"names":[],"mappings":";;;AAAA,iCAAyD;AAIzD,SAAgB,gBAAgB,CAAC,SAAiB;IAChD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAuB,IAAI,CAAC,CAAC;IAEnE,MAAM,kBAAkB,GAAG,IAAA,mBAAW,EAAC,KAAK,CAAC,EAAE;QAC7C,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS;YAAE,OAAO;QAC/C,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;QACvD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,CAAC,GAAkB,EAAE,YAAY,GAAG,GAAG,EAAE,QAAQ,GAAG,SAAS,EAAE,EAAE;QAC/F,sCAAsC;QACtC,IAAI,CAAC,GAAG,CAAC,IAAI;YAAE,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAEzF,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC;QAC1B,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAChC,CAAC;AAxBD,4CAwBC"}
@@ -0,0 +1,80 @@
1
+ import { IPartnerDataSchema } from './IPartnerDataSchema';
2
+ export interface Enrichment {
3
+ /**
4
+ * Pulls data from the vendor and returns the data graph in JSON format.
5
+ */
6
+ getEnrichmentData(requestData: IEnrichmentIntegrationRequestData): Promise<EnrichmentIntegrationResult>;
7
+ /**
8
+ * Constructs the URL to a photo for a given data field within the integration
9
+ */
10
+ getEnrichmentPhotoDetails?(requestData: IEnrichmentGetPhotoDetailsRequest): Promise<{
11
+ url: string;
12
+ title?: string;
13
+ description?: string;
14
+ }[]>;
15
+ getTimelineMarkerDetails?(requestData: IEnrichmentGetTimelineMarkerDetailsRequest): IEnrichmentGetTimelineMarkerDetailsResponse;
16
+ /**
17
+ * Pulls data from the vendor and returns the data graph in JSON format.
18
+ * Deprecated as of manifest version 2. Please use `getEnrichmentData`.
19
+ *
20
+ * @deprecated
21
+ */
22
+ getData?(requestData: IEnrichmentIntegrationRequestData): Promise<EnrichmentIntegrationResult>;
23
+ }
24
+ export interface IEnrichmentGetPhotoDetailsRequest {
25
+ credentials?: Record<any, string>;
26
+ key: string;
27
+ data: Record<string, any>;
28
+ width?: string;
29
+ height?: string;
30
+ }
31
+ export interface IEnrichmentGetTimelineMarkerDetailsRequest {
32
+ credentials?: Record<any, string>;
33
+ markerType?: string;
34
+ data: Record<string, any>;
35
+ schema: IPartnerDataSchema;
36
+ }
37
+ export declare type EnrichmentTimelineMarkerValue = {
38
+ title: string;
39
+ description: string;
40
+ dataType: string;
41
+ value: string | number | null | undefined | string[];
42
+ };
43
+ export interface IEnrichmentGetTimelineMarkerDetailsResponse {
44
+ name: string;
45
+ partner: string;
46
+ offering: string;
47
+ timelineMarkers: {
48
+ title: string;
49
+ description: string;
50
+ icon: string;
51
+ date: string;
52
+ popoverData: EnrichmentTimelineMarkerValue[];
53
+ tooltipData: Record<string, string | number | string[] | number[]>;
54
+ }[];
55
+ }
56
+ export interface IEnrichmentIntegrationRequestData {
57
+ credentials?: Record<any, string>;
58
+ options?: Record<string, any> | null;
59
+ full_address?: string;
60
+ street?: string;
61
+ city?: string;
62
+ state?: string;
63
+ zip?: string;
64
+ county?: string;
65
+ externalId?: string | null;
66
+ latitude?: number;
67
+ longitude?: number;
68
+ insuredName?: string | null;
69
+ clientOrgId?: number;
70
+ boundaryWkt?: string;
71
+ buildingsWkt?: string;
72
+ }
73
+ export declare type EnrichmentIntegrationResult = {
74
+ request_url: string;
75
+ result: {
76
+ data?: Record<string, any>;
77
+ err?: Record<string, any>;
78
+ };
79
+ };
80
+ //# sourceMappingURL=Enrichment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Enrichment.d.ts","sourceRoot":"","sources":["../../src/types/Enrichment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,iBAAiB,CAAC,WAAW,EAAE,iCAAiC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAExG;;OAEG;IACH,yBAAyB,CAAC,CACxB,WAAW,EAAE,iCAAiC,GAC7C,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;IAEpE,wBAAwB,CAAC,CACvB,WAAW,EAAE,0CAA0C,GACtD,2CAA2C,CAAC;IAE/C;;;;;OAKG;IACH,OAAO,CAAC,CAAC,WAAW,EAAE,iCAAiC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAChG;AAED,MAAM,WAAW,iCAAiC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC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CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,oBAAY,2BAA2B,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC3B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,CAAC;CACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Enrichment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Enrichment.js","sourceRoot":"","sources":["../../src/types/Enrichment.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ import { GeoJsonObject } from 'geojson';
2
+ export interface ICoordinate {
3
+ lat?: string | number;
4
+ latitude?: string | number;
5
+ lng?: string | number;
6
+ lon?: string | number;
7
+ longitude?: string | number;
8
+ }
9
+ export interface ITooltip {
10
+ title: string;
11
+ content?: string[];
12
+ }
13
+ interface IAddMapCoordinate {
14
+ coordinate: ICoordinate;
15
+ onCoordinateClicked?: () => void;
16
+ tooltip: ITooltip;
17
+ }
18
+ interface IAddGeometries {
19
+ id: string;
20
+ geometries: {
21
+ wkt?: string;
22
+ geojson?: GeoJsonObject;
23
+ tooltip?: ITooltip;
24
+ onGeometryClicked?: () => void;
25
+ }[];
26
+ }
27
+ export declare type EnrichmentComponentArgs = {
28
+ betterviewData?: {
29
+ property_id?: number;
30
+ policy_number?: string;
31
+ insured_name?: string;
32
+ address?: string;
33
+ city?: string;
34
+ state?: string;
35
+ zip?: string;
36
+ webhookUrl: string;
37
+ };
38
+ partnerHubData?: Record<string, any>;
39
+ previewMode?: boolean;
40
+ addMapCoordinate?: ({ coordinate, onCoordinateClicked, tooltip }: IAddMapCoordinate) => void;
41
+ addGeometries?: (data: IAddGeometries) => void;
42
+ hideGeometries?: (id: string) => void;
43
+ panTo?: (coordinate: ICoordinate) => void;
44
+ command: <T = any, U = any>(label: string, data?: T, options?: Record<string, string>) => Promise<U>;
45
+ getData: (key: string) => Promise<string | null>;
46
+ onClose?: (args: any) => void;
47
+ timelineDate?: string;
48
+ options?: Record<string, string>;
49
+ };
50
+ export {};
51
+ //# sourceMappingURL=EnrichmentComponentArgs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnrichmentComponentArgs.d.ts","sourceRoot":"","sources":["../../src/types/EnrichmentComponentArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AACD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AACD,UAAU,iBAAiB;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED,UAAU,cAAc;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,E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,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=EnrichmentComponentArgs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnrichmentComponentArgs.js","sourceRoot":"","sources":["../../src/types/EnrichmentComponentArgs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export declare enum IntegrationEventName {
2
+ 'cadence' = "cadence",
3
+ 'webhook_called' = "webhook_called"
4
+ }
5
+ //# sourceMappingURL=Events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Events.d.ts","sourceRoot":"","sources":["../../src/types/Events.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,SAAS,YAAY;IACrB,gBAAgB,mBAAmB;CACpC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntegrationEventName = void 0;
4
+ var IntegrationEventName;
5
+ (function (IntegrationEventName) {
6
+ IntegrationEventName["cadence"] = "cadence";
7
+ IntegrationEventName["webhook_called"] = "webhook_called";
8
+ })(IntegrationEventName = exports.IntegrationEventName || (exports.IntegrationEventName = {}));
9
+ //# sourceMappingURL=Events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Events.js","sourceRoot":"","sources":["../../src/types/Events.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,2CAAqB,CAAA;IACrB,yDAAmC,CAAA;AACrC,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAG/B"}
@@ -0,0 +1,32 @@
1
+ export interface IDataSchemaField {
2
+ description: string;
3
+ formatter?: Formatters;
4
+ jsonPath: string;
5
+ required?: boolean;
6
+ sample?: string | number | boolean;
7
+ title: string;
8
+ data_type: 'string' | 'number' | 'date' | 'stringArray' | 'objectArray' | 'boolean' | 'wkt' | 'geojson' | 'imgSrc' | 'downloadSrc' | 'coordinates' | 'coordinatesLatLngCSV' | 'coordinatesLngLatCSV' | 'imageUrlList' | 'temporalObjectArray' | 'imageObjectArray';
9
+ fields?: IDataSchemaField[];
10
+ imageObjectKey?: string;
11
+ temporalObjectKey?: string;
12
+ docRef?: string;
13
+ }
14
+ export interface IPartnerDataSchema {
15
+ name: string;
16
+ partner: string;
17
+ offering: string;
18
+ docRef?: string;
19
+ fields: IDataSchemaField[];
20
+ }
21
+ export interface IPartnerDataSchemas {
22
+ [name: string]: IPartnerDataSchema;
23
+ }
24
+ export declare enum Formatters {
25
+ numberWithCommas = "numberWithCommas",
26
+ currencyWithCommas = "currencyWithCommas",
27
+ scoreLetterToLowMedHigh = "scoreLetterToLowMedHigh",
28
+ roundTwoDecimalPlaces = "roundTwoDecimalPlaces",
29
+ decimalToPercentage = "decimalToPercentage",
30
+ roundAndFormatWithCommas = "roundAndFormatWithCommasFn"
31
+ }
32
+ //# sourceMappingURL=IPartnerDataSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPartnerDataSchema.d.ts","sourceRoot":"","sources":["../../src/types/IPartnerDataSchema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,aAAa,GACb,aAAa,GACb,SAAS,GACT,KAAK,GACL,SAAS,GACT,QAAQ,GACR,aAAa,GACb,aAAa,GACb,sBAAsB,GACtB,sBAAsB,GACtB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;IACvB,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AACD,MAAM,WAAW,mBAAmB;IAClC,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACpC;AAED,oBAAY,UAAU;IACpB,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,uBAAuB,4BAA4B;IACnD,qBAAqB,0BAA0B;IAC/C,mBAAmB,wBAAwB;IAC3C,wBAAwB,+BAA+B;CACxD"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formatters = void 0;
4
+ var Formatters;
5
+ (function (Formatters) {
6
+ Formatters["numberWithCommas"] = "numberWithCommas";
7
+ Formatters["currencyWithCommas"] = "currencyWithCommas";
8
+ Formatters["scoreLetterToLowMedHigh"] = "scoreLetterToLowMedHigh";
9
+ Formatters["roundTwoDecimalPlaces"] = "roundTwoDecimalPlaces";
10
+ Formatters["decimalToPercentage"] = "decimalToPercentage";
11
+ Formatters["roundAndFormatWithCommas"] = "roundAndFormatWithCommasFn";
12
+ })(Formatters = exports.Formatters || (exports.Formatters = {}));
13
+ //# sourceMappingURL=IPartnerDataSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPartnerDataSchema.js","sourceRoot":"","sources":["../../src/types/IPartnerDataSchema.ts"],"names":[],"mappings":";;;AAyCA,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,mDAAqC,CAAA;IACrC,uDAAyC,CAAA;IACzC,iEAAmD,CAAA;IACnD,6DAA+C,CAAA;IAC/C,yDAA2C,CAAA;IAC3C,qEAAuD,CAAA;AACzD,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB"}
@@ -0,0 +1,26 @@
1
+ import { IntegrationEventName, Storage } from '.';
2
+ export declare type Command<T, U> = (data?: T, options?: Record<string, string>) => Promise<U>;
3
+ /**
4
+ * Base class for integrations. All integrations should default export a class that extends this class.
5
+ */
6
+ export declare class Integration {
7
+ protected credentials?: Record<string, string> | undefined;
8
+ protected options?: Record<string, string> | undefined;
9
+ protected storage?: Storage | undefined;
10
+ private events;
11
+ private commands;
12
+ constructor(credentials?: Record<string, string> | undefined, options?: Record<string, string> | undefined, storage?: Storage | undefined);
13
+ /**
14
+ * Initializer for the class. This will be called once per instance of the integration. Multiple instances
15
+ * of an integration may be loaded throughout the system. Integrations should override this method if they
16
+ * need to register event handlers.
17
+ */
18
+ init(): Promise<void>;
19
+ command<T = any, U = any>(label: string, data?: T, options?: Record<string, string>): Promise<U>;
20
+ protected registerCommand<T = any, U = any>(label: string, command: Command<T, U>): void;
21
+ protected on(eventName: IntegrationEventName.webhook_called, handler: (data: any, propertyId?: number) => void): this;
22
+ protected on(eventName: IntegrationEventName.cadence, handler: (label: string) => void): this;
23
+ emit(eventName: IntegrationEventName.webhook_called, data: any, propertyId?: number): boolean;
24
+ emit(eventName: IntegrationEventName.cadence, label: string): boolean;
25
+ }
26
+ //# sourceMappingURL=Integration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Integration.d.ts","sourceRoot":"","sources":["../../src/types/Integration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAElD,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AC,EAAE,MAAM,GAAG,OAAO;IAC7F,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;CAI7E"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Integration = void 0;
4
+ const events_1 = require("events");
5
+ /**
6
+ * Base class for integrations. All integrations should default export a class that extends this class.
7
+ */
8
+ class Integration {
9
+ constructor(credentials, options, storage) {
10
+ this.credentials = credentials;
11
+ this.options = options;
12
+ this.storage = storage;
13
+ this.commands = {};
14
+ this.events = new events_1.EventEmitter();
15
+ }
16
+ /**
17
+ * Initializer for the class. This will be called once per instance of the integration. Multiple instances
18
+ * of an integration may be loaded throughout the system. Integrations should override this method if they
19
+ * need to register event handlers.
20
+ */
21
+ async init() {
22
+ // noop
23
+ }
24
+ async command(label, data, options) {
25
+ if (this.commands[label])
26
+ return this.commands[label](data, options);
27
+ throw new Error('Not implemented');
28
+ }
29
+ registerCommand(label, command) {
30
+ this.commands[label] = command;
31
+ }
32
+ on(eventName, handler) {
33
+ this.events.on(eventName, handler);
34
+ return this;
35
+ }
36
+ emit(eventName, ...args) {
37
+ return this.events.emit(eventName, ...args);
38
+ }
39
+ }
40
+ exports.Integration = Integration;
41
+ //# sourceMappingURL=Integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Integration.js","sourceRoot":"","sources":["../../src/types/Integration.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAKtC;;GAEG;AACH,MAAa,WAAW;IAItB,YACY,WAAoC,EACpC,OAAgC,EAChC,OAAiB;QAFjB,gBAAW,GAAX,WAAW,CAAyB;QACpC,YAAO,GAAP,OAAO,CAAyB;QAChC,YAAO,GAAP,OAAO,CAAU;QALrB,aAAQ,GAAsC,EAAE,CAAC;QAOvD,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAY,EAAE,CAAC;IACnC,CAAC;IACD;;;;OAIG;IACI,KAAK,CAAC,IAAI;QACf,OAAO;IACT,CAAC;IAEM,KAAK,CAAC,OAAO,CAAmB,KAAa,EAAE,IAAQ,EAAE,OAAgC;QAC9F,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAES,eAAe,CAAmB,KAAa,EAAE,OAAsB;QAC/E,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;IACjC,CAAC;IAIS,EAAE,CAAC,SAA+B,EAAE,OAAiC;QAC7E,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAIM,IAAI,CAAC,SAA+B,EAAE,GAAG,IAAW;QACzD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF;AAzCD,kCAyCC"}
@@ -0,0 +1,47 @@
1
+ export declare type IntegrationManifest = {
2
+ version: number;
3
+ partner: string;
4
+ offering: string;
5
+ description: string;
6
+ abstract?: string;
7
+ contact_name?: string;
8
+ contact_email?: string;
9
+ website_url?: string;
10
+ capabilities: {
11
+ cadence?: Cadence | Cadence[];
12
+ webhook?: boolean;
13
+ enrichment?: {
14
+ requires?: string[];
15
+ provides?: string[];
16
+ /**
17
+ * Use `components` instead
18
+ *
19
+ * @deprecated
20
+ */
21
+ has_card?: boolean;
22
+ has_photos?: string[];
23
+ };
24
+ hasCommands?: boolean;
25
+ };
26
+ /**
27
+ * Optional list of custom components
28
+ */
29
+ components?: {
30
+ bundle: string;
31
+ type: string;
32
+ }[];
33
+ credentials_schema?: Record<string, {
34
+ display: string;
35
+ sensitive?: boolean;
36
+ }>;
37
+ options_schema?: Record<string, {
38
+ display: string;
39
+ required?: boolean;
40
+ }>;
41
+ };
42
+ declare type Cadence = {
43
+ schedule: 'daily' | 'weekly' | 'monthly';
44
+ label: string;
45
+ };
46
+ export {};
47
+ //# sourceMappingURL=IntegrationManifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntegrationManifest.d.ts","sourceRoot":"","sources":["../../src/types/IntegrationManifest.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE;QACZ,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;QAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;QAElB,UAAU,CAAC,EAAE;YAKX,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;YAEpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;YACpB;;;;eAIG;YACH,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;SACvB,CAAC;QACF,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF;;OAEG;IACH,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IACJ,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC1E,CAAC;AAEF,aAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IAEzC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IntegrationManifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntegrationManifest.js","sourceRoot":"","sources":["../../src/types/IntegrationManifest.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Readable } from 'stream';
4
+ /**
5
+ * Provides data and file storage for integrations
6
+ */
7
+ export interface Storage {
8
+ getFile(key: string): Promise<Readable | null>;
9
+ putFile(key: string, buffer: Buffer): Promise<void>;
10
+ getData(key: string): Promise<string | null>;
11
+ saveData(key: string, value: string | null): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=Storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../src/types/Storage.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../src/types/Storage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export * from './Enrichment';
2
+ export * from './EnrichmentComponentArgs';
3
+ export * from './Events';
4
+ export * from './Integration';
5
+ export * from './IntegrationManifest';
6
+ export * from './IPartnerDataSchema';
7
+ export * from './Storage';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Enrichment"), exports);
18
+ __exportStar(require("./EnrichmentComponentArgs"), exports);
19
+ __exportStar(require("./Events"), exports);
20
+ __exportStar(require("./Integration"), exports);
21
+ __exportStar(require("./IntegrationManifest"), exports);
22
+ __exportStar(require("./IPartnerDataSchema"), exports);
23
+ __exportStar(require("./Storage"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,4DAA0C;AAC1C,2CAAyB;AACzB,gDAA8B;AAC9B,wDAAsC;AACtC,uDAAqC;AACrC,4CAA0B"}
@@ -0,0 +1,2 @@
1
+ export declare function jsonLog(obj: Record<string, any> | undefined): string;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,UAE3D"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.jsonLog = void 0;
7
+ const json_colorizer_1 = __importDefault(require("json-colorizer"));
8
+ function jsonLog(obj) {
9
+ return (0, json_colorizer_1.default)(JSON.stringify(obj, null, 2));
10
+ }
11
+ exports.jsonLog = jsonLog;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAsC;AAEtC,SAAgB,OAAO,CAAC,GAAoC;IAC1D,OAAO,IAAA,wBAAQ,EAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC;AAFD,0BAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterview/integration-toolkit",
3
- "version": "7.5.4",
3
+ "version": "7.5.6",
4
4
  "description": "Supports integration packages. This should be the only import from our integrations",
5
5
  "scripts": {
6
6
  "prebuild": "rm -rf ./lib",