@abcagency/hc-ui-components 1.0.0
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/globals.css +3 -0
- package/dist/index.js +4644 -0
- package/dist/output.css +784 -0
- package/dist/services/globals.css +3 -0
- package/dist/services/listingService.js +606 -0
- package/package.json +38 -0
- package/postcss.config.js +15 -0
- package/rollup.config.js +67 -0
- package/src/apis/hcApi.js +68 -0
- package/src/clientToken.js +9 -0
- package/src/components/layout/footer.js +34 -0
- package/src/components/layout/header.js +23 -0
- package/src/components/layout/layout.js +36 -0
- package/src/components/modules/accordions/MapAccordionItem.js +69 -0
- package/src/components/modules/accordions/default.js +173 -0
- package/src/components/modules/accordions/filterItem.js +53 -0
- package/src/components/modules/accordions/filters.js +44 -0
- package/src/components/modules/animations/slidein.js +41 -0
- package/src/components/modules/buttons/button-group-apply.js +75 -0
- package/src/components/modules/buttons/commute-pill.js +21 -0
- package/src/components/modules/buttons/default.js +196 -0
- package/src/components/modules/buttons/items-pill.js +31 -0
- package/src/components/modules/buttons/pill-wrapper.js +26 -0
- package/src/components/modules/buttons/show-all-button.js +20 -0
- package/src/components/modules/cards/default.js +168 -0
- package/src/components/modules/cards/filter.js +55 -0
- package/src/components/modules/dialogs/apply-dialog.js +47 -0
- package/src/components/modules/filter/commute.js +149 -0
- package/src/components/modules/filter/index.js +86 -0
- package/src/components/modules/filter/item.js +77 -0
- package/src/components/modules/filter/location.js +69 -0
- package/src/components/modules/filter/points-of-interest.js +43 -0
- package/src/components/modules/filter/radio-item.js +51 -0
- package/src/components/modules/filter/search.js +89 -0
- package/src/components/modules/filter/search.js.rej +9 -0
- package/src/components/modules/filter/sort.js +83 -0
- package/src/components/modules/form.js +362 -0
- package/src/components/modules/grid.js +75 -0
- package/src/components/modules/icon.js +33 -0
- package/src/components/modules/jobListing/listing-details.js +87 -0
- package/src/components/modules/jumbotron.js +81 -0
- package/src/components/modules/maps/info-window-card.js +17 -0
- package/src/components/modules/maps/info-window-content.js +60 -0
- package/src/components/modules/maps/list/field-mapper.js +113 -0
- package/src/components/modules/maps/list/header-item.js +90 -0
- package/src/components/modules/maps/list/header.js +46 -0
- package/src/components/modules/maps/list/index.js +104 -0
- package/src/components/modules/maps/list/item-expand-card/index.js +21 -0
- package/src/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +48 -0
- package/src/components/modules/maps/list/item-expand-card/recruiter-details.js +67 -0
- package/src/components/modules/maps/list/item-expand-card/recruiter-headshot.js +22 -0
- package/src/components/modules/maps/list/list-item/index.js +133 -0
- package/src/components/modules/maps/map-list.js +73 -0
- package/src/components/modules/maps/map-marker.js +84 -0
- package/src/components/modules/maps/map.js +218 -0
- package/src/components/modules/maps/place-marker.js +41 -0
- package/src/components/modules/maps/tabs.js +79 -0
- package/src/components/modules/navigation/nav-link.js +65 -0
- package/src/components/modules/navigation/navbar.js +109 -0
- package/src/components/modules/navigation/skip-link.js +21 -0
- package/src/components/modules/navigation/social.js +29 -0
- package/src/components/modules/sections/default.js +59 -0
- package/src/components/modules/sections/sectionContext.js +4 -0
- package/src/components/modules/video-player.js +126 -0
- package/src/constants/placeTypes.js +8 -0
- package/src/contexts/mapContext.js +116 -0
- package/src/contexts/mapListContext.js +212 -0
- package/src/contexts/placesContext.js +98 -0
- package/src/hooks/useClickOutside.js +16 -0
- package/src/hooks/useEventListener.js +25 -0
- package/src/hooks/useEventTracker.js +19 -0
- package/src/hooks/useList.js +102 -0
- package/src/hooks/useRefScrollProgress.js +24 -0
- package/src/hooks/useScript.js +63 -0
- package/src/hooks/useScrollDirection.js +39 -0
- package/src/hooks/useSectionTracker.js +95 -0
- package/src/hooks/useUserAgent.js +43 -0
- package/src/hooks/useWindowSize.js +28 -0
- package/src/index.css +25 -0
- package/src/index.js +116 -0
- package/src/services/configService.js +16 -0
- package/src/services/googlePlacesNearbyService.js +33 -0
- package/src/services/listingAggregatorService.js +42 -0
- package/src/services/listingEntityService.js +14 -0
- package/src/services/listingService.js +28 -0
- package/src/services/recruiterService.js +17 -0
- package/src/styles/fonts.js +0 -0
- package/src/styles/globals.css +25 -0
- package/src/tailwind/preset.default.js +15 -0
- package/src/tailwind/tailwind.config.js +126 -0
- package/src/util/arrayUtil.js +3 -0
- package/src/util/fieldMapper.js +19 -0
- package/src/util/filterUtil.js +195 -0
- package/src/util/loading.js +17 -0
- package/src/util/localStorageUtil.js +27 -0
- package/src/util/mapIconUtil.js +179 -0
- package/src/util/mapUtil.js +91 -0
- package/src/util/page-head.js +62 -0
- package/src/util/provider.js +12 -0
- package/src/util/sortUtil.js +33 -0
- package/src/util/stringUtils.js +6 -0
- package/src/util/urlFilterUtil.js +91 -0
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
function ownKeys(e, r) {
|
|
2
|
+
var t = Object.keys(e);
|
|
3
|
+
if (Object.getOwnPropertySymbols) {
|
|
4
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
5
|
+
r && (o = o.filter(function (r) {
|
|
6
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
7
|
+
})), t.push.apply(t, o);
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
}
|
|
11
|
+
function _objectSpread2(e) {
|
|
12
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
13
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
14
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
15
|
+
_defineProperty(e, r, t[r]);
|
|
16
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
17
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return e;
|
|
21
|
+
}
|
|
22
|
+
function _regeneratorRuntime() {
|
|
23
|
+
_regeneratorRuntime = function () {
|
|
24
|
+
return e;
|
|
25
|
+
};
|
|
26
|
+
var t,
|
|
27
|
+
e = {},
|
|
28
|
+
r = Object.prototype,
|
|
29
|
+
n = r.hasOwnProperty,
|
|
30
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
31
|
+
t[e] = r.value;
|
|
32
|
+
},
|
|
33
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
34
|
+
a = i.iterator || "@@iterator",
|
|
35
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
36
|
+
u = i.toStringTag || "@@toStringTag";
|
|
37
|
+
function define(t, e, r) {
|
|
38
|
+
return Object.defineProperty(t, e, {
|
|
39
|
+
value: r,
|
|
40
|
+
enumerable: !0,
|
|
41
|
+
configurable: !0,
|
|
42
|
+
writable: !0
|
|
43
|
+
}), t[e];
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
define({}, "");
|
|
47
|
+
} catch (t) {
|
|
48
|
+
define = function (t, e, r) {
|
|
49
|
+
return t[e] = r;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function wrap(t, e, r, n) {
|
|
53
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
54
|
+
a = Object.create(i.prototype),
|
|
55
|
+
c = new Context(n || []);
|
|
56
|
+
return o(a, "_invoke", {
|
|
57
|
+
value: makeInvokeMethod(t, r, c)
|
|
58
|
+
}), a;
|
|
59
|
+
}
|
|
60
|
+
function tryCatch(t, e, r) {
|
|
61
|
+
try {
|
|
62
|
+
return {
|
|
63
|
+
type: "normal",
|
|
64
|
+
arg: t.call(e, r)
|
|
65
|
+
};
|
|
66
|
+
} catch (t) {
|
|
67
|
+
return {
|
|
68
|
+
type: "throw",
|
|
69
|
+
arg: t
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
e.wrap = wrap;
|
|
74
|
+
var h = "suspendedStart",
|
|
75
|
+
l = "suspendedYield",
|
|
76
|
+
f = "executing",
|
|
77
|
+
s = "completed",
|
|
78
|
+
y = {};
|
|
79
|
+
function Generator() {}
|
|
80
|
+
function GeneratorFunction() {}
|
|
81
|
+
function GeneratorFunctionPrototype() {}
|
|
82
|
+
var p = {};
|
|
83
|
+
define(p, a, function () {
|
|
84
|
+
return this;
|
|
85
|
+
});
|
|
86
|
+
var d = Object.getPrototypeOf,
|
|
87
|
+
v = d && d(d(values([])));
|
|
88
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
89
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
90
|
+
function defineIteratorMethods(t) {
|
|
91
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
92
|
+
define(t, e, function (t) {
|
|
93
|
+
return this._invoke(e, t);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function AsyncIterator(t, e) {
|
|
98
|
+
function invoke(r, o, i, a) {
|
|
99
|
+
var c = tryCatch(t[r], t, o);
|
|
100
|
+
if ("throw" !== c.type) {
|
|
101
|
+
var u = c.arg,
|
|
102
|
+
h = u.value;
|
|
103
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
104
|
+
invoke("next", t, i, a);
|
|
105
|
+
}, function (t) {
|
|
106
|
+
invoke("throw", t, i, a);
|
|
107
|
+
}) : e.resolve(h).then(function (t) {
|
|
108
|
+
u.value = t, i(u);
|
|
109
|
+
}, function (t) {
|
|
110
|
+
return invoke("throw", t, i, a);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
a(c.arg);
|
|
114
|
+
}
|
|
115
|
+
var r;
|
|
116
|
+
o(this, "_invoke", {
|
|
117
|
+
value: function (t, n) {
|
|
118
|
+
function callInvokeWithMethodAndArg() {
|
|
119
|
+
return new e(function (e, r) {
|
|
120
|
+
invoke(t, n, e, r);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function makeInvokeMethod(e, r, n) {
|
|
128
|
+
var o = h;
|
|
129
|
+
return function (i, a) {
|
|
130
|
+
if (o === f) throw Error("Generator is already running");
|
|
131
|
+
if (o === s) {
|
|
132
|
+
if ("throw" === i) throw a;
|
|
133
|
+
return {
|
|
134
|
+
value: t,
|
|
135
|
+
done: !0
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
for (n.method = i, n.arg = a;;) {
|
|
139
|
+
var c = n.delegate;
|
|
140
|
+
if (c) {
|
|
141
|
+
var u = maybeInvokeDelegate(c, n);
|
|
142
|
+
if (u) {
|
|
143
|
+
if (u === y) continue;
|
|
144
|
+
return u;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
148
|
+
if (o === h) throw o = s, n.arg;
|
|
149
|
+
n.dispatchException(n.arg);
|
|
150
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
151
|
+
o = f;
|
|
152
|
+
var p = tryCatch(e, r, n);
|
|
153
|
+
if ("normal" === p.type) {
|
|
154
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
155
|
+
return {
|
|
156
|
+
value: p.arg,
|
|
157
|
+
done: n.done
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function maybeInvokeDelegate(e, r) {
|
|
165
|
+
var n = r.method,
|
|
166
|
+
o = e.iterator[n];
|
|
167
|
+
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;
|
|
168
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
169
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
170
|
+
var a = i.arg;
|
|
171
|
+
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);
|
|
172
|
+
}
|
|
173
|
+
function pushTryEntry(t) {
|
|
174
|
+
var e = {
|
|
175
|
+
tryLoc: t[0]
|
|
176
|
+
};
|
|
177
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
178
|
+
}
|
|
179
|
+
function resetTryEntry(t) {
|
|
180
|
+
var e = t.completion || {};
|
|
181
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
182
|
+
}
|
|
183
|
+
function Context(t) {
|
|
184
|
+
this.tryEntries = [{
|
|
185
|
+
tryLoc: "root"
|
|
186
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
187
|
+
}
|
|
188
|
+
function values(e) {
|
|
189
|
+
if (e || "" === e) {
|
|
190
|
+
var r = e[a];
|
|
191
|
+
if (r) return r.call(e);
|
|
192
|
+
if ("function" == typeof e.next) return e;
|
|
193
|
+
if (!isNaN(e.length)) {
|
|
194
|
+
var o = -1,
|
|
195
|
+
i = function next() {
|
|
196
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
197
|
+
return next.value = t, next.done = !0, next;
|
|
198
|
+
};
|
|
199
|
+
return i.next = i;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
203
|
+
}
|
|
204
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
205
|
+
value: GeneratorFunctionPrototype,
|
|
206
|
+
configurable: !0
|
|
207
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
208
|
+
value: GeneratorFunction,
|
|
209
|
+
configurable: !0
|
|
210
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
211
|
+
var e = "function" == typeof t && t.constructor;
|
|
212
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
213
|
+
}, e.mark = function (t) {
|
|
214
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
215
|
+
}, e.awrap = function (t) {
|
|
216
|
+
return {
|
|
217
|
+
__await: t
|
|
218
|
+
};
|
|
219
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
220
|
+
return this;
|
|
221
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
222
|
+
void 0 === i && (i = Promise);
|
|
223
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
224
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
225
|
+
return t.done ? t.value : a.next();
|
|
226
|
+
});
|
|
227
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
228
|
+
return this;
|
|
229
|
+
}), define(g, "toString", function () {
|
|
230
|
+
return "[object Generator]";
|
|
231
|
+
}), e.keys = function (t) {
|
|
232
|
+
var e = Object(t),
|
|
233
|
+
r = [];
|
|
234
|
+
for (var n in e) r.push(n);
|
|
235
|
+
return r.reverse(), function next() {
|
|
236
|
+
for (; r.length;) {
|
|
237
|
+
var t = r.pop();
|
|
238
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
239
|
+
}
|
|
240
|
+
return next.done = !0, next;
|
|
241
|
+
};
|
|
242
|
+
}, e.values = values, Context.prototype = {
|
|
243
|
+
constructor: Context,
|
|
244
|
+
reset: function (e) {
|
|
245
|
+
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);
|
|
246
|
+
},
|
|
247
|
+
stop: function () {
|
|
248
|
+
this.done = !0;
|
|
249
|
+
var t = this.tryEntries[0].completion;
|
|
250
|
+
if ("throw" === t.type) throw t.arg;
|
|
251
|
+
return this.rval;
|
|
252
|
+
},
|
|
253
|
+
dispatchException: function (e) {
|
|
254
|
+
if (this.done) throw e;
|
|
255
|
+
var r = this;
|
|
256
|
+
function handle(n, o) {
|
|
257
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
258
|
+
}
|
|
259
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
260
|
+
var i = this.tryEntries[o],
|
|
261
|
+
a = i.completion;
|
|
262
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
263
|
+
if (i.tryLoc <= this.prev) {
|
|
264
|
+
var c = n.call(i, "catchLoc"),
|
|
265
|
+
u = n.call(i, "finallyLoc");
|
|
266
|
+
if (c && u) {
|
|
267
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
268
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
269
|
+
} else if (c) {
|
|
270
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
271
|
+
} else {
|
|
272
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
273
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
abrupt: function (t, e) {
|
|
279
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
280
|
+
var o = this.tryEntries[r];
|
|
281
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
282
|
+
var i = o;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
287
|
+
var a = i ? i.completion : {};
|
|
288
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
289
|
+
},
|
|
290
|
+
complete: function (t, e) {
|
|
291
|
+
if ("throw" === t.type) throw t.arg;
|
|
292
|
+
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;
|
|
293
|
+
},
|
|
294
|
+
finish: function (t) {
|
|
295
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
296
|
+
var r = this.tryEntries[e];
|
|
297
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
catch: function (t) {
|
|
301
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
302
|
+
var r = this.tryEntries[e];
|
|
303
|
+
if (r.tryLoc === t) {
|
|
304
|
+
var n = r.completion;
|
|
305
|
+
if ("throw" === n.type) {
|
|
306
|
+
var o = n.arg;
|
|
307
|
+
resetTryEntry(r);
|
|
308
|
+
}
|
|
309
|
+
return o;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
throw Error("illegal catch attempt");
|
|
313
|
+
},
|
|
314
|
+
delegateYield: function (e, r, n) {
|
|
315
|
+
return this.delegate = {
|
|
316
|
+
iterator: values(e),
|
|
317
|
+
resultName: r,
|
|
318
|
+
nextLoc: n
|
|
319
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
320
|
+
}
|
|
321
|
+
}, e;
|
|
322
|
+
}
|
|
323
|
+
function _toPrimitive(t, r) {
|
|
324
|
+
if ("object" != typeof t || !t) return t;
|
|
325
|
+
var e = t[Symbol.toPrimitive];
|
|
326
|
+
if (void 0 !== e) {
|
|
327
|
+
var i = e.call(t, r || "default");
|
|
328
|
+
if ("object" != typeof i) return i;
|
|
329
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
330
|
+
}
|
|
331
|
+
return ("string" === r ? String : Number)(t);
|
|
332
|
+
}
|
|
333
|
+
function _toPropertyKey(t) {
|
|
334
|
+
var i = _toPrimitive(t, "string");
|
|
335
|
+
return "symbol" == typeof i ? i : i + "";
|
|
336
|
+
}
|
|
337
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
338
|
+
try {
|
|
339
|
+
var info = gen[key](arg);
|
|
340
|
+
var value = info.value;
|
|
341
|
+
} catch (error) {
|
|
342
|
+
reject(error);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (info.done) {
|
|
346
|
+
resolve(value);
|
|
347
|
+
} else {
|
|
348
|
+
Promise.resolve(value).then(_next, _throw);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function _asyncToGenerator(fn) {
|
|
352
|
+
return function () {
|
|
353
|
+
var self = this,
|
|
354
|
+
args = arguments;
|
|
355
|
+
return new Promise(function (resolve, reject) {
|
|
356
|
+
var gen = fn.apply(self, args);
|
|
357
|
+
function _next(value) {
|
|
358
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
359
|
+
}
|
|
360
|
+
function _throw(err) {
|
|
361
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
362
|
+
}
|
|
363
|
+
_next(undefined);
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function _defineProperty(obj, key, value) {
|
|
368
|
+
key = _toPropertyKey(key);
|
|
369
|
+
if (key in obj) {
|
|
370
|
+
Object.defineProperty(obj, key, {
|
|
371
|
+
value: value,
|
|
372
|
+
enumerable: true,
|
|
373
|
+
configurable: true,
|
|
374
|
+
writable: true
|
|
375
|
+
});
|
|
376
|
+
} else {
|
|
377
|
+
obj[key] = value;
|
|
378
|
+
}
|
|
379
|
+
return obj;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
var clientAuthKey = null;
|
|
383
|
+
var getClientAuthKey = function getClientAuthKey() {
|
|
384
|
+
return clientAuthKey;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
var baseURL = "https://https://api.myhirecontrol.com";
|
|
388
|
+
var login = /*#__PURE__*/function () {
|
|
389
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
390
|
+
var clientAuthKey, response, data;
|
|
391
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
392
|
+
while (1) switch (_context.prev = _context.next) {
|
|
393
|
+
case 0:
|
|
394
|
+
clientAuthKey = getClientAuthKey();
|
|
395
|
+
_context.prev = 1;
|
|
396
|
+
_context.next = 4;
|
|
397
|
+
return fetch("".concat(baseURL, "/auth/login"), {
|
|
398
|
+
method: 'POST',
|
|
399
|
+
headers: {
|
|
400
|
+
'Content-Type': 'application/json'
|
|
401
|
+
},
|
|
402
|
+
body: JSON.stringify({
|
|
403
|
+
clientAuthKey: clientAuthKey
|
|
404
|
+
})
|
|
405
|
+
});
|
|
406
|
+
case 4:
|
|
407
|
+
response = _context.sent;
|
|
408
|
+
_context.next = 7;
|
|
409
|
+
return response.json();
|
|
410
|
+
case 7:
|
|
411
|
+
data = _context.sent;
|
|
412
|
+
if (!(data.token && data.expiration)) {
|
|
413
|
+
_context.next = 12;
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
sessionStorage.setItem('authToken', data.token);
|
|
417
|
+
sessionStorage.setItem('tokenExpiration', data.expiration);
|
|
418
|
+
return _context.abrupt("return", {
|
|
419
|
+
token: data.token,
|
|
420
|
+
expiration: data.expiration
|
|
421
|
+
});
|
|
422
|
+
case 12:
|
|
423
|
+
_context.next = 18;
|
|
424
|
+
break;
|
|
425
|
+
case 14:
|
|
426
|
+
_context.prev = 14;
|
|
427
|
+
_context.t0 = _context["catch"](1);
|
|
428
|
+
console.error('Login failed:', _context.t0);
|
|
429
|
+
throw _context.t0;
|
|
430
|
+
case 18:
|
|
431
|
+
case "end":
|
|
432
|
+
return _context.stop();
|
|
433
|
+
}
|
|
434
|
+
}, _callee, null, [[1, 14]]);
|
|
435
|
+
}));
|
|
436
|
+
return function login() {
|
|
437
|
+
return _ref.apply(this, arguments);
|
|
438
|
+
};
|
|
439
|
+
}();
|
|
440
|
+
var fetchWithAuth = /*#__PURE__*/function () {
|
|
441
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url) {
|
|
442
|
+
var options,
|
|
443
|
+
token,
|
|
444
|
+
expirationDateTime,
|
|
445
|
+
currentTime,
|
|
446
|
+
authResponse,
|
|
447
|
+
headers,
|
|
448
|
+
finalOptions,
|
|
449
|
+
response,
|
|
450
|
+
_args2 = arguments;
|
|
451
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
452
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
453
|
+
case 0:
|
|
454
|
+
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
455
|
+
token = sessionStorage.getItem('authToken');
|
|
456
|
+
expirationDateTime = sessionStorage.getItem('tokenExpiration');
|
|
457
|
+
currentTime = new Date();
|
|
458
|
+
if (!(!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime)) {
|
|
459
|
+
_context2.next = 9;
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
_context2.next = 7;
|
|
463
|
+
return login();
|
|
464
|
+
case 7:
|
|
465
|
+
authResponse = _context2.sent;
|
|
466
|
+
token = authResponse.token;
|
|
467
|
+
case 9:
|
|
468
|
+
headers = new Headers(options.headers || {});
|
|
469
|
+
headers.append('Authorization', "Bearer ".concat(token));
|
|
470
|
+
finalOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
471
|
+
headers: headers
|
|
472
|
+
});
|
|
473
|
+
_context2.next = 14;
|
|
474
|
+
return fetch("".concat(baseURL).concat(url), finalOptions);
|
|
475
|
+
case 14:
|
|
476
|
+
response = _context2.sent;
|
|
477
|
+
if (response.ok) {
|
|
478
|
+
_context2.next = 17;
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
throw new Error('Network response was not ok.');
|
|
482
|
+
case 17:
|
|
483
|
+
return _context2.abrupt("return", response);
|
|
484
|
+
case 18:
|
|
485
|
+
case "end":
|
|
486
|
+
return _context2.stop();
|
|
487
|
+
}
|
|
488
|
+
}, _callee2);
|
|
489
|
+
}));
|
|
490
|
+
return function fetchWithAuth(_x) {
|
|
491
|
+
return _ref2.apply(this, arguments);
|
|
492
|
+
};
|
|
493
|
+
}();
|
|
494
|
+
var api = {
|
|
495
|
+
get: function () {
|
|
496
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url) {
|
|
497
|
+
var response;
|
|
498
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
499
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
500
|
+
case 0:
|
|
501
|
+
_context3.next = 2;
|
|
502
|
+
return fetchWithAuth(url);
|
|
503
|
+
case 2:
|
|
504
|
+
response = _context3.sent;
|
|
505
|
+
return _context3.abrupt("return", response.json());
|
|
506
|
+
case 4:
|
|
507
|
+
case "end":
|
|
508
|
+
return _context3.stop();
|
|
509
|
+
}
|
|
510
|
+
}, _callee3);
|
|
511
|
+
}));
|
|
512
|
+
function get(_x2) {
|
|
513
|
+
return _get.apply(this, arguments);
|
|
514
|
+
}
|
|
515
|
+
return get;
|
|
516
|
+
}(),
|
|
517
|
+
post: function () {
|
|
518
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url, data) {
|
|
519
|
+
var response;
|
|
520
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
521
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
522
|
+
case 0:
|
|
523
|
+
_context4.next = 2;
|
|
524
|
+
return fetchWithAuth(url, {
|
|
525
|
+
method: 'POST',
|
|
526
|
+
headers: {
|
|
527
|
+
'Content-Type': 'application/json'
|
|
528
|
+
},
|
|
529
|
+
body: JSON.stringify(data)
|
|
530
|
+
});
|
|
531
|
+
case 2:
|
|
532
|
+
response = _context4.sent;
|
|
533
|
+
return _context4.abrupt("return", response.json());
|
|
534
|
+
case 4:
|
|
535
|
+
case "end":
|
|
536
|
+
return _context4.stop();
|
|
537
|
+
}
|
|
538
|
+
}, _callee4);
|
|
539
|
+
}));
|
|
540
|
+
function post(_x3, _x4) {
|
|
541
|
+
return _post.apply(this, arguments);
|
|
542
|
+
}
|
|
543
|
+
return post;
|
|
544
|
+
}()
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
var getListings = /*#__PURE__*/function () {
|
|
548
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(companyId) {
|
|
549
|
+
var response;
|
|
550
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
551
|
+
while (1) switch (_context.prev = _context.next) {
|
|
552
|
+
case 0:
|
|
553
|
+
_context.prev = 0;
|
|
554
|
+
_context.next = 4;
|
|
555
|
+
return api.get("/Listings");
|
|
556
|
+
case 4:
|
|
557
|
+
response = _context.sent;
|
|
558
|
+
return _context.abrupt("return", response);
|
|
559
|
+
case 8:
|
|
560
|
+
_context.prev = 8;
|
|
561
|
+
_context.t0 = _context["catch"](0);
|
|
562
|
+
console.error(_context.t0);
|
|
563
|
+
throw _context.t0;
|
|
564
|
+
case 12:
|
|
565
|
+
case "end":
|
|
566
|
+
return _context.stop();
|
|
567
|
+
}
|
|
568
|
+
}, _callee, null, [[0, 8]]);
|
|
569
|
+
}));
|
|
570
|
+
return function getListings(_x) {
|
|
571
|
+
return _ref.apply(this, arguments);
|
|
572
|
+
};
|
|
573
|
+
}();
|
|
574
|
+
var getListingDetails = /*#__PURE__*/function () {
|
|
575
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(listingId) {
|
|
576
|
+
var response;
|
|
577
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
578
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
579
|
+
case 0:
|
|
580
|
+
_context2.prev = 0;
|
|
581
|
+
_context2.next = 3;
|
|
582
|
+
return api.get("/ListingDetails/".concat(listingId));
|
|
583
|
+
case 3:
|
|
584
|
+
response = _context2.sent;
|
|
585
|
+
return _context2.abrupt("return", response);
|
|
586
|
+
case 7:
|
|
587
|
+
_context2.prev = 7;
|
|
588
|
+
_context2.t0 = _context2["catch"](0);
|
|
589
|
+
console.error(_context2.t0);
|
|
590
|
+
throw _context2.t0;
|
|
591
|
+
case 11:
|
|
592
|
+
case "end":
|
|
593
|
+
return _context2.stop();
|
|
594
|
+
}
|
|
595
|
+
}, _callee2, null, [[0, 7]]);
|
|
596
|
+
}));
|
|
597
|
+
return function getListingDetails(_x2) {
|
|
598
|
+
return _ref2.apply(this, arguments);
|
|
599
|
+
};
|
|
600
|
+
}();
|
|
601
|
+
var listingService = {
|
|
602
|
+
getListings: getListings,
|
|
603
|
+
getListingDetails: getListingDetails
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
export { listingService as default, getListingDetails, getListings };
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@abcagency/hc-ui-components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rollup -c",
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@babel/cli": "^7.24.5",
|
|
17
|
+
"@babel/core": "^7.24.5",
|
|
18
|
+
"@babel/preset-env": "^7.24.5",
|
|
19
|
+
"@babel/preset-react": "^7.24.1",
|
|
20
|
+
"@rollup/plugin-alias": "^5.1.0",
|
|
21
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
22
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
23
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
24
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
25
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
26
|
+
"@tailwindcss/forms": "^0.5.7",
|
|
27
|
+
"@tailwindcss/typography": "^0.5.13",
|
|
28
|
+
"tailwindcss": "^3.4.3",
|
|
29
|
+
"tailwindcss-animate": "^1.0.7",
|
|
30
|
+
"autoprefixer": "^10.4.19",
|
|
31
|
+
"dotenv": "^16.4.5",
|
|
32
|
+
"postcss": "^8.4.38",
|
|
33
|
+
"postcss-preset-env": "^9.5.13",
|
|
34
|
+
"rollup": "^4.17.2",
|
|
35
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
36
|
+
"rollup-plugin-postcss": "^4.0.2"
|
|
37
|
+
}
|
|
38
|
+
}
|