@vixoniccom/kpi-chart 0.0.1-dev.8 → 0.0.2-beta.0
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/CHANGELOG.md +10 -0
- package/build/index.html +1 -1
- package/build/main.js +2 -129
- package/build/main.js.LICENSE.txt +41 -0
- package/build/test/downloads/background.jpg +0 -0
- package/build/test/downloads/monserrat.ttf +0 -0
- package/build/test/parameters.json +47 -0
- package/build/test/services.json +33 -0
- package/build.zip +0 -0
- package/configuration/generalGroup/index.ts +5 -27
- package/configuration.json +4 -24
- package/package.json +3 -5
- package/src/components/App.tsx +17 -134
- package/src/components/ChartContainer/index.tsx +14 -2
- package/src/components/utils.ts +30 -130
- package/src/data-loader.ts +43 -0
- package/src/global.d.ts +5 -0
- package/src/parameters.d.ts +1 -1
- package/src/test/services.json +33 -0
- package/tsconfig.json +4 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class GoogleSheetsDataLoader {
|
|
2
|
+
|
|
3
|
+
public onData: ((items: GoogleSheetsItems) => void) | undefined = undefined
|
|
4
|
+
private updateTime: number = 86400000
|
|
5
|
+
private updateTimer: number | undefined = undefined
|
|
6
|
+
private googleData: GoogleSheetsItems = { headers: [], rows: [] }
|
|
7
|
+
|
|
8
|
+
update(appData: VixonicData) {
|
|
9
|
+
|
|
10
|
+
const selectedServiceId = appData.parameters.documentService?.id
|
|
11
|
+
if (!selectedServiceId || !appData.services[selectedServiceId]) return
|
|
12
|
+
const serviceData = appData.services[selectedServiceId].data as GoogleSheetsItems[] | undefined
|
|
13
|
+
|
|
14
|
+
if (Array.isArray(serviceData)) {
|
|
15
|
+
this.googleData = serviceData[0]
|
|
16
|
+
} else {
|
|
17
|
+
this.googleData = { headers: [], rows: [] } as GoogleSheetsItems
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this.updateTime = appData.parameters.updateTime ?? 86400000
|
|
21
|
+
this.requestGoogleData()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
stop() {
|
|
25
|
+
this.setUpdateTime(undefined)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private setUpdateTime(milliseconds: number | undefined) {
|
|
29
|
+
window.clearTimeout(this.updateTimer)
|
|
30
|
+
if (milliseconds === undefined) return
|
|
31
|
+
this.updateTimer = window.setTimeout(this.requestGoogleData, milliseconds)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private dispatchData(items: GoogleSheetsItems) {
|
|
35
|
+
this.onData && this.onData(items)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private readonly requestGoogleData = () => {
|
|
39
|
+
window.clearTimeout(this.updateTimer)
|
|
40
|
+
this.dispatchData(this.googleData)
|
|
41
|
+
this.setUpdateTime(this.updateTime > 10000 ? this.updateTime : 10000)
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/global.d.ts
CHANGED
package/src/parameters.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ declare type VixonicData = {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
declare type VixonicParameters = Partial<{
|
|
8
|
-
|
|
8
|
+
documentService: { id: string }, updateTime: 300000 | 600000 | 900000 | 1800000 | 3600000, chartType: 'bar' | 'line' | 'area' | 'bubble', barOrientation: 'vertical' | 'horizontal', barStacked: boolean, darkMode: boolean, titleEnabled: boolean, title: string, titleTextFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, titlePadding: string, legendEnabled: boolean, legendTextFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, legendPosition: 'left' | 'right', legendMargin: number, circleSize: number, yAxisEnabled: boolean, showVerticalGrid: boolean, xAxisEnabled: boolean, showHorizontalGrid: boolean, appPadding: string, backgroundImage: {id?: string, filename?: string, extension?: string}, customMessageEnabled: boolean, customMessage: string, systemMessageTextFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }
|
|
9
9
|
}>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"services": {
|
|
3
|
+
"testService": {
|
|
4
|
+
"id": "c3f92c8b-7b1d-44d4-8e79-6d92b87cf4f1",
|
|
5
|
+
"data": [{
|
|
6
|
+
"headers": [
|
|
7
|
+
"category",
|
|
8
|
+
"Agents",
|
|
9
|
+
"Longest Wait Time (min)",
|
|
10
|
+
"Avg Vote to Agents",
|
|
11
|
+
"Call abounded",
|
|
12
|
+
"Call Presented",
|
|
13
|
+
"Call Handled"
|
|
14
|
+
],
|
|
15
|
+
"rows": [
|
|
16
|
+
["2022-5-9", "9", "4", "8", "3", "3", "0"],
|
|
17
|
+
["2022-5-8", "8", "1", "1", "9", "1", "2"],
|
|
18
|
+
["2022-5-7", "6", "6", "3", "6", "1", "5"],
|
|
19
|
+
["2022-5-6", "8", "8", "9", "8", "7", "9"],
|
|
20
|
+
["2022-5-5", "9", "8", "4", "6", "9", "3"],
|
|
21
|
+
["2022-5-4", "9", "6", "3", "4", "4", "0"],
|
|
22
|
+
["2022-5-3", "9", "3", "7", "3", "0", "0"],
|
|
23
|
+
["2022-5-24", "10", "7", "9", "8", "7", "9"],
|
|
24
|
+
["2022-5-23", "8", "1", "2", "6", "5", "7"],
|
|
25
|
+
["2022-5-22", "8", "8", "5", "3", "0", "0"],
|
|
26
|
+
["2022-5-21", "9", "8", "6", "1", "4", "4"],
|
|
27
|
+
["2022-5-20", "9", "3", "6", "3", "7", "4"],
|
|
28
|
+
["2022-5-2", "9", "3", "7", "9", "5", "6"]
|
|
29
|
+
]
|
|
30
|
+
}]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
3
|
+
"target": "es6",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"jsx": "react-jsx",
|
|
5
6
|
"moduleResolution": "node",
|
|
6
|
-
"jsx": "preserve",
|
|
7
7
|
"allowJs": true,
|
|
8
8
|
"checkJs": true,
|
|
9
9
|
"allowSyntheticDefaultImports": true,
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
},
|
|
25
25
|
"include": ["./src/**/*"],
|
|
26
26
|
"exclude": ["./node_modules/**/*"]
|
|
27
|
-
}
|
|
27
|
+
}
|