@corpsmap/corpsmap 4.1.0 → 4.1.1

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 (33) hide show
  1. package/dist/corpsmap.es.js +1 -1
  2. package/dist/corpsmap.umd.js +1 -1
  3. package/package.json +2 -1
  4. package/src/App.jsx +0 -12
  5. package/src/application-bundles-old/auth-bundle.js +0 -130
  6. package/src/application-bundles-old/config-bundle.js +0 -29
  7. package/src/application-bundles-old/ui-bundle.js +0 -406
  8. package/src/core-plugins/draw-tools-old/create-draw-bundle.js +0 -222
  9. package/src/core-plugins/draw-tools-old/draw-button.js +0 -189
  10. package/src/core-plugins/draw-tools-old/draw-label-bundle.js +0 -116
  11. package/src/core-plugins/draw-tools-old/draw-modify-bundle.js +0 -156
  12. package/src/core-plugins/draw-tools-old/draw-styles.js +0 -110
  13. package/src/core-plugins/draw-tools-old/draw-tool-item.js +0 -67
  14. package/src/core-plugins/draw-tools-old/index.js +0 -32
  15. package/src/css/_deprecated_bootstrap/css/bootstrap-paper.css +0 -7606
  16. package/src/css/_deprecated_bootstrap/css/bootstrap-paper.min.css +0 -8083
  17. package/src/css/_deprecated_bootstrap/css/bootstrap-simplex.min.css +0 -7328
  18. package/src/css/_deprecated_bootstrap/css/bootstrap-theme.css +0 -587
  19. package/src/css/_deprecated_bootstrap/css/bootstrap-theme.css.map +0 -1
  20. package/src/css/_deprecated_bootstrap/css/bootstrap-theme.min.css +0 -6
  21. package/src/css/_deprecated_bootstrap/css/bootstrap-theme.min.css.map +0 -1
  22. package/src/css/_deprecated_bootstrap/css/bootstrap.css +0 -7137
  23. package/src/css/_deprecated_bootstrap/css/bootstrap.css.map +0 -142
  24. package/src/css/_deprecated_bootstrap/css/bootstrap.min.css +0 -7132
  25. package/src/css/_deprecated_bootstrap/css/bootstrap.min.css.map +0 -143
  26. package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  27. package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.svg +0 -288
  28. package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  29. package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  30. package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  31. package/src/css/_deprecated_bootstrap/js/bootstrap.js +0 -2377
  32. package/src/css/_deprecated_bootstrap/js/bootstrap.min.js +0 -7
  33. package/src/css/_deprecated_bootstrap/js/npm.js +0 -13
