@xplortech/insights-elements 0.0.1-draft.7729525

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -0
  3. package/dist/cjs/apollo-data.esm-by4pfDU4.js +30 -0
  4. package/dist/cjs/apollo-data.esm-by4pfDU4.js.map +1 -0
  5. package/dist/cjs/app-globals-D-MP41KM.js +62 -0
  6. package/dist/cjs/app-globals-D-MP41KM.js.map +1 -0
  7. package/dist/cjs/index-CyoztwkV.js +40 -0
  8. package/dist/cjs/index-CyoztwkV.js.map +1 -0
  9. package/dist/cjs/index-DtrFwwSq.js +1472 -0
  10. package/dist/cjs/index-DtrFwwSq.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +8 -0
  12. package/dist/cjs/index.cjs.js.map +1 -0
  13. package/dist/cjs/insights-bar-chart.cjs.entry.js +42 -0
  14. package/dist/cjs/insights-bar-chart.entry.cjs.js.map +1 -0
  15. package/dist/cjs/insights-chart-base-D6QbrWmD.js +102 -0
  16. package/dist/cjs/insights-chart-base-D6QbrWmD.js.map +1 -0
  17. package/dist/cjs/insights-donut-chart.cjs.entry.js +42 -0
  18. package/dist/cjs/insights-donut-chart.entry.cjs.js.map +1 -0
  19. package/dist/cjs/insights-elements.cjs.js +26 -0
  20. package/dist/cjs/insights-elements.cjs.js.map +1 -0
  21. package/dist/cjs/insights-wrapper.cjs.entry.js +1087 -0
  22. package/dist/cjs/insights-wrapper.entry.cjs.js.map +1 -0
  23. package/dist/cjs/loader.cjs.js +14 -0
  24. package/dist/cjs/loader.cjs.js.map +1 -0
  25. package/dist/collection/collection-manifest.json +15 -0
  26. package/dist/collection/components/insights-bar-chart/insights-bar-chart.css +87 -0
  27. package/dist/collection/components/insights-bar-chart/insights-bar-chart.js +51 -0
  28. package/dist/collection/components/insights-bar-chart/insights-bar-chart.js.map +1 -0
  29. package/dist/collection/components/insights-chart-base.js +213 -0
  30. package/dist/collection/components/insights-chart-base.js.map +1 -0
  31. package/dist/collection/components/insights-donut-chart/insights-donut-chart.css +87 -0
  32. package/dist/collection/components/insights-donut-chart/insights-donut-chart.js +51 -0
  33. package/dist/collection/components/insights-donut-chart/insights-donut-chart.js.map +1 -0
  34. package/dist/collection/components/insights-wrapper/insights-wrapper.css +17 -0
  35. package/dist/collection/components/insights-wrapper/insights-wrapper.js +402 -0
  36. package/dist/collection/components/insights-wrapper/insights-wrapper.js.map +1 -0
  37. package/dist/collection/global/app.js +35 -0
  38. package/dist/collection/global/app.js.map +1 -0
  39. package/dist/collection/index.js +12 -0
  40. package/dist/collection/index.js.map +1 -0
  41. package/dist/collection/utils/chart-types.js +16 -0
  42. package/dist/collection/utils/chart-types.js.map +1 -0
  43. package/dist/collection/utils/code-generator.js +201 -0
  44. package/dist/collection/utils/code-generator.js.map +1 -0
  45. package/dist/collection/utils/insights-context.js +33 -0
  46. package/dist/collection/utils/insights-context.js.map +1 -0
  47. package/dist/components/index.d.ts +33 -0
  48. package/dist/components/index.js +44 -0
  49. package/dist/components/index.js.map +1 -0
  50. package/dist/components/insights-bar-chart.d.ts +11 -0
  51. package/dist/components/insights-bar-chart.js +73 -0
  52. package/dist/components/insights-bar-chart.js.map +1 -0
  53. package/dist/components/insights-donut-chart.d.ts +11 -0
  54. package/dist/components/insights-donut-chart.js +73 -0
  55. package/dist/components/insights-donut-chart.js.map +1 -0
  56. package/dist/components/insights-wrapper.d.ts +11 -0
  57. package/dist/components/insights-wrapper.js +1123 -0
  58. package/dist/components/insights-wrapper.js.map +1 -0
  59. package/dist/components/p-CSTD3N9t.js +37 -0
  60. package/dist/components/p-CSTD3N9t.js.map +1 -0
  61. package/dist/components/p-DFvs3VMW.js +1195 -0
  62. package/dist/components/p-DFvs3VMW.js.map +1 -0
  63. package/dist/components/p-DHA6uI9u.js +9 -0
  64. package/dist/components/p-DHA6uI9u.js.map +1 -0
  65. package/dist/components/p-Dv82-c17.js +100 -0
  66. package/dist/components/p-Dv82-c17.js.map +1 -0
  67. package/dist/esm/apollo-data.esm-DHA6uI9u.js +9 -0
  68. package/dist/esm/apollo-data.esm-DHA6uI9u.js.map +1 -0
  69. package/dist/esm/app-globals-BtE_P06_.js +41 -0
  70. package/dist/esm/app-globals-BtE_P06_.js.map +1 -0
  71. package/dist/esm/index-BAqvP5--.js +1447 -0
  72. package/dist/esm/index-BAqvP5--.js.map +1 -0
  73. package/dist/esm/index-CSTD3N9t.js +37 -0
  74. package/dist/esm/index-CSTD3N9t.js.map +1 -0
  75. package/dist/esm/index.js +2 -0
  76. package/dist/esm/index.js.map +1 -0
  77. package/dist/esm/insights-bar-chart.entry.js +40 -0
  78. package/dist/esm/insights-bar-chart.entry.js.map +1 -0
  79. package/dist/esm/insights-chart-base-uNbdsloe.js +100 -0
  80. package/dist/esm/insights-chart-base-uNbdsloe.js.map +1 -0
  81. package/dist/esm/insights-donut-chart.entry.js +40 -0
  82. package/dist/esm/insights-donut-chart.entry.js.map +1 -0
  83. package/dist/esm/insights-elements.js +22 -0
  84. package/dist/esm/insights-elements.js.map +1 -0
  85. package/dist/esm/insights-wrapper.entry.js +1085 -0
  86. package/dist/esm/insights-wrapper.entry.js.map +1 -0
  87. package/dist/esm/loader.js +12 -0
  88. package/dist/esm/loader.js.map +1 -0
  89. package/dist/index.cjs.js +1 -0
  90. package/dist/index.js +1 -0
  91. package/dist/insights-elements/index.esm.js +2 -0
  92. package/dist/insights-elements/index.esm.js.map +1 -0
  93. package/dist/insights-elements/insights-bar-chart.entry.esm.js.map +1 -0
  94. package/dist/insights-elements/insights-donut-chart.entry.esm.js.map +1 -0
  95. package/dist/insights-elements/insights-elements.esm.js +2 -0
  96. package/dist/insights-elements/insights-elements.esm.js.map +1 -0
  97. package/dist/insights-elements/insights-wrapper.entry.esm.js.map +1 -0
  98. package/dist/insights-elements/loader.esm.js.map +1 -0
  99. package/dist/insights-elements/p-247183e1.entry.js +2 -0
  100. package/dist/insights-elements/p-247183e1.entry.js.map +1 -0
  101. package/dist/insights-elements/p-29ce0a90.entry.js +2 -0
  102. package/dist/insights-elements/p-29ce0a90.entry.js.map +1 -0
  103. package/dist/insights-elements/p-BAqvP5--.js +3 -0
  104. package/dist/insights-elements/p-BAqvP5--.js.map +1 -0
  105. package/dist/insights-elements/p-CSTD3N9t.js +2 -0
  106. package/dist/insights-elements/p-CSTD3N9t.js.map +1 -0
  107. package/dist/insights-elements/p-DE0h_D1B.js +2 -0
  108. package/dist/insights-elements/p-DE0h_D1B.js.map +1 -0
  109. package/dist/insights-elements/p-DHA6uI9u.js +3 -0
  110. package/dist/insights-elements/p-DHA6uI9u.js.map +1 -0
  111. package/dist/insights-elements/p-DVNwzSpV.js +2 -0
  112. package/dist/insights-elements/p-DVNwzSpV.js.map +1 -0
  113. package/dist/insights-elements/p-e48a7068.entry.js +2 -0
  114. package/dist/insights-elements/p-e48a7068.entry.js.map +1 -0
  115. package/dist/types/components/insights-bar-chart/insights-bar-chart.d.ts +9 -0
  116. package/dist/types/components/insights-chart-base.d.ts +54 -0
  117. package/dist/types/components/insights-donut-chart/insights-donut-chart.d.ts +9 -0
  118. package/dist/types/components/insights-wrapper/insights-wrapper.d.ts +46 -0
  119. package/dist/types/components.d.ts +201 -0
  120. package/dist/types/global/app.d.ts +6 -0
  121. package/dist/types/index.d.ts +12 -0
  122. package/dist/types/stencil-public-runtime.d.ts +1756 -0
  123. package/dist/types/utils/chart-types.d.ts +53 -0
  124. package/dist/types/utils/code-generator.d.ts +31 -0
  125. package/dist/types/utils/insights-context.d.ts +39 -0
  126. package/insights-loader/cdn.js +1 -0
  127. package/insights-loader/index.cjs.js +1 -0
  128. package/insights-loader/index.d.ts +24 -0
  129. package/insights-loader/index.es2017.js +1 -0
  130. package/insights-loader/index.js +2 -0
  131. package/loader/index.cjs.js +8 -0
  132. package/loader/index.d.ts +5 -0
  133. package/loader/index.js +7 -0
  134. package/package.json +92 -0
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Filters for chart data queries
3
+ */
4
+ export interface ChartFilters {
5
+ [key: string]: any;
6
+ }
7
+ /**
8
+ * Query structure for insights API
9
+ */
10
+ export interface InsightsQuery {
11
+ columns: string[];
12
+ [key: string]: any;
13
+ }
14
+ /**
15
+ * Raw response from insights API
16
+ */
17
+ export interface RawInsightsResponse {
18
+ data: any[];
19
+ [key: string]: any;
20
+ }
21
+ /**
22
+ * Base props that all chart components will inherit
23
+ */
24
+ export interface BaseChartProps {
25
+ /**
26
+ * Name of the report to fetch data from
27
+ */
28
+ reportName: string;
29
+ /**
30
+ * Filters to apply to the query
31
+ */
32
+ filters?: ChartFilters;
33
+ /**
34
+ * Function to transform filters into a query object
35
+ * @param filters - The filters to transform
36
+ * @returns Query object with columns and other parameters
37
+ */
38
+ getQueryByFilters?: (filters: ChartFilters) => InsightsQuery;
39
+ /**
40
+ * Function to normalize the raw API response
41
+ * @param responseData - Raw response from the API
42
+ * @returns Normalized data for the chart
43
+ */
44
+ normalizeRawResponse?: (responseData: RawInsightsResponse) => any;
45
+ }
46
+ /**
47
+ * Default implementation of getQueryByFilters
48
+ */
49
+ export declare const defaultGetQueryByFilters: (filters: ChartFilters) => InsightsQuery;
50
+ /**
51
+ * Default implementation of normalizeRawResponse
52
+ */
53
+ export declare const defaultNormalizeRawResponse: (responseData: RawInsightsResponse) => any;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Code generator for insights chart components
3
+ * Generates framework-specific code examples based on current story args
4
+ */
5
+ export interface CodeGenProps {
6
+ reportName: string;
7
+ filters: Record<string, any>;
8
+ columns: string[];
9
+ queryFilters: Array<{
10
+ member: string;
11
+ operator: string;
12
+ values: any[];
13
+ }>;
14
+ order: Record<string, 'asc' | 'desc'>;
15
+ totals: Array<{
16
+ fn: string;
17
+ member: string;
18
+ }>;
19
+ limit: number;
20
+ normalizeMapping: Array<{
21
+ outputKey: string;
22
+ sourceField: string;
23
+ }>;
24
+ spec: any;
25
+ apiUrl?: string;
26
+ componentName?: string;
27
+ }
28
+ export declare function generateReactCode(props: CodeGenProps): string;
29
+ export declare function generateVueCode(props: CodeGenProps): string;
30
+ export declare function generateWebComponentCode(props: CodeGenProps): string;
31
+ export declare function getCodeForFramework(props: any, framework?: string): string;
@@ -0,0 +1,39 @@
1
+ export type EventType = 'error' | 'warning';
2
+ export interface EventData {
3
+ eventType: EventType;
4
+ data: any;
5
+ }
6
+ export interface ConfigurationItem {
7
+ apiUrl: string;
8
+ token?: string;
9
+ refreshToken?: () => Promise<string> | string;
10
+ onEventEmitted?: (event: EventData) => void;
11
+ }
12
+ export interface Configuration {
13
+ [configName: string]: ConfigurationItem;
14
+ }
15
+ /**
16
+ * Setup multiple configurations for insights
17
+ * @param configurations - Map of configuration names to configuration items
18
+ * @example
19
+ * ```typescript
20
+ * setupConfiguration({
21
+ * default: {
22
+ * apiUrl: 'https://api.example.com',
23
+ * token: 'token123',
24
+ * refreshToken: async () => 'newToken',
25
+ * onEventEmitted: (event) => console.log(event)
26
+ * },
27
+ * europe: {
28
+ * apiUrl: 'https://api.eu.example.com',
29
+ * token: 'euToken123'
30
+ * }
31
+ * });
32
+ * ```
33
+ */
34
+ export declare const setupConfiguration: (configurations: Configuration) => void;
35
+ /**
36
+ * Get configuration by name
37
+ * @param configName - Name of the configuration to retrieve (defaults to 'default')
38
+ */
39
+ export declare const getConfiguration: (configName?: string) => ConfigurationItem | undefined;
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/cjs/loader.cjs.js');
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/cjs/loader.cjs.js');
@@ -0,0 +1,24 @@
1
+ export * from '../dist/types/components';
2
+ export interface CustomElementsDefineOptions {
3
+ exclude?: string[];
4
+ resourcesUrl?: string;
5
+ syncQueue?: boolean;
6
+ jmp?: (c: Function) => any;
7
+ raf?: (c: FrameRequestCallback) => number;
8
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
9
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
10
+ }
11
+ export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;
12
+ /**
13
+ * @deprecated
14
+ */
15
+ export declare function applyPolyfills(): Promise<void>;
16
+
17
+ /**
18
+ * Used to specify a nonce value that corresponds with an application's CSP.
19
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
20
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
21
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
22
+ * will result in the same behavior.
23
+ */
24
+ export declare function setNonce(nonce: string): void;
@@ -0,0 +1 @@
1
+ export * from '../dist/esm/loader.js';
@@ -0,0 +1,2 @@
1
+ (function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
2
+ export * from '../dist/esm/loader.js';
@@ -0,0 +1,8 @@
1
+ /* eslint-disable no-undef */
2
+ const m = require('../insights-loader/index.cjs.js');
3
+ const k = require('@xplortech/apollo-data/loader');
4
+
5
+ exports.defineCustomElements = function (win, opt) {
6
+ m.defineCustomElements(win, opt);
7
+ k.defineCustomElements(win, opt);
8
+ };
@@ -0,0 +1,5 @@
1
+ import { CustomElementsDefineOptions } from '../insights-loader';
2
+
3
+ export { CustomElementsDefineOptions };
4
+
5
+ export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;
@@ -0,0 +1,7 @@
1
+ import { defineCustomElements as dceInsights } from '../insights-loader';
2
+ import { defineCustomElements as dceApolloData } from '@xplortech/apollo-data/loader';
3
+
4
+ export function defineCustomElements(win, options) {
5
+ dceInsights(win, options);
6
+ dceApolloData(win, options);
7
+ }
package/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "@xplortech/insights-elements",
3
+ "version": "0.0.1-draft.7729525",
4
+ "description": "Web Components for Xplor Insights",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "collection": "dist/collection/collection-manifest.json",
9
+ "collection:main": "dist/collection/index.js",
10
+ "unpkg": "dist/insights-elements/insights-elements.esm.js",
11
+ "author": "Xplor Technologies",
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "provenance": false
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/types/index.d.ts",
19
+ "import": "./dist/insights-elements/insights-elements.esm.js",
20
+ "require": "./dist/index.cjs.js"
21
+ },
22
+ "./loader": {
23
+ "types": "./loader/index.d.ts",
24
+ "import": "./loader/index.js",
25
+ "require": "./loader/index.cjs"
26
+ },
27
+ "./insights-loader": {
28
+ "types": "./insights-loader/index.d.ts",
29
+ "import": "./insights-loader/index.js",
30
+ "require": "./insights-loader/index.cjs"
31
+ },
32
+ "./dist/*": {
33
+ "import": "./dist/*",
34
+ "types": "./dist/*"
35
+ },
36
+ "./components/*": {
37
+ "import": "./dist/components/*.js",
38
+ "types": "./dist/components/*.d.ts"
39
+ },
40
+ "./examples": {
41
+ "import": "./dist/examples/index.js",
42
+ "types": "./dist/types/examples/index.d.ts"
43
+ }
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/xplor/insights-api.git",
48
+ "directory": "packages/insights-elements"
49
+ },
50
+ "files": [
51
+ "dist/",
52
+ "insights-loader/",
53
+ "loader/"
54
+ ],
55
+ "scripts": {
56
+ "build": "stencil build",
57
+ "start": "stencil build --dev --watch --serve",
58
+ "test": "stencil test --spec --e2e",
59
+ "test.watch": "stencil test --spec --e2e --watchAll",
60
+ "generate": "stencil generate",
61
+ "storybook": "storybook dev -p 6006",
62
+ "build-storybook": "storybook build && cp -r ../../node_modules/@xplortech/apollo-data/dist/esm/*.js storybook-static/assets/ && cp -r ../../node_modules/@xplortech/apollo-data/dist/apollo-data/*.js storybook-static/assets/",
63
+ "prepublishOnly": "npm run build"
64
+ },
65
+ "devDependencies": {
66
+ "@stencil/core": "^4.27.1",
67
+ "@stencil/react-output-target": "^1.2.0",
68
+ "@stencil/vue-output-target": "^0.11.8",
69
+ "@storybook/addon-essentials": "^8.6.14",
70
+ "@storybook/addon-links": "^8.6.14",
71
+ "@storybook/blocks": "^8.6.14",
72
+ "@storybook/web-components": "^8.6.14",
73
+ "@storybook/web-components-vite": "^8.6.14",
74
+ "@types/jest": "^29.5.14",
75
+ "@types/node": "^22.19.1",
76
+ "@types/react": "^19.2.7",
77
+ "jest": "^29.7.0",
78
+ "jest-cli": "^29.7.0",
79
+ "lit": "^3.3.1",
80
+ "puppeteer": "^24.3.0",
81
+ "react": "^19.2.0",
82
+ "react-dom": "^19.2.0",
83
+ "storybook": "^8.6.14",
84
+ "vite": "^7.2.4"
85
+ },
86
+ "dependencies": {
87
+ "@stencil/store": "^2.2.1",
88
+ "@xplortech/apollo-data": "^0.0.4",
89
+ "@xplortech/insights-js": "^0.1.6"
90
+ },
91
+ "license": "MIT"
92
+ }