@qrvey/utils 1.13.0-13 → 1.13.0-14
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/cache-managers/cache-chart-manager.d.ts +2 -6
- package/dist/cache-managers/cache-chart-manager.js +6 -3
- package/dist/cache-managers/cache-manager.d.ts +2 -1
- package/dist/cache-managers/cache-manager.js +4 -0
- package/dist/cache-managers/cache-metric-manager.d.ts +2 -6
- package/dist/cache-managers/cache-metric-manager.js +6 -3
- package/dist/cache-managers/cache-model-manager.d.ts +2 -6
- package/dist/cache-managers/cache-model-manager.js +6 -3
- package/dist/cache-managers/cache-permissions-manager.d.ts +2 -6
- package/dist/cache-managers/cache-permissions-manager.js +6 -3
- package/dist/cache-managers/cache-theme-manager.d.ts +2 -6
- package/dist/cache-managers/cache-theme-manager.js +6 -3
- package/dist/cjs/cache-managers/cache-chart-manager.d.ts +2 -6
- package/dist/cjs/cache-managers/cache-chart-manager.js +6 -3
- package/dist/cjs/cache-managers/cache-manager.d.ts +2 -1
- package/dist/cjs/cache-managers/cache-manager.js +4 -0
- package/dist/cjs/cache-managers/cache-metric-manager.d.ts +2 -6
- package/dist/cjs/cache-managers/cache-metric-manager.js +6 -3
- package/dist/cjs/cache-managers/cache-model-manager.d.ts +2 -6
- package/dist/cjs/cache-managers/cache-model-manager.js +6 -3
- package/dist/cjs/cache-managers/cache-permissions-manager.d.ts +2 -6
- package/dist/cjs/cache-managers/cache-permissions-manager.js +6 -3
- package/dist/cjs/cache-managers/cache-theme-manager.d.ts +2 -6
- package/dist/cjs/cache-managers/cache-theme-manager.js +6 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
2
2
|
export interface IGetChartConfig {
|
|
3
3
|
qv_token?: string;
|
|
4
4
|
api_key?: string;
|
|
@@ -24,11 +24,7 @@ export declare class ChartCacheManager extends QrveyCacheManager<IChartStoreStat
|
|
|
24
24
|
protected getConfigPropertyName(): keyof IGetChartConfig;
|
|
25
25
|
protected getStorePropertyName(): keyof IChartStoreState;
|
|
26
26
|
protected buildStoreId({ chart_id }: IGetChartConfig): string;
|
|
27
|
-
protected
|
|
28
|
-
state: IChartStoreState;
|
|
29
|
-
onChange: OnChangeType;
|
|
30
|
-
set: (property: keyof IChartStoreState, value: unknown) => void;
|
|
31
|
-
};
|
|
27
|
+
protected getInitialState(): IChartStoreState;
|
|
32
28
|
protected fetchDataAndUpdateStore(state: IChartStoreState, config: IGetChartConfig): void;
|
|
33
29
|
}
|
|
34
30
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createStore } from "@stencil/store";
|
|
2
1
|
import { QrveyCacheManager } from "./cache-manager";
|
|
3
2
|
import ChartsApi from "../services/api/Charts.api";
|
|
4
3
|
export class ChartCacheManager extends QrveyCacheManager {
|
|
@@ -17,8 +16,12 @@ export class ChartCacheManager extends QrveyCacheManager {
|
|
|
17
16
|
buildStoreId({ chart_id }) {
|
|
18
17
|
return `${chart_id}`;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
return
|
|
19
|
+
getInitialState() {
|
|
20
|
+
return {
|
|
21
|
+
chart: null,
|
|
22
|
+
loading: true,
|
|
23
|
+
error: null,
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
fetchDataAndUpdateStore(state, config) {
|
|
24
27
|
const chartConfig = Object.assign(Object.assign({}, config), { translated: true });
|
|
@@ -9,7 +9,8 @@ export declare abstract class QrveyCacheManager<TStoreState, TConfig> {
|
|
|
9
9
|
protected abstract getStorePropertyName(): keyof TStoreState;
|
|
10
10
|
protected abstract buildStoreId(config: TConfig): string;
|
|
11
11
|
protected abstract fetchDataAndUpdateStore(state: TStoreState, config: TConfig): void;
|
|
12
|
-
protected abstract
|
|
12
|
+
protected abstract getInitialState(): TStoreState;
|
|
13
|
+
protected createStore(_initialState?: Partial<TStoreState>): {
|
|
13
14
|
state: TStoreState;
|
|
14
15
|
onChange: OnChangeType;
|
|
15
16
|
set: (property: keyof TStoreState, value: unknown) => void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { createStore } from "@stencil/store";
|
|
1
2
|
export class QrveyCacheManager {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.stores = new Map();
|
|
4
5
|
}
|
|
6
|
+
createStore(_initialState) {
|
|
7
|
+
return createStore(Object.assign(Object.assign({}, this.getInitialState()), _initialState));
|
|
8
|
+
}
|
|
5
9
|
getStoreFromPromise(config, id) {
|
|
6
10
|
return new Promise((resolve) => {
|
|
7
11
|
const configProperty = this.getConfigPropertyName();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
2
2
|
export interface IGetMetricConfig {
|
|
3
3
|
qv_token?: string;
|
|
4
4
|
api_key?: string;
|
|
@@ -25,11 +25,7 @@ export declare class MetricCacheManager extends QrveyCacheManager<IMetricStoreSt
|
|
|
25
25
|
protected getConfigPropertyName(): keyof IGetMetricConfig;
|
|
26
26
|
protected getStorePropertyName(): keyof IMetricStoreState;
|
|
27
27
|
protected buildStoreId({ metric_id }: IGetMetricConfig): string;
|
|
28
|
-
protected
|
|
29
|
-
state: IMetricStoreState;
|
|
30
|
-
onChange: OnChangeType;
|
|
31
|
-
set: (property: keyof IMetricStoreState, value: unknown) => void;
|
|
32
|
-
};
|
|
28
|
+
protected getInitialState(): IMetricStoreState;
|
|
33
29
|
protected fetchDataAndUpdateStore(state: IMetricStoreState, config: IGetMetricConfig): void;
|
|
34
30
|
}
|
|
35
31
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createStore } from "@stencil/store";
|
|
2
1
|
import { QrveyCacheManager } from "./cache-manager";
|
|
3
2
|
import MetricPanelApi from "../services/api/metrics.api";
|
|
4
3
|
export class MetricCacheManager extends QrveyCacheManager {
|
|
@@ -17,8 +16,12 @@ export class MetricCacheManager extends QrveyCacheManager {
|
|
|
17
16
|
buildStoreId({ metric_id }) {
|
|
18
17
|
return `${metric_id}`;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
return
|
|
19
|
+
getInitialState() {
|
|
20
|
+
return {
|
|
21
|
+
metric: null,
|
|
22
|
+
loading: true,
|
|
23
|
+
error: null,
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
fetchDataAndUpdateStore(state, config) {
|
|
24
27
|
const api = new MetricPanelApi();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
2
2
|
import { IModel } from "../qrvey";
|
|
3
3
|
interface IGetModelConfig {
|
|
4
4
|
qv_token?: string;
|
|
@@ -20,11 +20,7 @@ export declare class ModelCacheManager extends QrveyCacheManager<IModelStoreStat
|
|
|
20
20
|
protected getConfigPropertyName(): keyof IGetModelConfig;
|
|
21
21
|
protected getStorePropertyName(): keyof IModelStoreState;
|
|
22
22
|
protected buildStoreId({ qrvey_id }: IGetModelConfig): string;
|
|
23
|
-
protected
|
|
24
|
-
state: IModelStoreState;
|
|
25
|
-
onChange: OnChangeType;
|
|
26
|
-
set: (property: keyof IModelStoreState, value: unknown) => void;
|
|
27
|
-
};
|
|
23
|
+
protected getInitialState(): IModelStoreState;
|
|
28
24
|
protected fetchDataAndUpdateStore(state: IModelStoreState, config: IGetModelConfig): void;
|
|
29
25
|
}
|
|
30
26
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createStore } from "@stencil/store";
|
|
2
1
|
import { QrveyCacheManager } from "./cache-manager";
|
|
3
2
|
import { getModel } from "../services/api/getModel.api";
|
|
4
3
|
export class ModelCacheManager extends QrveyCacheManager {
|
|
@@ -17,8 +16,12 @@ export class ModelCacheManager extends QrveyCacheManager {
|
|
|
17
16
|
buildStoreId({ qrvey_id }) {
|
|
18
17
|
return `${qrvey_id}`;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
return
|
|
19
|
+
getInitialState() {
|
|
20
|
+
return {
|
|
21
|
+
model: null,
|
|
22
|
+
loading: true,
|
|
23
|
+
error: null,
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
fetchDataAndUpdateStore(state, config) {
|
|
24
27
|
const includeInfo = ["bucketsInfo", "formulaInfo", "colorByValueInfo"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
1
2
|
import { AdminPermissions } from "../interfaces/AdminPermissions.interface";
|
|
2
|
-
import { OnChangeType, QrveyCacheManager } from "./cache-manager";
|
|
3
3
|
export interface IGetPermissionsConfig {
|
|
4
4
|
qv_token?: string;
|
|
5
5
|
api_key?: string;
|
|
@@ -17,11 +17,7 @@ export declare class PermissionsCacheManager extends QrveyCacheManager<IPermissi
|
|
|
17
17
|
protected getConfigPropertyName(): keyof IGetPermissionsConfig;
|
|
18
18
|
protected getStorePropertyName(): keyof IPermissionsStoreState;
|
|
19
19
|
protected buildStoreId({ user_id }: IGetPermissionsConfig): string;
|
|
20
|
-
protected
|
|
21
|
-
state: IPermissionsStoreState;
|
|
22
|
-
onChange: OnChangeType;
|
|
23
|
-
set: (property: keyof IPermissionsStoreState, value: unknown) => void;
|
|
24
|
-
};
|
|
20
|
+
protected getInitialState(): IPermissionsStoreState;
|
|
25
21
|
protected fetchDataAndUpdateStore(state: IPermissionsStoreState, config: IGetPermissionsConfig): void;
|
|
26
22
|
}
|
|
27
23
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createStore } from "@stencil/store";
|
|
2
1
|
import { QrveyCacheManager } from "./cache-manager";
|
|
3
2
|
import { getAdminPermissions } from "../services/api/adminPermissions.api";
|
|
4
3
|
export class PermissionsCacheManager extends QrveyCacheManager {
|
|
@@ -17,8 +16,12 @@ export class PermissionsCacheManager extends QrveyCacheManager {
|
|
|
17
16
|
buildStoreId({ user_id }) {
|
|
18
17
|
return `${user_id}`;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
return
|
|
19
|
+
getInitialState() {
|
|
20
|
+
return {
|
|
21
|
+
permissions: null,
|
|
22
|
+
loading: true,
|
|
23
|
+
error: null,
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
fetchDataAndUpdateStore(state, config) {
|
|
24
27
|
getAdminPermissions(config)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
2
2
|
import { AnTheme } from "../interfaces/themes/an-theme";
|
|
3
3
|
export interface IGetThemeConfig {
|
|
4
4
|
qv_token?: string;
|
|
@@ -18,11 +18,7 @@ export declare class ThemeCacheManager extends QrveyCacheManager<IThemeStoreStat
|
|
|
18
18
|
protected getConfigPropertyName(): keyof IGetThemeConfig;
|
|
19
19
|
protected getStorePropertyName(): keyof IThemeStoreState;
|
|
20
20
|
protected buildStoreId({ theme_id, app_id }: IGetThemeConfig): string;
|
|
21
|
-
protected
|
|
22
|
-
state: IThemeStoreState;
|
|
23
|
-
onChange: OnChangeType;
|
|
24
|
-
set: (property: keyof IThemeStoreState, value: unknown) => void;
|
|
25
|
-
};
|
|
21
|
+
protected getInitialState(): IThemeStoreState;
|
|
26
22
|
protected fetchDataAndUpdateStore(state: IThemeStoreState, config: IGetThemeConfig): void;
|
|
27
23
|
}
|
|
28
24
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createStore } from "@stencil/store";
|
|
2
1
|
import { QrveyCacheManager } from "./cache-manager";
|
|
3
2
|
import { getCurrentTheme, getThemeById } from "../services/api/Themes.api";
|
|
4
3
|
export class ThemeCacheManager extends QrveyCacheManager {
|
|
@@ -17,8 +16,12 @@ export class ThemeCacheManager extends QrveyCacheManager {
|
|
|
17
16
|
buildStoreId({ theme_id, app_id }) {
|
|
18
17
|
return `${app_id}-${theme_id !== null && theme_id !== void 0 ? theme_id : "current"}`;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
return
|
|
19
|
+
getInitialState() {
|
|
20
|
+
return {
|
|
21
|
+
theme: null,
|
|
22
|
+
loading: true,
|
|
23
|
+
error: null,
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
fetchDataAndUpdateStore(state, config) {
|
|
24
27
|
(config.theme_id ? getThemeById(config) : getCurrentTheme(config))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
2
2
|
export interface IGetChartConfig {
|
|
3
3
|
qv_token?: string;
|
|
4
4
|
api_key?: string;
|
|
@@ -24,11 +24,7 @@ export declare class ChartCacheManager extends QrveyCacheManager<IChartStoreStat
|
|
|
24
24
|
protected getConfigPropertyName(): keyof IGetChartConfig;
|
|
25
25
|
protected getStorePropertyName(): keyof IChartStoreState;
|
|
26
26
|
protected buildStoreId({ chart_id }: IGetChartConfig): string;
|
|
27
|
-
protected
|
|
28
|
-
state: IChartStoreState;
|
|
29
|
-
onChange: OnChangeType;
|
|
30
|
-
set: (property: keyof IChartStoreState, value: unknown) => void;
|
|
31
|
-
};
|
|
27
|
+
protected getInitialState(): IChartStoreState;
|
|
32
28
|
protected fetchDataAndUpdateStore(state: IChartStoreState, config: IGetChartConfig): void;
|
|
33
29
|
}
|
|
34
30
|
export {};
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ChartCacheManager = void 0;
|
|
7
|
-
const store_1 = require("@stencil/store");
|
|
8
7
|
const cache_manager_1 = require("./cache-manager");
|
|
9
8
|
const Charts_api_1 = __importDefault(require("../services/api/Charts.api"));
|
|
10
9
|
class ChartCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
@@ -23,8 +22,12 @@ class ChartCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
|
23
22
|
buildStoreId({ chart_id }) {
|
|
24
23
|
return `${chart_id}`;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
return
|
|
25
|
+
getInitialState() {
|
|
26
|
+
return {
|
|
27
|
+
chart: null,
|
|
28
|
+
loading: true,
|
|
29
|
+
error: null,
|
|
30
|
+
};
|
|
28
31
|
}
|
|
29
32
|
fetchDataAndUpdateStore(state, config) {
|
|
30
33
|
const chartConfig = Object.assign(Object.assign({}, config), { translated: true });
|
|
@@ -9,7 +9,8 @@ export declare abstract class QrveyCacheManager<TStoreState, TConfig> {
|
|
|
9
9
|
protected abstract getStorePropertyName(): keyof TStoreState;
|
|
10
10
|
protected abstract buildStoreId(config: TConfig): string;
|
|
11
11
|
protected abstract fetchDataAndUpdateStore(state: TStoreState, config: TConfig): void;
|
|
12
|
-
protected abstract
|
|
12
|
+
protected abstract getInitialState(): TStoreState;
|
|
13
|
+
protected createStore(_initialState?: Partial<TStoreState>): {
|
|
13
14
|
state: TStoreState;
|
|
14
15
|
onChange: OnChangeType;
|
|
15
16
|
set: (property: keyof TStoreState, value: unknown) => void;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QrveyCacheManager = void 0;
|
|
4
|
+
const store_1 = require("@stencil/store");
|
|
4
5
|
class QrveyCacheManager {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.stores = new Map();
|
|
7
8
|
}
|
|
9
|
+
createStore(_initialState) {
|
|
10
|
+
return (0, store_1.createStore)(Object.assign(Object.assign({}, this.getInitialState()), _initialState));
|
|
11
|
+
}
|
|
8
12
|
getStoreFromPromise(config, id) {
|
|
9
13
|
return new Promise((resolve) => {
|
|
10
14
|
const configProperty = this.getConfigPropertyName();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
2
2
|
export interface IGetMetricConfig {
|
|
3
3
|
qv_token?: string;
|
|
4
4
|
api_key?: string;
|
|
@@ -25,11 +25,7 @@ export declare class MetricCacheManager extends QrveyCacheManager<IMetricStoreSt
|
|
|
25
25
|
protected getConfigPropertyName(): keyof IGetMetricConfig;
|
|
26
26
|
protected getStorePropertyName(): keyof IMetricStoreState;
|
|
27
27
|
protected buildStoreId({ metric_id }: IGetMetricConfig): string;
|
|
28
|
-
protected
|
|
29
|
-
state: IMetricStoreState;
|
|
30
|
-
onChange: OnChangeType;
|
|
31
|
-
set: (property: keyof IMetricStoreState, value: unknown) => void;
|
|
32
|
-
};
|
|
28
|
+
protected getInitialState(): IMetricStoreState;
|
|
33
29
|
protected fetchDataAndUpdateStore(state: IMetricStoreState, config: IGetMetricConfig): void;
|
|
34
30
|
}
|
|
35
31
|
export {};
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MetricCacheManager = void 0;
|
|
7
|
-
const store_1 = require("@stencil/store");
|
|
8
7
|
const cache_manager_1 = require("./cache-manager");
|
|
9
8
|
const metrics_api_1 = __importDefault(require("../services/api/metrics.api"));
|
|
10
9
|
class MetricCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
@@ -23,8 +22,12 @@ class MetricCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
|
23
22
|
buildStoreId({ metric_id }) {
|
|
24
23
|
return `${metric_id}`;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
return
|
|
25
|
+
getInitialState() {
|
|
26
|
+
return {
|
|
27
|
+
metric: null,
|
|
28
|
+
loading: true,
|
|
29
|
+
error: null,
|
|
30
|
+
};
|
|
28
31
|
}
|
|
29
32
|
fetchDataAndUpdateStore(state, config) {
|
|
30
33
|
const api = new metrics_api_1.default();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
2
2
|
import { IModel } from "../qrvey";
|
|
3
3
|
interface IGetModelConfig {
|
|
4
4
|
qv_token?: string;
|
|
@@ -20,11 +20,7 @@ export declare class ModelCacheManager extends QrveyCacheManager<IModelStoreStat
|
|
|
20
20
|
protected getConfigPropertyName(): keyof IGetModelConfig;
|
|
21
21
|
protected getStorePropertyName(): keyof IModelStoreState;
|
|
22
22
|
protected buildStoreId({ qrvey_id }: IGetModelConfig): string;
|
|
23
|
-
protected
|
|
24
|
-
state: IModelStoreState;
|
|
25
|
-
onChange: OnChangeType;
|
|
26
|
-
set: (property: keyof IModelStoreState, value: unknown) => void;
|
|
27
|
-
};
|
|
23
|
+
protected getInitialState(): IModelStoreState;
|
|
28
24
|
protected fetchDataAndUpdateStore(state: IModelStoreState, config: IGetModelConfig): void;
|
|
29
25
|
}
|
|
30
26
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModelCacheManager = void 0;
|
|
4
|
-
const store_1 = require("@stencil/store");
|
|
5
4
|
const cache_manager_1 = require("./cache-manager");
|
|
6
5
|
const getModel_api_1 = require("../services/api/getModel.api");
|
|
7
6
|
class ModelCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
@@ -20,8 +19,12 @@ class ModelCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
|
20
19
|
buildStoreId({ qrvey_id }) {
|
|
21
20
|
return `${qrvey_id}`;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
return
|
|
22
|
+
getInitialState() {
|
|
23
|
+
return {
|
|
24
|
+
model: null,
|
|
25
|
+
loading: true,
|
|
26
|
+
error: null,
|
|
27
|
+
};
|
|
25
28
|
}
|
|
26
29
|
fetchDataAndUpdateStore(state, config) {
|
|
27
30
|
const includeInfo = ["bucketsInfo", "formulaInfo", "colorByValueInfo"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
1
2
|
import { AdminPermissions } from "../interfaces/AdminPermissions.interface";
|
|
2
|
-
import { OnChangeType, QrveyCacheManager } from "./cache-manager";
|
|
3
3
|
export interface IGetPermissionsConfig {
|
|
4
4
|
qv_token?: string;
|
|
5
5
|
api_key?: string;
|
|
@@ -17,11 +17,7 @@ export declare class PermissionsCacheManager extends QrveyCacheManager<IPermissi
|
|
|
17
17
|
protected getConfigPropertyName(): keyof IGetPermissionsConfig;
|
|
18
18
|
protected getStorePropertyName(): keyof IPermissionsStoreState;
|
|
19
19
|
protected buildStoreId({ user_id }: IGetPermissionsConfig): string;
|
|
20
|
-
protected
|
|
21
|
-
state: IPermissionsStoreState;
|
|
22
|
-
onChange: OnChangeType;
|
|
23
|
-
set: (property: keyof IPermissionsStoreState, value: unknown) => void;
|
|
24
|
-
};
|
|
20
|
+
protected getInitialState(): IPermissionsStoreState;
|
|
25
21
|
protected fetchDataAndUpdateStore(state: IPermissionsStoreState, config: IGetPermissionsConfig): void;
|
|
26
22
|
}
|
|
27
23
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PermissionsCacheManager = void 0;
|
|
4
|
-
const store_1 = require("@stencil/store");
|
|
5
4
|
const cache_manager_1 = require("./cache-manager");
|
|
6
5
|
const adminPermissions_api_1 = require("../services/api/adminPermissions.api");
|
|
7
6
|
class PermissionsCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
@@ -20,8 +19,12 @@ class PermissionsCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
|
20
19
|
buildStoreId({ user_id }) {
|
|
21
20
|
return `${user_id}`;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
return
|
|
22
|
+
getInitialState() {
|
|
23
|
+
return {
|
|
24
|
+
permissions: null,
|
|
25
|
+
loading: true,
|
|
26
|
+
error: null,
|
|
27
|
+
};
|
|
25
28
|
}
|
|
26
29
|
fetchDataAndUpdateStore(state, config) {
|
|
27
30
|
(0, adminPermissions_api_1.getAdminPermissions)(config)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
2
2
|
import { AnTheme } from "../interfaces/themes/an-theme";
|
|
3
3
|
export interface IGetThemeConfig {
|
|
4
4
|
qv_token?: string;
|
|
@@ -18,11 +18,7 @@ export declare class ThemeCacheManager extends QrveyCacheManager<IThemeStoreStat
|
|
|
18
18
|
protected getConfigPropertyName(): keyof IGetThemeConfig;
|
|
19
19
|
protected getStorePropertyName(): keyof IThemeStoreState;
|
|
20
20
|
protected buildStoreId({ theme_id, app_id }: IGetThemeConfig): string;
|
|
21
|
-
protected
|
|
22
|
-
state: IThemeStoreState;
|
|
23
|
-
onChange: OnChangeType;
|
|
24
|
-
set: (property: keyof IThemeStoreState, value: unknown) => void;
|
|
25
|
-
};
|
|
21
|
+
protected getInitialState(): IThemeStoreState;
|
|
26
22
|
protected fetchDataAndUpdateStore(state: IThemeStoreState, config: IGetThemeConfig): void;
|
|
27
23
|
}
|
|
28
24
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ThemeCacheManager = void 0;
|
|
4
|
-
const store_1 = require("@stencil/store");
|
|
5
4
|
const cache_manager_1 = require("./cache-manager");
|
|
6
5
|
const Themes_api_1 = require("../services/api/Themes.api");
|
|
7
6
|
class ThemeCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
@@ -20,8 +19,12 @@ class ThemeCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
|
20
19
|
buildStoreId({ theme_id, app_id }) {
|
|
21
20
|
return `${app_id}-${theme_id !== null && theme_id !== void 0 ? theme_id : "current"}`;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
return
|
|
22
|
+
getInitialState() {
|
|
23
|
+
return {
|
|
24
|
+
theme: null,
|
|
25
|
+
loading: true,
|
|
26
|
+
error: null,
|
|
27
|
+
};
|
|
25
28
|
}
|
|
26
29
|
fetchDataAndUpdateStore(state, config) {
|
|
27
30
|
(config.theme_id ? (0, Themes_api_1.getThemeById)(config) : (0, Themes_api_1.getCurrentTheme)(config))
|