@abcagency/hc-ui-components 1.0.19 → 1.0.21
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/_virtual/_rollupPluginBabelHelpers.js +516 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/apis/hcApi.js +189 -0
- package/dist/apis/hcApi.js.map +1 -0
- package/dist/clientToken.js +10 -0
- package/dist/clientToken.js.map +1 -0
- package/dist/components/HireControlMap.js +124 -0
- package/dist/components/HireControlMap.js.map +1 -0
- package/dist/components/modules/accordions/MapAccordionItem.js +76 -0
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -0
- package/dist/components/modules/accordions/default.js +108 -0
- package/dist/components/modules/accordions/default.js.map +1 -0
- package/dist/components/modules/accordions/filterItem.js +50 -0
- package/dist/components/modules/accordions/filterItem.js.map +1 -0
- package/dist/components/modules/accordions/filters.js +46 -0
- package/dist/components/modules/accordions/filters.js.map +1 -0
- package/dist/components/modules/buttons/button-group-apply.js +76 -0
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -0
- package/dist/components/modules/buttons/commute-pill.js +18 -0
- package/dist/components/modules/buttons/commute-pill.js.map +1 -0
- package/dist/components/modules/buttons/default.js +146 -0
- package/dist/components/modules/buttons/default.js.map +1 -0
- package/dist/components/modules/buttons/items-pill.js +23 -0
- package/dist/components/modules/buttons/items-pill.js.map +1 -0
- package/dist/components/modules/buttons/pill-wrapper.js +20 -0
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -0
- package/dist/components/modules/buttons/show-all-button.js +39 -0
- package/dist/components/modules/buttons/show-all-button.js.map +1 -0
- package/dist/components/modules/cards/default.js +102 -0
- package/dist/components/modules/cards/default.js.map +1 -0
- package/dist/components/modules/cards/filter.js +38 -0
- package/dist/components/modules/cards/filter.js.map +1 -0
- package/dist/components/modules/dialogs/apply-dialog.js +46 -0
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -0
- package/dist/components/modules/filter/commute.js +184 -0
- package/dist/components/modules/filter/commute.js.map +1 -0
- package/dist/components/modules/filter/index.js +79 -0
- package/dist/components/modules/filter/index.js.map +1 -0
- package/dist/components/modules/filter/item.js +71 -0
- package/dist/components/modules/filter/item.js.map +1 -0
- package/dist/components/modules/filter/location.js +68 -0
- package/dist/components/modules/filter/location.js.map +1 -0
- package/dist/components/modules/filter/points-of-interest.js +38 -0
- package/dist/components/modules/filter/points-of-interest.js.map +1 -0
- package/dist/components/modules/filter/radio-item.js +46 -0
- package/dist/components/modules/filter/radio-item.js.map +1 -0
- package/dist/components/modules/filter/search.js +83 -0
- package/dist/components/modules/filter/search.js.map +1 -0
- package/dist/components/modules/filter/sort.js +93 -0
- package/dist/components/modules/filter/sort.js.map +1 -0
- package/dist/components/modules/grid.js +39 -0
- package/dist/components/modules/grid.js.map +1 -0
- package/dist/components/modules/icon.js +23 -0
- package/dist/components/modules/icon.js.map +1 -0
- package/dist/components/modules/jobListing/listing-details.js +67 -0
- package/dist/components/modules/jobListing/listing-details.js.map +1 -0
- package/dist/components/modules/maps/info-window-card.js +14 -0
- package/dist/components/modules/maps/info-window-card.js.map +1 -0
- package/dist/components/modules/maps/info-window-content.js +39 -0
- package/dist/components/modules/maps/info-window-content.js.map +1 -0
- package/dist/components/modules/maps/list/field-mapper.js +88 -0
- package/dist/components/modules/maps/list/field-mapper.js.map +1 -0
- package/dist/components/modules/maps/list/header-item.js +59 -0
- package/dist/components/modules/maps/list/header-item.js.map +1 -0
- package/dist/components/modules/maps/list/header.js +37 -0
- package/dist/components/modules/maps/list/header.js.map +1 -0
- package/dist/components/modules/maps/list/index.js +93 -0
- package/dist/components/modules/maps/list/index.js.map +1 -0
- package/dist/components/modules/maps/list/item-expand-card/index.js +16 -0
- package/dist/components/modules/maps/list/item-expand-card/index.js.map +1 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +38 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +1 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js +40 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +1 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js +20 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +1 -0
- package/dist/components/modules/maps/list/list-item/index.js +98 -0
- package/dist/components/modules/maps/list/list-item/index.js.map +1 -0
- package/dist/components/modules/maps/map-list.js +57 -0
- package/dist/components/modules/maps/map-list.js.map +1 -0
- package/dist/components/modules/maps/map-marker.js +85 -0
- package/dist/components/modules/maps/map-marker.js.map +1 -0
- package/dist/components/modules/maps/map.js +201 -0
- package/dist/components/modules/maps/map.js.map +1 -0
- package/dist/components/modules/maps/place-marker.js +37 -0
- package/dist/components/modules/maps/place-marker.js.map +1 -0
- package/dist/components/modules/maps/tabs.js +84 -0
- package/dist/components/modules/maps/tabs.js.map +1 -0
- package/dist/constants/placeTypes.js +11 -0
- package/dist/constants/placeTypes.js.map +1 -0
- package/dist/contexts/mapContext.js +133 -0
- package/dist/contexts/mapContext.js.map +1 -0
- package/dist/contexts/mapListContext.js +276 -0
- package/dist/contexts/mapListContext.js.map +1 -0
- package/dist/contexts/placesContext.js +152 -0
- package/dist/contexts/placesContext.js.map +1 -0
- package/dist/hooks/useList.js +119 -0
- package/dist/hooks/useList.js.map +1 -0
- package/dist/index.js +2 -4554
- package/dist/index.js.map +1 -0
- package/dist/services/_virtual/_rollupPluginBabelHelpers.js +372 -0
- package/dist/services/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/services/apis/hcApi.js +189 -0
- package/dist/services/apis/hcApi.js.map +1 -0
- package/dist/services/clientToken.js +7 -0
- package/dist/services/clientToken.js.map +1 -0
- package/dist/services/configService.js +33 -0
- package/dist/services/configService.js.map +1 -0
- package/dist/services/googlePlacesNearbyService.js +61 -0
- package/dist/services/googlePlacesNearbyService.js.map +1 -0
- package/dist/services/listingAggregatorService.js +56 -0
- package/dist/services/listingAggregatorService.js.map +1 -0
- package/dist/services/listingEntityService.js +36 -0
- package/dist/services/listingEntityService.js.map +1 -0
- package/dist/services/listingService.js +60 -112
- package/dist/services/listingService.js.map +1 -0
- package/dist/services/recruiterService.js +36 -0
- package/dist/services/recruiterService.js.map +1 -0
- package/dist/util/filterUtil.js +213 -0
- package/dist/util/filterUtil.js.map +1 -0
- package/dist/util/loading.js +16 -0
- package/dist/util/loading.js.map +1 -0
- package/dist/util/localStorageUtil.js +32 -0
- package/dist/util/localStorageUtil.js.map +1 -0
- package/dist/util/mapIconUtil.js +73 -0
- package/dist/util/mapIconUtil.js.map +1 -0
- package/dist/util/mapUtil.js +76 -0
- package/dist/util/mapUtil.js.map +1 -0
- package/dist/util/sortUtil.js +33 -0
- package/dist/util/sortUtil.js.map +1 -0
- package/dist/util/stringUtils.js +9 -0
- package/dist/util/stringUtils.js.map +1 -0
- package/package.json +40 -36
- package/postcss.config.js +13 -15
- package/rollup.config.mjs +88 -0
- package/src/apis/hcApi.js +93 -87
- package/src/clientToken.js +9 -9
- package/src/components/HireControlMap.js +100 -0
- package/src/components/modules/accordions/MapAccordionItem.js +69 -69
- package/src/components/modules/accordions/default.js +171 -173
- package/src/components/modules/accordions/filterItem.js +53 -53
- package/src/components/modules/accordions/filters.js +45 -44
- package/src/components/modules/buttons/button-group-apply.js +98 -98
- package/src/components/modules/buttons/commute-pill.js +21 -21
- package/src/components/modules/buttons/default.js +197 -196
- package/src/components/modules/buttons/items-pill.js +31 -31
- package/src/components/modules/buttons/pill-wrapper.js +27 -26
- package/src/components/modules/buttons/show-all-button.js +20 -20
- package/src/components/modules/cards/default.js +168 -168
- package/src/components/modules/cards/filter.js +55 -55
- package/src/components/modules/dialogs/apply-dialog.js +47 -47
- package/src/components/modules/filter/commute.js +150 -151
- package/src/components/modules/filter/index.js +86 -86
- package/src/components/modules/filter/item.js +77 -77
- package/src/components/modules/filter/location.js +68 -69
- package/src/components/modules/filter/points-of-interest.js +43 -43
- package/src/components/modules/filter/radio-item.js +51 -51
- package/src/components/modules/filter/search.js +91 -91
- package/src/components/modules/filter/sort.js +83 -83
- package/src/components/modules/grid.js +56 -56
- package/src/components/modules/icon.js +33 -33
- package/src/components/modules/jobListing/listing-details.js +91 -91
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/info-window-content.js +57 -60
- package/src/components/modules/maps/list/field-mapper.js +110 -111
- package/src/components/modules/maps/list/header-item.js +90 -90
- package/src/components/modules/maps/list/header.js +46 -46
- package/src/components/modules/maps/list/index.js +103 -104
- package/src/components/modules/maps/list/item-expand-card/index.js +22 -21
- package/src/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +49 -48
- package/src/components/modules/maps/list/item-expand-card/recruiter-details.js +68 -67
- package/src/components/modules/maps/list/item-expand-card/recruiter-headshot.js +22 -22
- package/src/components/modules/maps/list/list-item/index.js +132 -132
- package/src/components/modules/maps/map-list.js +73 -73
- package/src/components/modules/maps/map-marker.js +84 -84
- package/src/components/modules/maps/map.js +226 -226
- package/src/components/modules/maps/tabs.js +79 -79
- package/src/constants/placeTypes.js +8 -8
- package/src/contexts/mapContext.js +18 -17
- package/src/contexts/placesContext.js +1 -0
- package/src/index.js +3 -103
- package/src/services/configService.js +16 -16
- package/src/services/googlePlacesNearbyService.js +33 -33
- package/src/services/listingService.js +27 -28
- package/src/services/recruiterService.js +17 -17
- package/src/styles/globals.css +23 -23
- package/src/styles/index.css +24 -0
- package/src/tailwind/preset.default.js +15 -15
- package/src/tailwind/tailwind.config.js +127 -127
- package/src/util/arrayUtil.js +3 -3
- package/src/util/fieldMapper.js +20 -19
- package/src/util/loading.js +17 -17
- package/src/util/localStorageUtil.js +26 -26
- package/src/util/mapIconUtil.js +2 -2
- package/src/util/sortUtil.js +32 -32
- package/src/util/stringUtils.js +6 -6
- package/dist/globals.css +0 -3
- package/dist/output.css +0 -784
- package/dist/services/globals.css +0 -3
- package/rollup.config.js +0 -68
- package/src/components/layout/footer.js +0 -34
- package/src/components/layout/header.js +0 -23
- package/src/components/layout/layout.js +0 -36
- package/src/components/modules/animations/slidein.js +0 -41
- package/src/components/modules/navigation/nav-link.js +0 -65
- package/src/components/modules/navigation/navbar.js +0 -106
- package/src/components/modules/navigation/skip-link.js +0 -21
- package/src/components/modules/navigation/social.js +0 -29
- package/src/components/modules/sections/default.js +0 -59
- package/src/components/modules/sections/sectionContext.js +0 -4
- package/src/hooks/useClickOutside.js +0 -16
- package/src/hooks/useEventListener.js +0 -25
- package/src/hooks/useEventTracker.js +0 -19
- package/src/hooks/useRefScrollProgress.js +0 -24
- package/src/hooks/useScript.js +0 -63
- package/src/hooks/useScrollDirection.js +0 -39
- package/src/hooks/useSectionTracker.js +0 -95
- package/src/hooks/useUserAgent.js +0 -43
- package/src/hooks/useWindowSize.js +0 -28
- package/src/index.css +0 -25
- package/src/styles/fonts.js +0 -0
- package/src/util/page-head.js +0 -62
- package/src/util/provider.js +0 -12
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
function _arrayLikeToArray(r, a) {
|
|
2
|
+
(null == a || a > r.length) && (a = r.length);
|
|
3
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
4
|
+
return n;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithHoles(r) {
|
|
7
|
+
if (Array.isArray(r)) return r;
|
|
8
|
+
}
|
|
9
|
+
function _arrayWithoutHoles(r) {
|
|
10
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
11
|
+
}
|
|
12
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
13
|
+
try {
|
|
14
|
+
var i = n[a](c),
|
|
15
|
+
u = i.value;
|
|
16
|
+
} catch (n) {
|
|
17
|
+
return void e(n);
|
|
18
|
+
}
|
|
19
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
20
|
+
}
|
|
21
|
+
function _asyncToGenerator(n) {
|
|
22
|
+
return function () {
|
|
23
|
+
var t = this,
|
|
24
|
+
e = arguments;
|
|
25
|
+
return new Promise(function (r, o) {
|
|
26
|
+
var a = n.apply(t, e);
|
|
27
|
+
function _next(n) {
|
|
28
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
29
|
+
}
|
|
30
|
+
function _throw(n) {
|
|
31
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
32
|
+
}
|
|
33
|
+
_next(void 0);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function _createForOfIteratorHelper(r, e) {
|
|
38
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
39
|
+
if (!t) {
|
|
40
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e ) {
|
|
41
|
+
t && (r = t);
|
|
42
|
+
var n = 0,
|
|
43
|
+
F = function () {};
|
|
44
|
+
return {
|
|
45
|
+
s: F,
|
|
46
|
+
n: function () {
|
|
47
|
+
return n >= r.length ? {
|
|
48
|
+
done: !0
|
|
49
|
+
} : {
|
|
50
|
+
done: !1,
|
|
51
|
+
value: r[n++]
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
e: function (r) {
|
|
55
|
+
throw r;
|
|
56
|
+
},
|
|
57
|
+
f: F
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
61
|
+
}
|
|
62
|
+
var o,
|
|
63
|
+
a = !0,
|
|
64
|
+
u = !1;
|
|
65
|
+
return {
|
|
66
|
+
s: function () {
|
|
67
|
+
t = t.call(r);
|
|
68
|
+
},
|
|
69
|
+
n: function () {
|
|
70
|
+
var r = t.next();
|
|
71
|
+
return a = r.done, r;
|
|
72
|
+
},
|
|
73
|
+
e: function (r) {
|
|
74
|
+
u = !0, o = r;
|
|
75
|
+
},
|
|
76
|
+
f: function () {
|
|
77
|
+
try {
|
|
78
|
+
a || null == t.return || t.return();
|
|
79
|
+
} finally {
|
|
80
|
+
if (u) throw o;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function _defineProperty(e, r, t) {
|
|
86
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
87
|
+
value: t,
|
|
88
|
+
enumerable: !0,
|
|
89
|
+
configurable: !0,
|
|
90
|
+
writable: !0
|
|
91
|
+
}) : e[r] = t, e;
|
|
92
|
+
}
|
|
93
|
+
function _extends() {
|
|
94
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
95
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
96
|
+
var t = arguments[e];
|
|
97
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
98
|
+
}
|
|
99
|
+
return n;
|
|
100
|
+
}, _extends.apply(null, arguments);
|
|
101
|
+
}
|
|
102
|
+
function _iterableToArray(r) {
|
|
103
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
104
|
+
}
|
|
105
|
+
function _iterableToArrayLimit(r, l) {
|
|
106
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
107
|
+
if (null != t) {
|
|
108
|
+
var e,
|
|
109
|
+
n,
|
|
110
|
+
i,
|
|
111
|
+
u,
|
|
112
|
+
a = [],
|
|
113
|
+
f = !0,
|
|
114
|
+
o = !1;
|
|
115
|
+
try {
|
|
116
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
117
|
+
if (Object(t) !== t) return;
|
|
118
|
+
f = !1;
|
|
119
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
120
|
+
} catch (r) {
|
|
121
|
+
o = !0, n = r;
|
|
122
|
+
} finally {
|
|
123
|
+
try {
|
|
124
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
125
|
+
} finally {
|
|
126
|
+
if (o) throw n;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return a;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function _nonIterableRest() {
|
|
133
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
134
|
+
}
|
|
135
|
+
function _nonIterableSpread() {
|
|
136
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
137
|
+
}
|
|
138
|
+
function ownKeys(e, r) {
|
|
139
|
+
var t = Object.keys(e);
|
|
140
|
+
if (Object.getOwnPropertySymbols) {
|
|
141
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
142
|
+
r && (o = o.filter(function (r) {
|
|
143
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
144
|
+
})), t.push.apply(t, o);
|
|
145
|
+
}
|
|
146
|
+
return t;
|
|
147
|
+
}
|
|
148
|
+
function _objectSpread2(e) {
|
|
149
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
150
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
151
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
152
|
+
_defineProperty(e, r, t[r]);
|
|
153
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
154
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return e;
|
|
158
|
+
}
|
|
159
|
+
function _objectWithoutProperties(e, t) {
|
|
160
|
+
if (null == e) return {};
|
|
161
|
+
var o,
|
|
162
|
+
r,
|
|
163
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
164
|
+
if (Object.getOwnPropertySymbols) {
|
|
165
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
166
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
167
|
+
}
|
|
168
|
+
return i;
|
|
169
|
+
}
|
|
170
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
171
|
+
if (null == r) return {};
|
|
172
|
+
var t = {};
|
|
173
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
174
|
+
if (e.indexOf(n) >= 0) continue;
|
|
175
|
+
t[n] = r[n];
|
|
176
|
+
}
|
|
177
|
+
return t;
|
|
178
|
+
}
|
|
179
|
+
function _regeneratorRuntime() {
|
|
180
|
+
_regeneratorRuntime = function () {
|
|
181
|
+
return e;
|
|
182
|
+
};
|
|
183
|
+
var t,
|
|
184
|
+
e = {},
|
|
185
|
+
r = Object.prototype,
|
|
186
|
+
n = r.hasOwnProperty,
|
|
187
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
188
|
+
t[e] = r.value;
|
|
189
|
+
},
|
|
190
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
191
|
+
a = i.iterator || "@@iterator",
|
|
192
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
193
|
+
u = i.toStringTag || "@@toStringTag";
|
|
194
|
+
function define(t, e, r) {
|
|
195
|
+
return Object.defineProperty(t, e, {
|
|
196
|
+
value: r,
|
|
197
|
+
enumerable: !0,
|
|
198
|
+
configurable: !0,
|
|
199
|
+
writable: !0
|
|
200
|
+
}), t[e];
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
define({}, "");
|
|
204
|
+
} catch (t) {
|
|
205
|
+
define = function (t, e, r) {
|
|
206
|
+
return t[e] = r;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function wrap(t, e, r, n) {
|
|
210
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
211
|
+
a = Object.create(i.prototype),
|
|
212
|
+
c = new Context(n || []);
|
|
213
|
+
return o(a, "_invoke", {
|
|
214
|
+
value: makeInvokeMethod(t, r, c)
|
|
215
|
+
}), a;
|
|
216
|
+
}
|
|
217
|
+
function tryCatch(t, e, r) {
|
|
218
|
+
try {
|
|
219
|
+
return {
|
|
220
|
+
type: "normal",
|
|
221
|
+
arg: t.call(e, r)
|
|
222
|
+
};
|
|
223
|
+
} catch (t) {
|
|
224
|
+
return {
|
|
225
|
+
type: "throw",
|
|
226
|
+
arg: t
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
e.wrap = wrap;
|
|
231
|
+
var h = "suspendedStart",
|
|
232
|
+
l = "suspendedYield",
|
|
233
|
+
f = "executing",
|
|
234
|
+
s = "completed",
|
|
235
|
+
y = {};
|
|
236
|
+
function Generator() {}
|
|
237
|
+
function GeneratorFunction() {}
|
|
238
|
+
function GeneratorFunctionPrototype() {}
|
|
239
|
+
var p = {};
|
|
240
|
+
define(p, a, function () {
|
|
241
|
+
return this;
|
|
242
|
+
});
|
|
243
|
+
var d = Object.getPrototypeOf,
|
|
244
|
+
v = d && d(d(values([])));
|
|
245
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
246
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
247
|
+
function defineIteratorMethods(t) {
|
|
248
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
249
|
+
define(t, e, function (t) {
|
|
250
|
+
return this._invoke(e, t);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function AsyncIterator(t, e) {
|
|
255
|
+
function invoke(r, o, i, a) {
|
|
256
|
+
var c = tryCatch(t[r], t, o);
|
|
257
|
+
if ("throw" !== c.type) {
|
|
258
|
+
var u = c.arg,
|
|
259
|
+
h = u.value;
|
|
260
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
261
|
+
invoke("next", t, i, a);
|
|
262
|
+
}, function (t) {
|
|
263
|
+
invoke("throw", t, i, a);
|
|
264
|
+
}) : e.resolve(h).then(function (t) {
|
|
265
|
+
u.value = t, i(u);
|
|
266
|
+
}, function (t) {
|
|
267
|
+
return invoke("throw", t, i, a);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
a(c.arg);
|
|
271
|
+
}
|
|
272
|
+
var r;
|
|
273
|
+
o(this, "_invoke", {
|
|
274
|
+
value: function (t, n) {
|
|
275
|
+
function callInvokeWithMethodAndArg() {
|
|
276
|
+
return new e(function (e, r) {
|
|
277
|
+
invoke(t, n, e, r);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function makeInvokeMethod(e, r, n) {
|
|
285
|
+
var o = h;
|
|
286
|
+
return function (i, a) {
|
|
287
|
+
if (o === f) throw Error("Generator is already running");
|
|
288
|
+
if (o === s) {
|
|
289
|
+
if ("throw" === i) throw a;
|
|
290
|
+
return {
|
|
291
|
+
value: t,
|
|
292
|
+
done: !0
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
for (n.method = i, n.arg = a;;) {
|
|
296
|
+
var c = n.delegate;
|
|
297
|
+
if (c) {
|
|
298
|
+
var u = maybeInvokeDelegate(c, n);
|
|
299
|
+
if (u) {
|
|
300
|
+
if (u === y) continue;
|
|
301
|
+
return u;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
305
|
+
if (o === h) throw o = s, n.arg;
|
|
306
|
+
n.dispatchException(n.arg);
|
|
307
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
308
|
+
o = f;
|
|
309
|
+
var p = tryCatch(e, r, n);
|
|
310
|
+
if ("normal" === p.type) {
|
|
311
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
312
|
+
return {
|
|
313
|
+
value: p.arg,
|
|
314
|
+
done: n.done
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function maybeInvokeDelegate(e, r) {
|
|
322
|
+
var n = r.method,
|
|
323
|
+
o = e.iterator[n];
|
|
324
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
325
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
326
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
327
|
+
var a = i.arg;
|
|
328
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
329
|
+
}
|
|
330
|
+
function pushTryEntry(t) {
|
|
331
|
+
var e = {
|
|
332
|
+
tryLoc: t[0]
|
|
333
|
+
};
|
|
334
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
335
|
+
}
|
|
336
|
+
function resetTryEntry(t) {
|
|
337
|
+
var e = t.completion || {};
|
|
338
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
339
|
+
}
|
|
340
|
+
function Context(t) {
|
|
341
|
+
this.tryEntries = [{
|
|
342
|
+
tryLoc: "root"
|
|
343
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
344
|
+
}
|
|
345
|
+
function values(e) {
|
|
346
|
+
if (e || "" === e) {
|
|
347
|
+
var r = e[a];
|
|
348
|
+
if (r) return r.call(e);
|
|
349
|
+
if ("function" == typeof e.next) return e;
|
|
350
|
+
if (!isNaN(e.length)) {
|
|
351
|
+
var o = -1,
|
|
352
|
+
i = function next() {
|
|
353
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
354
|
+
return next.value = t, next.done = !0, next;
|
|
355
|
+
};
|
|
356
|
+
return i.next = i;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
360
|
+
}
|
|
361
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
362
|
+
value: GeneratorFunctionPrototype,
|
|
363
|
+
configurable: !0
|
|
364
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
365
|
+
value: GeneratorFunction,
|
|
366
|
+
configurable: !0
|
|
367
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
368
|
+
var e = "function" == typeof t && t.constructor;
|
|
369
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
370
|
+
}, e.mark = function (t) {
|
|
371
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
372
|
+
}, e.awrap = function (t) {
|
|
373
|
+
return {
|
|
374
|
+
__await: t
|
|
375
|
+
};
|
|
376
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
377
|
+
return this;
|
|
378
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
379
|
+
void 0 === i && (i = Promise);
|
|
380
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
381
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
382
|
+
return t.done ? t.value : a.next();
|
|
383
|
+
});
|
|
384
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
385
|
+
return this;
|
|
386
|
+
}), define(g, "toString", function () {
|
|
387
|
+
return "[object Generator]";
|
|
388
|
+
}), e.keys = function (t) {
|
|
389
|
+
var e = Object(t),
|
|
390
|
+
r = [];
|
|
391
|
+
for (var n in e) r.push(n);
|
|
392
|
+
return r.reverse(), function next() {
|
|
393
|
+
for (; r.length;) {
|
|
394
|
+
var t = r.pop();
|
|
395
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
396
|
+
}
|
|
397
|
+
return next.done = !0, next;
|
|
398
|
+
};
|
|
399
|
+
}, e.values = values, Context.prototype = {
|
|
400
|
+
constructor: Context,
|
|
401
|
+
reset: function (e) {
|
|
402
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
403
|
+
},
|
|
404
|
+
stop: function () {
|
|
405
|
+
this.done = !0;
|
|
406
|
+
var t = this.tryEntries[0].completion;
|
|
407
|
+
if ("throw" === t.type) throw t.arg;
|
|
408
|
+
return this.rval;
|
|
409
|
+
},
|
|
410
|
+
dispatchException: function (e) {
|
|
411
|
+
if (this.done) throw e;
|
|
412
|
+
var r = this;
|
|
413
|
+
function handle(n, o) {
|
|
414
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
415
|
+
}
|
|
416
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
417
|
+
var i = this.tryEntries[o],
|
|
418
|
+
a = i.completion;
|
|
419
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
420
|
+
if (i.tryLoc <= this.prev) {
|
|
421
|
+
var c = n.call(i, "catchLoc"),
|
|
422
|
+
u = n.call(i, "finallyLoc");
|
|
423
|
+
if (c && u) {
|
|
424
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
425
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
426
|
+
} else if (c) {
|
|
427
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
428
|
+
} else {
|
|
429
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
430
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
abrupt: function (t, e) {
|
|
436
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
437
|
+
var o = this.tryEntries[r];
|
|
438
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
439
|
+
var i = o;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
444
|
+
var a = i ? i.completion : {};
|
|
445
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
446
|
+
},
|
|
447
|
+
complete: function (t, e) {
|
|
448
|
+
if ("throw" === t.type) throw t.arg;
|
|
449
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
450
|
+
},
|
|
451
|
+
finish: function (t) {
|
|
452
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
453
|
+
var r = this.tryEntries[e];
|
|
454
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
catch: function (t) {
|
|
458
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
459
|
+
var r = this.tryEntries[e];
|
|
460
|
+
if (r.tryLoc === t) {
|
|
461
|
+
var n = r.completion;
|
|
462
|
+
if ("throw" === n.type) {
|
|
463
|
+
var o = n.arg;
|
|
464
|
+
resetTryEntry(r);
|
|
465
|
+
}
|
|
466
|
+
return o;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
throw Error("illegal catch attempt");
|
|
470
|
+
},
|
|
471
|
+
delegateYield: function (e, r, n) {
|
|
472
|
+
return this.delegate = {
|
|
473
|
+
iterator: values(e),
|
|
474
|
+
resultName: r,
|
|
475
|
+
nextLoc: n
|
|
476
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
477
|
+
}
|
|
478
|
+
}, e;
|
|
479
|
+
}
|
|
480
|
+
function _slicedToArray(r, e) {
|
|
481
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
482
|
+
}
|
|
483
|
+
function _taggedTemplateLiteral(e, t) {
|
|
484
|
+
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
|
|
485
|
+
raw: {
|
|
486
|
+
value: Object.freeze(t)
|
|
487
|
+
}
|
|
488
|
+
}));
|
|
489
|
+
}
|
|
490
|
+
function _toConsumableArray(r) {
|
|
491
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
492
|
+
}
|
|
493
|
+
function _toPrimitive(t, r) {
|
|
494
|
+
if ("object" != typeof t || !t) return t;
|
|
495
|
+
var e = t[Symbol.toPrimitive];
|
|
496
|
+
if (void 0 !== e) {
|
|
497
|
+
var i = e.call(t, r || "default");
|
|
498
|
+
if ("object" != typeof i) return i;
|
|
499
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
500
|
+
}
|
|
501
|
+
return ("string" === r ? String : Number)(t);
|
|
502
|
+
}
|
|
503
|
+
function _toPropertyKey(t) {
|
|
504
|
+
var i = _toPrimitive(t, "string");
|
|
505
|
+
return "symbol" == typeof i ? i : i + "";
|
|
506
|
+
}
|
|
507
|
+
function _unsupportedIterableToArray(r, a) {
|
|
508
|
+
if (r) {
|
|
509
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
510
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
511
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _arrayWithoutHoles as arrayWithoutHoles, _asyncToGenerator as asyncToGenerator, _createForOfIteratorHelper as createForOfIteratorHelper, _defineProperty as defineProperty, _extends as extends, _iterableToArray as iterableToArray, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _nonIterableSpread as nonIterableSpread, _objectSpread2 as objectSpread2, _objectWithoutProperties as objectWithoutProperties, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose, _regeneratorRuntime as regeneratorRuntime, _slicedToArray as slicedToArray, _taggedTemplateLiteral as taggedTemplateLiteral, _toConsumableArray as toConsumableArray, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey, _unsupportedIterableToArray as unsupportedIterableToArray };
|
|
516
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { getClientAuthKey } from '../clientToken.js';
|
|
3
|
+
|
|
4
|
+
var baseURL = "https://api.myhirecontrol.com";
|
|
5
|
+
var memoryStorage = {
|
|
6
|
+
authToken: null,
|
|
7
|
+
tokenExpiration: null
|
|
8
|
+
};
|
|
9
|
+
function setStorage(key, value) {
|
|
10
|
+
try {
|
|
11
|
+
sessionStorage.setItem(key, value);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
memoryStorage[key] = value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function getStorage(key) {
|
|
17
|
+
try {
|
|
18
|
+
return sessionStorage.getItem(key) || memoryStorage[key];
|
|
19
|
+
} catch (error) {
|
|
20
|
+
return memoryStorage[key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
var login = /*#__PURE__*/function () {
|
|
24
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
25
|
+
var clientAuthKey, response, data;
|
|
26
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
27
|
+
while (1) switch (_context.prev = _context.next) {
|
|
28
|
+
case 0:
|
|
29
|
+
clientAuthKey = getClientAuthKey();
|
|
30
|
+
_context.prev = 1;
|
|
31
|
+
_context.next = 4;
|
|
32
|
+
return fetch("".concat(baseURL, "/auth/login"), {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: {
|
|
35
|
+
'Content-Type': 'application/json'
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
clientAuthKey: clientAuthKey
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
case 4:
|
|
42
|
+
response = _context.sent;
|
|
43
|
+
_context.next = 7;
|
|
44
|
+
return response.json();
|
|
45
|
+
case 7:
|
|
46
|
+
data = _context.sent;
|
|
47
|
+
if (!(data.token && data.expiration)) {
|
|
48
|
+
_context.next = 12;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
setStorage('authToken', data.token);
|
|
52
|
+
setStorage('tokenExpiration', data.expiration);
|
|
53
|
+
return _context.abrupt("return", {
|
|
54
|
+
token: data.token,
|
|
55
|
+
expiration: data.expiration
|
|
56
|
+
});
|
|
57
|
+
case 12:
|
|
58
|
+
_context.next = 18;
|
|
59
|
+
break;
|
|
60
|
+
case 14:
|
|
61
|
+
_context.prev = 14;
|
|
62
|
+
_context.t0 = _context["catch"](1);
|
|
63
|
+
console.error('Login failed:', _context.t0);
|
|
64
|
+
throw _context.t0;
|
|
65
|
+
case 18:
|
|
66
|
+
case "end":
|
|
67
|
+
return _context.stop();
|
|
68
|
+
}
|
|
69
|
+
}, _callee, null, [[1, 14]]);
|
|
70
|
+
}));
|
|
71
|
+
return function login() {
|
|
72
|
+
return _ref.apply(this, arguments);
|
|
73
|
+
};
|
|
74
|
+
}();
|
|
75
|
+
var fetchWithAuth = /*#__PURE__*/function () {
|
|
76
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url) {
|
|
77
|
+
var options,
|
|
78
|
+
token,
|
|
79
|
+
expirationDateTime,
|
|
80
|
+
currentTime,
|
|
81
|
+
authResponse,
|
|
82
|
+
headers,
|
|
83
|
+
finalOptions,
|
|
84
|
+
response,
|
|
85
|
+
_args2 = arguments;
|
|
86
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
87
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
90
|
+
token = getStorage('authToken');
|
|
91
|
+
expirationDateTime = getStorage('tokenExpiration');
|
|
92
|
+
currentTime = new Date();
|
|
93
|
+
if (!(!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime)) {
|
|
94
|
+
_context2.next = 9;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
_context2.next = 7;
|
|
98
|
+
return login();
|
|
99
|
+
case 7:
|
|
100
|
+
authResponse = _context2.sent;
|
|
101
|
+
token = authResponse.token;
|
|
102
|
+
case 9:
|
|
103
|
+
headers = new Headers(options.headers || {});
|
|
104
|
+
headers.append('Authorization', "Bearer ".concat(token));
|
|
105
|
+
finalOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
106
|
+
headers: headers
|
|
107
|
+
});
|
|
108
|
+
_context2.next = 14;
|
|
109
|
+
return fetch("".concat(baseURL).concat(url), finalOptions);
|
|
110
|
+
case 14:
|
|
111
|
+
response = _context2.sent;
|
|
112
|
+
if (response.ok) {
|
|
113
|
+
_context2.next = 17;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
throw new Error('Network response was not ok.');
|
|
117
|
+
case 17:
|
|
118
|
+
return _context2.abrupt("return", response);
|
|
119
|
+
case 18:
|
|
120
|
+
case "end":
|
|
121
|
+
return _context2.stop();
|
|
122
|
+
}
|
|
123
|
+
}, _callee2);
|
|
124
|
+
}));
|
|
125
|
+
return function fetchWithAuth(_x) {
|
|
126
|
+
return _ref2.apply(this, arguments);
|
|
127
|
+
};
|
|
128
|
+
}();
|
|
129
|
+
var api = {
|
|
130
|
+
get: function () {
|
|
131
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url) {
|
|
132
|
+
var response;
|
|
133
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
134
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
135
|
+
case 0:
|
|
136
|
+
_context3.next = 2;
|
|
137
|
+
return fetchWithAuth(url);
|
|
138
|
+
case 2:
|
|
139
|
+
response = _context3.sent;
|
|
140
|
+
_context3.next = 5;
|
|
141
|
+
return response.json();
|
|
142
|
+
case 5:
|
|
143
|
+
return _context3.abrupt("return", _context3.sent);
|
|
144
|
+
case 6:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context3.stop();
|
|
147
|
+
}
|
|
148
|
+
}, _callee3);
|
|
149
|
+
}));
|
|
150
|
+
function get(_x2) {
|
|
151
|
+
return _get.apply(this, arguments);
|
|
152
|
+
}
|
|
153
|
+
return get;
|
|
154
|
+
}(),
|
|
155
|
+
post: function () {
|
|
156
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url, data) {
|
|
157
|
+
var response;
|
|
158
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
159
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
160
|
+
case 0:
|
|
161
|
+
_context4.next = 2;
|
|
162
|
+
return fetchWithAuth(url, {
|
|
163
|
+
method: 'POST',
|
|
164
|
+
headers: {
|
|
165
|
+
'Content-Type': 'application/json'
|
|
166
|
+
},
|
|
167
|
+
body: JSON.stringify(data)
|
|
168
|
+
});
|
|
169
|
+
case 2:
|
|
170
|
+
response = _context4.sent;
|
|
171
|
+
_context4.next = 5;
|
|
172
|
+
return response.json();
|
|
173
|
+
case 5:
|
|
174
|
+
return _context4.abrupt("return", _context4.sent);
|
|
175
|
+
case 6:
|
|
176
|
+
case "end":
|
|
177
|
+
return _context4.stop();
|
|
178
|
+
}
|
|
179
|
+
}, _callee4);
|
|
180
|
+
}));
|
|
181
|
+
function post(_x3, _x4) {
|
|
182
|
+
return _post.apply(this, arguments);
|
|
183
|
+
}
|
|
184
|
+
return post;
|
|
185
|
+
}()
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export { api as default };
|
|
189
|
+
//# sourceMappingURL=hcApi.js.map
|