@hiver/connector-admin 4.19.1-appsEventTracking-beta.0 → 4.19.1-appsEventTracking-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-admin",
3
- "version": "4.19.1-appsEventTracking-beta.0",
3
+ "version": "4.19.1-appsEventTracking-beta.1",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/api-view/index.tsx"],"names":[],"mappings":"AAiCA,eAAO,MAAM,OAAO,+CA0GnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/api-view/index.tsx"],"names":[],"mappings":"AAkCA,eAAO,MAAM,OAAO,+CA0GnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/app-detail/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AA0BzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAqC9C,UAAU,kBAAkB;IAC1B;;;;;;OAMG;IACH,IAAI,EAAE,aAAa,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA0GhD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/app-detail/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AAwBzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAqC9C,UAAU,kBAAkB;IAC1B;;;;;;OAMG;IACH,IAAI,EAAE,aAAa,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAgGhD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/auth-success/index.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,WAAW,+CAyCvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/auth-success/index.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,WAAW,+CA8BvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/initial-setup/index.tsx"],"names":[],"mappings":"AA4BA,eAAO,MAAM,YAAY,+CAqGxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/initial-setup/index.tsx"],"names":[],"mappings":"AA6BA,eAAO,MAAM,YAAY,+CAmIxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/app/connectors/pages/settings/auth/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,UAAU,YAAY;IACpB,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,YAAY,sBAAuB,YAAY,4CA0Q3D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/app/connectors/pages/settings/auth/index.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,UAAU,YAAY;IACpB,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,YAAY,sBAAuB,YAAY,4CA8S3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/settings/index.tsx"],"names":[],"mappings":"AA6CA,eAAO,MAAM,QAAQ,+CAgJpB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/app/connectors/pages/settings/index.tsx"],"names":[],"mappings":"AA+CA,eAAO,MAAM,QAAQ,+CAmKpB,CAAC"}
@@ -38,21 +38,33 @@ export declare const GAINSIGHTEVENT: {
38
38
  LOOKUP_SAVED: string;
39
39
  FIELD_MAP_BUTTON_CLICKED: string;
40
40
  FIELD_MAP_CONFIG_SAVED: string;
41
- APP_ONBOARDING_PAGE_VISITED: string;
42
41
  };
43
42
  /**
44
- * The `page` values carried by `app_onboarding_page_visited` one per step of
45
- * the Apps onboarding journey. Kept here rather than inlined at the call sites
46
- * so the vocabulary analysts query cannot drift page by page.
43
+ * The Apps onboarding funnel. Separate event names rather than one event with a
44
+ * step param, because half of these are outcomes (`*_success` / `*_failure`)
45
+ * which are not page views and cannot be values of a `page` field.
46
+ *
47
+ * Every `*_viewed` event fires when its screen RENDERS, never on the click that
48
+ * navigates there — a click can be followed by a redirect or a failed fetch, and
49
+ * counting it would inflate every step above the one actually reached.
47
50
  */