@@ -1,130 +0,0 @@
1
- import xhr from 'xhr';
2
- import { createSelector } from 'redux-bundler';
3
-
4
- const getTokenPart = function(token, part){
5
- const splitToken = token.split('.');
6
- return splitToken[part];
7
- }
8
-
9
- export default {
10
- name: 'auth',
11
-
12
- getReducer(){
13
- const initialData = {
14
- shouldCheckExpired: true,
15
- token: '',
16
- err: null
17
- }
18
-
19
- return (state = initialData, {type, payload}) => {
20
-
21
- switch(type){
22
- case 'AUTH_LOGGED_IN':
23
- case 'AUTH_LOGGED_ERROR':
24
- case 'AUTH_CHECK_EXPIRED':
25
- return Object.assign({}, state, payload);
26
- case 'AUTH_LOGGED_OUT':
27
- return Object.assign({}, state, {
28
- token: '',
29
- err: null
30
- });
31
- default:
32
- return state;
33
- }
34
- }
35
- },
36
-
37
- doLogin: () => ({dispatch, store}) => {
38
- const root = store.selectApiRoot();
39
- store.doSetCursor('wait');
40
- let notification;
41
- dispatch({type:'AUTH_LOGGING_IN'});
42
- xhr.get({
43
- url: `${root}/auth/login`
44
- }, (err, res, body) => {
45
- store.doSetCursor();
46
- if(res.statusCode === 404){
47
- notification = {
48
- title: "Error Logging In",
49
- message: `It looks like you don't have a CorpsMap account, click the button below to open the CorpsMap home page and create an account.`,
50
- level: "info",
51
- position: "tr",
52
- autoDismiss: 0,
53
- action: {
54
- label: "Create Account",
55
- callback: function() {
56
- window.open(
57
- `${root}/corpsmap/home`,
58
- "_blank"
59
- );
60
- }
61
- }
62
- }
63
- dispatch({type:'AUTH_USER_DOES_NOT_EXIST', payload: { notification: notification }})
64
- }else if(res.statusCode === 200){
65
- notification = {
66
- title: 'Authentication Notificiation',
67
- message: 'Successfully Logged In',
68
- level: 'success'
69
- }
70
- dispatch({type:'AUTH_LOGGED_IN', payload: { token: JSON.parse(body), notification: notification }});
71
- }else{
72
- notification = {
73
- title: 'Authentication Notificiation',
74
- message: 'Error Logging In',
75
- level: 'error'
76
- }
77
- dispatch({type:'AUTH_LOGIN_ERROR', payload: { err: err , notification: notification }})
78
- }
79
- })
80
- },
81
-
82
- doLogout: () => ({dispatch, store}) => {
83
- dispatch({type:'AUTH_LOGGED_OUT'});
84
- },
85
-
86
- doAuthCheckExpired: () => ({ dispatch, store }) => {
87
- dispatch({ type: 'AUTH_CHECK_EXPIRED', payload: { shouldCheckExpired: false }});
88
- const isExpired = store.selectIsTokenExpired();
89
- if(isExpired) store.doLogout();
90
- },
91
-
92
- selectIsLoggedIn: (state) => {
93
- return !!state.auth.token;
94
- },
95
-
96
- selectTokenRaw: (state) => {
97
- return state.auth.token;
98
- },
99
-
100
- selectIsTokenExpired: createSelector(
101
- 'selectIsLoggedIn',
102
- 'selectTokenPayload',
103
- (isLoggedIn, payload) => {
104
- if(!isLoggedIn) return false;
105
- return payload.exp < Math.floor(Date.now()/1000);
106
- }
107
- ),
108
-
109
- selectTokenHeader: createSelector(
110
- 'selectTokenRaw',
111
- (token) => {
112
- if(!token) return {};
113
- return JSON.parse(window.atob(getTokenPart(token, 0)));
114
- }
115
- ),
116
-
117
- selectTokenPayload: createSelector(
118
- 'selectTokenRaw',
119
- (token) => {
120
- if(!token) return {};
121
- return JSON.parse(window.atob(getTokenPart(token, 1)));
122
- }
123
- ),
124
-
125
- reactAuthShouldCheckExpired: (state) => {
126
- if(state.auth.shouldCheckExpired) return { actionCreator: 'doAuthCheckExpired' };
127
- },
128
-
129
- persistActions: ['AUTH_LOGGED_IN', 'AUTH_LOGGED_OUT']
130
- }
@@ -1,29 +0,0 @@
1
-
2
- export default {
3
- name: 'config',
4
- getReducer(){
5
- const initialData = {
6
- default:{}
7
- }
8
-
9
- return (state = initialData, { type, payload }) => {
10
- return state;
11
- }
12
- },
13
-
14
- selectDefaultConfig: (state) => {
15
- return state.config.default;
16
- },
17
-
18
- selectBasemapList: (state) => {
19
- return state.config.default.basemaps.map((b) => {
20
- if(b.url.indexOf('{accessToken}') !== -1) b.url = b.url.replace(/{accessToken}/ig, b.accessToken || '');
21
- if(b.url.indexOf('{s}') !== -1) b.url = b.url.replace(/{s}/ig, b.accessToken || '{a-c}');
22
- return b;
23
- });
24
- },
25
-
26
- selectDefaultLayers: (state) => {
27
- return state.config.default.datasets;
28
- }
29
- }
@@ -1,406 +0,0 @@
1
- // import v4 from 'uuid/v4';
2
- import { v4 as uuidv4 } from "uuid";
3
-
4
- export default {
5
- name: "ui",
6
-
7
- getReducer: () => {
8
- const initialData = {
9
- northConfig: {
10
- height: window.innerHeight,
11
- },
12
- southConfig: {
13
- height: 0,
14
- children: [],
15
- },
16
- primaryPanelConfig: {
17
- openedBy: null,
18
- width: 420,
19
- children: [],
20
- options: null,
21
- },
22
- secondaryPanelConfig: {
23
- open: false,
24
- width: 300,
25
- children: [],
26
- options: null,
27
- },
28
- modalConfig: {
29
- children: [],
30
- options: null,
31
- openedBy: null,
32
- },
33
- basicToolbarConfig: {
34
- activeTool: null,
35
- },
36
- theme: "bg-blue-chambray",
37
- shouldUpdateWindowSize: false,
38
- };
39
-
40
- return (state = initialData, { type, payload }) => {
41
- if (type === "WINDOW_RESIZE") {
42
- return Object.assign({}, state, {
43
- shouldUpdateWindowSize: true,
44
- });
45
- }
46
-
47
- if (type.indexOf("UI_UPDATE_WINDOW_SIZE_") !== -1) {
48
- return Object.assign({}, state, payload);
49
- }
50
-
51
- if (type === "UI_RESIZED_NORTH_SOUTH") {
52
- const northConfig = {
53
- height: payload.hNorth,
54
- };
55
- const southConfig = {
56
- height: payload.hSouth,
57
- children: state.southConfig.children,
58
- options: state.southConfig.options,
59
- };
60
- return Object.assign({}, state, {
61
- northConfig: northConfig,
62
- southConfig: southConfig,
63
- });
64
- }
65
-
66
- if (type === "UI_OPENED_SOUTH_PANEL") {
67
- const northConfig = {
68
- height: window.innerHeight / 2,
69
- };
70
- const southConfig = {
71
- height: window.innerHeight / 2,
72
- children: payload.children,
73
- };
74
- return Object.assign({}, state, {
75
- northConfig: northConfig,
76
- southConfig: southConfig,
77
- });
78
- }
79
-
80
- if (type === "UI_CLOSED_SOUTH_PANEL") {
81
- const northConfig = {
82
- height: window.innerHeight,
83
- };
84
- const southConfig = {
85
- height: 0,
86
- children: [],
87
- };
88
- return Object.assign({}, state, {
89
- northConfig: northConfig,
90
- southConfig: southConfig,
91
- });
92
- }
93
-
94
- if (type === "UI_CLOSED_SOUTH_TAB") {
95
- const southConfig = {
96
- children: payload.children,
97
- };
98
- return Object.assign({}, state, {
99
- southConfig: southConfig,
100
- });
101
- }
102
-
103
- if (type === "UI_OPENED_MODAL_WINDOW") {
104
- const modalConfig = {
105
- children: payload.children,
106
- options: payload.options,
107
- openedBy: payload.openedBy,
108
- };
109
- return Object.assign({}, state, {
110
- modalConfig: modalConfig,
111
- });
112
- }
113
-
114
- if (type === "UI_CLOSED_MODAL_WINDOW") {
115
- const modalConfig = {
116
- children: [],
117
- options: null,
118
- openedBy: null,
119
- };
120
- return Object.assign({}, state, {
121
- modalConfig: modalConfig,
122
- });
123
- }
124
-
125
- if (type === "UI_OPENED_PRIMARY_PANEL") {
126
- const primaryPanelConfig = {
127
- openedBy: payload.openedBy,
128
- width: state.primaryPanelConfig.width,
129
- children: payload.children,
130
- options: payload.options,
131
- };
132
- return Object.assign({}, state, {
133
- primaryPanelConfig: primaryPanelConfig,
134
- });
135
- }
136
-
137
- if (type === "UI_CLOSED_PRIMARY_PANEL") {
138
- const primaryPanelConfig = {
139
- openedBy: null,
140
- width: state.primaryPanelConfig.width,
141
- left: state.primaryPanelConfig.left,
142
- children: [],
143
- options: null,
144
- };
145
- return Object.assign({}, state, {
146
- primaryPanelConfig: primaryPanelConfig,
147
- });
148
- }
149
-
150
- if (type === "UI_RESIZED_PRIMARY_PANEL") {
151
- const primaryPanelConfig = {
152
- open: state.primaryPanelConfig.open,
153
- width: payload.width,
154
- left: state.primaryPanelConfig.left,
155
- children: state.primaryPanelConfig.children,
156
- options: state.primaryPanelConfig.options,
157
- openedBy: state.primaryPanelConfig.openedBy,
158
- };
159
- const secondaryPanelConfig = {
160
- open: state.secondaryPanelConfig.open,
161
- width: state.secondaryPanelConfig.width,
162
- left: payload.width,
163
- children: state.secondaryPanelConfig.children,
164
- options: state.secondaryPanelConfig.options,
165
- openedBy: state.secondaryPanelConfig.openedBy,
166
- };
167
- return Object.assign({}, state, {
168
- primaryPanelConfig: primaryPanelConfig,
169
- secondaryPanelConfig: secondaryPanelConfig,
170
- });
171
- }
172
-
173
- if (type === "UI_ACTIVATE_BASIC_TOOL") {
174
- const basicToolbarConfig = {
175
- activeTool: payload,
176
- };
177
- return Object.assign({}, state, {
178
- basicToolbarConfig: basicToolbarConfig,
179
- });
180
- }
181
-
182
- if (type === "UI_DEACTIVATE_BASIC_TOOL") {
183
- const basicToolbarConfig = {
184
- activeTool: null,
185
- };
186
- return Object.assign({}, state, {
187
- basicToolbarConfig: basicToolbarConfig,
188
- });
189
- }
190
-
191
- if (type === "UI_THEME_CHANGED") {
192
- return Object.assign({}, state, {
193
- theme: payload,
194
- });
195
- }
196
-
197
- return state;
198
- };
199
- },
200
-
201
- // ACTION CREATORS
202
- doUiUpdateWindowSize:
203
- () =>
204
- ({ dispatch, store }) => {
205
- dispatch({
206
- type: "UI_UPDATE_WINDOW_SIZE_START",
207
- payload: { shouldUpdateWindowSize: false },
208
- });
209
- const h = store.selectViewportHeight();
210
- const northConfig = store.selectNorthConfig();
211
- const southConfig = store.selectSouthConfig();
212
- const northPortion =
213
- northConfig.height / (northConfig.height + southConfig.height);
214
- const southPortion =
215
- southConfig.height / (northConfig.height + southConfig.height);
216
- const newPayload = {
217
- northConfig: Object.assign({}, northConfig, {
218
- height: h * northPortion,
219
- }),
220
- southConfig: Object.assign({}, southConfig, {
221
- height: h * southPortion,
222
- }),
223
- };
224
- dispatch({ type: "UI_UPDATE_WINDOW_SIZE_COMPLETE", payload: newPayload });
225
- store.doMapUpdateSize();
226
- },
227
-
228
- doMapUpdateSize:
229
- () =>
230
- ({ dispatch, store }) => {
231
- const map = store.selectMap();
232
- window.setTimeout(() => {
233
- map.updateSize();
234
- }, 100);
235
- },
236
-
237
- doSouthRegionOpen:
238
- ({ component, options, openedBy, displayName }) =>
239
- ({ dispatch, store }) => {
240
- const existingChildren = store.selectSouthRegionChildren();
241
- const uid = uuidv4();
242
- dispatch({
243
- type: "UI_OPENED_SOUTH_PANEL",
244
- payload: {
245
- children: existingChildren.concat([
246
- { component, options, openedBy, displayName, uid },
247
- ]),
248
- },
249
- });
250
- store.doMapUpdateSize();
251
- },
252
-
253
- doCloseSouthTab:
254
- (child) =>
255
- ({ dispatch, store }) => {
256
- const children = store.selectSouthRegionChildren().slice();
257
- const idx = children.indexOf(child);
258
- children.splice(idx, 1);
259
- dispatch({
260
- type: "UI_CLOSED_SOUTH_TAB",
261
- payload: { children: children },
262
- });
263
- if (children.length === 0) return store.doCloseSouthRegion();
264
- },
265
-
266
- doCloseSouthRegion:
267
- () =>
268
- ({ dispatch, store }) => {
269
- dispatch({ type: "UI_CLOSED_SOUTH_PANEL" });
270
- store.doMapUpdateSize();
271
- },
272
-
273
- doModalOpen:
274
- ({ children, options, openedBy }) =>
275
- ({ dispatch }) => {
276
- dispatch({
277
- type: "UI_OPENED_MODAL_WINDOW",
278
- payload: { children, options, openedBy },
279
- });
280
- },
281
-
282
- doModalClose:
283
- () =>
284
- ({ dispatch }) => {
285
- dispatch({ type: "UI_CLOSED_MODAL_WINDOW" });
286
- },
287
-
288
- doPrimaryPanelOpen:
289
- ({ children, options, openedBy }) =>
290
- ({ dispatch }) => {
291
- dispatch({
292
- type: "UI_OPENED_PRIMARY_PANEL",
293
- payload: { children, options, openedBy },
294
- });
295
- },
296
-
297
- doPrimaryPanelClose:
298
- () =>
299
- ({ dispatch }) => {
300
- dispatch({ type: "UI_CLOSED_PRIMARY_PANEL" });
301
- },
302
-
303
- doOpenSecondaryPanel:
304
- ({ children, options, openedBy }) =>
305
- ({ dispatch }) => {
306
- dispatch({
307
- type: "UI_OPENED_SECONDARY_PANEL",
308
- payload: { children, options, openedBy },
309
- });
310
- },
311
-
312
- doCloseSecondaryPanel:
313
- () =>
314
- ({ dispatch }) => {
315
- dispatch({ type: "UI_CLOSED_SECONDARY_PANEL" });
316
- },
317
-
318
- doSetTheme:
319
- (newTheme) =>
320
- ({ dispatch }) => {
321
- dispatch({ type: "UI_THEME_CHANGED", payload: newTheme });
322
- },
323
-
324
- doResizeSouthRegion:
325
- ({ hNorth, hSouth }) =>
326
- ({ dispatch, store }) => {
327
- dispatch({ type: "UI_RESIZED_NORTH_SOUTH", payload: { hNorth, hSouth } });
328
- store.doMapUpdateSize();
329
- },
330
-
331
- doPrimaryPanelResize:
332
- ({ width }) =>
333
- ({ dispatch }) => {
334
- dispatch({ type: "UI_RESIZED_PRIMARY_PANEL", payload: { width } });
335
- },
336
-
337
- doBasicToolbarActivate:
338
- ({ activeTool }) =>
339
- ({ dispatch }) => {
340
- dispatch({ type: "UI_ACTIVATE_BASIC_TOOL", payload: activeTool });
341
- },
342
-
343
- doBasicToolbarDeactivate:
344
- () =>
345
- ({ dispatch }) => {
346
- dispatch({ type: "UI_DEACTIVATE_BASIC_TOOL" });
347
- },
348
-
349
- // SELECTORS
350
- selectNorthConfig: (state) => {
351
- return state.ui.northConfig;
352
- },
353
-
354
- selectSouthConfig: (state) => {
355
- return state.ui.southConfig;
356
- },
357
-
358
- selectNorthHeight: (state) => {
359
- return state.ui.northConfig.height;
360
- },
361
-
362
- selectSouthHeight: (state) => {
363
- return state.ui.southConfig.height;
364
- },
365
-
366
- selectSouthRegionChildren: (state) => {
367
- return state.ui.southConfig.children;
368
- },
369
-
370
- selectModalChildren: (state) => {
371
- return state.ui.modalConfig.children;
372
- },
373
-
374
- selectModalOptions: (state) => {
375
- return state.ui.modalConfig.options;
376
- },
377
-
378
- selectPrimaryPanelOpenedBy: (state) => {
379
- return state.ui.primaryPanelConfig.openedBy;
380
- },
381
-
382
- selectPrimaryPanelChildren: (state) => {
383
- return state.ui.primaryPanelConfig.children;
384
- },
385
-
386
- selectPrimaryPanelOptions: (state) => {
387
- return state.ui.primaryPanelConfig.options;
388
- },
389
-
390
- selectPrimaryPanelWidth: (state) => {
391
- return state.ui.primaryPanelConfig.width;
392
- },
393
-
394
- selectBasicToolbarActiveTool: (state) => {
395
- return state.ui.basicToolbarConfig.activeTool;
396
- },
397
-
398
- selectTheme: (state) => {
399
- return state.ui.theme;
400
- },
401
-
402
- reactShouldUpdateWindowSize: (state) => {
403
- if (state.ui.shouldUpdateWindowSize)
404
- return { actionCreator: "doUiUpdateWindowSize" };
405
- },
406
- };