@open-tender/cloud 0.1.46 → 0.1.48
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.
|
@@ -7,7 +7,7 @@ export interface ConfigState {
|
|
|
7
7
|
brand: ConfigBrand | null;
|
|
8
8
|
content: ConfigContent | null;
|
|
9
9
|
error: any;
|
|
10
|
-
|
|
10
|
+
isApp: boolean | undefined;
|
|
11
11
|
isBackgroundFetch: boolean;
|
|
12
12
|
loading: RequestStatus;
|
|
13
13
|
retries: number;
|
|
@@ -23,7 +23,7 @@ export declare const fetchConfig: import("@reduxjs/toolkit").AsyncThunk<ConfigSt
|
|
|
23
23
|
clientId?: string | undefined;
|
|
24
24
|
brandId?: string | undefined;
|
|
25
25
|
callback?: (() => void) | undefined;
|
|
26
|
-
|
|
26
|
+
isApp?: boolean | undefined;
|
|
27
27
|
}, {
|
|
28
28
|
state: AppState;
|
|
29
29
|
rejectValue: RequestError;
|
|
@@ -14,7 +14,7 @@ const initialState = {
|
|
|
14
14
|
brand: null,
|
|
15
15
|
content: null,
|
|
16
16
|
theme: null,
|
|
17
|
-
|
|
17
|
+
isApp: false,
|
|
18
18
|
isBackgroundFetch: false,
|
|
19
19
|
loading: 'idle',
|
|
20
20
|
error: null,
|
|
@@ -29,13 +29,7 @@ exports.fetchConfig = (0, toolkit_1.createAsyncThunk)(ConfigActionType.FetchConf
|
|
|
29
29
|
try {
|
|
30
30
|
const api = new api_1.default(options);
|
|
31
31
|
const response = yield api.getConfig();
|
|
32
|
-
|
|
33
|
-
// baseUrl: options.baseUrl,
|
|
34
|
-
// authUrl: options.authUrl,
|
|
35
|
-
// clientId: options.clientId,
|
|
36
|
-
// brandId: options.brandId
|
|
37
|
-
// }
|
|
38
|
-
const { baseUrl, authUrl, clientId, brandId, callback } = options;
|
|
32
|
+
const { baseUrl, authUrl, clientId, brandId, callback, isApp } = options;
|
|
39
33
|
const app = { baseUrl, authUrl, clientId, brandId };
|
|
40
34
|
if (!app.clientId)
|
|
41
35
|
app.clientId = response.clientId;
|
|
@@ -43,7 +37,7 @@ exports.fetchConfig = (0, toolkit_1.createAsyncThunk)(ConfigActionType.FetchConf
|
|
|
43
37
|
app.brandId = response.brand.brandId;
|
|
44
38
|
if (callback)
|
|
45
39
|
callback();
|
|
46
|
-
return Object.assign(Object.assign({}, response), { app });
|
|
40
|
+
return Object.assign(Object.assign({}, response), { isApp, app });
|
|
47
41
|
}
|
|
48
42
|
catch (err) {
|
|
49
43
|
return rejectWithValue(err);
|
|
@@ -64,18 +58,12 @@ const configSlice = (0, toolkit_1.createSlice)({
|
|
|
64
58
|
extraReducers: builder => {
|
|
65
59
|
builder
|
|
66
60
|
.addCase(exports.fetchConfig.fulfilled, (state, action) => {
|
|
67
|
-
const { app, brand, content, theme, settings } = action.payload;
|
|
68
|
-
const isApp = action.meta.arg.isMobile;
|
|
61
|
+
const { app, isApp, brand, content, theme, settings } = action.payload;
|
|
69
62
|
state.app = app;
|
|
70
|
-
state.appTheme = isApp && theme ? (0, utils_1.decorateTheme)(theme) : null;
|
|
71
63
|
state.brand = brand;
|
|
72
64
|
state.content = content;
|
|
73
65
|
state.theme = !isApp && theme ? theme : null;
|
|
74
|
-
|
|
75
|
-
// ? action.meta.arg.isMobile
|
|
76
|
-
// ? decorateTheme(theme as Theme)
|
|
77
|
-
// : theme
|
|
78
|
-
// : null
|
|
66
|
+
state.appTheme = isApp && theme ? (0, utils_1.decorateTheme)(theme) : null;
|
|
79
67
|
state.settings = settings;
|
|
80
68
|
state.loading = 'idle';
|
|
81
69
|
state.api = new api_1.default(app);
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { RequestError } from '@open-tender/types';
|
|
1
|
+
import { LatLng, RequestError } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface GeoLocationState {
|
|
4
|
-
latLng:
|
|
5
|
-
lat: number;
|
|
6
|
-
lng: number;
|
|
7
|
-
} | null;
|
|
4
|
+
latLng: LatLng | null;
|
|
8
5
|
error: RequestError;
|
|
9
6
|
loading: boolean;
|
|
10
7
|
}
|
|
11
8
|
export declare const resetGeolocation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"geolocation/resetGeolocation">, setGeoLatLng: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "geolocation/setGeoLatLng">, setGeoError: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "geolocation/setGeoError">, setGeoLoading: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"geolocation/setGeoLoading">;
|
|
12
9
|
export declare const selectGeo: (state: AppState) => GeoLocationState;
|
|
13
|
-
export declare const selectGeoLatLng: (state: AppState) =>
|
|
14
|
-
lat: number;
|
|
15
|
-
lng: number;
|
|
16
|
-
} | null;
|
|
10
|
+
export declare const selectGeoLatLng: (state: AppState) => LatLng | null;
|
|
17
11
|
export declare const geolocationReducer: import("redux").Reducer<GeoLocationState, import("redux").AnyAction>;
|
|
@@ -7,7 +7,7 @@ export interface ConfigState {
|
|
|
7
7
|
brand: ConfigBrand | null;
|
|
8
8
|
content: ConfigContent | null;
|
|
9
9
|
error: any;
|
|
10
|
-
|
|
10
|
+
isApp: boolean | undefined;
|
|
11
11
|
isBackgroundFetch: boolean;
|
|
12
12
|
loading: RequestStatus;
|
|
13
13
|
retries: number;
|
|
@@ -23,7 +23,7 @@ export declare const fetchConfig: import("@reduxjs/toolkit").AsyncThunk<ConfigSt
|
|
|
23
23
|
clientId?: string | undefined;
|
|
24
24
|
brandId?: string | undefined;
|
|
25
25
|
callback?: (() => void) | undefined;
|
|
26
|
-
|
|
26
|
+
isApp?: boolean | undefined;
|
|
27
27
|
}, {
|
|
28
28
|
state: AppState;
|
|
29
29
|
rejectValue: RequestError;
|
|
@@ -10,7 +10,7 @@ const initialState = {
|
|
|
10
10
|
brand: null,
|
|
11
11
|
content: null,
|
|
12
12
|
theme: null,
|
|
13
|
-
|
|
13
|
+
isApp: false,
|
|
14
14
|
isBackgroundFetch: false,
|
|
15
15
|
loading: 'idle',
|
|
16
16
|
error: null,
|
|
@@ -25,13 +25,7 @@ export const fetchConfig = createAsyncThunk(ConfigActionType.FetchConfig, (optio
|
|
|
25
25
|
try {
|
|
26
26
|
const api = new OpenTenderAPI(options);
|
|
27
27
|
const response = yield api.getConfig();
|
|
28
|
-
|
|
29
|
-
// baseUrl: options.baseUrl,
|
|
30
|
-
// authUrl: options.authUrl,
|
|
31
|
-
// clientId: options.clientId,
|
|
32
|
-
// brandId: options.brandId
|
|
33
|
-
// }
|
|
34
|
-
const { baseUrl, authUrl, clientId, brandId, callback } = options;
|
|
28
|
+
const { baseUrl, authUrl, clientId, brandId, callback, isApp } = options;
|
|
35
29
|
const app = { baseUrl, authUrl, clientId, brandId };
|
|
36
30
|
if (!app.clientId)
|
|
37
31
|
app.clientId = response.clientId;
|
|
@@ -39,7 +33,7 @@ export const fetchConfig = createAsyncThunk(ConfigActionType.FetchConfig, (optio
|
|
|
39
33
|
app.brandId = response.brand.brandId;
|
|
40
34
|
if (callback)
|
|
41
35
|
callback();
|
|
42
|
-
return Object.assign(Object.assign({}, response), { app });
|
|
36
|
+
return Object.assign(Object.assign({}, response), { isApp, app });
|
|
43
37
|
}
|
|
44
38
|
catch (err) {
|
|
45
39
|
return rejectWithValue(err);
|
|
@@ -60,18 +54,12 @@ const configSlice = createSlice({
|
|
|
60
54
|
extraReducers: builder => {
|
|
61
55
|
builder
|
|
62
56
|
.addCase(fetchConfig.fulfilled, (state, action) => {
|
|
63
|
-
const { app, brand, content, theme, settings } = action.payload;
|
|
64
|
-
const isApp = action.meta.arg.isMobile;
|
|
57
|
+
const { app, isApp, brand, content, theme, settings } = action.payload;
|
|
65
58
|
state.app = app;
|
|
66
|
-
state.appTheme = isApp && theme ? decorateTheme(theme) : null;
|
|
67
59
|
state.brand = brand;
|
|
68
60
|
state.content = content;
|
|
69
61
|
state.theme = !isApp && theme ? theme : null;
|
|
70
|
-
|
|
71
|
-
// ? action.meta.arg.isMobile
|
|
72
|
-
// ? decorateTheme(theme as Theme)
|
|
73
|
-
// : theme
|
|
74
|
-
// : null
|
|
62
|
+
state.appTheme = isApp && theme ? decorateTheme(theme) : null;
|
|
75
63
|
state.settings = settings;
|
|
76
64
|
state.loading = 'idle';
|
|
77
65
|
state.api = new OpenTenderAPI(app);
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { RequestError } from '@open-tender/types';
|
|
1
|
+
import { LatLng, RequestError } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface GeoLocationState {
|
|
4
|
-
latLng:
|
|
5
|
-
lat: number;
|
|
6
|
-
lng: number;
|
|
7
|
-
} | null;
|
|
4
|
+
latLng: LatLng | null;
|
|
8
5
|
error: RequestError;
|
|
9
6
|
loading: boolean;
|
|
10
7
|
}
|
|
11
8
|
export declare const resetGeolocation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"geolocation/resetGeolocation">, setGeoLatLng: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "geolocation/setGeoLatLng">, setGeoError: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "geolocation/setGeoError">, setGeoLoading: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"geolocation/setGeoLoading">;
|
|
12
9
|
export declare const selectGeo: (state: AppState) => GeoLocationState;
|
|
13
|
-
export declare const selectGeoLatLng: (state: AppState) =>
|
|
14
|
-
lat: number;
|
|
15
|
-
lng: number;
|
|
16
|
-
} | null;
|
|
10
|
+
export declare const selectGeoLatLng: (state: AppState) => LatLng | null;
|
|
17
11
|
export declare const geolocationReducer: import("redux").Reducer<GeoLocationState, import("redux").AnyAction>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"typescript": "^4.8.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@open-tender/types": "^0.2.
|
|
53
|
-
"@open-tender/utils": "^0.1.
|
|
52
|
+
"@open-tender/types": "^0.2.43",
|
|
53
|
+
"@open-tender/utils": "^0.1.96",
|
|
54
54
|
"@reduxjs/toolkit": "^1.8.5",
|
|
55
55
|
"react": "^18.2.0"
|
|
56
56
|
},
|