48
- export declare const GAINSIGHT_ONBOARDING_PAGES: {
49
- readonly TEMPLATE_APP: "template_app";
50
- readonly APP_DETAIL: "app_detail";
51
- readonly API_VIEW: "api_view";
52
- readonly INITIAL_SETUP: "initial_setup";
53
- readonly AUTH_SUCCESS: "auth_success";
51
+ export declare const APP_ONBOARDING_EVENTS: {
52
+ /** App overview screen (the api-view surface) rendered. */
53
+ readonly APP_OVERVIEW_VIEWED: "app_overview_viewed";
54
+ /** Marketplace auth screen rendered: /connector/settings/:id without isEdit. */
55
+ readonly MARKETPLACE_AUTH_PAGE_VIEWED: "marketplace_auth_page_viewed";
56
+ /** Inbox + role visibility screen rendered. */
57
+ readonly INITIAL_SETUP_VIEWED: "initial_setup_viewed";
58
+ readonly INITIAL_SETUP_SUCCESS: "initial_setup_success";
59
+ readonly INITIAL_SETUP_FAILURE: "initial_setup_failure";
60
+ /** Auth outcome. Carries setup_context to separate marketplace from installed. */
61
+ readonly AUTHENTICATION_SUCCESS: "authentication_success";
62
+ readonly AUTHENTICATION_FAILURE: "authentication_failure";
63
+ /** Post-install Settings tabs (?isEdit=true). */
64
+ readonly AUTHENTICATION_TAB_VIEWED: "authentication_tab_viewed";
65
+ readonly VISIBILITY_TAB_VIEWED: "visibility_tab_viewed";
54
66
  };
55
- export type GainsightOnboardingPage = (typeof GAINSIGHT_ONBOARDING_PAGES)[keyof typeof GAINSIGHT_ONBOARDING_PAGES];
67
+ export type AppOnboardingEvent = (typeof APP_ONBOARDING_EVENTS)[keyof typeof APP_ONBOARDING_EVENTS];
56
68
  export declare const GAINSIGHT_CONSTANTS: {
57
69
  AUTH_PAGE: string;
58
70
  DETAILS_PAGE: string;
@@ -1 +1 @@
1
- {"version":3,"file":"gainsight.d.ts","sourceRoot":"","sources":["../../../src/v2/constants/gainsight.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;CAM7B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC;AAEnH,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC"}
1
+ {"version":3,"file":"gainsight.d.ts","sourceRoot":"","sources":["../../../src/v2/constants/gainsight.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC1B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;IAChC,2DAA2D;;IAE3D,gFAAgF;;IAEhF,+CAA+C;;;;IAI/C,kFAAkF;;;IAGlF,iDAAiD;;;CAGzC,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAEpG,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-app-event.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app-event.test.d.ts","sourceRoot":"","sources":["../../../../src/v2/hooks/__tests__/use-app-event.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { AppOnboardingEvent } from '../constants/gainsight';
2
+ import { AppEventMetadata } from '../utils/app-event-metadata';
3
+ interface IUseAppEventOnViewParams {
4
+ /** Which `*_viewed` event this screen is. */
5
+ event: AppOnboardingEvent;
6
+ /** Metadata from `buildAppEventMetadata`, plus anything page-specific. */
7
+ data?: AppEventMetadata;
8
+ /**
9
+ * False while the screen is not the one actually being shown — still fetching,
10
+ * about to redirect, or a tab that is mounted but hidden. Rules of hooks mean
11
+ * the hook is always called; this gates the emit instead.
12
+ */
13
+ enabled?: boolean;
14
+ }
15
+ export declare const useAppEventOnView: ({ event, data, enabled }: IUseAppEventOnViewParams) => void;
16
+ /**
17
+ * Imperative sender for the outcome events. Returns a stable function, so it is
18
+ * safe in an effect's dependency array.
19
+ */
20
+ export declare const useAppEventSender: () => (event: AppOnboardingEvent, data?: AppEventMetadata) => void;
21
+ export {};
22
+ //# sourceMappingURL=use-app-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app-event.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/use-app-event.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAwCtE,UAAU,wBAAwB;IAChC,6CAA6C;IAC7C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,0EAA0E;IAC1E,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,iBAAiB,6BAAqC,wBAAwB,KAAG,IA+B7F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,gBAQlB,kBAAkB,SAAS,gBAAgB,SAStD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=app-event-metadata.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-event-metadata.test.d.ts","sourceRoot":"","sources":["../../../../src/v2/utils/__tests__/app-event-metadata.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import { IConnectorDetails } from '../types/connector';
2
+ /**
3
+ * Shared metadata for the Apps onboarding analytics events.
4
+ *
5
+ * Every one of these events answers "which app, in what state" before it answers
6
+ * anything else, so the same block rides on all of them and analysts can group
7
+ * across the funnel without joining back to the connectors collection.
8
+ *
9
+ * Two rules this file exists to enforce:
10
+ *
11
+ * 1. **Allow-list, never spread the row.** `IConnectorDetails` carries
12
+ * `authDetails` — client secrets, tokens, API keys. Spreading a connector into
13
+ * an analytics payload would ship credentials to a third party. Every field
14
+ * below is named on purpose.
15
+ * 2. **Omit what is not known; never fabricate.** A template row has no
16
+ * `isAuthenticated`/`isEnabled` because it is not installed yet, and an absent
17
+ * key is honest where `false` would read as "installed but disabled".
18
+ */
19
+ export interface IAppEventMetadataInput {
20
+ /** The `:id` in the URL — a template id pre-install, an install id post-install. */
21
+ id?: string;
22
+ /**
23
+ * Whether the page is looking at an installed connector (`?isEdit=true`) rather
24
+ * than a marketplace template. Drives both which id key is used and
25
+ * `setup_context`, the connector-vs-template identifier.
26
+ */
27
+ isEdit?: boolean;
28
+ /** The connector or template row the page already holds. */
29
+ row?: IConnectorDetails | null;
30
+ /** Install id when the page knows one independently of `:id` (initial setup). */
31
+ connectorId?: string | null;
32
+ /** Overrides `setup_context` for flows where `isEdit` is not the right signal. */
33
+ setupContext?: 'connector' | 'template';
34
+ }
35
+ export type AppEventMetadata = Record<string, string | number | boolean>;
36
+ export declare const buildAppEventMetadata: ({ id, isEdit, row, connectorId, setupContext }: IAppEventMetadataInput) => AppEventMetadata;
37
+ //# sourceMappingURL=app-event-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-event-metadata.d.ts","sourceRoot":"","sources":["../../../src/v2/utils/app-event-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,sBAAsB;IACrC,oFAAoF;IACpF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,GAAG,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/B,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kFAAkF;IAClF,YAAY,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACzC;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAEzE,eAAO,MAAM,qBAAqB,mDAM/B,sBAAsB,KAAG,gBAuB3B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=use-onboarding-page-visited.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-onboarding-page-visited.test.d.ts","sourceRoot":"","sources":["../../../../src/v2/hooks/__tests__/use-onboarding-page-visited.test.tsx"],"names":[],"mappings":""}
@@ -1,36 +0,0 @@
1
- import { GainsightOnboardingPage } from '../constants/gainsight';
2
- import { ISendTrackingEventData } from '../types/app';
3
- interface IUseOnboardingPageVisitedParams {
4
- /** Which step of the onboarding journey this page is. */
5
- page: GainsightOnboardingPage;
6
- /** Page-specific identifiers (`connector_id` / `template_id`) merged into the payload. */
7
- data?: ISendTrackingEventData;
8
- /**
9
- * Set to false while the page does not yet know it is the one being shown —
10
- * `api-view` and `app-detail` redirect to each other depending on whether the
11
- * app's type is registered, and a funnel step must not be counted twice.
12
- * Rules of hooks mean the hook is always called; this gates the emit instead.
13
- */
14
- enabled?: boolean;
15
- }
16
- /**
17
- * Fires `app_onboarding_page_visited` once per visit to an onboarding page.
18
- *
19
- * "Once per visit", not once per session: the guard is a ref on this hook's own
20
- * instance, so it survives re-renders and a late connector load, and navigating
21
- * away and back mounts a fresh instance that fires again.
22
- *
23
- * `total_apps_activated` is read from `getPITConnectorStats` at emit time — the
24
- * same helper the dashboard spreads into `connector_section_viewed` and the
25
- * Gainsight identify attributes, so the two can never disagree.
26
- *
27
- * The connector list is only waited on while it is actually in flight, so a page
28
- * that never fetches it — `auth-success` renders in the OAuth popup, a fresh app
29
- * instance where nobody dispatches `fetchConnectors` — still emits its funnel
30
- * step. What it does NOT do is claim a count it never had: `total_apps_activated`
31
- * is omitted unless the list actually loaded, because a fabricated 0 cannot be
32
- * told apart from a real one and analytics cannot be backfilled.
33
- */
34
- export declare const useOnboardingPageVisited: ({ page, data, enabled }: IUseOnboardingPageVisitedParams) => void;
35
- export {};
36
- //# sourceMappingURL=use-onboarding-page-visited.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-onboarding-page-visited.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/use-onboarding-page-visited.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,UAAU,+BAA+B;IACvC,yDAAyD;IACzD,IAAI,EAAE,uBAAuB,CAAC;IAC9B,0FAA0F;IAC1F,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,4BAAoC,+BAA+B,KAAG,IA4C1G,CAAC"}