@hiver/connector-agent 4.27.0-appWidgets-beta.6 → 4.27.0-appWidgets-beta.8
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/features/app-widget/components/AppWidget.d.ts +5 -0
- package/features/app-widget/components/AppWidget.d.ts.map +1 -1
- package/features/app-widget/loader.d.ts +8 -2
- package/features/app-widget/loader.d.ts.map +1 -1
- package/features/app-widget/model.d.ts +1 -1
- package/features/app-widget/model.d.ts.map +1 -1
- package/features/app-widget/types.d.ts +5 -0
- package/features/app-widget/types.d.ts.map +1 -1
- package/features/app-widget/useAppWidgetData.d.ts.map +1 -1
- package/index.es.js +48 -34
- package/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -28,10 +28,15 @@ export type AppWidgetCommonProps = UseAppWidgetDataArgs & {
|
|
|
28
28
|
};
|
|
29
29
|
export type AppWidgetSummaryProps = AppWidgetCommonProps & {
|
|
30
30
|
/** Reports what the header shows, for hosts that render their own badge or pill. */
|
|
31
|
+
/**
|
|
32
|
+
* `available` is false when the app has no cards turned on for the conversation's inboxes:
|
|
33
|
+
* hosts hide the whole section then (the summary stays mounted so it can report it back).
|
|
34
|
+
*/
|
|
31
35
|
onSummaryChange?: (summary: {
|
|
32
36
|
text: string;
|
|
33
37
|
isLoading: boolean;
|
|
34
38
|
disconnected: boolean;
|
|
39
|
+
available: boolean;
|
|
35
40
|
}) => void;
|
|
36
41
|
};
|
|
37
42
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppWidget.d.ts","sourceRoot":"","sources":["../../../../src/features/app-widget/components/AppWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAmBxD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,2FAA2F;AAC3F,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AAE7B,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;AAEzF,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8FAA8F;IAC9F,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;CACzC,CAAC;AAuBF,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,GAAG;IACzD,oFAAoF;IACpF,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"AppWidget.d.ts","sourceRoot":"","sources":["../../../../src/features/app-widget/components/AppWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAmBxD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,2FAA2F;AAC3F,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AAE7B,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;AAEzF,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8FAA8F;IAC9F,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;CACzC,CAAC;AAuBF,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,GAAG;IACzD,oFAAoF;IACpF;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CACtH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA2CtD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,GAAG;IACtD,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,oFAAoF;IACpF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAuFhD,CAAC;AAoLF,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -9,8 +9,14 @@ export type AppWidgetLoadArgs = {
|
|
|
9
9
|
contactEmail: string;
|
|
10
10
|
inboxIds: string[];
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
export type AppWidgetCardList = {
|
|
13
|
+
/** The cards the widget reads (linked records carry an externalResourceId). */
|
|
14
|
+
cards: ICard[];
|
|
15
|
+
/** The app has at least one card turned on for these inboxes (see AppWidgetModel.available). */
|
|
16
|
+
available: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** The app's cards for this conversation. */
|
|
19
|
+
export declare const fetchAppWidgetCards: (app: AppSpec, { connectorId, conversationId, inboxIds }: AppWidgetLoadArgs) => Promise<AppWidgetCardList>;
|
|
14
20
|
/** One card's data. Failures come back as a read with the HTTP status, not a throw. */
|
|
15
21
|
export declare const readAppWidgetCard: (card: ICard, { conversationId, contactEmail, inboxIds }: AppWidgetLoadArgs, isRefresh?: boolean) => Promise<AppWidgetCardRead>;
|
|
16
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/features/app-widget/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,eAAe,CAAC;AAG1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/features/app-widget/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,eAAe,CAAC;AAG1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,+EAA+E;IAC/E,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,gGAAgG;IAChG,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB,QACzB,OAAO,6CAC+B,iBAAiB,KAC3D,OAAO,CAAC,iBAAiB,CAY3B,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,SACtB,KAAK,8CACiC,iBAAiB,0BAE5D,OAAO,CAAC,iBAAiB,CAgB3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SACvB,iBAAiB,gBACF;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,KACzC,OAAO,CAAC,cAAc,GAAG,IAAI,CAM/B,CAAC"}
|
|
@@ -29,6 +29,6 @@ export declare const formatMoney: (amount: number, currency?: string) => string;
|
|
|
29
29
|
* this is where the per-category rules (which cards, in which order, what the collapsed value
|
|
30
30
|
* says) live and are tested.
|
|
31
31
|
*/
|
|
32
|
-
export declare const buildAppWidgetModel: (app: AppSpec, reads: AppWidgetCardRead[]) => AppWidgetModel;
|
|
32
|
+
export declare const buildAppWidgetModel: (app: AppSpec, reads: AppWidgetCardRead[], available?: boolean) => AppWidgetModel;
|
|
33
33
|
export {};
|
|
34
34
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/features/app-widget/model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAe,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpG,OAAO,KAAK,EAAE,OAAO,EAAyB,MAAM,QAAQ,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAkB,cAAc,EAAmB,MAAM,SAAS,CAAC;AAElG,KAAK,QAAQ,GAAG,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG;IAC1F,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,yFAAyF;AACzF,KAAK,GAAG,GAAG;IACT,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAmBF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,SAAU,aAAa,GAAG,IAAI,KAAG,GAAG,EAuB3D,CAAC;AAmBF,eAAO,MAAM,QAAQ,UAAW,cAAc,GAAG,SAAS,KAAG,MAAM,GAAG,IAIrE,CAAC;AAOF,gFAAgF;AAChF,eAAO,MAAM,WAAW,WAAY,MAAM,aAAa,MAAM,KAAG,MAS/D,CAAC;AAoTF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAS,OAAO,SAAS,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/features/app-widget/model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAe,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpG,OAAO,KAAK,EAAE,OAAO,EAAyB,MAAM,QAAQ,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAkB,cAAc,EAAmB,MAAM,SAAS,CAAC;AAElG,KAAK,QAAQ,GAAG,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG;IAC1F,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,yFAAyF;AACzF,KAAK,GAAG,GAAG;IACT,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAmBF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,SAAU,aAAa,GAAG,IAAI,KAAG,GAAG,EAuB3D,CAAC;AAmBF,eAAO,MAAM,QAAQ,UAAW,cAAc,GAAG,SAAS,KAAG,MAAM,GAAG,IAIrE,CAAC;AAOF,gFAAgF;AAChF,eAAO,MAAM,WAAW,WAAY,MAAM,aAAa,MAAM,KAAG,MAS/D,CAAC;AAoTF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAS,OAAO,SAAS,iBAAiB,EAAE,0BAAqB,cAsBhG,CAAC"}
|
|
@@ -33,6 +33,11 @@ export type AppWidgetModel = {
|
|
|
33
33
|
/** Every record the widget could show; drives "View all (N)". */
|
|
34
34
|
total: number;
|
|
35
35
|
connection: AppWidgetConnection;
|
|
36
|
+
/**
|
|
37
|
+
* False when the app has no cards turned on for the conversation's inboxes. The app is then
|
|
38
|
+
* not enabled for this shared mailbox and hosts hide the widget instead of an empty state.
|
|
39
|
+
*/
|
|
40
|
+
available: boolean;
|
|
36
41
|
};
|
|
37
42
|
/** One card from the cards list, with its data read (null while unread or failed). */
|
|
38
43
|
export type AppWidgetCardRead = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/app-widget/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,IAAI,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG;IAC5B,sFAAsF;IACtF,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,MAAM,EAAE,OAAO,CAAC;IAChB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,SAAS,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/app-widget/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,IAAI,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG;IAC5B,sFAAsF;IACtF,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,MAAM,EAAE,OAAO,CAAC;IAChB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,SAAS,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,mBAAmB,CAAC;IAChC;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3B,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppWidgetData.d.ts","sourceRoot":"","sources":["../../../src/features/app-widget/useAppWidgetData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7B,8FAA8F;IAC9F,SAAS,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAMF,eAAO,MAAM,mBAAmB,gBAAiB,MAAM,kBAAkB,MAAM,2CAC1B,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,oFAO1B,oBAAoB,KAAG,
|
|
1
|
+
{"version":3,"file":"useAppWidgetData.d.ts","sourceRoot":"","sources":["../../../src/features/app-widget/useAppWidgetData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7B,8FAA8F;IAC9F,SAAS,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAMF,eAAO,MAAM,mBAAmB,gBAAiB,MAAM,kBAAkB,MAAM,2CAC1B,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,oFAO1B,oBAAoB,KAAG,aAyDzB,CAAC"}
|
package/index.es.js
CHANGED
|
@@ -41246,16 +41246,17 @@ const WK = (e) => ke({
|
|
|
41246
41246
|
}
|
|
41247
41247
|
}, rC = /^Your connection to .+ has expired\./, KJ = (e) => e.some(
|
|
41248
41248
|
({ data: t, errorStatus: n }) => n === OJ || !!(t != null && t.redirectToAdminTab) || rC.test((t == null ? void 0 : t.cardErrorMessage) ?? "")
|
|
41249
|
-
), YJ = (e, t) => t === RJ || t === tC || !!(e != null && e.cardErrorMessage) && !rC.test((e == null ? void 0 : e.cardErrorMessage) ?? "") || gD(e), qJ = 2, oC = (e, t) => {
|
|
41250
|
-
const
|
|
41251
|
-
(
|
|
41252
|
-
),
|
|
41249
|
+
), YJ = (e, t) => t === RJ || t === tC || !!(e != null && e.cardErrorMessage) && !rC.test((e == null ? void 0 : e.cardErrorMessage) ?? "") || gD(e), qJ = 2, oC = (e, t, n = !0) => {
|
|
41250
|
+
const r = WJ(UJ(e, t)), o = r.filter((c) => c.linked), u = r.filter((c) => !c.linked), i = [...ZJ(e, o), ...XJ(e, u)], s = u.filter(
|
|
41251
|
+
(c) => !(e.category === "crm" && ["Account", "Company"].includes(c.recordType))
|
|
41252
|
+
), f = o.length + s.length;
|
|
41253
41253
|
return {
|
|
41254
41254
|
category: e.category,
|
|
41255
|
-
summary: JJ(e,
|
|
41256
|
-
records:
|
|
41257
|
-
total:
|
|
41258
|
-
connection: KJ(t) ? "expired" : "ok"
|
|
41255
|
+
summary: JJ(e, r, o.length),
|
|
41256
|
+
records: i.slice(0, qJ).map($J),
|
|
41257
|
+
total: f,
|
|
41258
|
+
connection: KJ(t) ? "expired" : "ok",
|
|
41259
|
+
available: n
|
|
41259
41260
|
};
|
|
41260
41261
|
}, $J = (e) => ({
|
|
41261
41262
|
id: e.id,
|
|
@@ -41268,9 +41269,17 @@ const WK = (e) => ke({
|
|
|
41268
41269
|
linked: e.linked,
|
|
41269
41270
|
restricted: e.restricted
|
|
41270
41271
|
}), uC = async (e, { connectorId: t, conversationId: n, inboxIds: r }) => {
|
|
41271
|
-
var
|
|
41272
|
-
const o = await T6({ inboxIds: r, conversationId: n, connectorId: t }), u = (
|
|
41273
|
-
|
|
41272
|
+
var s;
|
|
41273
|
+
const o = await T6({ inboxIds: r, conversationId: n, connectorId: t }), u = (s = o == null ? void 0 : o.data) == null ? void 0 : s.cards;
|
|
41274
|
+
if (!Array.isArray(u)) return { cards: [], available: !1 };
|
|
41275
|
+
const i = u.filter((f) => f.connectorId === t);
|
|
41276
|
+
return {
|
|
41277
|
+
// PM widgets list only linked records, so their lookup cards are never read.
|
|
41278
|
+
cards: i.filter((f) => e.category !== "pm" || !!f.externalResourceId),
|
|
41279
|
+
// Counted before the PM filter: a PM app with cards but no links is enabled and shows its
|
|
41280
|
+
// empty state.
|
|
41281
|
+
available: i.length > 0
|
|
41282
|
+
};
|
|
41274
41283
|
}, aC = async (e, { conversationId: t, contactEmail: n, inboxIds: r }, o = !1) => {
|
|
41275
41284
|
var u;
|
|
41276
41285
|
try {
|
|
@@ -41291,8 +41300,8 @@ const WK = (e) => ke({
|
|
|
41291
41300
|
}, XK = async (e, { refresh: t = !1 } = {}) => {
|
|
41292
41301
|
const n = eC(e.connectorName);
|
|
41293
41302
|
if (!n || !e.conversationId) return null;
|
|
41294
|
-
const r = await uC(n, e),
|
|
41295
|
-
return oC(n, o);
|
|
41303
|
+
const { cards: r, available: o } = await uC(n, e), u = await Promise.all(r.map((i) => aC(i, e, t)));
|
|
41304
|
+
return oC(n, u, o);
|
|
41296
41305
|
}, eK = 5e3, M2 = /* @__PURE__ */ new Map(), P2 = (e, t) => ["appWidget", e, t], iC = ({
|
|
41297
41306
|
connectorId: e,
|
|
41298
41307
|
connectorName: t,
|
|
@@ -41301,28 +41310,33 @@ const WK = (e) => ke({
|
|
|
41301
41310
|
inboxIds: o,
|
|
41302
41311
|
enabled: u = !0
|
|
41303
41312
|
}) => {
|
|
41313
|
+
var b;
|
|
41304
41314
|
const i = eC(t), s = u && !!i && !!n, f = Wt(), c = `${e}:${n}`, l = [...P2(e, n), o.join(",")], D = { connectorId: e, connectorName: t, conversationId: n, contactEmail: r, inboxIds: o }, C = Tt({
|
|
41305
41315
|
queryKey: [...l, "cards"],
|
|
41306
41316
|
enabled: s,
|
|
41307
|
-
queryFn: () => i ? uC(i, D) : Promise.resolve([])
|
|
41308
|
-
}), m = $(() =>
|
|
41309
|
-
|
|
41310
|
-
|
|
41317
|
+
queryFn: () => i ? uC(i, D) : Promise.resolve({ cards: [], available: !1 })
|
|
41318
|
+
}), m = $(() => {
|
|
41319
|
+
var B;
|
|
41320
|
+
return ((B = C.data) == null ? void 0 : B.cards) ?? [];
|
|
41321
|
+
}, [C.data]), p = ((b = C.data) == null ? void 0 : b.available) ?? !0, A = xl({
|
|
41322
|
+
queries: m.map((B) => ({
|
|
41323
|
+
queryKey: [...l, "card", B.id, B.externalResourceId ?? "", r],
|
|
41311
41324
|
enabled: s,
|
|
41312
41325
|
retry: !1,
|
|
41313
|
-
queryFn: () => aC(
|
|
41326
|
+
queryFn: () => aC(B, D, Date.now() < (M2.get(c) ?? 0))
|
|
41314
41327
|
}))
|
|
41315
|
-
}),
|
|
41328
|
+
}), d = A.some((B) => B.isLoading), g = A.map((B) => B.data), F = A.map((B) => B.dataUpdatedAt).join(","), h = $(() => !i || C.isLoading || d ? null : oC(
|
|
41316
41329
|
i,
|
|
41317
|
-
|
|
41318
|
-
|
|
41330
|
+
g.filter((B) => !!B),
|
|
41331
|
+
p
|
|
41332
|
+
), [i, C.isLoading, d, F, p]), E = ie(() => {
|
|
41319
41333
|
M2.set(c, Date.now() + eK), f.invalidateQueries({ queryKey: P2(e, n) });
|
|
41320
41334
|
}, [f, c, e, n]);
|
|
41321
41335
|
return {
|
|
41322
41336
|
app: i,
|
|
41323
|
-
model:
|
|
41324
|
-
isLoading: s && (C.isLoading ||
|
|
41325
|
-
refresh:
|
|
41337
|
+
model: h,
|
|
41338
|
+
isLoading: s && (C.isLoading || d),
|
|
41339
|
+
refresh: E
|
|
41326
41340
|
};
|
|
41327
41341
|
}, sC = (e, t) => {
|
|
41328
41342
|
const [n, r] = P(!1);
|
|
@@ -41343,17 +41357,17 @@ const WK = (e) => ke({
|
|
|
41343
41357
|
...r
|
|
41344
41358
|
});
|
|
41345
41359
|
}, tK = (e) => {
|
|
41346
|
-
const { app: t, model: n, isLoading: r } = iC(e), { tokens: o } = o1(), u = sC(r, qh), i = (n == null ? void 0 : n.connection) === "expired", s = vJ(n, !!e.isAdmin), { onSummaryChange:
|
|
41360
|
+
const { app: t, model: n, isLoading: r } = iC(e), { tokens: o } = o1(), u = sC(r, qh), i = (n == null ? void 0 : n.connection) === "expired", s = vJ(n, !!e.isAdmin), f = (n == null ? void 0 : n.available) ?? !0, { onSummaryChange: c } = e;
|
|
41347
41361
|
re(() => {
|
|
41348
|
-
|
|
41349
|
-
}, [
|
|
41350
|
-
const
|
|
41362
|
+
c == null || c({ text: s, isLoading: r, disconnected: i, available: f });
|
|
41363
|
+
}, [c, s, r, i, f]);
|
|
41364
|
+
const l = se(Date.now()), D = se(!1);
|
|
41351
41365
|
return re(() => {
|
|
41352
|
-
|
|
41353
|
-
load_ms: Date.now() -
|
|
41366
|
+
D.current || r || !n || !n.available || (D.current = !0, js(e, t, zr.RENDERED, {
|
|
41367
|
+
load_ms: Date.now() - l.current,
|
|
41354
41368
|
state: i ? "disconnected" : n.total === 0 ? "empty" : "records"
|
|
41355
41369
|
}));
|
|
41356
|
-
}, [r, n]), t ? r ? u ? /* @__PURE__ */ a.jsx(fu, { "data-testid": "app-widget-summary-loading", variant: "rounded", width: 56, height: 16 }) : null : s ? /* @__PURE__ */ a.jsx(
|
|
41370
|
+
}, [r, n]), !t || !f ? null : r ? u ? /* @__PURE__ */ a.jsx(fu, { "data-testid": "app-widget-summary-loading", variant: "rounded", width: 56, height: 16 }) : null : s ? /* @__PURE__ */ a.jsx(
|
|
41357
41371
|
Y,
|
|
41358
41372
|
{
|
|
41359
41373
|
"data-testid": "app-widget-summary",
|
|
@@ -41362,14 +41376,14 @@ const WK = (e) => ke({
|
|
|
41362
41376
|
sx: { color: i ? o.negative : o.textSecondary, fontSize: 12, lineHeight: "16px" },
|
|
41363
41377
|
children: s
|
|
41364
41378
|
}
|
|
41365
|
-
) : null
|
|
41379
|
+
) : null;
|
|
41366
41380
|
}, nK = (e) => {
|
|
41367
41381
|
const { app: t, model: n, isLoading: r, refresh: o } = iC(e), { tokens: u } = o1(), i = sC(r, qh);
|
|
41368
41382
|
if (!t) return null;
|
|
41369
41383
|
const s = (f, c, l) => {
|
|
41370
41384
|
c && js(e, t, c, l), e.onAction(f);
|
|
41371
41385
|
};
|
|
41372
|
-
return r ? i ? /* @__PURE__ */ a.jsx(iK, {}) : null : n ? n.connection === "expired" ? /* @__PURE__ */ a.jsx(
|
|
41386
|
+
return r ? i ? /* @__PURE__ */ a.jsx(iK, {}) : null : !n || !n.available ? null : n.connection === "expired" ? /* @__PURE__ */ a.jsx(
|
|
41373
41387
|
sK,
|
|
41374
41388
|
{
|
|
41375
41389
|
app: t,
|
|
@@ -41430,7 +41444,7 @@ const WK = (e) => ke({
|
|
|
41430
41444
|
})
|
|
41431
41445
|
}
|
|
41432
41446
|
)
|
|
41433
|
-
] })
|
|
41447
|
+
] });
|
|
41434
41448
|
}, rK = () => /* @__PURE__ */ a.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": !0, children: [
|
|
41435
41449
|
/* @__PURE__ */ a.jsx("path", { d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9", strokeLinecap: "round" }),
|
|
41436
41450
|
/* @__PURE__ */ a.jsx("path", { d: "M13.5 2.5v3h-3", strokeLinecap: "round", strokeLinejoin: "round" })
|
package/index.umd.js
CHANGED
|
@@ -5872,4 +5872,4 @@ Do you want to continue?`,SO="Select an object to create",jp="Select an object t
|
|
|
5872
5872
|
letter-spacing: 0.4px;
|
|
5873
5873
|
line-height: 20px;
|
|
5874
5874
|
margin-top: 14px;
|
|
5875
|
-
`,eJ=({children:e,zIndex:t,onClose:n})=>{const r=a.jsxs(qZ,{children:[a.jsx(UZ,{variant:"h2",color:"text.primary",children:"Split apps view"}),a.jsx(KZ,{variant:"body2",color:"text.secondary",children:"Each connected app now has its own tab, making it easier to view app-specific data"}),a.jsx($Z,{variant:"contained",color:"primary",onClick:n,children:"Dismiss"})]});return a.jsx(YZ,{open:!0,title:r,placement:"left-start",disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,arrow:!0,slotProps:{popper:{sx:{zIndex:t+1},modifiers:[{name:"flip",enabled:!0},{name:"preventOverflow",enabled:!0}]},tooltip:{sx:{pointerEvents:"auto",maxWidth:"min(360px, calc(60vw - 24px))",padding:"12px"},onClick:o=>o.stopPropagation()},arrow:{sx:{fontSize:`${f.theme.typography.caption.fontSize}px`}}},children:e})},M6=ja("LOCAL"),tJ="connector-library-split-apps-nudge",nJ=({open:e,targetRef:t,endElRef:n,zIndex:r,storageKey:o=tJ,onClose:u})=>{const[s,i]=p.useState(()=>M6.getItem(o)==="true"),c=()=>{M6.setItem(o,"true"),i(!0),u()},l=D=>a.jsx(eJ,{zIndex:r,onClose:c,children:D});return s?null:a.jsx(xL,{open:e,targetRef:t,endElRef:n,padding:8,zIndex:r,renderHighlight:l})},rJ=({theme:e,...t})=>a.jsx(JZ,{theme:e,children:a.jsx(nJ,{...t})}),oJ=fl(),_6=({children:e})=>a.jsx(n0,{client:oJ,children:e}),uJ=e=>{var t;switch(e.category){case"ecommerce":return"No customer found for this email. Search by email or order ID to link one.";case"crm":return"No contact found for this email.";case"finance":return"No customer or vendor found for this email.";case"pm":return`No ${((t=e.recordWord)==null?void 0:t[1])??"tasks"} linked to this conversation.`;default:return"Nothing found for this email."}},j6=e=>{var t;return e.category==="ecommerce"?"orders":e.category==="pm"?((t=e.recordWord)==null?void 0:t[1])??"tasks":"records"},aJ=(e,t,n)=>n?`${t} is disconnected. Reconnect to see this customer's ${j6(e)} and keep linked records in sync.`:`${t} is disconnected. Only an admin can reconnect it. ${AJ(j6(e))} will show here again once it's back.`,sJ=e=>`Reconnect ${e}`,fJ="Notify admin",iJ="Admin notified",cJ=e=>e?"Reconnect":"Unavailable",lJ=e=>`View all (${e>99?"99+":e})`,DJ="Search & link",dJ=e=>`Showing records for ${e}`,AJ=e=>e.charAt(0).toUpperCase()+e.slice(1),N6=(e,t)=>e?e.connection==="expired"?cJ(t):e.summary:"",yr={RENDERED:"app_widget_rendered",CARD_CLICKED:"app_widget_card_clicked",VIEW_ALL_CLICKED:"app_widget_view_all_clicked",CTA_CLICKED:"app_widget_cta_clicked",REFRESHED:"app_widget_refreshed",AUTH_ACTION:"app_widget_auth_action"},P6=300,Q6={label:"Order",keys:["order_number","name","number","id","tranid"]},pJ={id:"shopify",namePattern:/shopify/i,category:"ecommerce",records:[{recordType:"Customer",cardTitle:/customer/i,title:{label:"Customer",keys:["customer_name","display_name","name"],join:["first_name","last_name"]},fields:[{label:"Orders",keys:["total_orders","orders_count","number_of_orders"],labelPattern:/orders/i},{label:"Amount spent",keys:["total_spent","amount_spent"],labelPattern:/spent/i,format:"money"}]},{recordType:"Order",cardTitle:/order/i,excludeTitle:/line item/i,title:Q6,fields:[{label:"Fulfillment",keys:["fulfillment_status","display_fulfillment_status"],labelPattern:/fulfil/i},{label:"Order date",keys:["created_at","order_date"],labelPattern:/created|date/i,format:"date"}]}]},gJ={id:"woocommerce",namePattern:/woo/i,category:"ecommerce",records:[{recordType:"Customer",cardTitle:/customer/i,title:{label:"Customer",keys:["name","customer_name"],join:["first_name","last_name"]},fields:[{label:"Orders",keys:["orders_count","total_orders"],labelPattern:/orders/i},{label:"Customer since",keys:["date_created","created_at"],labelPattern:/created|since/i,format:"date"}]},{recordType:"Order",cardTitle:/order/i,title:Q6,fields:[{label:"Status",keys:["status","order_status"],labelPattern:/status/i},{label:"Order date",keys:["date_created","created_at"],labelPattern:/created|date/i,format:"date"}]}]},_i={label:"Owner",keys:["owner_name","owner","deal_owner_name","hubspot_owner_id"],labelPattern:/owner/i},CJ={id:"salesforce",namePattern:/salesforce/i,category:"crm",dealWord:["open opp","open opps"],createLabel:"Create",records:[{recordType:"Contact",cardTitle:/contact/i,title:{label:"Contact",keys:["name","contact_name"],join:["first_name","last_name"]},fields:[{label:"Account",keys:["account_name","account"],labelPattern:/^account( name)?$/i},_i]},{recordType:"Opportunity",cardTitle:/opportunit/i,title:{label:"Opportunity",keys:["opportunity_name","name"]},fields:[{label:"Stage",keys:["stage_name","stage"],labelPattern:/stage/i},{label:"Amount",keys:["amount"],labelPattern:/amount/i,format:"money"}]},{recordType:"Case",cardTitle:/case/i,excludeTitle:/automation/i,title:{label:"Case",keys:["subject","case_number"]},fields:[{label:"Status",keys:["status"],labelPattern:/status/i},{label:"Priority",keys:["priority"],labelPattern:/priority/i}]},{recordType:"Account",cardTitle:/account/i,title:{label:"Account",keys:["name","account_name"]},fields:[_i,{label:"Type",keys:["type","account_type"],labelPattern:/^type$/i}]}]},hJ={id:"hubspot",namePattern:/hubspot/i,category:"crm",dealWord:["open deal","open deals"],records:[{recordType:"Contact",cardTitle:/contact/i,title:{label:"Contact",keys:["name"],join:["first_name","last_name"]},fields:[{label:"Company",keys:["company","company_name"],labelPattern:/^company( name)?$/i},_i]},{recordType:"Deal",cardTitle:/deal/i,title:{label:"Deal",keys:["deal_name","dealname","name"]},fields:[{label:"Stage",keys:["deal_stage","dealstage"],labelPattern:/stage/i},{label:"Amount",keys:["amount"],labelPattern:/amount/i,format:"money"}]},{recordType:"Company",cardTitle:/compan/i,title:{label:"Company",keys:["name","company_name"]},fields:[_i,{label:"Lifecycle stage",keys:["lifecycle_stage","lifecyclestage"],labelPattern:/lifecycle/i}]}]},FJ={id:"netsuite",namePattern:/netsuite/i,category:"finance",records:[{recordType:"Customer",cardTitle:/customer/i,title:{label:"Customer",keys:["company_name","customer_name","name"]},fields:[{label:"Overdue",keys:["overdue_balance","overdueBalance","overdue_amount"],labelPattern:/overdue/i,format:"money"},{label:"Balance",keys:["balance"],labelPattern:/^balance$/i,format:"money"}]},{recordType:"Vendor",cardTitle:/vendor/i,title:{label:"Vendor",keys:["company_name","legal_name","name"]},fields:[{label:"Balance",keys:["balance_primary","balance"],labelPattern:/balance/i,format:"money"},{label:"Unbilled orders",keys:["unbilled_orders_primary","unbilled_orders"],labelPattern:/unbilled/i,format:"money"}]},{recordType:"Sales order",cardTitle:/sales order/i,title:{label:"Sales order",keys:["tranid","tran_id","order_number"]},fields:[{label:"Status",keys:["status"],labelPattern:/status/i},{label:"Total",keys:["total"],labelPattern:/^total$/i,format:"money"}]},{recordType:"Purchase order",cardTitle:/pu?rc?hase order/i,title:{label:"PO",keys:["tranid","tran_id","po_number"]},fields:[{label:"Status",keys:["status"],labelPattern:/status/i},{label:"Total",keys:["total"],labelPattern:/^total$/i,format:"money"}]}]},rs=(e,t,n)=>({recordType:e,cardTitle:/./,title:n??{label:e,keys:["title","name","summary"]},fields:t}),R6={label:"Status",keys:["status","status_name"],labelPattern:/status/i},os={label:"Assignee",keys:["assignee","assignees","members","person"],labelPattern:/assign|member|person/i},mJ=[{id:"jira",namePattern:/jira/i,category:"pm",recordWord:["issue","issues"],createLabel:"Create issue",records:[rs("Issue",[R6,os],{label:"Issue",keys:["title","summary"],join:["issue_id","title"]})]},{id:"clickup",namePattern:/clickup/i,category:"pm",recordWord:["task","tasks"],createLabel:"Create task",records:[rs("Task",[R6,os])]},{id:"asana",namePattern:/asana/i,category:"pm",recordWord:["task","tasks"],createLabel:"Create task",records:[rs("Task",[{label:"Status",keys:["section","completed","status"],labelPattern:/section|completed|status/i},os])]},{id:"monday",namePattern:/monday/i,category:"pm",recordWord:["item","items"],createLabel:"Create item",records:[rs("Item",[{label:"Status",keys:["status","group"],labelPattern:/status|group/i},os])]},{id:"trello",namePattern:/trello/i,category:"pm",recordWord:["card","cards"],createLabel:"Create card",records:[rs("Card",[{label:"List",keys:["list","list_name"],labelPattern:/list/i},os])]}],EJ=[pJ,gJ,CJ,hJ,FJ,...mJ],Xl=e=>e?EJ.find(t=>t.namePattern.test(e))??null:null,H6=404,bJ=403,xJ=401,Zl=e=>e==null||e===""||Array.isArray(e)&&e.length===0,W6=(e,t)=>e.priority-t.priority,yJ=e=>{var r;if(!(e!=null&&e.data))return[];if(e.cardErrorMessage||w1(e))return[];if(e.cardType==="flat_with_list")return(((r=e.data.listItems)==null?void 0:r.fields)??[]).map(o=>({fields:[...(Array.isArray(o)?o:o.data)??[]].sort(W6),externalResourceId:Array.isArray(o)?void 0:o.externalResourceId}));const t=e.data.flatDisplay,n=(Array.isArray(t)?t:(t==null?void 0:t.data)??[]).filter(o=>Number(o.statusCode)!==H6&&!(Number(o.statusCode)>=400&&Zl(o.value)));return n.length===0?[]:[{fields:[...n].sort(W6),externalResourceId:Array.isArray(t)||t==null?void 0:t.externalResourceId}]},Mn=(e,t)=>Zl(e)?"":typeof e=="boolean"?t==="completed"?e?"Completed":"Not completed":e?"Yes":"No":Array.isArray(e)?e.map(n=>typeof n=="object"&&n!==null?n.filename??"":String(n)).filter(Boolean).join(", "):String(e),Xo=e=>{if(Zl(e)||Array.isArray(e)||typeof e=="boolean")return null;const t=typeof e=="number"?e:Number(String(e).replace(/[^0-9.-]/g,""));return Number.isFinite(t)?t:null},G6=e=>{var n;const t=(n=e.fields.find(r=>r.key==="currency"))==null?void 0:n.value;return typeof t=="string"&&/^[A-Z]{3}$/.test(t)?t:void 0},Zo=(e,t)=>{const n={notation:"compact",maximumFractionDigits:1};try{return new Intl.NumberFormat("en-US",t?{...n,style:"currency",currency:t}:n).format(e)}catch{return new Intl.NumberFormat("en-US",n).format(e)}},BJ=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)},ji=(e,t)=>t.keys.map(n=>e.fields.find(r=>r.key===n)).find(Boolean)??(t.labelPattern?e.fields.find(n=>{var r;return(r=t.labelPattern)==null?void 0:r.test(n.label)}):void 0),vJ=(e,t,n)=>{if(t.format==="money"){const o=Xo(e.value);return o===null?Mn(e.value,e.key):Zo(o,G6(n))}const r=Mn(e.value,e.key);return t.format==="date"&&r?BJ(r):r},wJ=(e,t)=>{if(t.join){const o=t.join.map(s=>e.fields.find(i=>i.key===s)),u=o.map(s=>Mn(s==null?void 0:s.value,s==null?void 0:s.key)).filter(Boolean).join(" ");if(u&&o.every(Boolean))return{text:u,field:o.find(s=>s==null?void 0:s.deepLink),used:t.join}}const n=ji(e,t),r=n?Mn(n.value,n.key):"";if(r&&n)return{text:r,field:n,used:[n.key]};if(t.join){const o=t.join.map(s=>e.fields.find(i=>i.key===s)).filter(Boolean),u=o.map(s=>Mn(s.value,s.key)).filter(Boolean).join(" ");if(u)return{text:u,field:o[0],used:o.map(s=>s.key)}}return{text:"",used:[]}},SJ=(e,t,n)=>t.fields.map(r=>{const o=ji(e,r);if(o){n.add(o.key);const s=vJ(o,r,e);if(!s&&r.label==="Account")return{label:r.label,value:"No account"};const i=r.label==="Overdue"&&(Xo(o.value)??0)>0;return{label:r.label,value:s||"—",...i?{tone:"critical"}:{}}}const u=e.fields.find(s=>!n.has(s.key)&&s.type!=="attachment"&&s.key!=="currency"&&Mn(s.value,s.key));return u?(n.add(u.key),{label:u.label,value:Mn(u.value,u.key)}):null}).filter(r=>r!==null),IJ=(e,t)=>{var r,o;const n={};return t.fields.forEach(u=>{var s;n[u.label]=(s=ji(e,u))==null?void 0:s.value}),n.__title=(r=ji(e,t.title))==null?void 0:r.value,n.__close=(o=e.fields.find(u=>/close_?date/i.test(u.key)))==null?void 0:o.value,n.__currency=G6(e),n},kJ=(e,t)=>e.records.find(n=>{var r;return n.cardTitle.test(t)&&!((r=n.excludeTitle)!=null&&r.test(t))}),TJ=(e,t)=>{const n=[];return t.forEach(({card:r,data:o,errorStatus:u},s)=>{var l;const i=kJ(e,r.title);if(!i)return;const c=!!r.externalResourceId;if(!(e.category==="pm"&&!c)){if(c&&RJ(o,u)){const D=((l=e.recordWord)==null?void 0:l[0])??i.recordType.toLowerCase();n.push({id:`${r.id}:${r.externalResourceId}`,cardId:r.id,recordType:i.recordType,title:`Restricted ${D}`,fields:[],deepLink:null,externalResourceId:r.externalResourceId,linked:c,restricted:!0,spec:i,raw:{},order:s});return}yJ(o).forEach((D,d)=>{var g,A;const m=new Set,b=wJ(D,i.title);b.used.forEach(h=>m.add(h));const C=D.externalResourceId??r.externalResourceId;n.push({id:`${r.id}:${C??d}`,cardId:r.id,recordType:i.recordType,title:b.text||i.recordType,fields:SJ(D,i,m),deepLink:((g=b.field)==null?void 0:g.deepLink)??((A=D.fields.find(h=>h.deepLink))==null?void 0:A.deepLink)??null,externalResourceId:C,linked:c,spec:i,raw:IJ(D,i),order:s})})}}),n},LJ=e=>{const t=new Set;return[...e].sort((n,r)=>Number(r.linked)-Number(n.linked)).filter(n=>{if(!n.externalResourceId)return!0;const r=`${n.recordType}:${n.externalResourceId}`;return t.has(r)?!1:(t.add(r),!0)}).sort((n,r)=>n.order-r.order)},OJ=/closed/i,MJ=/closed/i,_J=/^(billed|fully billed|closed|cancell?ed)$/i,Pu=e=>{const t=Mn(e.raw.Stage??e.raw.Status);switch(e.recordType){case"Opportunity":case"Deal":return!OJ.test(t);case"Case":return!MJ.test(t);case"Sales order":case"Purchase order":return!_J.test(t.trim());default:return!0}},Ni=e=>{const t=new Date(Mn(e)).getTime();return Number.isNaN(t)?null:t},Vt=(e,...t)=>e.filter(n=>t.includes(n.recordType)),jJ=(e,t)=>{switch(e.category){case"ecommerce":{const n=Vt(t,"Customer").slice(0,1),r=[...Vt(t,"Order")].sort((o,u)=>(Ni(u.raw["Order date"])??0)-(Ni(o.raw["Order date"])??0)).slice(0,1);return[...n,...r]}case"crm":{const n=Vt(t,"Contact").slice(0,1),r=Vt(t,"Opportunity","Deal").filter(Pu).sort((u,s)=>(Ni(u.raw.__close)??1/0)-(Ni(s.raw.__close)??1/0)).slice(0,1),o=Vt(t,"Case").filter(Pu).slice(0,1);return[...n,...r,...o]}case"finance":{const n=Vt(t,"Customer").slice(0,1),r=Vt(t,"Vendor").slice(0,1),o=Vt(t,n.length?"Sales order":"Purchase order").filter(Pu).slice(0,1);return[...n,...r,...o]}default:return[]}},NJ=(e,t)=>e.category==="ecommerce"?[...Vt(t,"Order"),...t.filter(n=>n.recordType!=="Order")]:t,Jo=(e,[t,n])=>`${e} ${e===1?t:n}`,PJ=(e,t,n)=>{var r;switch(e.category){case"ecommerce":{const o=Vt(t,"Customer")[0],u=o?Xo(o.raw.Orders):null;if(o&&u!==null)return Jo(u,["order","orders"]);const s=Vt(t,"Order").filter(i=>i.linked).length;return s?Jo(s,["linked order","linked orders"]):""}case"crm":{const o=Vt(t,"Opportunity","Deal").filter(Pu).length;if(o)return Jo(o,e.dealWord??["open deal","open deals"]);if(e.id==="salesforce"){const i=Vt(t,"Case").filter(Pu).length;if(i)return Jo(i,["open case","open cases"])}const u=Vt(t,"Contact")[0],s=Mn((u==null?void 0:u.raw.Account)??(u==null?void 0:u.raw.Company))||Mn((r=Vt(t,"Account","Company")[0])==null?void 0:r.raw.__title);return s||(!u&&n?Jo(n,["linked","linked"]):"")}case"finance":{const o=Vt(t,"Customer")[0];if(o){const s=Mn(o.raw.__currency)||void 0,i=Xo(o.raw.Overdue);if(i&&i>0)return`${Zo(i,s)} overdue`;const c=Xo(o.raw.Balance);if(c&&c>0)return`${Zo(c,s)} balance`;const l=Vt(t,"Sales order").filter(Pu).length;return l?Jo(l,["open order","open orders"]):`${Zo(0,s)} balance`}const u=Vt(t,"Vendor")[0];if(u){const s=Mn(u.raw.__currency)||void 0,i=Xo(u.raw.Balance);if(i&&i>0)return`${Zo(i,s)} payable`;const c=Xo(u.raw["Unbilled orders"]);return c&&c>0?`${Zo(c,s)} unbilled`:`${Zo(0,s)} payable`}return""}case"pm":return n?Jo(n,e.recordWord??["record","records"]):"";default:return""}},V6=/^Your connection to .+ has expired\./,QJ=e=>e.some(({data:t,errorStatus:n})=>n===xJ||!!(t!=null&&t.redirectToAdminTab)||V6.test((t==null?void 0:t.cardErrorMessage)??"")),RJ=(e,t)=>t===bJ||t===H6||!!(e!=null&&e.cardErrorMessage)&&!V6.test((e==null?void 0:e.cardErrorMessage)??"")||w1(e),HJ=2,z6=(e,t)=>{const n=LJ(TJ(e,t)),r=n.filter(c=>c.linked),o=n.filter(c=>!c.linked),u=[...NJ(e,r),...jJ(e,o)],s=o.filter(c=>!(e.category==="crm"&&["Account","Company"].includes(c.recordType))),i=r.length+s.length;return{category:e.category,summary:PJ(e,n,r.length),records:u.slice(0,HJ).map(WJ),total:i,connection:QJ(t)?"expired":"ok"}},WJ=e=>({id:e.id,cardId:e.cardId,recordType:e.recordType,title:e.title,fields:e.fields,deepLink:e.deepLink,externalResourceId:e.externalResourceId,linked:e.linked,restricted:e.restricted}),X6=async(e,{connectorId:t,conversationId:n,inboxIds:r})=>{var s;const o=await Up({inboxIds:r,conversationId:n,connectorId:t}),u=(s=o==null?void 0:o.data)==null?void 0:s.cards;return Array.isArray(u)?u.filter(i=>i.connectorId===t).filter(i=>e.category!=="pm"||!!i.externalResourceId):[]},Z6=async(e,{conversationId:t,contactEmail:n,inboxIds:r},o=!1)=>{var u;try{const s=await Kp(e.id,n,t,e.externalResourceId,void 0,r,void 0,o);return{card:e,data:(s==null?void 0:s.data)??null}}catch(s){return{card:e,data:null,errorStatus:(u=s==null?void 0:s.response)==null?void 0:u.status}}},GJ=async(e,{refresh:t=!1}={})=>{const n=Xl(e.connectorName);if(!n||!e.conversationId)return null;const r=await X6(n,e),o=await Promise.all(r.map(u=>Z6(u,e,t)));return z6(n,o)},VJ=5e3,J6=new Map,Y6=(e,t)=>["appWidget",e,t],q6=({connectorId:e,connectorName:t,conversationId:n,contactEmail:r,inboxIds:o,enabled:u=!0})=>{const s=Xl(t),i=u&&!!s&&!!n,c=vt(),l=`${e}:${n}`,D=[...Y6(e,n),o.join(",")],d={connectorId:e,connectorName:t,conversationId:n,contactEmail:r,inboxIds:o},m=Ct({queryKey:[...D,"cards"],enabled:i,queryFn:()=>s?X6(s,d):Promise.resolve([])}),b=p.useMemo(()=>m.data??[],[m.data]),C=o0({queries:b.map(F=>({queryKey:[...D,"card",F.id,F.externalResourceId??"",r],enabled:i,retry:!1,queryFn:()=>Z6(F,d,Date.now()<(J6.get(l)??0))}))}),g=C.some(F=>F.isLoading),A=C.map(F=>F.data),h=p.useMemo(()=>!s||m.isLoading||g?null:z6(s,A.filter(F=>!!F)),[s,m.isLoading,g,...A]),E=p.useCallback(()=>{J6.set(l,Date.now()+VJ),c.invalidateQueries({queryKey:Y6(e,n)})},[c,l,e,n]);return{app:s,model:h,isLoading:i&&(m.isLoading||g),refresh:E}},U6=(e,t)=>{const[n,r]=p.useState(!1);return p.useEffect(()=>{if(!e){r(!1);return}const o=setTimeout(()=>r(!0),t);return()=>clearTimeout(o)},[e,t]),n},Pi=(e,t,n,r={})=>{var o;return(o=e.sendTrackingEvent)==null?void 0:o.call(e,n,{app_name:e.connectorName,category:t==null?void 0:t.category,...e.trackingContext,...r})},zJ=e=>{const{app:t,model:n,isLoading:r}=q6(e),{tokens:o}=zf(),u=U6(r,P6),s=(n==null?void 0:n.connection)==="expired",i=N6(n,!!e.isAdmin),{onSummaryChange:c}=e;p.useEffect(()=>{c==null||c({text:i,isLoading:r,disconnected:s})},[c,i,r,s]);const l=p.useRef(Date.now()),D=p.useRef(!1);return p.useEffect(()=>{D.current||r||!n||(D.current=!0,Pi(e,t,yr.RENDERED,{load_ms:Date.now()-l.current,state:s?"disconnected":n.total===0?"empty":"records"}))},[r,n]),t?r?u?a.jsx(f.Skeleton,{"data-testid":"app-widget-summary-loading",variant:"rounded",width:56,height:16}):null:i?a.jsx(f.Typography,{"data-testid":"app-widget-summary",variant:"body2",noWrap:!0,sx:{color:s?o.negative:o.textSecondary,fontSize:12,lineHeight:"16px"},children:i}):null:null},XJ=e=>{const{app:t,model:n,isLoading:r,refresh:o}=q6(e),{tokens:u}=zf(),s=U6(r,P6);if(!t)return null;const i=(c,l,D)=>{l&&Pi(e,t,l,D),e.onAction(c)};return r?s?a.jsx(UJ,{}):null:n?n.connection==="expired"?a.jsx(KJ,{app:t,appName:e.connectorName,isAdmin:!!e.isAdmin,adminNotified:!!e.adminNotified,tokens:u,onReconnect:()=>i({type:"reconnect"},yr.AUTH_ACTION,{action:"reconnect"}),onNotifyAdmin:()=>i({type:"notify_admin"},yr.AUTH_ACTION,{action:"notify_admin"})}):a.jsxs(f.Stack,{"data-testid":"app-widget-body",spacing:1,sx:{pb:1},children:[a.jsx(JJ,{lookupKey:t.category==="pm"?"":e.contactEmail,tokens:u,onRefresh:()=>{Pi(e,t,yr.REFRESHED),o()}}),n.records.length===0?a.jsx(f.Typography,{variant:"body2",sx:{color:u.textSecondary,fontSize:13},children:uJ(t)}):n.records.map(c=>a.jsx(YJ,{record:c,tokens:u,onOpen:()=>i({type:"open_record",record:c},yr.CARD_CLICKED,{target:"card",record_type:c.recordType}),onOpenInApp:()=>{Pi(e,t,yr.CARD_CLICKED,{target:"open_in_app",record_type:c.recordType}),c.deepLink&&window.open(c.deepLink,"_blank","noopener,noreferrer")}},c.id)),n.total>n.records.length&&a.jsx(f.Button,{variant:"text",size:"small",sx:{alignSelf:"flex-start",px:0,minWidth:0,color:u.accent},onClick:()=>i({type:"view_all"},yr.VIEW_ALL_CLICKED,{total:n.total}),children:lJ(n.total)}),a.jsx(qJ,{app:t,tokens:u,onCreate:()=>i({type:"create"},yr.CTA_CLICKED,{cta:"create"}),onSearchLink:()=>i({type:"search_link",prefill:{email:e.contactEmail}},yr.CTA_CLICKED,{cta:"search_link"})})]}):null},ZJ=()=>a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[a.jsx("path",{d:"M13.5 8a5.5 5.5 0 1 1-1.6-3.9",strokeLinecap:"round"}),a.jsx("path",{d:"M13.5 2.5v3h-3",strokeLinecap:"round",strokeLinejoin:"round"})]}),JJ=({lookupKey:e,tokens:t,onRefresh:n})=>a.jsxs(f.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[a.jsx(f.Typography,{variant:"caption",noWrap:!0,title:e,sx:{color:t.textTertiary,minWidth:0},children:e?dJ(e):""}),a.jsx(f.Tooltip,{title:"Refresh",children:a.jsx(f.Box,{component:"button",type:"button","aria-label":"Refresh",onClick:n,sx:{display:"flex",border:"none",background:"none",p:.5,cursor:"pointer",color:t.iconSecondary,borderRadius:1,"&:hover":{background:t.surfaceHover}},children:a.jsx(ZJ,{})})})]}),YJ=({record:e,tokens:t,onOpen:n,onOpenInApp:r})=>a.jsx(f.Box,{"data-testid":"app-widget-card",role:"button",tabIndex:0,onClick:n,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n())},sx:{border:`1px solid ${t.border}`,borderRadius:1,p:1.25,cursor:"pointer",background:t.surface,"&:hover":{background:t.surfaceHover}},children:a.jsxs(f.Stack,{direction:"row",alignItems:"flex-start",spacing:1,children:[a.jsxs(f.Box,{sx:{minWidth:0,flex:1},children:[a.jsx(f.Typography,{variant:"caption",sx:{color:t.textTertiary,display:"block"},children:e.recordType}),a.jsx(f.Tooltip,{title:e.title,placement:"top-start",children:a.jsx(f.Typography,{variant:"body2",noWrap:!0,sx:{color:t.textPrimary,fontWeight:500},children:e.title})}),e.fields.map(o=>a.jsxs(f.Stack,{direction:"row",spacing:.5,sx:{minWidth:0},children:[a.jsxs(f.Typography,{variant:"caption",sx:{color:t.textTertiary,flexShrink:0},children:[o.label,":"]}),a.jsx(f.Typography,{variant:"caption",noWrap:!0,title:o.value,sx:{color:o.tone==="critical"?t.negative:t.textSecondary},children:o.value})]},o.label))]}),e.deepLink&&a.jsx(f.Tooltip,{title:"Open in app",children:a.jsx(f.Box,{component:"button",type:"button","aria-label":"Open in app",onClick:o=>{o.stopPropagation(),r()},sx:{display:"flex",border:"none",background:"none",p:0,cursor:"pointer",color:t.iconSecondary},children:a.jsx(f.icons.OpenInNew,{sx:{fontSize:16}})})})]})}),qJ=({app:e,tokens:t,onCreate:n,onSearchLink:r})=>a.jsxs(f.Stack,{direction:"row",spacing:1,children:[e.createLabel&&a.jsx(f.Button,{variant:"contained",size:"small",fullWidth:!0,sx:{background:t.primaryAction,color:t.onAccent,"&:hover":{background:t.primaryActionHover}},onClick:n,children:e.createLabel}),a.jsx(f.Button,{variant:"outlined",size:"small",fullWidth:!0,sx:{borderColor:t.borderStrong,color:t.textPrimary},onClick:r,children:DJ})]}),UJ=()=>a.jsxs(f.Stack,{"data-testid":"app-widget-loading",spacing:1,sx:{pb:1},children:[a.jsx(f.Skeleton,{variant:"rounded",height:64}),a.jsx(f.Skeleton,{variant:"rounded",height:64})]}),KJ=({app:e,appName:t,isAdmin:n,adminNotified:r,tokens:o,onReconnect:u,onNotifyAdmin:s})=>a.jsxs(f.Stack,{"data-testid":"app-widget-disconnected",spacing:1,sx:{pb:1},children:[a.jsx(f.Typography,{variant:"body2",sx:{color:o.textSecondary,fontSize:13},children:aJ(e,t,n)}),n?a.jsx(f.Button,{variant:"contained",size:"small",onClick:u,children:sJ(t)}):a.jsx(f.Button,{variant:"outlined",size:"small",disabled:r,onClick:s,children:r?iJ:fJ})]}),K6=({theme:e,children:t})=>{const n=ko(e),r=p.useMemo(()=>({...n,display:"contents"}),[n]);return a.jsx("span",{className:"connector-theme-root","data-color-scheme":e.mode,style:r,children:a.jsx(qr,{config:e,children:t})})},$J=({theme:e=mr,...t})=>a.jsx(K6,{theme:e,children:a.jsx(_6,{children:a.jsx(zJ,{...t})})}),eY=({theme:e=mr,...t})=>a.jsx(K6,{theme:e,children:a.jsx(_6,{children:a.jsx(XJ,{...t})})});ge.APP_WIDGET_EVENTS=yr,ge.ActionQueue=IH,ge.AppWidgetBody=eY,ge.AppWidgetSummary=$J,ge.CONNECTORS_AGENT_EVENTS=jR,ge.ConnectorCardList=_R,ge.EmailLogger=QG,ge.GmailLogObserver=PG,ge.HigSlackConnectModalIsland=y6,ge.HigSlackSection=PZ,ge.HigSlackSectionBody=QZ,ge.HigSlackTab=EZ,ge.HiverConnectorBifrostAuth=Ee,ge.IntegrationSense=BH,ge.OmniEmailLogger=FV,ge.OmniSlackTab=gZ,ge.SLACK_LINKS_API=sg,ge.SlackConnectModalIsland=y6,ge.SlackLinkActionsIsland=hZ,ge.SplitAppsNudge=rJ,ge.addNewConnectors=Eh,ge.appWidgetSummaryText=N6,ge.connectorThemeDefaults=Vf,ge.createAppStore=ZZ,ge.dismissNotification=od,ge.fetchAppCfValues=WZ,ge.fetchDeferredAppCfValues=GZ,ge.getAppWidgetSpec=Xl,ge.getConnectorsBifrostConfigs=an,ge.getMetaData=AI,ge.initConnectorsBifrost=cm,ge.loadAppWidgetModel=GJ,ge.resolveConnectorThemeTokens=F1,ge.setCaptureFeedbackOnDemand=bh,ge.shouldCaptureFeedback=A0,ge.shouldShowNotification=rd,ge.useConnectorSelectedEmail=AR,ge.useSlackLinksSummary=HZ,ge.useSlackTabLabel=RZ,Object.defineProperty(ge,Symbol.toStringTag,{value:"Module"})});
|
|
5875
|
+
`,eJ=({children:e,zIndex:t,onClose:n})=>{const r=a.jsxs(qZ,{children:[a.jsx(UZ,{variant:"h2",color:"text.primary",children:"Split apps view"}),a.jsx(KZ,{variant:"body2",color:"text.secondary",children:"Each connected app now has its own tab, making it easier to view app-specific data"}),a.jsx($Z,{variant:"contained",color:"primary",onClick:n,children:"Dismiss"})]});return a.jsx(YZ,{open:!0,title:r,placement:"left-start",disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,arrow:!0,slotProps:{popper:{sx:{zIndex:t+1},modifiers:[{name:"flip",enabled:!0},{name:"preventOverflow",enabled:!0}]},tooltip:{sx:{pointerEvents:"auto",maxWidth:"min(360px, calc(60vw - 24px))",padding:"12px"},onClick:o=>o.stopPropagation()},arrow:{sx:{fontSize:`${f.theme.typography.caption.fontSize}px`}}},children:e})},M6=ja("LOCAL"),tJ="connector-library-split-apps-nudge",nJ=({open:e,targetRef:t,endElRef:n,zIndex:r,storageKey:o=tJ,onClose:u})=>{const[s,i]=p.useState(()=>M6.getItem(o)==="true"),c=()=>{M6.setItem(o,"true"),i(!0),u()},l=D=>a.jsx(eJ,{zIndex:r,onClose:c,children:D});return s?null:a.jsx(xL,{open:e,targetRef:t,endElRef:n,padding:8,zIndex:r,renderHighlight:l})},rJ=({theme:e,...t})=>a.jsx(JZ,{theme:e,children:a.jsx(nJ,{...t})}),oJ=fl(),_6=({children:e})=>a.jsx(n0,{client:oJ,children:e}),uJ=e=>{var t;switch(e.category){case"ecommerce":return"No customer found for this email. Search by email or order ID to link one.";case"crm":return"No contact found for this email.";case"finance":return"No customer or vendor found for this email.";case"pm":return`No ${((t=e.recordWord)==null?void 0:t[1])??"tasks"} linked to this conversation.`;default:return"Nothing found for this email."}},j6=e=>{var t;return e.category==="ecommerce"?"orders":e.category==="pm"?((t=e.recordWord)==null?void 0:t[1])??"tasks":"records"},aJ=(e,t,n)=>n?`${t} is disconnected. Reconnect to see this customer's ${j6(e)} and keep linked records in sync.`:`${t} is disconnected. Only an admin can reconnect it. ${AJ(j6(e))} will show here again once it's back.`,sJ=e=>`Reconnect ${e}`,fJ="Notify admin",iJ="Admin notified",cJ=e=>e?"Reconnect":"Unavailable",lJ=e=>`View all (${e>99?"99+":e})`,DJ="Search & link",dJ=e=>`Showing records for ${e}`,AJ=e=>e.charAt(0).toUpperCase()+e.slice(1),N6=(e,t)=>e?e.connection==="expired"?cJ(t):e.summary:"",yr={RENDERED:"app_widget_rendered",CARD_CLICKED:"app_widget_card_clicked",VIEW_ALL_CLICKED:"app_widget_view_all_clicked",CTA_CLICKED:"app_widget_cta_clicked",REFRESHED:"app_widget_refreshed",AUTH_ACTION:"app_widget_auth_action"},P6=300,Q6={label:"Order",keys:["order_number","name","number","id","tranid"]},pJ={id:"shopify",namePattern:/shopify/i,category:"ecommerce",records:[{recordType:"Customer",cardTitle:/customer/i,title:{label:"Customer",keys:["customer_name","display_name","name"],join:["first_name","last_name"]},fields:[{label:"Orders",keys:["total_orders","orders_count","number_of_orders"],labelPattern:/orders/i},{label:"Amount spent",keys:["total_spent","amount_spent"],labelPattern:/spent/i,format:"money"}]},{recordType:"Order",cardTitle:/order/i,excludeTitle:/line item/i,title:Q6,fields:[{label:"Fulfillment",keys:["fulfillment_status","display_fulfillment_status"],labelPattern:/fulfil/i},{label:"Order date",keys:["created_at","order_date"],labelPattern:/created|date/i,format:"date"}]}]},gJ={id:"woocommerce",namePattern:/woo/i,category:"ecommerce",records:[{recordType:"Customer",cardTitle:/customer/i,title:{label:"Customer",keys:["name","customer_name"],join:["first_name","last_name"]},fields:[{label:"Orders",keys:["orders_count","total_orders"],labelPattern:/orders/i},{label:"Customer since",keys:["date_created","created_at"],labelPattern:/created|since/i,format:"date"}]},{recordType:"Order",cardTitle:/order/i,title:Q6,fields:[{label:"Status",keys:["status","order_status"],labelPattern:/status/i},{label:"Order date",keys:["date_created","created_at"],labelPattern:/created|date/i,format:"date"}]}]},_i={label:"Owner",keys:["owner_name","owner","deal_owner_name","hubspot_owner_id"],labelPattern:/owner/i},CJ={id:"salesforce",namePattern:/salesforce/i,category:"crm",dealWord:["open opp","open opps"],createLabel:"Create",records:[{recordType:"Contact",cardTitle:/contact/i,title:{label:"Contact",keys:["name","contact_name"],join:["first_name","last_name"]},fields:[{label:"Account",keys:["account_name","account"],labelPattern:/^account( name)?$/i},_i]},{recordType:"Opportunity",cardTitle:/opportunit/i,title:{label:"Opportunity",keys:["opportunity_name","name"]},fields:[{label:"Stage",keys:["stage_name","stage"],labelPattern:/stage/i},{label:"Amount",keys:["amount"],labelPattern:/amount/i,format:"money"}]},{recordType:"Case",cardTitle:/case/i,excludeTitle:/automation/i,title:{label:"Case",keys:["subject","case_number"]},fields:[{label:"Status",keys:["status"],labelPattern:/status/i},{label:"Priority",keys:["priority"],labelPattern:/priority/i}]},{recordType:"Account",cardTitle:/account/i,title:{label:"Account",keys:["name","account_name"]},fields:[_i,{label:"Type",keys:["type","account_type"],labelPattern:/^type$/i}]}]},hJ={id:"hubspot",namePattern:/hubspot/i,category:"crm",dealWord:["open deal","open deals"],records:[{recordType:"Contact",cardTitle:/contact/i,title:{label:"Contact",keys:["name"],join:["first_name","last_name"]},fields:[{label:"Company",keys:["company","company_name"],labelPattern:/^company( name)?$/i},_i]},{recordType:"Deal",cardTitle:/deal/i,title:{label:"Deal",keys:["deal_name","dealname","name"]},fields:[{label:"Stage",keys:["deal_stage","dealstage"],labelPattern:/stage/i},{label:"Amount",keys:["amount"],labelPattern:/amount/i,format:"money"}]},{recordType:"Company",cardTitle:/compan/i,title:{label:"Company",keys:["name","company_name"]},fields:[_i,{label:"Lifecycle stage",keys:["lifecycle_stage","lifecyclestage"],labelPattern:/lifecycle/i}]}]},FJ={id:"netsuite",namePattern:/netsuite/i,category:"finance",records:[{recordType:"Customer",cardTitle:/customer/i,title:{label:"Customer",keys:["company_name","customer_name","name"]},fields:[{label:"Overdue",keys:["overdue_balance","overdueBalance","overdue_amount"],labelPattern:/overdue/i,format:"money"},{label:"Balance",keys:["balance"],labelPattern:/^balance$/i,format:"money"}]},{recordType:"Vendor",cardTitle:/vendor/i,title:{label:"Vendor",keys:["company_name","legal_name","name"]},fields:[{label:"Balance",keys:["balance_primary","balance"],labelPattern:/balance/i,format:"money"},{label:"Unbilled orders",keys:["unbilled_orders_primary","unbilled_orders"],labelPattern:/unbilled/i,format:"money"}]},{recordType:"Sales order",cardTitle:/sales order/i,title:{label:"Sales order",keys:["tranid","tran_id","order_number"]},fields:[{label:"Status",keys:["status"],labelPattern:/status/i},{label:"Total",keys:["total"],labelPattern:/^total$/i,format:"money"}]},{recordType:"Purchase order",cardTitle:/pu?rc?hase order/i,title:{label:"PO",keys:["tranid","tran_id","po_number"]},fields:[{label:"Status",keys:["status"],labelPattern:/status/i},{label:"Total",keys:["total"],labelPattern:/^total$/i,format:"money"}]}]},rs=(e,t,n)=>({recordType:e,cardTitle:/./,title:n??{label:e,keys:["title","name","summary"]},fields:t}),R6={label:"Status",keys:["status","status_name"],labelPattern:/status/i},os={label:"Assignee",keys:["assignee","assignees","members","person"],labelPattern:/assign|member|person/i},mJ=[{id:"jira",namePattern:/jira/i,category:"pm",recordWord:["issue","issues"],createLabel:"Create issue",records:[rs("Issue",[R6,os],{label:"Issue",keys:["title","summary"],join:["issue_id","title"]})]},{id:"clickup",namePattern:/clickup/i,category:"pm",recordWord:["task","tasks"],createLabel:"Create task",records:[rs("Task",[R6,os])]},{id:"asana",namePattern:/asana/i,category:"pm",recordWord:["task","tasks"],createLabel:"Create task",records:[rs("Task",[{label:"Status",keys:["section","completed","status"],labelPattern:/section|completed|status/i},os])]},{id:"monday",namePattern:/monday/i,category:"pm",recordWord:["item","items"],createLabel:"Create item",records:[rs("Item",[{label:"Status",keys:["status","group"],labelPattern:/status|group/i},os])]},{id:"trello",namePattern:/trello/i,category:"pm",recordWord:["card","cards"],createLabel:"Create card",records:[rs("Card",[{label:"List",keys:["list","list_name"],labelPattern:/list/i},os])]}],EJ=[pJ,gJ,CJ,hJ,FJ,...mJ],Xl=e=>e?EJ.find(t=>t.namePattern.test(e))??null:null,H6=404,bJ=403,xJ=401,Zl=e=>e==null||e===""||Array.isArray(e)&&e.length===0,W6=(e,t)=>e.priority-t.priority,yJ=e=>{var r;if(!(e!=null&&e.data))return[];if(e.cardErrorMessage||w1(e))return[];if(e.cardType==="flat_with_list")return(((r=e.data.listItems)==null?void 0:r.fields)??[]).map(o=>({fields:[...(Array.isArray(o)?o:o.data)??[]].sort(W6),externalResourceId:Array.isArray(o)?void 0:o.externalResourceId}));const t=e.data.flatDisplay,n=(Array.isArray(t)?t:(t==null?void 0:t.data)??[]).filter(o=>Number(o.statusCode)!==H6&&!(Number(o.statusCode)>=400&&Zl(o.value)));return n.length===0?[]:[{fields:[...n].sort(W6),externalResourceId:Array.isArray(t)||t==null?void 0:t.externalResourceId}]},Mn=(e,t)=>Zl(e)?"":typeof e=="boolean"?t==="completed"?e?"Completed":"Not completed":e?"Yes":"No":Array.isArray(e)?e.map(n=>typeof n=="object"&&n!==null?n.filename??"":String(n)).filter(Boolean).join(", "):String(e),Xo=e=>{if(Zl(e)||Array.isArray(e)||typeof e=="boolean")return null;const t=typeof e=="number"?e:Number(String(e).replace(/[^0-9.-]/g,""));return Number.isFinite(t)?t:null},G6=e=>{var n;const t=(n=e.fields.find(r=>r.key==="currency"))==null?void 0:n.value;return typeof t=="string"&&/^[A-Z]{3}$/.test(t)?t:void 0},Zo=(e,t)=>{const n={notation:"compact",maximumFractionDigits:1};try{return new Intl.NumberFormat("en-US",t?{...n,style:"currency",currency:t}:n).format(e)}catch{return new Intl.NumberFormat("en-US",n).format(e)}},BJ=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)},ji=(e,t)=>t.keys.map(n=>e.fields.find(r=>r.key===n)).find(Boolean)??(t.labelPattern?e.fields.find(n=>{var r;return(r=t.labelPattern)==null?void 0:r.test(n.label)}):void 0),vJ=(e,t,n)=>{if(t.format==="money"){const o=Xo(e.value);return o===null?Mn(e.value,e.key):Zo(o,G6(n))}const r=Mn(e.value,e.key);return t.format==="date"&&r?BJ(r):r},wJ=(e,t)=>{if(t.join){const o=t.join.map(s=>e.fields.find(i=>i.key===s)),u=o.map(s=>Mn(s==null?void 0:s.value,s==null?void 0:s.key)).filter(Boolean).join(" ");if(u&&o.every(Boolean))return{text:u,field:o.find(s=>s==null?void 0:s.deepLink),used:t.join}}const n=ji(e,t),r=n?Mn(n.value,n.key):"";if(r&&n)return{text:r,field:n,used:[n.key]};if(t.join){const o=t.join.map(s=>e.fields.find(i=>i.key===s)).filter(Boolean),u=o.map(s=>Mn(s.value,s.key)).filter(Boolean).join(" ");if(u)return{text:u,field:o[0],used:o.map(s=>s.key)}}return{text:"",used:[]}},SJ=(e,t,n)=>t.fields.map(r=>{const o=ji(e,r);if(o){n.add(o.key);const s=vJ(o,r,e);if(!s&&r.label==="Account")return{label:r.label,value:"No account"};const i=r.label==="Overdue"&&(Xo(o.value)??0)>0;return{label:r.label,value:s||"—",...i?{tone:"critical"}:{}}}const u=e.fields.find(s=>!n.has(s.key)&&s.type!=="attachment"&&s.key!=="currency"&&Mn(s.value,s.key));return u?(n.add(u.key),{label:u.label,value:Mn(u.value,u.key)}):null}).filter(r=>r!==null),IJ=(e,t)=>{var r,o;const n={};return t.fields.forEach(u=>{var s;n[u.label]=(s=ji(e,u))==null?void 0:s.value}),n.__title=(r=ji(e,t.title))==null?void 0:r.value,n.__close=(o=e.fields.find(u=>/close_?date/i.test(u.key)))==null?void 0:o.value,n.__currency=G6(e),n},kJ=(e,t)=>e.records.find(n=>{var r;return n.cardTitle.test(t)&&!((r=n.excludeTitle)!=null&&r.test(t))}),TJ=(e,t)=>{const n=[];return t.forEach(({card:r,data:o,errorStatus:u},s)=>{var l;const i=kJ(e,r.title);if(!i)return;const c=!!r.externalResourceId;if(!(e.category==="pm"&&!c)){if(c&&RJ(o,u)){const D=((l=e.recordWord)==null?void 0:l[0])??i.recordType.toLowerCase();n.push({id:`${r.id}:${r.externalResourceId}`,cardId:r.id,recordType:i.recordType,title:`Restricted ${D}`,fields:[],deepLink:null,externalResourceId:r.externalResourceId,linked:c,restricted:!0,spec:i,raw:{},order:s});return}yJ(o).forEach((D,d)=>{var g,A;const m=new Set,b=wJ(D,i.title);b.used.forEach(h=>m.add(h));const C=D.externalResourceId??r.externalResourceId;n.push({id:`${r.id}:${C??d}`,cardId:r.id,recordType:i.recordType,title:b.text||i.recordType,fields:SJ(D,i,m),deepLink:((g=b.field)==null?void 0:g.deepLink)??((A=D.fields.find(h=>h.deepLink))==null?void 0:A.deepLink)??null,externalResourceId:C,linked:c,spec:i,raw:IJ(D,i),order:s})})}}),n},LJ=e=>{const t=new Set;return[...e].sort((n,r)=>Number(r.linked)-Number(n.linked)).filter(n=>{if(!n.externalResourceId)return!0;const r=`${n.recordType}:${n.externalResourceId}`;return t.has(r)?!1:(t.add(r),!0)}).sort((n,r)=>n.order-r.order)},OJ=/closed/i,MJ=/closed/i,_J=/^(billed|fully billed|closed|cancell?ed)$/i,Pu=e=>{const t=Mn(e.raw.Stage??e.raw.Status);switch(e.recordType){case"Opportunity":case"Deal":return!OJ.test(t);case"Case":return!MJ.test(t);case"Sales order":case"Purchase order":return!_J.test(t.trim());default:return!0}},Ni=e=>{const t=new Date(Mn(e)).getTime();return Number.isNaN(t)?null:t},Vt=(e,...t)=>e.filter(n=>t.includes(n.recordType)),jJ=(e,t)=>{switch(e.category){case"ecommerce":{const n=Vt(t,"Customer").slice(0,1),r=[...Vt(t,"Order")].sort((o,u)=>(Ni(u.raw["Order date"])??0)-(Ni(o.raw["Order date"])??0)).slice(0,1);return[...n,...r]}case"crm":{const n=Vt(t,"Contact").slice(0,1),r=Vt(t,"Opportunity","Deal").filter(Pu).sort((u,s)=>(Ni(u.raw.__close)??1/0)-(Ni(s.raw.__close)??1/0)).slice(0,1),o=Vt(t,"Case").filter(Pu).slice(0,1);return[...n,...r,...o]}case"finance":{const n=Vt(t,"Customer").slice(0,1),r=Vt(t,"Vendor").slice(0,1),o=Vt(t,n.length?"Sales order":"Purchase order").filter(Pu).slice(0,1);return[...n,...r,...o]}default:return[]}},NJ=(e,t)=>e.category==="ecommerce"?[...Vt(t,"Order"),...t.filter(n=>n.recordType!=="Order")]:t,Jo=(e,[t,n])=>`${e} ${e===1?t:n}`,PJ=(e,t,n)=>{var r;switch(e.category){case"ecommerce":{const o=Vt(t,"Customer")[0],u=o?Xo(o.raw.Orders):null;if(o&&u!==null)return Jo(u,["order","orders"]);const s=Vt(t,"Order").filter(i=>i.linked).length;return s?Jo(s,["linked order","linked orders"]):""}case"crm":{const o=Vt(t,"Opportunity","Deal").filter(Pu).length;if(o)return Jo(o,e.dealWord??["open deal","open deals"]);if(e.id==="salesforce"){const i=Vt(t,"Case").filter(Pu).length;if(i)return Jo(i,["open case","open cases"])}const u=Vt(t,"Contact")[0],s=Mn((u==null?void 0:u.raw.Account)??(u==null?void 0:u.raw.Company))||Mn((r=Vt(t,"Account","Company")[0])==null?void 0:r.raw.__title);return s||(!u&&n?Jo(n,["linked","linked"]):"")}case"finance":{const o=Vt(t,"Customer")[0];if(o){const s=Mn(o.raw.__currency)||void 0,i=Xo(o.raw.Overdue);if(i&&i>0)return`${Zo(i,s)} overdue`;const c=Xo(o.raw.Balance);if(c&&c>0)return`${Zo(c,s)} balance`;const l=Vt(t,"Sales order").filter(Pu).length;return l?Jo(l,["open order","open orders"]):`${Zo(0,s)} balance`}const u=Vt(t,"Vendor")[0];if(u){const s=Mn(u.raw.__currency)||void 0,i=Xo(u.raw.Balance);if(i&&i>0)return`${Zo(i,s)} payable`;const c=Xo(u.raw["Unbilled orders"]);return c&&c>0?`${Zo(c,s)} unbilled`:`${Zo(0,s)} payable`}return""}case"pm":return n?Jo(n,e.recordWord??["record","records"]):"";default:return""}},V6=/^Your connection to .+ has expired\./,QJ=e=>e.some(({data:t,errorStatus:n})=>n===xJ||!!(t!=null&&t.redirectToAdminTab)||V6.test((t==null?void 0:t.cardErrorMessage)??"")),RJ=(e,t)=>t===bJ||t===H6||!!(e!=null&&e.cardErrorMessage)&&!V6.test((e==null?void 0:e.cardErrorMessage)??"")||w1(e),HJ=2,z6=(e,t,n=!0)=>{const r=LJ(TJ(e,t)),o=r.filter(l=>l.linked),u=r.filter(l=>!l.linked),s=[...NJ(e,o),...jJ(e,u)],i=u.filter(l=>!(e.category==="crm"&&["Account","Company"].includes(l.recordType))),c=o.length+i.length;return{category:e.category,summary:PJ(e,r,o.length),records:s.slice(0,HJ).map(WJ),total:c,connection:QJ(t)?"expired":"ok",available:n}},WJ=e=>({id:e.id,cardId:e.cardId,recordType:e.recordType,title:e.title,fields:e.fields,deepLink:e.deepLink,externalResourceId:e.externalResourceId,linked:e.linked,restricted:e.restricted}),X6=async(e,{connectorId:t,conversationId:n,inboxIds:r})=>{var i;const o=await Up({inboxIds:r,conversationId:n,connectorId:t}),u=(i=o==null?void 0:o.data)==null?void 0:i.cards;if(!Array.isArray(u))return{cards:[],available:!1};const s=u.filter(c=>c.connectorId===t);return{cards:s.filter(c=>e.category!=="pm"||!!c.externalResourceId),available:s.length>0}},Z6=async(e,{conversationId:t,contactEmail:n,inboxIds:r},o=!1)=>{var u;try{const s=await Kp(e.id,n,t,e.externalResourceId,void 0,r,void 0,o);return{card:e,data:(s==null?void 0:s.data)??null}}catch(s){return{card:e,data:null,errorStatus:(u=s==null?void 0:s.response)==null?void 0:u.status}}},GJ=async(e,{refresh:t=!1}={})=>{const n=Xl(e.connectorName);if(!n||!e.conversationId)return null;const{cards:r,available:o}=await X6(n,e),u=await Promise.all(r.map(s=>Z6(s,e,t)));return z6(n,u,o)},VJ=5e3,J6=new Map,Y6=(e,t)=>["appWidget",e,t],q6=({connectorId:e,connectorName:t,conversationId:n,contactEmail:r,inboxIds:o,enabled:u=!0})=>{var y;const s=Xl(t),i=u&&!!s&&!!n,c=vt(),l=`${e}:${n}`,D=[...Y6(e,n),o.join(",")],d={connectorId:e,connectorName:t,conversationId:n,contactEmail:r,inboxIds:o},m=Ct({queryKey:[...D,"cards"],enabled:i,queryFn:()=>s?X6(s,d):Promise.resolve({cards:[],available:!1})}),b=p.useMemo(()=>{var S;return((S=m.data)==null?void 0:S.cards)??[]},[m.data]),C=((y=m.data)==null?void 0:y.available)??!0,g=o0({queries:b.map(S=>({queryKey:[...D,"card",S.id,S.externalResourceId??"",r],enabled:i,retry:!1,queryFn:()=>Z6(S,d,Date.now()<(J6.get(l)??0))}))}),A=g.some(S=>S.isLoading),h=g.map(S=>S.data),E=g.map(S=>S.dataUpdatedAt).join(","),F=p.useMemo(()=>!s||m.isLoading||A?null:z6(s,h.filter(S=>!!S),C),[s,m.isLoading,A,E,C]),x=p.useCallback(()=>{J6.set(l,Date.now()+VJ),c.invalidateQueries({queryKey:Y6(e,n)})},[c,l,e,n]);return{app:s,model:F,isLoading:i&&(m.isLoading||A),refresh:x}},U6=(e,t)=>{const[n,r]=p.useState(!1);return p.useEffect(()=>{if(!e){r(!1);return}const o=setTimeout(()=>r(!0),t);return()=>clearTimeout(o)},[e,t]),n},Pi=(e,t,n,r={})=>{var o;return(o=e.sendTrackingEvent)==null?void 0:o.call(e,n,{app_name:e.connectorName,category:t==null?void 0:t.category,...e.trackingContext,...r})},zJ=e=>{const{app:t,model:n,isLoading:r}=q6(e),{tokens:o}=zf(),u=U6(r,P6),s=(n==null?void 0:n.connection)==="expired",i=N6(n,!!e.isAdmin),c=(n==null?void 0:n.available)??!0,{onSummaryChange:l}=e;p.useEffect(()=>{l==null||l({text:i,isLoading:r,disconnected:s,available:c})},[l,i,r,s,c]);const D=p.useRef(Date.now()),d=p.useRef(!1);return p.useEffect(()=>{d.current||r||!n||!n.available||(d.current=!0,Pi(e,t,yr.RENDERED,{load_ms:Date.now()-D.current,state:s?"disconnected":n.total===0?"empty":"records"}))},[r,n]),!t||!c?null:r?u?a.jsx(f.Skeleton,{"data-testid":"app-widget-summary-loading",variant:"rounded",width:56,height:16}):null:i?a.jsx(f.Typography,{"data-testid":"app-widget-summary",variant:"body2",noWrap:!0,sx:{color:s?o.negative:o.textSecondary,fontSize:12,lineHeight:"16px"},children:i}):null},XJ=e=>{const{app:t,model:n,isLoading:r,refresh:o}=q6(e),{tokens:u}=zf(),s=U6(r,P6);if(!t)return null;const i=(c,l,D)=>{l&&Pi(e,t,l,D),e.onAction(c)};return r?s?a.jsx(UJ,{}):null:!n||!n.available?null:n.connection==="expired"?a.jsx(KJ,{app:t,appName:e.connectorName,isAdmin:!!e.isAdmin,adminNotified:!!e.adminNotified,tokens:u,onReconnect:()=>i({type:"reconnect"},yr.AUTH_ACTION,{action:"reconnect"}),onNotifyAdmin:()=>i({type:"notify_admin"},yr.AUTH_ACTION,{action:"notify_admin"})}):a.jsxs(f.Stack,{"data-testid":"app-widget-body",spacing:1,sx:{pb:1},children:[a.jsx(JJ,{lookupKey:t.category==="pm"?"":e.contactEmail,tokens:u,onRefresh:()=>{Pi(e,t,yr.REFRESHED),o()}}),n.records.length===0?a.jsx(f.Typography,{variant:"body2",sx:{color:u.textSecondary,fontSize:13},children:uJ(t)}):n.records.map(c=>a.jsx(YJ,{record:c,tokens:u,onOpen:()=>i({type:"open_record",record:c},yr.CARD_CLICKED,{target:"card",record_type:c.recordType}),onOpenInApp:()=>{Pi(e,t,yr.CARD_CLICKED,{target:"open_in_app",record_type:c.recordType}),c.deepLink&&window.open(c.deepLink,"_blank","noopener,noreferrer")}},c.id)),n.total>n.records.length&&a.jsx(f.Button,{variant:"text",size:"small",sx:{alignSelf:"flex-start",px:0,minWidth:0,color:u.accent},onClick:()=>i({type:"view_all"},yr.VIEW_ALL_CLICKED,{total:n.total}),children:lJ(n.total)}),a.jsx(qJ,{app:t,tokens:u,onCreate:()=>i({type:"create"},yr.CTA_CLICKED,{cta:"create"}),onSearchLink:()=>i({type:"search_link",prefill:{email:e.contactEmail}},yr.CTA_CLICKED,{cta:"search_link"})})]})},ZJ=()=>a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[a.jsx("path",{d:"M13.5 8a5.5 5.5 0 1 1-1.6-3.9",strokeLinecap:"round"}),a.jsx("path",{d:"M13.5 2.5v3h-3",strokeLinecap:"round",strokeLinejoin:"round"})]}),JJ=({lookupKey:e,tokens:t,onRefresh:n})=>a.jsxs(f.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[a.jsx(f.Typography,{variant:"caption",noWrap:!0,title:e,sx:{color:t.textTertiary,minWidth:0},children:e?dJ(e):""}),a.jsx(f.Tooltip,{title:"Refresh",children:a.jsx(f.Box,{component:"button",type:"button","aria-label":"Refresh",onClick:n,sx:{display:"flex",border:"none",background:"none",p:.5,cursor:"pointer",color:t.iconSecondary,borderRadius:1,"&:hover":{background:t.surfaceHover}},children:a.jsx(ZJ,{})})})]}),YJ=({record:e,tokens:t,onOpen:n,onOpenInApp:r})=>a.jsx(f.Box,{"data-testid":"app-widget-card",role:"button",tabIndex:0,onClick:n,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n())},sx:{border:`1px solid ${t.border}`,borderRadius:1,p:1.25,cursor:"pointer",background:t.surface,"&:hover":{background:t.surfaceHover}},children:a.jsxs(f.Stack,{direction:"row",alignItems:"flex-start",spacing:1,children:[a.jsxs(f.Box,{sx:{minWidth:0,flex:1},children:[a.jsx(f.Typography,{variant:"caption",sx:{color:t.textTertiary,display:"block"},children:e.recordType}),a.jsx(f.Tooltip,{title:e.title,placement:"top-start",children:a.jsx(f.Typography,{variant:"body2",noWrap:!0,sx:{color:t.textPrimary,fontWeight:500},children:e.title})}),e.fields.map(o=>a.jsxs(f.Stack,{direction:"row",spacing:.5,sx:{minWidth:0},children:[a.jsxs(f.Typography,{variant:"caption",sx:{color:t.textTertiary,flexShrink:0},children:[o.label,":"]}),a.jsx(f.Typography,{variant:"caption",noWrap:!0,title:o.value,sx:{color:o.tone==="critical"?t.negative:t.textSecondary},children:o.value})]},o.label))]}),e.deepLink&&a.jsx(f.Tooltip,{title:"Open in app",children:a.jsx(f.Box,{component:"button",type:"button","aria-label":"Open in app",onClick:o=>{o.stopPropagation(),r()},sx:{display:"flex",border:"none",background:"none",p:0,cursor:"pointer",color:t.iconSecondary},children:a.jsx(f.icons.OpenInNew,{sx:{fontSize:16}})})})]})}),qJ=({app:e,tokens:t,onCreate:n,onSearchLink:r})=>a.jsxs(f.Stack,{direction:"row",spacing:1,children:[e.createLabel&&a.jsx(f.Button,{variant:"contained",size:"small",fullWidth:!0,sx:{background:t.primaryAction,color:t.onAccent,"&:hover":{background:t.primaryActionHover}},onClick:n,children:e.createLabel}),a.jsx(f.Button,{variant:"outlined",size:"small",fullWidth:!0,sx:{borderColor:t.borderStrong,color:t.textPrimary},onClick:r,children:DJ})]}),UJ=()=>a.jsxs(f.Stack,{"data-testid":"app-widget-loading",spacing:1,sx:{pb:1},children:[a.jsx(f.Skeleton,{variant:"rounded",height:64}),a.jsx(f.Skeleton,{variant:"rounded",height:64})]}),KJ=({app:e,appName:t,isAdmin:n,adminNotified:r,tokens:o,onReconnect:u,onNotifyAdmin:s})=>a.jsxs(f.Stack,{"data-testid":"app-widget-disconnected",spacing:1,sx:{pb:1},children:[a.jsx(f.Typography,{variant:"body2",sx:{color:o.textSecondary,fontSize:13},children:aJ(e,t,n)}),n?a.jsx(f.Button,{variant:"contained",size:"small",onClick:u,children:sJ(t)}):a.jsx(f.Button,{variant:"outlined",size:"small",disabled:r,onClick:s,children:r?iJ:fJ})]}),K6=({theme:e,children:t})=>{const n=ko(e),r=p.useMemo(()=>({...n,display:"contents"}),[n]);return a.jsx("span",{className:"connector-theme-root","data-color-scheme":e.mode,style:r,children:a.jsx(qr,{config:e,children:t})})},$J=({theme:e=mr,...t})=>a.jsx(K6,{theme:e,children:a.jsx(_6,{children:a.jsx(zJ,{...t})})}),eY=({theme:e=mr,...t})=>a.jsx(K6,{theme:e,children:a.jsx(_6,{children:a.jsx(XJ,{...t})})});ge.APP_WIDGET_EVENTS=yr,ge.ActionQueue=IH,ge.AppWidgetBody=eY,ge.AppWidgetSummary=$J,ge.CONNECTORS_AGENT_EVENTS=jR,ge.ConnectorCardList=_R,ge.EmailLogger=QG,ge.GmailLogObserver=PG,ge.HigSlackConnectModalIsland=y6,ge.HigSlackSection=PZ,ge.HigSlackSectionBody=QZ,ge.HigSlackTab=EZ,ge.HiverConnectorBifrostAuth=Ee,ge.IntegrationSense=BH,ge.OmniEmailLogger=FV,ge.OmniSlackTab=gZ,ge.SLACK_LINKS_API=sg,ge.SlackConnectModalIsland=y6,ge.SlackLinkActionsIsland=hZ,ge.SplitAppsNudge=rJ,ge.addNewConnectors=Eh,ge.appWidgetSummaryText=N6,ge.connectorThemeDefaults=Vf,ge.createAppStore=ZZ,ge.dismissNotification=od,ge.fetchAppCfValues=WZ,ge.fetchDeferredAppCfValues=GZ,ge.getAppWidgetSpec=Xl,ge.getConnectorsBifrostConfigs=an,ge.getMetaData=AI,ge.initConnectorsBifrost=cm,ge.loadAppWidgetModel=GJ,ge.resolveConnectorThemeTokens=F1,ge.setCaptureFeedbackOnDemand=bh,ge.shouldCaptureFeedback=A0,ge.shouldShowNotification=rd,ge.useConnectorSelectedEmail=AR,ge.useSlackLinksSummary=HZ,ge.useSlackTabLabel=RZ,Object.defineProperty(ge,Symbol.toStringTag,{value:"Module"})});
|