@fixefy/fixefy-ui-utils 0.2.4 → 0.2.5
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/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/page_context/index.d.ts +8 -0
- package/dist/page_context/index.js +11 -9
- package/package.json +2 -10
- package/dist/contents/index.d.ts +0 -3
- package/dist/contents/index.js +0 -154
- package/dist/renderer/index.d.ts +0 -9
- package/dist/renderer/index.js +0 -125
- package/dist/src/auth/index.js +0 -89
- package/dist/src/aws/aws_lambda_helper.js +0 -184
- package/dist/src/aws/data_models.js +0 -4
- package/dist/src/aws/index.js +0 -18
- package/dist/src/commander/index.js +0 -390
- package/dist/src/constants/index.js +0 -115
- package/dist/src/contents/index.js +0 -154
- package/dist/src/files/index.js +0 -41
- package/dist/src/graphql/index.js +0 -382
- package/dist/src/headers/index.js +0 -161
- package/dist/src/images/index.js +0 -18
- package/dist/src/index.js +0 -44
- package/dist/src/json/index.js +0 -165
- package/dist/src/page_context/index.js +0 -760
- package/dist/src/redirect/index.js +0 -31
- package/dist/src/renderer/index.js +0 -125
- package/dist/src/resolvers/index.js +0 -51
- package/dist/src/transform/index.js +0 -96
- package/dist/src/types/index.js +0 -4
- package/dist/src/validate/index.js +0 -68
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './auth';
|
|
|
2
2
|
export * from './aws';
|
|
3
3
|
export * from './commander';
|
|
4
4
|
export * from './constants';
|
|
5
|
-
export * from './contents';
|
|
6
5
|
export * from './files';
|
|
7
6
|
export * from './graphql';
|
|
8
7
|
export * from './headers';
|
|
@@ -10,7 +9,6 @@ export * from './images';
|
|
|
10
9
|
export * from './json';
|
|
11
10
|
export * from './page_context';
|
|
12
11
|
export * from './redirect';
|
|
13
|
-
export * from './renderer';
|
|
14
12
|
export * from './transform';
|
|
15
13
|
export * from './types';
|
|
16
14
|
export * from './validate';
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,6 @@ _export_star(require("./auth"), exports);
|
|
|
12
12
|
_export_star(require("./aws"), exports);
|
|
13
13
|
_export_star(require("./commander"), exports);
|
|
14
14
|
_export_star(require("./constants"), exports);
|
|
15
|
-
_export_star(require("./contents"), exports);
|
|
16
15
|
_export_star(require("./files"), exports);
|
|
17
16
|
_export_star(require("./graphql"), exports);
|
|
18
17
|
_export_star(require("./headers"), exports);
|
|
@@ -20,7 +19,6 @@ _export_star(require("./images"), exports);
|
|
|
20
19
|
_export_star(require("./json"), exports);
|
|
21
20
|
const _page_context = /*#__PURE__*/ _interop_require_default(_export_star(require("./page_context"), exports));
|
|
22
21
|
_export_star(require("./redirect"), exports);
|
|
23
|
-
_export_star(require("./renderer"), exports);
|
|
24
22
|
_export_star(require("./transform"), exports);
|
|
25
23
|
_export_star(require("./types"), exports);
|
|
26
24
|
_export_star(require("./validate"), exports);
|
|
@@ -55,6 +55,7 @@ declare module '@mui/material/styles' {
|
|
|
55
55
|
typography: TypographyPalleteColorOptions;
|
|
56
56
|
priority: PriorityPalleteColorOptions;
|
|
57
57
|
colors: ColorsPaletteColorOptions;
|
|
58
|
+
values: ValuesPaletteColorOptions;
|
|
58
59
|
}
|
|
59
60
|
interface PaletteOptions {
|
|
60
61
|
greyscale: PaletteOptions['primary'];
|
|
@@ -83,6 +84,13 @@ declare module '@mui/material/styles' {
|
|
|
83
84
|
typography: TypographyPalleteColorOptions;
|
|
84
85
|
priority: PriorityPalleteColorOptions;
|
|
85
86
|
colors: ColorsPaletteColorOptions;
|
|
87
|
+
values: ValuesPaletteColorOptions;
|
|
88
|
+
}
|
|
89
|
+
interface ValuesPaletteColorOptions {
|
|
90
|
+
original_value: string;
|
|
91
|
+
fair_value: string;
|
|
92
|
+
expected_refund: string;
|
|
93
|
+
actual_refund: string;
|
|
86
94
|
}
|
|
87
95
|
interface ColorsPaletteColorOptions {
|
|
88
96
|
red: string;
|
|
@@ -193,6 +193,12 @@ const theme = (0, _styles.createTheme)({
|
|
|
193
193
|
title: '#172326',
|
|
194
194
|
delete: '#EB5757'
|
|
195
195
|
},
|
|
196
|
+
values: {
|
|
197
|
+
original_value: '#87ACB6',
|
|
198
|
+
fair_value: '#2F4F57',
|
|
199
|
+
expected_refund: '#56CCF2',
|
|
200
|
+
actual_refund: '#EC6AC8'
|
|
201
|
+
},
|
|
196
202
|
statistics: {
|
|
197
203
|
value: '#568793',
|
|
198
204
|
label: '#8B9092'
|
|
@@ -297,8 +303,8 @@ const theme = (0, _styles.createTheme)({
|
|
|
297
303
|
background: '#EB5757'
|
|
298
304
|
},
|
|
299
305
|
in_dispute: {
|
|
300
|
-
border: '#
|
|
301
|
-
background: '#
|
|
306
|
+
border: '#56CCF2',
|
|
307
|
+
background: '#56CCF2'
|
|
302
308
|
},
|
|
303
309
|
in_progress: {
|
|
304
310
|
border: '#56CCF2',
|
|
@@ -362,13 +368,9 @@ const theme = (0, _styles.createTheme)({
|
|
|
362
368
|
border: '#56CCF2',
|
|
363
369
|
background: '#56CCF2'
|
|
364
370
|
},
|
|
365
|
-
|
|
366
|
-
border: '#
|
|
367
|
-
background: '#
|
|
368
|
-
},
|
|
369
|
-
declined: {
|
|
370
|
-
border: '#EB5757',
|
|
371
|
-
background: '#EB5757'
|
|
371
|
+
pending: {
|
|
372
|
+
border: '#ECC631',
|
|
373
|
+
background: '#ECC631'
|
|
372
374
|
},
|
|
373
375
|
approved: {
|
|
374
376
|
border: '#27AE60',
|
package/package.json
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
"fs": false
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@fixefy/fixefy-ui-components": "0.2.0",
|
|
8
7
|
"@mui/material": "^5.15.19",
|
|
9
|
-
"@mui/styled-engine": "^5.15.14",
|
|
10
8
|
"@mui/styles": "^5.15.19",
|
|
11
9
|
"aws-sdk": "^2.1632.0",
|
|
12
10
|
"convert-excel-to-json": "^1.7.0",
|
|
@@ -15,7 +13,6 @@
|
|
|
15
13
|
"react-dom": "^18.3.1"
|
|
16
14
|
},
|
|
17
15
|
"devDependencies": {
|
|
18
|
-
"@svgr/webpack": "^8.1.0",
|
|
19
16
|
"@types/convert-excel-to-json": "^1.7.4",
|
|
20
17
|
"@types/node": "^20.14.0",
|
|
21
18
|
"@types/nookies": "^2.0.3",
|
|
@@ -37,13 +34,8 @@
|
|
|
37
34
|
"url": "https://github.com/Fixefy/fixefy-commander.git"
|
|
38
35
|
},
|
|
39
36
|
"scripts": {
|
|
40
|
-
"build": "swc src -d dist && tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
41
|
-
"build:copy": "node ../../scripts/copy-files-ex.js",
|
|
37
|
+
"build": "swc src -d dist --strip-leading-paths && tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
42
38
|
"pre_release": "yarn clean && yarn && yarn build",
|
|
43
|
-
"release17": "node version-check.js 17 && yarn pre_release && npm pack && npm publish",
|
|
44
|
-
"release17:config": "node version-check.js 17 && yarn pre_release && npm publish --userconfig ./.npmrc",
|
|
45
|
-
"release18": "node version-check.js 18 && yarn pre_release && npm pack && npm publish",
|
|
46
|
-
"release18:config": "node version-check.js 18 && yarn pre_release && npm publish --userconfig ./.npmrc",
|
|
47
39
|
"raw_publish": "npm publish --userconfig ./.npmrc --otp=000000",
|
|
48
40
|
"clean": "rm -rf build && rm -rf dist-* && yarn clean:node",
|
|
49
41
|
"clean:node": "rm -rf node_modules",
|
|
@@ -65,5 +57,5 @@
|
|
|
65
57
|
"require": "./dist/index.js"
|
|
66
58
|
}
|
|
67
59
|
},
|
|
68
|
-
"version": "0.2.
|
|
60
|
+
"version": "0.2.5"
|
|
69
61
|
}
|
package/dist/contents/index.d.ts
DELETED
package/dist/contents/index.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "parseInput", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return parseInput;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
-
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
13
|
-
const _ = require("../");
|
|
14
|
-
const _fixefyuicomponents = require("@fixefy/fixefy-ui-components");
|
|
15
|
-
function _define_property(obj, key, value) {
|
|
16
|
-
if (key in obj) {
|
|
17
|
-
Object.defineProperty(obj, key, {
|
|
18
|
-
value: value,
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true
|
|
22
|
-
});
|
|
23
|
-
} else {
|
|
24
|
-
obj[key] = value;
|
|
25
|
-
}
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
function _interop_require_default(obj) {
|
|
29
|
-
return obj && obj.__esModule ? obj : {
|
|
30
|
-
default: obj
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function _object_spread(target) {
|
|
34
|
-
for(var i = 1; i < arguments.length; i++){
|
|
35
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
36
|
-
var ownKeys = Object.keys(source);
|
|
37
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
38
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
39
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
ownKeys.forEach(function(key) {
|
|
43
|
-
_define_property(target, key, source[key]);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return target;
|
|
47
|
-
}
|
|
48
|
-
function ownKeys(object, enumerableOnly) {
|
|
49
|
-
var keys = Object.keys(object);
|
|
50
|
-
if (Object.getOwnPropertySymbols) {
|
|
51
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
52
|
-
if (enumerableOnly) {
|
|
53
|
-
symbols = symbols.filter(function(sym) {
|
|
54
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
keys.push.apply(keys, symbols);
|
|
58
|
-
}
|
|
59
|
-
return keys;
|
|
60
|
-
}
|
|
61
|
-
function _object_spread_props(target, source) {
|
|
62
|
-
source = source != null ? source : {};
|
|
63
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
64
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
65
|
-
} else {
|
|
66
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
67
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return target;
|
|
71
|
-
}
|
|
72
|
-
function _object_without_properties(source, excluded) {
|
|
73
|
-
if (source == null) return {};
|
|
74
|
-
var target = _object_without_properties_loose(source, excluded);
|
|
75
|
-
var key, i;
|
|
76
|
-
if (Object.getOwnPropertySymbols) {
|
|
77
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
78
|
-
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
79
|
-
key = sourceSymbolKeys[i];
|
|
80
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
81
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
82
|
-
target[key] = source[key];
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return target;
|
|
86
|
-
}
|
|
87
|
-
function _object_without_properties_loose(source, excluded) {
|
|
88
|
-
if (source == null) return {};
|
|
89
|
-
var target = {};
|
|
90
|
-
var sourceKeys = Object.keys(source);
|
|
91
|
-
var key, i;
|
|
92
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
93
|
-
key = sourceKeys[i];
|
|
94
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
95
|
-
target[key] = source[key];
|
|
96
|
-
}
|
|
97
|
-
return target;
|
|
98
|
-
}
|
|
99
|
-
const parseInput = (_param)=>{
|
|
100
|
-
var { client, fetcher, control, structure, droppedItem, state, onInputChange, classes, args } = _param, rest = _object_without_properties(_param, [
|
|
101
|
-
"client",
|
|
102
|
-
"fetcher",
|
|
103
|
-
"control",
|
|
104
|
-
"structure",
|
|
105
|
-
"droppedItem",
|
|
106
|
-
"state",
|
|
107
|
-
"onInputChange",
|
|
108
|
-
"classes",
|
|
109
|
-
"args"
|
|
110
|
-
]);
|
|
111
|
-
const { type, children } = structure;
|
|
112
|
-
const { AsyncDropdown, Textfield, clear, dropdownOptions } = _.ComponentTypes;
|
|
113
|
-
switch(type){
|
|
114
|
-
case AsyncDropdown:
|
|
115
|
-
{
|
|
116
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_fixefyuicomponents.FxAsyncDropdown, _object_spread({
|
|
117
|
-
classes: classes,
|
|
118
|
-
structure: structure,
|
|
119
|
-
fetcher: fetcher,
|
|
120
|
-
onChange: ()=>{}
|
|
121
|
-
}, rest));
|
|
122
|
-
}
|
|
123
|
-
case Textfield:
|
|
124
|
-
{
|
|
125
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_fixefyuicomponents.FxTextField, _object_spread({
|
|
126
|
-
autoFocus: true,
|
|
127
|
-
droppedItem: droppedItem,
|
|
128
|
-
defaultValue: args && args.data && args.data.default_value,
|
|
129
|
-
onChange: (e)=>onInputChange({
|
|
130
|
-
structure,
|
|
131
|
-
value: e.target.value
|
|
132
|
-
}),
|
|
133
|
-
structure: structure
|
|
134
|
-
}, rest));
|
|
135
|
-
}
|
|
136
|
-
case dropdownOptions:
|
|
137
|
-
return children.map((child)=>{
|
|
138
|
-
return parseInput(_object_spread({
|
|
139
|
-
client,
|
|
140
|
-
control,
|
|
141
|
-
structure: child,
|
|
142
|
-
droppedItem,
|
|
143
|
-
state,
|
|
144
|
-
onInputChange,
|
|
145
|
-
classes,
|
|
146
|
-
args
|
|
147
|
-
}, rest));
|
|
148
|
-
});
|
|
149
|
-
case clear:
|
|
150
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_fixefyuicomponents.FxButton, _object_spread_props(_object_spread({}, rest), {
|
|
151
|
-
children: structure.name
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
};
|
package/dist/renderer/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const parseValue: ({ value, structure, onClick }: any) => any;
|
|
3
|
-
export declare const getValueComponentByComponentValue: ({ value, name, title, type, onClick, }: {
|
|
4
|
-
value?: any;
|
|
5
|
-
name?: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
type?: any;
|
|
8
|
-
onClick?: any;
|
|
9
|
-
}) => React.JSX.Element;
|
package/dist/renderer/index.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
getValueComponentByComponentValue: function() {
|
|
13
|
-
return getValueComponentByComponentValue;
|
|
14
|
-
},
|
|
15
|
-
parseValue: function() {
|
|
16
|
-
return parseValue;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
20
|
-
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
21
|
-
const _material = require("@mui/material");
|
|
22
|
-
const _fixefyuicomponents = require("@fixefy/fixefy-ui-components");
|
|
23
|
-
const _ = require("../");
|
|
24
|
-
function _interop_require_default(obj) {
|
|
25
|
-
return obj && obj.__esModule ? obj : {
|
|
26
|
-
default: obj
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
const parseValue = ({ value, structure, onClick })=>{
|
|
30
|
-
//TODO: change active to enabled or disabled
|
|
31
|
-
const { extended, name, type, title } = structure;
|
|
32
|
-
// extract path if exists
|
|
33
|
-
const path = extended && extended.title_path;
|
|
34
|
-
let theTruth;
|
|
35
|
-
if (path) {
|
|
36
|
-
// extract the object in the path
|
|
37
|
-
theTruth = (0, _.getJPart)(value, path, undefined);
|
|
38
|
-
}
|
|
39
|
-
const _value = theTruth === undefined || theTruth === null ? value[name] : theTruth;
|
|
40
|
-
if (_value === undefined || _value === null) {
|
|
41
|
-
return getValueComponentByComponentValue({
|
|
42
|
-
value: 'No Value Found'
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
// get string value according to value type
|
|
46
|
-
let rv = (0, _.getStringValueByValueType)({
|
|
47
|
-
value: _value,
|
|
48
|
-
name
|
|
49
|
-
});
|
|
50
|
-
// parse wrapping component according to type
|
|
51
|
-
rv = getValueComponentByComponentValue({
|
|
52
|
-
value: rv,
|
|
53
|
-
name,
|
|
54
|
-
title,
|
|
55
|
-
type,
|
|
56
|
-
onClick: (e)=>onClick(e, _value)
|
|
57
|
-
});
|
|
58
|
-
return rv;
|
|
59
|
-
};
|
|
60
|
-
const getValueComponentByComponentValue = ({ value, name, title, type, onClick })=>{
|
|
61
|
-
let rv = null;
|
|
62
|
-
switch(type){
|
|
63
|
-
case _.ComponentTypes.Chip:
|
|
64
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_fixefyuicomponents.FxChip, {
|
|
65
|
-
size: "small",
|
|
66
|
-
style: {
|
|
67
|
-
marginBottom: '5px'
|
|
68
|
-
},
|
|
69
|
-
status: value.toLowerCase(),
|
|
70
|
-
label: value
|
|
71
|
-
}, `${name}-Chip-3003`);
|
|
72
|
-
break;
|
|
73
|
-
case _.ComponentTypes.ClickableLabel:
|
|
74
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
75
|
-
sx: {
|
|
76
|
-
marginBottom: '5px',
|
|
77
|
-
fontSize: '14px',
|
|
78
|
-
textDecoration: 'underline',
|
|
79
|
-
cursor: 'pointer'
|
|
80
|
-
},
|
|
81
|
-
variant: "body1",
|
|
82
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Link, {
|
|
83
|
-
onClick: onClick,
|
|
84
|
-
children: (0, _.titleCase)(value)
|
|
85
|
-
})
|
|
86
|
-
}, `${name}-Link-2002`);
|
|
87
|
-
break;
|
|
88
|
-
case _.ComponentTypes.Label:
|
|
89
|
-
if (Array.isArray(value) && (value === null || value === void 0 ? void 0 : value.length) > 1) {
|
|
90
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_fixefyuicomponents.FxShowMore, {
|
|
91
|
-
items: value,
|
|
92
|
-
label: title !== null && title !== void 0 ? title : '',
|
|
93
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
94
|
-
lineHeight: '20px',
|
|
95
|
-
sx: {
|
|
96
|
-
fontSize: '14px'
|
|
97
|
-
},
|
|
98
|
-
variant: "body1",
|
|
99
|
-
children: (0, _.titleCase)(value[0])
|
|
100
|
-
}, `${name}-Label-1000`)
|
|
101
|
-
});
|
|
102
|
-
} else {
|
|
103
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
104
|
-
lineHeight: '20px',
|
|
105
|
-
sx: {
|
|
106
|
-
fontSize: '14px'
|
|
107
|
-
},
|
|
108
|
-
variant: "body1",
|
|
109
|
-
children: (0, _.titleCase)(value)
|
|
110
|
-
}, `${name}-Label-1000`);
|
|
111
|
-
}
|
|
112
|
-
break;
|
|
113
|
-
default:
|
|
114
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
115
|
-
lineHeight: '20px',
|
|
116
|
-
sx: {
|
|
117
|
-
fontSize: '14px'
|
|
118
|
-
},
|
|
119
|
-
variant: "body1",
|
|
120
|
-
children: (0, _.titleCase)(value)
|
|
121
|
-
}, `${name}-Label-1000`);
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
return rv;
|
|
125
|
-
};
|
package/dist/src/auth/index.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
attachAuth: function() {
|
|
13
|
-
return attachAuth;
|
|
14
|
-
},
|
|
15
|
-
getToken: function() {
|
|
16
|
-
return getToken;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _nookies = require("nookies");
|
|
20
|
-
function _define_property(obj, key, value) {
|
|
21
|
-
if (key in obj) {
|
|
22
|
-
Object.defineProperty(obj, key, {
|
|
23
|
-
value: value,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
function _object_spread(target) {
|
|
34
|
-
for(var i = 1; i < arguments.length; i++){
|
|
35
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
36
|
-
var ownKeys = Object.keys(source);
|
|
37
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
38
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
39
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
ownKeys.forEach(function(key) {
|
|
43
|
-
_define_property(target, key, source[key]);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return target;
|
|
47
|
-
}
|
|
48
|
-
function ownKeys(object, enumerableOnly) {
|
|
49
|
-
var keys = Object.keys(object);
|
|
50
|
-
if (Object.getOwnPropertySymbols) {
|
|
51
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
52
|
-
if (enumerableOnly) {
|
|
53
|
-
symbols = symbols.filter(function(sym) {
|
|
54
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
keys.push.apply(keys, symbols);
|
|
58
|
-
}
|
|
59
|
-
return keys;
|
|
60
|
-
}
|
|
61
|
-
function _object_spread_props(target, source) {
|
|
62
|
-
source = source != null ? source : {};
|
|
63
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
64
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
65
|
-
} else {
|
|
66
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
67
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return target;
|
|
71
|
-
}
|
|
72
|
-
const attachAuth = (ctx, headers)=>{
|
|
73
|
-
const token = getToken(ctx);
|
|
74
|
-
return _object_spread_props(_object_spread({}, headers), {
|
|
75
|
-
authorization: `Bearer ${token}`
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const getToken = (ctx)=>{
|
|
79
|
-
return (0, _nookies.parseCookies)(ctx)['token'];
|
|
80
|
-
} // export const checkLoggedIn = async ({ client }) => {
|
|
81
|
-
// const rv = await client
|
|
82
|
-
// .query({ query: gql(ME_QUERY) })
|
|
83
|
-
// .then(({ data }) => ({ loggedInUser: data }))
|
|
84
|
-
// .catch(() => ({
|
|
85
|
-
// loggedInUser: null,
|
|
86
|
-
// })); // Fail gracefully
|
|
87
|
-
// return rv;
|
|
88
|
-
// };
|
|
89
|
-
;
|