@fluid-app/rep-core 0.1.14 → 0.1.16
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/dist/chunk-CKQMccvm.cjs +28 -0
- package/dist/data-sources/DataAwareWidget.cjs +47 -56
- package/dist/data-sources/DataAwareWidget.cjs.map +1 -1
- package/dist/data-sources/DataAwareWidget.d.cts +27 -19
- package/dist/data-sources/DataAwareWidget.d.cts.map +1 -0
- package/dist/data-sources/DataAwareWidget.d.mts +38 -0
- package/dist/data-sources/DataAwareWidget.d.mts.map +1 -0
- package/dist/data-sources/DataAwareWidget.mjs +48 -0
- package/dist/data-sources/DataAwareWidget.mjs.map +1 -0
- package/dist/data-sources/ErrorState.cjs +18 -10
- package/dist/data-sources/ErrorState.cjs.map +1 -1
- package/dist/data-sources/ErrorState.d.cts +5 -3
- package/dist/data-sources/ErrorState.d.cts.map +1 -0
- package/dist/data-sources/ErrorState.d.mts +7 -0
- package/dist/data-sources/ErrorState.d.mts.map +1 -0
- package/dist/data-sources/ErrorState.mjs +18 -0
- package/dist/data-sources/ErrorState.mjs.map +1 -0
- package/dist/data-sources/context.cjs +22 -14
- package/dist/data-sources/context.cjs.map +1 -1
- package/dist/data-sources/context.d.cts +16 -10
- package/dist/data-sources/context.d.cts.map +1 -0
- package/dist/data-sources/context.d.mts +22 -0
- package/dist/data-sources/context.d.mts.map +1 -0
- package/dist/data-sources/context.mjs +21 -0
- package/dist/data-sources/context.mjs.map +1 -0
- package/dist/data-sources/fetchers/api.cjs +63 -10
- package/dist/data-sources/fetchers/api.cjs.map +1 -1
- package/dist/data-sources/fetchers/api.d.cts +4 -2
- package/dist/data-sources/fetchers/api.d.cts.map +1 -0
- package/dist/data-sources/fetchers/api.d.mts +10 -0
- package/dist/data-sources/fetchers/api.d.mts.map +1 -0
- package/dist/data-sources/fetchers/api.mjs +64 -0
- package/dist/data-sources/fetchers/api.mjs.map +1 -0
- package/dist/data-sources/fetchers/custom.cjs +106 -10
- package/dist/data-sources/fetchers/custom.cjs.map +1 -1
- package/dist/data-sources/fetchers/custom.d.cts +4 -2
- package/dist/data-sources/fetchers/custom.d.cts.map +1 -0
- package/dist/data-sources/fetchers/{custom.d.ts → custom.d.mts} +4 -2
- package/dist/data-sources/fetchers/custom.d.mts.map +1 -0
- package/dist/data-sources/fetchers/custom.mjs +107 -0
- package/dist/data-sources/fetchers/custom.mjs.map +1 -0
- package/dist/data-sources/fetchers/static.cjs +159 -14
- package/dist/data-sources/fetchers/static.cjs.map +1 -1
- package/dist/data-sources/fetchers/static.d.cts +12 -10
- package/dist/data-sources/fetchers/static.d.cts.map +1 -0
- package/dist/data-sources/fetchers/{static.d.ts → static.d.mts} +12 -10
- package/dist/data-sources/fetchers/static.d.mts.map +1 -0
- package/dist/data-sources/fetchers/static.mjs +158 -0
- package/dist/data-sources/fetchers/static.mjs.map +1 -0
- package/dist/data-sources/preview-context.cjs +15 -15
- package/dist/data-sources/preview-context.cjs.map +1 -1
- package/dist/data-sources/preview-context.d.cts +10 -6
- package/dist/data-sources/preview-context.d.cts.map +1 -0
- package/dist/data-sources/preview-context.d.mts +15 -0
- package/dist/data-sources/preview-context.d.mts.map +1 -0
- package/dist/data-sources/preview-context.mjs +18 -0
- package/dist/data-sources/preview-context.mjs.map +1 -0
- package/dist/data-sources/registry-context.cjs +51 -24
- package/dist/data-sources/registry-context.cjs.map +1 -1
- package/dist/data-sources/registry-context.d.cts +30 -22
- package/dist/data-sources/registry-context.d.cts.map +1 -0
- package/dist/data-sources/registry-context.d.mts +49 -0
- package/dist/data-sources/registry-context.d.mts.map +1 -0
- package/dist/data-sources/registry-context.mjs +49 -0
- package/dist/data-sources/registry-context.mjs.map +1 -0
- package/dist/data-sources/registry.cjs +29 -18
- package/dist/data-sources/registry.cjs.map +1 -1
- package/dist/data-sources/registry.d.cts +9 -7
- package/dist/data-sources/registry.d.cts.map +1 -0
- package/dist/data-sources/registry.d.mts +19 -0
- package/dist/data-sources/registry.d.mts.map +1 -0
- package/dist/data-sources/registry.mjs +29 -0
- package/dist/data-sources/registry.mjs.map +1 -0
- package/dist/data-sources/transformers.cjs +152 -10
- package/dist/data-sources/transformers.cjs.map +1 -1
- package/dist/data-sources/transformers.d.cts +4 -17
- package/dist/data-sources/transformers.d.cts.map +1 -0
- package/dist/data-sources/transformers.d.mts +10 -0
- package/dist/data-sources/transformers.d.mts.map +1 -0
- package/dist/data-sources/transformers.mjs +153 -0
- package/dist/data-sources/transformers.mjs.map +1 -0
- package/dist/data-sources/types.cjs +0 -4
- package/dist/data-sources/types.d.cts +2 -157
- package/dist/data-sources/types.d.mts +2 -0
- package/dist/data-sources/types.mjs +1 -0
- package/dist/data-sources/use-widget-data.cjs +109 -17
- package/dist/data-sources/use-widget-data.cjs.map +1 -1
- package/dist/data-sources/use-widget-data.d.cts +9 -8
- package/dist/data-sources/use-widget-data.d.cts.map +1 -0
- package/dist/data-sources/use-widget-data.d.mts +17 -0
- package/dist/data-sources/use-widget-data.d.mts.map +1 -0
- package/dist/data-sources/use-widget-data.mjs +109 -0
- package/dist/data-sources/use-widget-data.mjs.map +1 -0
- package/dist/index-Bxe_LIi8.d.cts +287 -0
- package/dist/index-Bxe_LIi8.d.cts.map +1 -0
- package/dist/index-CCAu2n19.d.mts +287 -0
- package/dist/index-CCAu2n19.d.mts.map +1 -0
- package/dist/registries/index.cjs +212 -127
- package/dist/registries/index.cjs.map +1 -1
- package/dist/registries/index.d.cts +146 -149
- package/dist/registries/index.d.cts.map +1 -0
- package/dist/registries/{index.d.ts → index.d.mts} +146 -149
- package/dist/registries/index.d.mts.map +1 -0
- package/dist/registries/index.mjs +229 -0
- package/dist/registries/index.mjs.map +1 -0
- package/dist/shell/AppShellLayout.cjs +47 -12
- package/dist/shell/AppShellLayout.cjs.map +1 -1
- package/dist/shell/AppShellLayout.d.cts +29 -19
- package/dist/shell/AppShellLayout.d.cts.map +1 -0
- package/dist/shell/AppShellLayout.d.mts +40 -0
- package/dist/shell/AppShellLayout.d.mts.map +1 -0
- package/dist/shell/AppShellLayout.mjs +46 -0
- package/dist/{chunk-45BCVWQK.cjs.map → shell/AppShellLayout.mjs.map} +1 -1
- package/dist/shell/ScreenHeader.cjs +44 -0
- package/dist/shell/ScreenHeader.cjs.map +1 -0
- package/dist/shell/ScreenHeader.d.cts +12 -0
- package/dist/shell/ScreenHeader.d.cts.map +1 -0
- package/dist/shell/ScreenHeader.d.mts +12 -0
- package/dist/shell/ScreenHeader.d.mts.map +1 -0
- package/dist/shell/ScreenHeader.mjs +42 -0
- package/dist/shell/ScreenHeader.mjs.map +1 -0
- package/dist/shell/ScreenHeaderContext.cjs +91 -0
- package/dist/shell/ScreenHeaderContext.cjs.map +1 -0
- package/dist/shell/ScreenHeaderContext.d.cts +36 -0
- package/dist/shell/ScreenHeaderContext.d.cts.map +1 -0
- package/dist/shell/ScreenHeaderContext.d.mts +36 -0
- package/dist/shell/ScreenHeaderContext.d.mts.map +1 -0
- package/dist/shell/ScreenHeaderContext.mjs +86 -0
- package/dist/shell/ScreenHeaderContext.mjs.map +1 -0
- package/dist/shell/ThemeModeContext.cjs +68 -18
- package/dist/shell/ThemeModeContext.cjs.map +1 -1
- package/dist/shell/ThemeModeContext.d.cts +23 -16
- package/dist/shell/ThemeModeContext.d.cts.map +1 -0
- package/dist/shell/ThemeModeContext.d.mts +34 -0
- package/dist/shell/ThemeModeContext.d.mts.map +1 -0
- package/dist/shell/ThemeModeContext.mjs +66 -0
- package/dist/shell/ThemeModeContext.mjs.map +1 -0
- package/dist/shell/index.cjs +43 -205
- package/dist/shell/index.d.cts +7 -43
- package/dist/shell/index.d.mts +7 -0
- package/dist/shell/index.mjs +7 -0
- package/dist/shell/sidebar.cjs +372 -87
- package/dist/shell/sidebar.cjs.map +1 -1
- package/dist/shell/sidebar.d.cts +38 -36
- package/dist/shell/sidebar.d.cts.map +1 -0
- package/dist/shell/{sidebar.d.ts → sidebar.d.mts} +38 -36
- package/dist/shell/sidebar.d.mts.map +1 -0
- package/dist/shell/sidebar.mjs +364 -0
- package/dist/{chunk-PFDBULOI.cjs.map → shell/sidebar.mjs.map} +1 -1
- package/dist/shell/use-mobile.cjs +49 -18
- package/dist/shell/use-mobile.cjs.map +1 -1
- package/dist/shell/use-mobile.d.cts +3 -1
- package/dist/shell/use-mobile.d.cts.map +1 -0
- package/dist/shell/{use-mobile.d.ts → use-mobile.d.mts} +3 -1
- package/dist/shell/use-mobile.d.mts.map +1 -0
- package/dist/shell/use-mobile.mjs +47 -0
- package/dist/shell/use-mobile.mjs.map +1 -0
- package/dist/theme/index.cjs +663 -549
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.cts +32 -32
- package/dist/theme/index.d.cts.map +1 -0
- package/dist/theme/{index.d.ts → index.d.mts} +32 -32
- package/dist/theme/index.d.mts.map +1 -0
- package/dist/theme/index.mjs +728 -0
- package/dist/theme/index.mjs.map +1 -0
- package/dist/types/index.cjs +18 -72
- package/dist/types/index.d.cts +4 -268
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types-BIXtQlHB.d.cts +155 -0
- package/dist/types-BIXtQlHB.d.cts.map +1 -0
- package/dist/types-BXFX9bXp.cjs +303 -0
- package/dist/types-BXFX9bXp.cjs.map +1 -0
- package/dist/types-Bjmd7Fdx.mjs +208 -0
- package/dist/types-Bjmd7Fdx.mjs.map +1 -0
- package/dist/types-ByG6Xy3C.d.mts +85 -0
- package/dist/types-ByG6Xy3C.d.mts.map +1 -0
- package/dist/types-C5OFJy-O.d.mts +155 -0
- package/dist/types-C5OFJy-O.d.mts.map +1 -0
- package/dist/types-Ctu-Zio6.d.cts +85 -0
- package/dist/types-Ctu-Zio6.d.cts.map +1 -0
- package/dist/{widget-schema-D-ca3--K.d.ts → widget-schema--PY1uMWx.d.cts} +38 -41
- package/dist/widget-schema--PY1uMWx.d.cts.map +1 -0
- package/dist/{widget-schema-DvJdg1-B.d.cts → widget-schema-YkD5p3v4.d.mts} +38 -41
- package/dist/widget-schema-YkD5p3v4.d.mts.map +1 -0
- package/dist/widget-utils/index.cjs +96 -89
- package/dist/widget-utils/index.cjs.map +1 -1
- package/dist/widget-utils/index.d.cts +8 -6
- package/dist/widget-utils/index.d.cts.map +1 -0
- package/dist/widget-utils/{index.d.ts → index.d.mts} +8 -6
- package/dist/widget-utils/index.d.mts.map +1 -0
- package/dist/widget-utils/index.mjs +119 -0
- package/dist/widget-utils/index.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/chunk-2SPTFZRC.js +0 -72
- package/dist/chunk-2SPTFZRC.js.map +0 -1
- package/dist/chunk-3I5Y3PEO.js +0 -23
- package/dist/chunk-3I5Y3PEO.js.map +0 -1
- package/dist/chunk-3ZRE7GX6.js +0 -620
- package/dist/chunk-3ZRE7GX6.js.map +0 -1
- package/dist/chunk-45BCVWQK.cjs +0 -38
- package/dist/chunk-46PUWB7C.cjs +0 -69
- package/dist/chunk-46PUWB7C.cjs.map +0 -1
- package/dist/chunk-5NYM4UTW.cjs +0 -58
- package/dist/chunk-5NYM4UTW.cjs.map +0 -1
- package/dist/chunk-B2NTWEDF.cjs +0 -130
- package/dist/chunk-B2NTWEDF.cjs.map +0 -1
- package/dist/chunk-GDY76JA6.cjs +0 -153
- package/dist/chunk-GDY76JA6.cjs.map +0 -1
- package/dist/chunk-HGVSPZEL.cjs +0 -119
- package/dist/chunk-HGVSPZEL.cjs.map +0 -1
- package/dist/chunk-HIDJYVKJ.js +0 -54
- package/dist/chunk-HIDJYVKJ.js.map +0 -1
- package/dist/chunk-KTXGU7OP.cjs +0 -136
- package/dist/chunk-KTXGU7OP.cjs.map +0 -1
- package/dist/chunk-KW5E2H5T.js +0 -128
- package/dist/chunk-KW5E2H5T.js.map +0 -1
- package/dist/chunk-LBLHDGMT.js +0 -25
- package/dist/chunk-LBLHDGMT.js.map +0 -1
- package/dist/chunk-MNVDL4FX.js +0 -134
- package/dist/chunk-MNVDL4FX.js.map +0 -1
- package/dist/chunk-MOTOSPAO.cjs +0 -15
- package/dist/chunk-MOTOSPAO.cjs.map +0 -1
- package/dist/chunk-N2K6W7FX.cjs +0 -169
- package/dist/chunk-N2K6W7FX.cjs.map +0 -1
- package/dist/chunk-PFDBULOI.cjs +0 -665
- package/dist/chunk-PVTQWD4I.js +0 -166
- package/dist/chunk-PVTQWD4I.js.map +0 -1
- package/dist/chunk-SJQPHJL4.cjs +0 -26
- package/dist/chunk-SJQPHJL4.cjs.map +0 -1
- package/dist/chunk-TML66UEU.js +0 -13
- package/dist/chunk-TML66UEU.js.map +0 -1
- package/dist/chunk-U3CQLX2Z.cjs +0 -28
- package/dist/chunk-U3CQLX2Z.cjs.map +0 -1
- package/dist/chunk-UUNEVOA5.js +0 -36
- package/dist/chunk-UUNEVOA5.js.map +0 -1
- package/dist/chunk-VRF7QEID.js +0 -67
- package/dist/chunk-VRF7QEID.js.map +0 -1
- package/dist/chunk-VSZWXSQA.js +0 -38
- package/dist/chunk-VSZWXSQA.js.map +0 -1
- package/dist/chunk-WYOHFNNW.js +0 -117
- package/dist/chunk-WYOHFNNW.js.map +0 -1
- package/dist/chunk-YKF5ZFF5.js +0 -136
- package/dist/chunk-YKF5ZFF5.js.map +0 -1
- package/dist/chunk-YXJMBVXO.cjs +0 -76
- package/dist/chunk-YXJMBVXO.cjs.map +0 -1
- package/dist/chunk-ZA4AE7KF.cjs +0 -42
- package/dist/chunk-ZA4AE7KF.cjs.map +0 -1
- package/dist/data-sources/DataAwareWidget.d.ts +0 -30
- package/dist/data-sources/DataAwareWidget.js +0 -57
- package/dist/data-sources/DataAwareWidget.js.map +0 -1
- package/dist/data-sources/ErrorState.d.ts +0 -5
- package/dist/data-sources/ErrorState.js +0 -3
- package/dist/data-sources/ErrorState.js.map +0 -1
- package/dist/data-sources/context.d.ts +0 -16
- package/dist/data-sources/context.js +0 -3
- package/dist/data-sources/context.js.map +0 -1
- package/dist/data-sources/fetchers/api.d.ts +0 -8
- package/dist/data-sources/fetchers/api.js +0 -3
- package/dist/data-sources/fetchers/api.js.map +0 -1
- package/dist/data-sources/fetchers/custom.js +0 -3
- package/dist/data-sources/fetchers/custom.js.map +0 -1
- package/dist/data-sources/fetchers/static.js +0 -3
- package/dist/data-sources/fetchers/static.js.map +0 -1
- package/dist/data-sources/preview-context.d.ts +0 -11
- package/dist/data-sources/preview-context.js +0 -18
- package/dist/data-sources/preview-context.js.map +0 -1
- package/dist/data-sources/registry-context.d.ts +0 -41
- package/dist/data-sources/registry-context.js +0 -9
- package/dist/data-sources/registry-context.js.map +0 -1
- package/dist/data-sources/registry.d.ts +0 -17
- package/dist/data-sources/registry.js +0 -7
- package/dist/data-sources/registry.js.map +0 -1
- package/dist/data-sources/transformers.d.ts +0 -23
- package/dist/data-sources/transformers.js +0 -3
- package/dist/data-sources/transformers.js.map +0 -1
- package/dist/data-sources/types.cjs.map +0 -1
- package/dist/data-sources/types.d.ts +0 -157
- package/dist/data-sources/types.js +0 -3
- package/dist/data-sources/types.js.map +0 -1
- package/dist/data-sources/use-widget-data.d.ts +0 -16
- package/dist/data-sources/use-widget-data.js +0 -10
- package/dist/data-sources/use-widget-data.js.map +0 -1
- package/dist/registries/index.js +0 -144
- package/dist/registries/index.js.map +0 -1
- package/dist/shareable-item-DkgWpwoU.d.cts +0 -21
- package/dist/shareable-item-DkgWpwoU.d.ts +0 -21
- package/dist/shell/AppShellLayout.d.ts +0 -30
- package/dist/shell/AppShellLayout.js +0 -5
- package/dist/shell/AppShellLayout.js.map +0 -1
- package/dist/shell/ThemeModeContext.d.ts +0 -27
- package/dist/shell/ThemeModeContext.js +0 -3
- package/dist/shell/ThemeModeContext.js.map +0 -1
- package/dist/shell/index.cjs.map +0 -1
- package/dist/shell/index.d.ts +0 -43
- package/dist/shell/index.js +0 -76
- package/dist/shell/index.js.map +0 -1
- package/dist/shell/sidebar.js +0 -4
- package/dist/shell/sidebar.js.map +0 -1
- package/dist/shell/use-mobile.js +0 -3
- package/dist/shell/use-mobile.js.map +0 -1
- package/dist/theme/index.js +0 -611
- package/dist/theme/index.js.map +0 -1
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.d.ts +0 -268
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types-CNIhy4JD.d.cts +0 -83
- package/dist/types-CNIhy4JD.d.ts +0 -83
- package/dist/widget-utils/index.js +0 -111
- package/dist/widget-utils/index.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
Object.defineProperty(exports, "__toESM", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return __toESM;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -1,59 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
require(
|
|
6
|
-
require(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
className: "bg-muted animate-pulse rounded-md",
|
|
42
|
-
style: { minHeight: 100 },
|
|
43
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
if (error && !data) {
|
|
48
|
-
if (errorComponent) {
|
|
49
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: errorComponent(error) });
|
|
50
|
-
}
|
|
51
|
-
return /* @__PURE__ */ jsxRuntime.jsx(chunkMOTOSPAO_cjs.ErrorState, {});
|
|
52
|
-
}
|
|
53
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...mergedProps });
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../chunk-CKQMccvm.cjs");
|
|
3
|
+
const require_data_sources_use_widget_data = require("./use-widget-data.cjs");
|
|
4
|
+
const require_data_sources_ErrorState = require("./ErrorState.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
//#region src/data-sources/DataAwareWidget.tsx
|
|
8
|
+
const EMPTY_OBJECT = {};
|
|
9
|
+
/**
|
|
10
|
+
* Wrapper component that resolves data sources before rendering the widget.
|
|
11
|
+
* Merges resolved data with static props.
|
|
12
|
+
*/
|
|
13
|
+
function DataAwareWidgetImpl({ widget, Component, additionalProps, loadingComponent, errorComponent, baseUrl }) {
|
|
14
|
+
const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;
|
|
15
|
+
const { data, isLoading, error } = require_data_sources_use_widget_data.useWidgetData(widget, { baseUrl });
|
|
16
|
+
const mergedProps = (0, react.useMemo)(() => ({
|
|
17
|
+
...widget.props,
|
|
18
|
+
...data,
|
|
19
|
+
...stableAdditionalProps
|
|
20
|
+
}), [
|
|
21
|
+
widget.props,
|
|
22
|
+
data,
|
|
23
|
+
stableAdditionalProps
|
|
24
|
+
]);
|
|
25
|
+
if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {
|
|
26
|
+
if (loadingComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: loadingComponent });
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
28
|
+
className: "bg-muted animate-pulse rounded-md",
|
|
29
|
+
style: { minHeight: 100 },
|
|
30
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
31
|
+
className: "sr-only",
|
|
32
|
+
children: "Loading..."
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (error && !data) {
|
|
37
|
+
if (errorComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: errorComponent(error) });
|
|
38
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_data_sources_ErrorState.ErrorState, {});
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { ...mergedProps });
|
|
54
41
|
}
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Memoized wrapper component that resolves data sources before rendering the widget.
|
|
44
|
+
* Prevents re-renders when parent re-renders but props haven't changed.
|
|
45
|
+
*/
|
|
46
|
+
const DataAwareWidget = (0, react.memo)(DataAwareWidgetImpl);
|
|
47
|
+
//#endregion
|
|
57
48
|
exports.DataAwareWidget = DataAwareWidget;
|
|
58
|
-
|
|
49
|
+
|
|
59
50
|
//# sourceMappingURL=DataAwareWidget.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"DataAwareWidget.cjs","names":["useWidgetData","ErrorState"],"sources":["../../src/data-sources/DataAwareWidget.tsx"],"sourcesContent":["import { memo, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport type { WidgetSchema } from \"../types/widget-schema\";\nimport { useWidgetData } from \"./use-widget-data\";\nimport { ErrorState } from \"./ErrorState\";\n\nexport interface DataAwareWidgetProps {\n widget: WidgetSchema;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Component: ComponentType<any>;\n /** Additional props to pass through (e.g., edit mode callbacks) */\n additionalProps?: Record<string, unknown>;\n /** Custom loading component */\n loadingComponent?: ReactNode;\n /** Custom error component */\n errorComponent?: (error: Error) => ReactNode;\n /** Base URL for API calls (e.g., \"https://api.fluid.app/api\") */\n baseUrl?: string | undefined;\n}\n\n// Empty object constant to avoid creating new references\nconst EMPTY_OBJECT: Record<string, unknown> = {};\n\n/**\n * Wrapper component that resolves data sources before rendering the widget.\n * Merges resolved data with static props.\n */\nfunction DataAwareWidgetImpl({\n widget,\n Component,\n additionalProps,\n loadingComponent,\n errorComponent,\n baseUrl,\n}: DataAwareWidgetProps) {\n // Use stable empty object if no additionalProps provided\n const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;\n const { data, isLoading, error } = useWidgetData(widget, { baseUrl });\n\n // Merge static props with resolved data\n // Data takes precedence (allows overriding defaults)\n // Memoized to prevent unnecessary child re-renders\n // Note: Must be called before any early returns to satisfy Rules of Hooks\n const mergedProps = useMemo(\n () => ({\n ...widget.props,\n ...data,\n ...stableAdditionalProps,\n }),\n [widget.props, data, stableAdditionalProps],\n );\n\n // Show loading state\n if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Default skeleton - can be customized\n return (\n <div\n className=\"bg-muted animate-pulse rounded-md\"\n style={{ minHeight: 100 }}\n >\n <span className=\"sr-only\">Loading...</span>\n </div>\n );\n }\n\n // Show error state (if no fallback was applied)\n if (error && !data) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n // Default error display\n return <ErrorState />;\n }\n\n return <Component {...mergedProps} />;\n}\n\n/**\n * Memoized wrapper component that resolves data sources before rendering the widget.\n * Prevents re-renders when parent re-renders but props haven't changed.\n */\nexport const DataAwareWidget = memo(DataAwareWidgetImpl);\n"],"mappings":";;;;;;;AAoBA,MAAM,eAAwC,EAAE;;;;;AAMhD,SAAS,oBAAoB,EAC3B,QACA,WACA,iBACA,kBACA,gBACA,WACuB;CAEvB,MAAM,wBAAwB,mBAAmB;CACjD,MAAM,EAAE,MAAM,WAAW,UAAUA,qCAAAA,cAAc,QAAQ,EAAE,SAAS,CAAC;CAMrE,MAAM,eAAA,GAAA,MAAA,gBACG;EACL,GAAG,OAAO;EACV,GAAG;EACH,GAAG;EACJ,GACD;EAAC,OAAO;EAAO;EAAM;EAAsB,CAC5C;AAGD,KAAI,aAAa,OAAO,YAAY,SAAS,iBAAiB,OAAO;AACnE,MAAI,iBACF,QAAO,iBAAA,GAAA,kBAAA,KAAA,kBAAA,UAAA,EAAA,UAAG,kBAAoB,CAAA;AAGhC,SACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACE,WAAU;GACV,OAAO,EAAE,WAAW,KAAK;aAEzB,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,WAAU;cAAU;IAAiB,CAAA;GACvC,CAAA;;AAKV,KAAI,SAAS,CAAC,MAAM;AAClB,MAAI,eACF,QAAO,iBAAA,GAAA,kBAAA,KAAA,kBAAA,UAAA,EAAA,UAAG,eAAe,MAAM,EAAI,CAAA;AAGrC,SAAO,iBAAA,GAAA,kBAAA,KAACC,gCAAAA,YAAD,EAAc,CAAA;;AAGvB,QAAO,iBAAA,GAAA,kBAAA,KAAC,WAAD,EAAW,GAAI,aAAe,CAAA;;;;;;AAOvC,MAAa,mBAAA,GAAA,MAAA,MAAuB,oBAAoB"}
|
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import './types.cjs';
|
|
1
|
+
import { a as WidgetSchema } from "../widget-schema--PY1uMWx.cjs";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
import { ComponentType, ReactNode } from "react";
|
|
6
5
|
|
|
6
|
+
//#region src/data-sources/DataAwareWidget.d.ts
|
|
7
7
|
interface DataAwareWidgetProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
widget: WidgetSchema;
|
|
9
|
+
Component: ComponentType<any>;
|
|
10
|
+
/** Additional props to pass through (e.g., edit mode callbacks) */
|
|
11
|
+
additionalProps?: Record<string, unknown>;
|
|
12
|
+
/** Custom loading component */
|
|
13
|
+
loadingComponent?: ReactNode;
|
|
14
|
+
/** Custom error component */
|
|
15
|
+
errorComponent?: (error: Error) => ReactNode;
|
|
16
|
+
/** Base URL for API calls (e.g., "https://api.fluid.app/api") */
|
|
17
|
+
baseUrl?: string | undefined;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Wrapper component that resolves data sources before rendering the widget.
|
|
21
21
|
* Merges resolved data with static props.
|
|
22
22
|
*/
|
|
23
|
-
declare function DataAwareWidgetImpl({
|
|
23
|
+
declare function DataAwareWidgetImpl({
|
|
24
|
+
widget,
|
|
25
|
+
Component,
|
|
26
|
+
additionalProps,
|
|
27
|
+
loadingComponent,
|
|
28
|
+
errorComponent,
|
|
29
|
+
baseUrl
|
|
30
|
+
}: DataAwareWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
24
31
|
/**
|
|
25
32
|
* Memoized wrapper component that resolves data sources before rendering the widget.
|
|
26
33
|
* Prevents re-renders when parent re-renders but props haven't changed.
|
|
27
34
|
*/
|
|
28
|
-
declare const DataAwareWidget:
|
|
29
|
-
|
|
30
|
-
export { DataAwareWidget,
|
|
35
|
+
declare const DataAwareWidget: react.MemoExoticComponent<typeof DataAwareWidgetImpl>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { DataAwareWidget, DataAwareWidgetProps };
|
|
38
|
+
//# sourceMappingURL=DataAwareWidget.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataAwareWidget.d.cts","names":[],"sources":["../../src/data-sources/DataAwareWidget.tsx"],"mappings":";;;;;;UAKiB,oBAAA;EACf,MAAA,EAAQ,YAAA;EAER,SAAA,EAAW,aAAA;;EAEX,eAAA,GAAkB,MAAA;EALiB;EAOnC,gBAAA,GAAmB,SAAA;EANX;EAQR,cAAA,IAAkB,KAAA,EAAO,KAAA,KAAU,SAAA;EAJjB;EAMlB,OAAA;AAAA;;;;;iBAUO,mBAAA,CAAA;EACP,MAAA;EACA,SAAA;EACA,eAAA;EACA,gBAAA;EACA,cAAA;EACA;AAAA,GACC,oBAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;cAkDV,eAAA,EAAe,KAAA,CAAA,mBAAA,QAAA,mBAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { a as WidgetSchema } from "../widget-schema-YkD5p3v4.mjs";
|
|
2
|
+
import * as react from "react";
|
|
3
|
+
import { ComponentType, ReactNode } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/data-sources/DataAwareWidget.d.ts
|
|
7
|
+
interface DataAwareWidgetProps {
|
|
8
|
+
widget: WidgetSchema;
|
|
9
|
+
Component: ComponentType<any>;
|
|
10
|
+
/** Additional props to pass through (e.g., edit mode callbacks) */
|
|
11
|
+
additionalProps?: Record<string, unknown>;
|
|
12
|
+
/** Custom loading component */
|
|
13
|
+
loadingComponent?: ReactNode;
|
|
14
|
+
/** Custom error component */
|
|
15
|
+
errorComponent?: (error: Error) => ReactNode;
|
|
16
|
+
/** Base URL for API calls (e.g., "https://api.fluid.app/api") */
|
|
17
|
+
baseUrl?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Wrapper component that resolves data sources before rendering the widget.
|
|
21
|
+
* Merges resolved data with static props.
|
|
22
|
+
*/
|
|
23
|
+
declare function DataAwareWidgetImpl({
|
|
24
|
+
widget,
|
|
25
|
+
Component,
|
|
26
|
+
additionalProps,
|
|
27
|
+
loadingComponent,
|
|
28
|
+
errorComponent,
|
|
29
|
+
baseUrl
|
|
30
|
+
}: DataAwareWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* Memoized wrapper component that resolves data sources before rendering the widget.
|
|
33
|
+
* Prevents re-renders when parent re-renders but props haven't changed.
|
|
34
|
+
*/
|
|
35
|
+
declare const DataAwareWidget: react.MemoExoticComponent<typeof DataAwareWidgetImpl>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { DataAwareWidget, DataAwareWidgetProps };
|
|
38
|
+
//# sourceMappingURL=DataAwareWidget.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataAwareWidget.d.mts","names":[],"sources":["../../src/data-sources/DataAwareWidget.tsx"],"mappings":";;;;;;UAKiB,oBAAA;EACf,MAAA,EAAQ,YAAA;EAER,SAAA,EAAW,aAAA;;EAEX,eAAA,GAAkB,MAAA;EALiB;EAOnC,gBAAA,GAAmB,SAAA;EANX;EAQR,cAAA,IAAkB,KAAA,EAAO,KAAA,KAAU,SAAA;EAJjB;EAMlB,OAAA;AAAA;;;;;iBAUO,mBAAA,CAAA;EACP,MAAA;EACA,SAAA;EACA,eAAA;EACA,gBAAA;EACA,cAAA;EACA;AAAA,GACC,oBAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;cAkDV,eAAA,EAAe,KAAA,CAAA,mBAAA,QAAA,mBAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useWidgetData } from "./use-widget-data.mjs";
|
|
2
|
+
import { ErrorState } from "./ErrorState.mjs";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/data-sources/DataAwareWidget.tsx
|
|
6
|
+
const EMPTY_OBJECT = {};
|
|
7
|
+
/**
|
|
8
|
+
* Wrapper component that resolves data sources before rendering the widget.
|
|
9
|
+
* Merges resolved data with static props.
|
|
10
|
+
*/
|
|
11
|
+
function DataAwareWidgetImpl({ widget, Component, additionalProps, loadingComponent, errorComponent, baseUrl }) {
|
|
12
|
+
const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;
|
|
13
|
+
const { data, isLoading, error } = useWidgetData(widget, { baseUrl });
|
|
14
|
+
const mergedProps = useMemo(() => ({
|
|
15
|
+
...widget.props,
|
|
16
|
+
...data,
|
|
17
|
+
...stableAdditionalProps
|
|
18
|
+
}), [
|
|
19
|
+
widget.props,
|
|
20
|
+
data,
|
|
21
|
+
stableAdditionalProps
|
|
22
|
+
]);
|
|
23
|
+
if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {
|
|
24
|
+
if (loadingComponent) return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
|
|
25
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26
|
+
className: "bg-muted animate-pulse rounded-md",
|
|
27
|
+
style: { minHeight: 100 },
|
|
28
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
29
|
+
className: "sr-only",
|
|
30
|
+
children: "Loading..."
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (error && !data) {
|
|
35
|
+
if (errorComponent) return /* @__PURE__ */ jsx(Fragment, { children: errorComponent(error) });
|
|
36
|
+
return /* @__PURE__ */ jsx(ErrorState, {});
|
|
37
|
+
}
|
|
38
|
+
return /* @__PURE__ */ jsx(Component, { ...mergedProps });
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Memoized wrapper component that resolves data sources before rendering the widget.
|
|
42
|
+
* Prevents re-renders when parent re-renders but props haven't changed.
|
|
43
|
+
*/
|
|
44
|
+
const DataAwareWidget = memo(DataAwareWidgetImpl);
|
|
45
|
+
//#endregion
|
|
46
|
+
export { DataAwareWidget };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=DataAwareWidget.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataAwareWidget.mjs","names":[],"sources":["../../src/data-sources/DataAwareWidget.tsx"],"sourcesContent":["import { memo, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport type { WidgetSchema } from \"../types/widget-schema\";\nimport { useWidgetData } from \"./use-widget-data\";\nimport { ErrorState } from \"./ErrorState\";\n\nexport interface DataAwareWidgetProps {\n widget: WidgetSchema;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Component: ComponentType<any>;\n /** Additional props to pass through (e.g., edit mode callbacks) */\n additionalProps?: Record<string, unknown>;\n /** Custom loading component */\n loadingComponent?: ReactNode;\n /** Custom error component */\n errorComponent?: (error: Error) => ReactNode;\n /** Base URL for API calls (e.g., \"https://api.fluid.app/api\") */\n baseUrl?: string | undefined;\n}\n\n// Empty object constant to avoid creating new references\nconst EMPTY_OBJECT: Record<string, unknown> = {};\n\n/**\n * Wrapper component that resolves data sources before rendering the widget.\n * Merges resolved data with static props.\n */\nfunction DataAwareWidgetImpl({\n widget,\n Component,\n additionalProps,\n loadingComponent,\n errorComponent,\n baseUrl,\n}: DataAwareWidgetProps) {\n // Use stable empty object if no additionalProps provided\n const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;\n const { data, isLoading, error } = useWidgetData(widget, { baseUrl });\n\n // Merge static props with resolved data\n // Data takes precedence (allows overriding defaults)\n // Memoized to prevent unnecessary child re-renders\n // Note: Must be called before any early returns to satisfy Rules of Hooks\n const mergedProps = useMemo(\n () => ({\n ...widget.props,\n ...data,\n ...stableAdditionalProps,\n }),\n [widget.props, data, stableAdditionalProps],\n );\n\n // Show loading state\n if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Default skeleton - can be customized\n return (\n <div\n className=\"bg-muted animate-pulse rounded-md\"\n style={{ minHeight: 100 }}\n >\n <span className=\"sr-only\">Loading...</span>\n </div>\n );\n }\n\n // Show error state (if no fallback was applied)\n if (error && !data) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n // Default error display\n return <ErrorState />;\n }\n\n return <Component {...mergedProps} />;\n}\n\n/**\n * Memoized wrapper component that resolves data sources before rendering the widget.\n * Prevents re-renders when parent re-renders but props haven't changed.\n */\nexport const DataAwareWidget = memo(DataAwareWidgetImpl);\n"],"mappings":";;;;;AAoBA,MAAM,eAAwC,EAAE;;;;;AAMhD,SAAS,oBAAoB,EAC3B,QACA,WACA,iBACA,kBACA,gBACA,WACuB;CAEvB,MAAM,wBAAwB,mBAAmB;CACjD,MAAM,EAAE,MAAM,WAAW,UAAU,cAAc,QAAQ,EAAE,SAAS,CAAC;CAMrE,MAAM,cAAc,eACX;EACL,GAAG,OAAO;EACV,GAAG;EACH,GAAG;EACJ,GACD;EAAC,OAAO;EAAO;EAAM;EAAsB,CAC5C;AAGD,KAAI,aAAa,OAAO,YAAY,SAAS,iBAAiB,OAAO;AACnE,MAAI,iBACF,QAAO,oBAAA,UAAA,EAAA,UAAG,kBAAoB,CAAA;AAGhC,SACE,oBAAC,OAAD;GACE,WAAU;GACV,OAAO,EAAE,WAAW,KAAK;aAEzB,oBAAC,QAAD;IAAM,WAAU;cAAU;IAAiB,CAAA;GACvC,CAAA;;AAKV,KAAI,SAAS,CAAC,MAAM;AAClB,MAAI,eACF,QAAO,oBAAA,UAAA,EAAA,UAAG,eAAe,MAAM,EAAI,CAAA;AAGrC,SAAO,oBAAC,YAAD,EAAc,CAAA;;AAGvB,QAAO,oBAAC,WAAD,EAAW,GAAI,aAAe,CAAA;;;;;;AAOvC,MAAa,kBAAkB,KAAK,oBAAoB"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../chunk-CKQMccvm.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
//#region src/data-sources/ErrorState.tsx
|
|
5
|
+
function ErrorState() {
|
|
6
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
7
|
+
className: "flex min-h-[120px] flex-col items-center justify-center p-6 text-center",
|
|
8
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
9
|
+
className: "text-lg font-semibold",
|
|
10
|
+
children: "Something Went Wrong"
|
|
11
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12
|
+
className: "text-muted-foreground text-sm",
|
|
13
|
+
children: "Please contact a company admin for help"
|
|
14
|
+
})]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.ErrorState = ErrorState;
|
|
2
19
|
|
|
3
|
-
var chunkMOTOSPAO_cjs = require('../chunk-MOTOSPAO.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "ErrorState", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunkMOTOSPAO_cjs.ErrorState; }
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=ErrorState.cjs.map
|
|
12
20
|
//# sourceMappingURL=ErrorState.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"ErrorState.cjs","names":[],"sources":["../../src/data-sources/ErrorState.tsx"],"sourcesContent":["export function ErrorState() {\n return (\n <div className=\"flex min-h-[120px] flex-col items-center justify-center p-6 text-center\">\n <p className=\"text-lg font-semibold\">Something Went Wrong</p>\n <p className=\"text-muted-foreground text-sm\">\n Please contact a company admin for help\n </p>\n </div>\n );\n}\n"],"mappings":";;;;AAAA,SAAgB,aAAa;AAC3B,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,WAAU;YAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;GAAG,WAAU;aAAwB;GAAwB,CAAA,EAC7D,iBAAA,GAAA,kBAAA,KAAC,KAAD;GAAG,WAAU;aAAgC;GAEzC,CAAA,CACA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
declare function ErrorState(): react_jsx_runtime.JSX.Element;
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
2
|
|
|
3
|
+
//#region src/data-sources/ErrorState.d.ts
|
|
4
|
+
declare function ErrorState(): react_jsx_runtime0.JSX.Element;
|
|
5
|
+
//#endregion
|
|
5
6
|
export { ErrorState };
|
|
7
|
+
//# sourceMappingURL=ErrorState.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorState.d.cts","names":[],"sources":["../../src/data-sources/ErrorState.tsx"],"mappings":";;;iBAAgB,UAAA,CAAA,GAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorState.d.mts","names":[],"sources":["../../src/data-sources/ErrorState.tsx"],"mappings":";;;iBAAgB,UAAA,CAAA,GAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
//#region src/data-sources/ErrorState.tsx
|
|
3
|
+
function ErrorState() {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5
|
+
className: "flex min-h-[120px] flex-col items-center justify-center p-6 text-center",
|
|
6
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
7
|
+
className: "text-lg font-semibold",
|
|
8
|
+
children: "Something Went Wrong"
|
|
9
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
10
|
+
className: "text-muted-foreground text-sm",
|
|
11
|
+
children: "Please contact a company admin for help"
|
|
12
|
+
})]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ErrorState };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=ErrorState.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorState.mjs","names":[],"sources":["../../src/data-sources/ErrorState.tsx"],"sourcesContent":["export function ErrorState() {\n return (\n <div className=\"flex min-h-[120px] flex-col items-center justify-center p-6 text-center\">\n <p className=\"text-lg font-semibold\">Something Went Wrong</p>\n <p className=\"text-muted-foreground text-sm\">\n Please contact a company admin for help\n </p>\n </div>\n );\n}\n"],"mappings":";;AAAA,SAAgB,aAAa;AAC3B,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,KAAD;GAAG,WAAU;aAAwB;GAAwB,CAAA,EAC7D,oBAAC,KAAD;GAAG,WAAU;aAAgC;GAEzC,CAAA,CACA"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../chunk-CKQMccvm.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
//#region src/data-sources/context.tsx
|
|
6
|
+
const DataSourceContext = (0, react.createContext)({});
|
|
7
|
+
function DataSourceProvider({ baseUrl, getApiHeaders, children }) {
|
|
8
|
+
const value = (0, react.useMemo)(() => ({
|
|
9
|
+
baseUrl,
|
|
10
|
+
getApiHeaders
|
|
11
|
+
}), [baseUrl, getApiHeaders]);
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataSourceContext.Provider, {
|
|
13
|
+
value,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function useDataSourceConfig() {
|
|
18
|
+
return (0, react.useContext)(DataSourceContext);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.DataSourceProvider = DataSourceProvider;
|
|
22
|
+
exports.useDataSourceConfig = useDataSourceConfig;
|
|
2
23
|
|
|
3
|
-
var chunkSJQPHJL4_cjs = require('../chunk-SJQPHJL4.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "DataSourceProvider", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunkSJQPHJL4_cjs.DataSourceProvider; }
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(exports, "useDataSourceConfig", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return chunkSJQPHJL4_cjs.useDataSourceConfig; }
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=context.cjs.map
|
|
16
24
|
//# sourceMappingURL=context.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"context.cjs","names":[],"sources":["../../src/data-sources/context.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nexport interface DataSourceContextValue {\n baseUrl?: string | undefined;\n getApiHeaders?: (() => Record<string, string>) | undefined;\n}\n\nconst DataSourceContext = createContext<DataSourceContextValue>({});\n\nexport interface DataSourceProviderProps {\n baseUrl?: string | undefined;\n getApiHeaders?: (() => Record<string, string>) | undefined;\n children: ReactNode;\n}\n\nexport function DataSourceProvider({\n baseUrl,\n getApiHeaders,\n children,\n}: DataSourceProviderProps) {\n const value = useMemo(\n () => ({ baseUrl, getApiHeaders }),\n [baseUrl, getApiHeaders],\n );\n\n return (\n <DataSourceContext.Provider value={value}>\n {children}\n </DataSourceContext.Provider>\n );\n}\n\nexport function useDataSourceConfig(): DataSourceContextValue {\n return useContext(DataSourceContext);\n}\n"],"mappings":";;;;;AAOA,MAAM,qBAAA,GAAA,MAAA,eAA0D,EAAE,CAAC;AAQnE,SAAgB,mBAAmB,EACjC,SACA,eACA,YAC0B;CAC1B,MAAM,SAAA,GAAA,MAAA,gBACG;EAAE;EAAS;EAAe,GACjC,CAAC,SAAS,cAAc,CACzB;AAED,QACE,iBAAA,GAAA,kBAAA,KAAC,kBAAkB,UAAnB;EAAmC;EAChC;EAC0B,CAAA;;AAIjC,SAAgB,sBAA8C;AAC5D,SAAA,GAAA,MAAA,YAAkB,kBAAkB"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { ReactNode } from
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
|
+
//#region src/data-sources/context.d.ts
|
|
4
5
|
interface DataSourceContextValue {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
baseUrl?: string | undefined;
|
|
7
|
+
getApiHeaders?: (() => Record<string, string>) | undefined;
|
|
7
8
|
}
|
|
8
9
|
interface DataSourceProviderProps {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
baseUrl?: string | undefined;
|
|
11
|
+
getApiHeaders?: (() => Record<string, string>) | undefined;
|
|
12
|
+
children: ReactNode;
|
|
12
13
|
}
|
|
13
|
-
declare function DataSourceProvider({
|
|
14
|
+
declare function DataSourceProvider({
|
|
15
|
+
baseUrl,
|
|
16
|
+
getApiHeaders,
|
|
17
|
+
children
|
|
18
|
+
}: DataSourceProviderProps): react_jsx_runtime0.JSX.Element;
|
|
14
19
|
declare function useDataSourceConfig(): DataSourceContextValue;
|
|
15
|
-
|
|
16
|
-
export {
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DataSourceContextValue, DataSourceProvider, DataSourceProviderProps, useDataSourceConfig };
|
|
22
|
+
//# sourceMappingURL=context.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.cts","names":[],"sources":["../../src/data-sources/context.tsx"],"mappings":";;;;UAEiB,sBAAA;EACf,OAAA;EACA,aAAA,UAAuB,MAAA;AAAA;AAAA,UAKR,uBAAA;EACf,OAAA;EACA,aAAA,UAAuB,MAAA;EACvB,QAAA,EAAU,SAAA;AAAA;AAAA,iBAGI,kBAAA,CAAA;EACd,OAAA;EACA,aAAA;EACA;AAAA,GACC,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAaV,mBAAA,CAAA,GAAuB,sBAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/data-sources/context.d.ts
|
|
5
|
+
interface DataSourceContextValue {
|
|
6
|
+
baseUrl?: string | undefined;
|
|
7
|
+
getApiHeaders?: (() => Record<string, string>) | undefined;
|
|
8
|
+
}
|
|
9
|
+
interface DataSourceProviderProps {
|
|
10
|
+
baseUrl?: string | undefined;
|
|
11
|
+
getApiHeaders?: (() => Record<string, string>) | undefined;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare function DataSourceProvider({
|
|
15
|
+
baseUrl,
|
|
16
|
+
getApiHeaders,
|
|
17
|
+
children
|
|
18
|
+
}: DataSourceProviderProps): react_jsx_runtime0.JSX.Element;
|
|
19
|
+
declare function useDataSourceConfig(): DataSourceContextValue;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DataSourceContextValue, DataSourceProvider, DataSourceProviderProps, useDataSourceConfig };
|
|
22
|
+
//# sourceMappingURL=context.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.mts","names":[],"sources":["../../src/data-sources/context.tsx"],"mappings":";;;;UAEiB,sBAAA;EACf,OAAA;EACA,aAAA,UAAuB,MAAA;AAAA;AAAA,UAKR,uBAAA;EACf,OAAA;EACA,aAAA,UAAuB,MAAA;EACvB,QAAA,EAAU,SAAA;AAAA;AAAA,iBAGI,kBAAA,CAAA;EACd,OAAA;EACA,aAAA;EACA;AAAA,GACC,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAaV,mBAAA,CAAA,GAAuB,sBAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/data-sources/context.tsx
|
|
4
|
+
const DataSourceContext = createContext({});
|
|
5
|
+
function DataSourceProvider({ baseUrl, getApiHeaders, children }) {
|
|
6
|
+
const value = useMemo(() => ({
|
|
7
|
+
baseUrl,
|
|
8
|
+
getApiHeaders
|
|
9
|
+
}), [baseUrl, getApiHeaders]);
|
|
10
|
+
return /* @__PURE__ */ jsx(DataSourceContext.Provider, {
|
|
11
|
+
value,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function useDataSourceConfig() {
|
|
16
|
+
return useContext(DataSourceContext);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DataSourceProvider, useDataSourceConfig };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.mjs","names":[],"sources":["../../src/data-sources/context.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nexport interface DataSourceContextValue {\n baseUrl?: string | undefined;\n getApiHeaders?: (() => Record<string, string>) | undefined;\n}\n\nconst DataSourceContext = createContext<DataSourceContextValue>({});\n\nexport interface DataSourceProviderProps {\n baseUrl?: string | undefined;\n getApiHeaders?: (() => Record<string, string>) | undefined;\n children: ReactNode;\n}\n\nexport function DataSourceProvider({\n baseUrl,\n getApiHeaders,\n children,\n}: DataSourceProviderProps) {\n const value = useMemo(\n () => ({ baseUrl, getApiHeaders }),\n [baseUrl, getApiHeaders],\n );\n\n return (\n <DataSourceContext.Provider value={value}>\n {children}\n </DataSourceContext.Provider>\n );\n}\n\nexport function useDataSourceConfig(): DataSourceContextValue {\n return useContext(DataSourceContext);\n}\n"],"mappings":";;;AAOA,MAAM,oBAAoB,cAAsC,EAAE,CAAC;AAQnE,SAAgB,mBAAmB,EACjC,SACA,eACA,YAC0B;CAC1B,MAAM,QAAQ,eACL;EAAE;EAAS;EAAe,GACjC,CAAC,SAAS,cAAc,CACzB;AAED,QACE,oBAAC,kBAAkB,UAAnB;EAAmC;EAChC;EAC0B,CAAA;;AAIjC,SAAgB,sBAA8C;AAC5D,QAAO,WAAW,kBAAkB"}
|
|
@@ -1,12 +1,65 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/data-sources/fetchers/api.ts
|
|
3
|
+
/**
|
|
4
|
+
* Extracts a value from an object using dot notation path
|
|
5
|
+
* e.g., getByPath({ data: { items: [1,2,3] } }, 'data.items') => [1,2,3]
|
|
6
|
+
*/
|
|
7
|
+
function getByPath(obj, path) {
|
|
8
|
+
return path.split(".").reduce((current, key) => {
|
|
9
|
+
if (current && typeof current === "object" && key in current) return current[key];
|
|
10
|
+
}, obj);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Replaces {variable} placeholders in an endpoint path with values from the
|
|
14
|
+
* variables map. E.g., "/reps/{rep_id}/most_shared" with { rep_id: "42" }
|
|
15
|
+
* becomes "/reps/42/most_shared".
|
|
16
|
+
*/
|
|
17
|
+
function interpolateVariables(endpoint, variables) {
|
|
18
|
+
if (!variables) return endpoint;
|
|
19
|
+
const resolved = endpoint.replace(/\{(\w+)\}/g, (match, key) => variables[key] ?? match);
|
|
20
|
+
const unresolved = resolved.match(/\{(\w+)\}/g);
|
|
21
|
+
if (unresolved) console.warn(`[DataSource] Unresolved variable placeholders in endpoint: ${unresolved.join(", ")}. Endpoint: "${endpoint}". Available variables: ${Object.keys(variables).join(", ") || "(none)"}`);
|
|
22
|
+
return resolved;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the full URL for an endpoint.
|
|
26
|
+
* - Substitutes {variable} placeholders from context variables
|
|
27
|
+
* - Absolute URLs (starting with http:// or https://) are used as-is
|
|
28
|
+
* - Relative paths are prefixed with the context's baseUrl
|
|
29
|
+
*/
|
|
30
|
+
function resolveEndpointUrl(endpoint, baseUrl, variables) {
|
|
31
|
+
const resolved = interpolateVariables(endpoint, variables);
|
|
32
|
+
if (resolved.startsWith("http://") || resolved.startsWith("https://")) return resolved;
|
|
33
|
+
if (baseUrl) return `${baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl}${resolved.startsWith("/") ? resolved : `/${resolved}`}`;
|
|
34
|
+
return resolved;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Default API fetcher implementation
|
|
38
|
+
*/
|
|
39
|
+
async function apiFetcher(source, context) {
|
|
40
|
+
const { endpoint, method = "GET", headers = {}, body } = source;
|
|
41
|
+
const mergedVariables = {
|
|
42
|
+
...context.variables,
|
|
43
|
+
...source.variables
|
|
44
|
+
};
|
|
45
|
+
const url = resolveEndpointUrl(endpoint, context.baseUrl, mergedVariables);
|
|
46
|
+
const fetchOptions = {
|
|
47
|
+
method,
|
|
48
|
+
headers: {
|
|
49
|
+
"content-type": "application/json",
|
|
50
|
+
...context.getApiHeaders?.(),
|
|
51
|
+
...headers
|
|
52
|
+
},
|
|
53
|
+
signal: context.signal
|
|
54
|
+
};
|
|
55
|
+
if (body && (method === "POST" || method === "PUT")) fetchOptions.body = JSON.stringify(body);
|
|
56
|
+
const response = await fetch(url, fetchOptions);
|
|
57
|
+
if (!response.ok) throw new Error(`API request failed: ${response.status} ${response.statusText}`);
|
|
58
|
+
const data = await response.json();
|
|
59
|
+
if (source.resultPath) return getByPath(data, source.resultPath);
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.apiFetcher = apiFetcher;
|
|
2
64
|
|
|
3
|
-
var chunk46PUWB7C_cjs = require('../../chunk-46PUWB7C.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "apiFetcher", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunk46PUWB7C_cjs.apiFetcher; }
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=api.cjs.map
|
|
12
65
|
//# sourceMappingURL=api.cjs.map
|