@defra/flood-webchat 0.0.1-alpha.9 → 0.0.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +1 -83
  2. package/dist/client.js +445 -0
  3. package/dist/client.js.map +1 -0
  4. package/dist/server.js +362 -0
  5. package/dist/server.js.map +1 -0
  6. package/docs/development-guide.md +1 -2
  7. package/jest.config.mjs +29 -0
  8. package/main.scss +5 -741
  9. package/package.json +18 -13
  10. package/src/client/components/availability/availability.jsx +101 -0
  11. package/src/client/components/availability/availability.scss +89 -0
  12. package/src/client/index.jsx +16 -0
  13. package/src/client/lib/check-availability.js +7 -0
  14. package/src/client/lib/classnames.js +1 -0
  15. package/src/client/lib/external-stores.js +4 -0
  16. package/src/client/lib/external-sync-store.js +42 -0
  17. package/src/server/index.js +11 -6
  18. package/src/server/{client.js → lib/client.js} +32 -12
  19. package/src/server/{utils.js → lib/utils.js} +8 -13
  20. package/webpack.config.mjs +32 -0
  21. package/assets/audio/notification.mp3 +0 -0
  22. package/babel.config.cjs +0 -3
  23. package/dist/templates.js +0 -554
  24. package/src/client/index.js +0 -14
  25. package/src/client/lib/availability.js +0 -75
  26. package/src/client/lib/config.js +0 -17
  27. package/src/client/lib/keyboard.js +0 -149
  28. package/src/client/lib/notification.js +0 -59
  29. package/src/client/lib/nunjucks.js +0 -3
  30. package/src/client/lib/panel.js +0 -293
  31. package/src/client/lib/provider.js +0 -11
  32. package/src/client/lib/skiplink.js +0 -27
  33. package/src/client/lib/state.js +0 -82
  34. package/src/client/lib/transcript.js +0 -34
  35. package/src/client/lib/utils.js +0 -190
  36. package/src/client/lib/webchat.js +0 -1075
  37. package/src/style/_mixins.scss +0 -13
package/README.md CHANGED
@@ -1,91 +1,9 @@
1
1
  # flood-webchat
2
2
 
3
3
  ## Useful Links
4
-
5
4
  - [Development Guide](./docs/development-guide.md)
6
5
  - [How to Publish](./docs/how-to-publish.md)
7
6
 
8
7
  ## Usage
8
+ TBC
9
9
 
10
- ### Installation
11
-
12
- Run:
13
-
14
- ```shell
15
- npm i @defra/flood-webchat
16
- ```
17
-
18
- ### Assets
19
-
20
- You need to copy `./assets/audio/notification.mp3` to your 'assets' directory. This is the notification sound users will
21
- hear when they receive a message.
22
-
23
- ### Server Side Javascript
24
-
25
- You will need to implement an endpoint on your server which checks the availability of webchat. An express example can
26
- be seen below:
27
-
28
- ```js
29
-
30
- import getAvailability from '@defra/flood-webchat'
31
- //... the rest of your server setup
32
- const webchatOptions = {
33
- clientId: process.env.CXONE_CLIENT_ID,
34
- clientSecret: process.env.CXONE_CLIENT_SECRET,
35
- accessKey: process.env.CXONE_ACCESS_KEY,
36
- accessSecret: process.env.CXONE_ACCESS_SECRET,
37
- skillEndpoint: process.env.CXONE_SKILL_ENDPOINT,
38
- hoursEndpoint: process.env.CXONE_HOURS_ENDPOINT,
39
- maxQueueCount: process.env.CXONE_MAX_QUEUE_COUNT
40
- }
41
-
42
- app.get('/webchat-availability', async (req, res, next) => {
43
- try {
44
- const response = await getAvailability(webchatOptions)
45
- return res.status(200).json(response)
46
- } catch (err) {
47
- next(err)
48
- }
49
- })
50
- ```
51
-
52
- ### Client Side Javascript
53
-
54
- You will also need to initialise webchat in your client side code:
55
-
56
- ```js
57
- import * as webchat from '@defra/flood-webchat';
58
-
59
- if (document.getElementById('wc-availability')) {
60
- webchat.init('wc-availability', {
61
- brandId: 'your brand id',
62
- channelId: 'your channel id',
63
- environmentName: 'your environment name',
64
- availabilityEndpoint: '/webchat-availability',
65
- audioUrl: 'path/to/notification.mp3'
66
- })
67
- }
68
- ```
69
-
70
- ### HTML
71
-
72
- In your html, will need to add the "Start Chat" link with some placeholder text for if webchat is not supported in the
73
- user's browser.
74
-
75
- ```html
76
-
77
- <div id="wc-availability">
78
- <p>Webchat is not supported with your browser</p>
79
- </div>
80
- ```
81
-
82
- And finally a script tag, to prevent the webchat widget "flashing" on page load/reload.
83
-
84
- ```html
85
-
86
- <script>
87
- if (window.location.hash === '#webchat' && window.matchMedia('(max-width: 640px)').matches) {
88
- document.body.classList.add('wc-hidden')
89
- }
90
- </script>
91
- ```
package/dist/client.js ADDED
@@ -0,0 +1,445 @@
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ "./src/client/components/availability/availability.jsx":
6
+ /*!*************************************************************!*\
7
+ !*** ./src/client/components/availability/availability.jsx ***!
8
+ \*************************************************************/
9
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10
+
11
+ __webpack_require__.r(__webpack_exports__);
12
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13
+ /* harmony export */ Availability: () => (/* binding */ Availability)
14
+ /* harmony export */ });
15
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
16
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
17
+ /* harmony import */ var _lib_classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../lib/classnames */ "./src/client/lib/classnames.js");
18
+ /* harmony import */ var _lib_external_stores__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/external-stores */ "./src/client/lib/external-stores.js");
19
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
23
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
24
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
+
26
+
27
+
28
+ function Availability(props) {
29
+ var _useWebchatOpenState = (0,_lib_external_stores__WEBPACK_IMPORTED_MODULE_2__.useWebchatOpenState)(),
30
+ _useWebchatOpenState2 = _slicedToArray(_useWebchatOpenState, 2),
31
+ isOpen = _useWebchatOpenState2[0],
32
+ setOpen = _useWebchatOpenState2[1];
33
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ isFixed = _useState2[0],
36
+ setFixed = _useState2[1];
37
+ var buttonRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
38
+ var onClick = function onClick() {
39
+ setOpen(!isOpen);
40
+ };
41
+ var onKeyDown = function onKeyDown(event) {
42
+ if (event.key === ' ') {
43
+ event.preventDefault();
44
+ }
45
+ };
46
+ var onKeyUp = function onKeyUp(event) {
47
+ if (event.key === ' ') {
48
+ setOpen(!isOpen);
49
+ }
50
+ };
51
+ var intersectionCallback = function intersectionCallback(entries) {
52
+ var _entries = _slicedToArray(entries, 1),
53
+ entry = _entries[0];
54
+ var isBelowFold = !entry.isIntersecting && entry.boundingClientRect.top > 0;
55
+ setFixed(!isOpen && isBelowFold);
56
+ };
57
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
58
+ var _buttonRef$current;
59
+ var observer = new window.IntersectionObserver(intersectionCallback, {
60
+ rootMargin: '35px'
61
+ });
62
+ var parentElement = (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.parentElement;
63
+ if (parentElement) {
64
+ observer.observe(parentElement);
65
+ }
66
+ return function () {
67
+ if (parentElement) {
68
+ observer.unobserve(parentElement);
69
+ }
70
+ };
71
+ }, [buttonRef, isOpen]);
72
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
73
+ document.documentElement.classList.toggle('wc-scroll-padding', isFixed);
74
+ document.body.classList.toggle('wc-scroll-padding', isFixed);
75
+ }, [isFixed]);
76
+ switch (props.availability) {
77
+ case 'AVAILABLE':
78
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
79
+ className: (0,_lib_classnames__WEBPACK_IMPORTED_MODULE_1__.classnames)('wc-availability', isFixed && 'wc-availability--fixed'),
80
+ ref: buttonRef
81
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
82
+ className: "wc-availability__inner"
83
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
84
+ className: "wc-availability__link",
85
+ href: "#webchat",
86
+ role: "button",
87
+ draggable: "false",
88
+ onClick: onClick,
89
+ onKeyUp: onKeyUp,
90
+ onKeyDown: onKeyDown
91
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(AvailabilityContent, null))));
92
+ case 'EXISTING':
93
+ case 'UNAVAILABLE':
94
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", {
95
+ className: "govuk-body"
96
+ }, "When it is available, a 'start chat' link will appear.");
97
+ default:
98
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", {
99
+ className: "govuk-body"
100
+ }, "Checking availability");
101
+ }
102
+ }
103
+ function AvailabilityContent() {
104
+ var _useMessageThread = (0,_lib_external_stores__WEBPACK_IMPORTED_MODULE_2__.useMessageThread)(),
105
+ _useMessageThread2 = _slicedToArray(_useMessageThread, 1),
106
+ thread = _useMessageThread2[0];
107
+ var unreadMessageCount = thread.filter(function (message) {
108
+ return !message.read;
109
+ }).length;
110
+ if (!thread.length) {
111
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, "Start Chat");
112
+ }
113
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, "Show Chat ", !!unreadMessageCount && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
114
+ className: "wc-availability__unseen"
115
+ }, unreadMessageCount), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
116
+ className: "govuk-visually-hidden"
117
+ }, " ", unreadMessageCount === 1 ? 'new message' : 'new messages')));
118
+ }
119
+
120
+ /***/ }),
121
+
122
+ /***/ "./src/client/lib/check-availability.js":
123
+ /*!**********************************************!*\
124
+ !*** ./src/client/lib/check-availability.js ***!
125
+ \**********************************************/
126
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
127
+
128
+ __webpack_require__.r(__webpack_exports__);
129
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
130
+ /* harmony export */ checkAvailability: () => (/* binding */ checkAvailability)
131
+ /* harmony export */ });
132
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
133
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || "" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
134
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
135
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
136
+ function checkAvailability(_x) {
137
+ return _checkAvailability.apply(this, arguments);
138
+ }
139
+ function _checkAvailability() {
140
+ _checkAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(endpoint) {
141
+ var response, data;
142
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
143
+ while (1) switch (_context.prev = _context.next) {
144
+ case 0:
145
+ _context.next = 2;
146
+ return fetch(endpoint);
147
+ case 2:
148
+ response = _context.sent;
149
+ _context.next = 5;
150
+ return response.json();
151
+ case 5:
152
+ data = _context.sent;
153
+ return _context.abrupt("return", {
154
+ availability: data.availability || 'UNAVAILABLE'
155
+ });
156
+ case 7:
157
+ case "end":
158
+ return _context.stop();
159
+ }
160
+ }, _callee);
161
+ }));
162
+ return _checkAvailability.apply(this, arguments);
163
+ }
164
+
165
+ /***/ }),
166
+
167
+ /***/ "./src/client/lib/classnames.js":
168
+ /*!**************************************!*\
169
+ !*** ./src/client/lib/classnames.js ***!
170
+ \**************************************/
171
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
172
+
173
+ __webpack_require__.r(__webpack_exports__);
174
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
175
+ /* harmony export */ classnames: () => (/* binding */ classnames)
176
+ /* harmony export */ });
177
+ var classnames = function classnames() {
178
+ for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
179
+ classes[_key] = arguments[_key];
180
+ }
181
+ return classes.filter(function (classname) {
182
+ return classname && typeof classname === 'string';
183
+ }).join(' ');
184
+ };
185
+
186
+ /***/ }),
187
+
188
+ /***/ "./src/client/lib/external-stores.js":
189
+ /*!*******************************************!*\
190
+ !*** ./src/client/lib/external-stores.js ***!
191
+ \*******************************************/
192
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
193
+
194
+ __webpack_require__.r(__webpack_exports__);
195
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
196
+ /* harmony export */ useMessageThread: () => (/* binding */ useMessageThread),
197
+ /* harmony export */ useWebchatOpenState: () => (/* binding */ useWebchatOpenState)
198
+ /* harmony export */ });
199
+ /* harmony import */ var _external_sync_store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./external-sync-store */ "./src/client/lib/external-sync-store.js");
200
+
201
+ var useWebchatOpenState = _external_sync_store__WEBPACK_IMPORTED_MODULE_0__["default"].create(false);
202
+ var useMessageThread = _external_sync_store__WEBPACK_IMPORTED_MODULE_0__["default"].create([]);
203
+
204
+ /***/ }),
205
+
206
+ /***/ "./src/client/lib/external-sync-store.js":
207
+ /*!***********************************************!*\
208
+ !*** ./src/client/lib/external-sync-store.js ***!
209
+ \***********************************************/
210
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
211
+
212
+ __webpack_require__.r(__webpack_exports__);
213
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
214
+ /* harmony export */ "default": () => (/* binding */ ExternalSyncStore)
215
+ /* harmony export */ });
216
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
217
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
218
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
219
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
220
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
221
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
222
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
223
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
224
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
225
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
226
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
227
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
228
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
229
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
230
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
231
+
232
+ var ExternalSyncStore = /*#__PURE__*/function () {
233
+ function ExternalSyncStore(initialValue) {
234
+ _classCallCheck(this, ExternalSyncStore);
235
+ this._value = initialValue;
236
+ this._listeners = [];
237
+ }
238
+ _createClass(ExternalSyncStore, [{
239
+ key: "update",
240
+ value: function update(value) {
241
+ this._value = value;
242
+ this.emitChange();
243
+ }
244
+ }, {
245
+ key: "subscribe",
246
+ value: function subscribe(listener) {
247
+ var _this = this;
248
+ this._listeners = [].concat(_toConsumableArray(this._listeners), [listener]);
249
+ return function () {
250
+ _this._listeners = _this._listeners.filter(function (l) {
251
+ return l !== listener;
252
+ });
253
+ };
254
+ }
255
+ }, {
256
+ key: "emitChange",
257
+ value: function emitChange() {
258
+ var _iterator = _createForOfIteratorHelper(this._listeners),
259
+ _step;
260
+ try {
261
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
262
+ var listener = _step.value;
263
+ listener();
264
+ }
265
+ } catch (err) {
266
+ _iterator.e(err);
267
+ } finally {
268
+ _iterator.f();
269
+ }
270
+ }
271
+ }, {
272
+ key: "getSnapshot",
273
+ value: function getSnapshot() {
274
+ return this._value;
275
+ }
276
+ }], [{
277
+ key: "create",
278
+ value: function create(initialValue) {
279
+ var store = new ExternalSyncStore(initialValue);
280
+ var boundSubscribe = store.subscribe.bind(store);
281
+ var boundGetSnapshot = store.getSnapshot.bind(store);
282
+ var boundUpdate = store.update.bind(store);
283
+ return function () {
284
+ return [(0,react__WEBPACK_IMPORTED_MODULE_0__.useSyncExternalStore)(boundSubscribe, boundGetSnapshot), boundUpdate];
285
+ };
286
+ }
287
+ }]);
288
+ return ExternalSyncStore;
289
+ }();
290
+
291
+
292
+ /***/ }),
293
+
294
+ /***/ "react":
295
+ /*!************************!*\
296
+ !*** external "react" ***!
297
+ \************************/
298
+ /***/ ((module) => {
299
+
300
+ module.exports = require("react");
301
+
302
+ /***/ }),
303
+
304
+ /***/ "react-dom/client":
305
+ /*!***********************************!*\
306
+ !*** external "react-dom/client" ***!
307
+ \***********************************/
308
+ /***/ ((module) => {
309
+
310
+ module.exports = require("react-dom/client");
311
+
312
+ /***/ })
313
+
314
+ /******/ });
315
+ /************************************************************************/
316
+ /******/ // The module cache
317
+ /******/ var __webpack_module_cache__ = {};
318
+ /******/
319
+ /******/ // The require function
320
+ /******/ function __webpack_require__(moduleId) {
321
+ /******/ // Check if module is in cache
322
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
323
+ /******/ if (cachedModule !== undefined) {
324
+ /******/ return cachedModule.exports;
325
+ /******/ }
326
+ /******/ // Create a new module (and put it into the cache)
327
+ /******/ var module = __webpack_module_cache__[moduleId] = {
328
+ /******/ // no module.id needed
329
+ /******/ // no module.loaded needed
330
+ /******/ exports: {}
331
+ /******/ };
332
+ /******/
333
+ /******/ // Execute the module function
334
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
335
+ /******/
336
+ /******/ // Return the exports of the module
337
+ /******/ return module.exports;
338
+ /******/ }
339
+ /******/
340
+ /************************************************************************/
341
+ /******/ /* webpack/runtime/compat get default export */
342
+ /******/ (() => {
343
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
344
+ /******/ __webpack_require__.n = (module) => {
345
+ /******/ var getter = module && module.__esModule ?
346
+ /******/ () => (module['default']) :
347
+ /******/ () => (module);
348
+ /******/ __webpack_require__.d(getter, { a: getter });
349
+ /******/ return getter;
350
+ /******/ };
351
+ /******/ })();
352
+ /******/
353
+ /******/ /* webpack/runtime/define property getters */
354
+ /******/ (() => {
355
+ /******/ // define getter functions for harmony exports
356
+ /******/ __webpack_require__.d = (exports, definition) => {
357
+ /******/ for(var key in definition) {
358
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
359
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
360
+ /******/ }
361
+ /******/ }
362
+ /******/ };
363
+ /******/ })();
364
+ /******/
365
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
366
+ /******/ (() => {
367
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
368
+ /******/ })();
369
+ /******/
370
+ /******/ /* webpack/runtime/make namespace object */
371
+ /******/ (() => {
372
+ /******/ // define __esModule on exports
373
+ /******/ __webpack_require__.r = (exports) => {
374
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
375
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
376
+ /******/ }
377
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
378
+ /******/ };
379
+ /******/ })();
380
+ /******/
381
+ /************************************************************************/
382
+ var __webpack_exports__ = {};
383
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
384
+ (() => {
385
+ /*!******************************!*\
386
+ !*** ./src/client/index.jsx ***!
387
+ \******************************/
388
+ __webpack_require__.r(__webpack_exports__);
389
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
390
+ /* harmony export */ init: () => (/* binding */ init)
391
+ /* harmony export */ });
392
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
393
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
394
+ /* harmony import */ var react_dom_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom/client */ "react-dom/client");
395
+ /* harmony import */ var react_dom_client__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom_client__WEBPACK_IMPORTED_MODULE_1__);
396
+ /* harmony import */ var _components_availability_availability_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/availability/availability.jsx */ "./src/client/components/availability/availability.jsx");
397
+ /* harmony import */ var _lib_check_availability__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/check-availability */ "./src/client/lib/check-availability.js");
398
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
399
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || "" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
400
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
401
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
402
+
403
+
404
+
405
+
406
+ function init(_x, _x2) {
407
+ return _init.apply(this, arguments);
408
+ }
409
+ function _init() {
410
+ _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(container, options) {
411
+ var root, availability, result;
412
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
413
+ while (1) switch (_context.prev = _context.next) {
414
+ case 0:
415
+ root = (0,react_dom_client__WEBPACK_IMPORTED_MODULE_1__.createRoot)(container);
416
+ _context.prev = 1;
417
+ _context.next = 4;
418
+ return (0,_lib_check_availability__WEBPACK_IMPORTED_MODULE_3__.checkAvailability)(options.availabilityEndpoint);
419
+ case 4:
420
+ result = _context.sent;
421
+ availability = result.availability;
422
+ _context.next = 11;
423
+ break;
424
+ case 8:
425
+ _context.prev = 8;
426
+ _context.t0 = _context["catch"](1);
427
+ availability = 'UNAVAILABLE';
428
+ case 11:
429
+ root.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_availability_availability_jsx__WEBPACK_IMPORTED_MODULE_2__.Availability, {
430
+ availability: availability
431
+ }));
432
+ case 12:
433
+ case "end":
434
+ return _context.stop();
435
+ }
436
+ }, _callee, null, [[1, 8]]);
437
+ }));
438
+ return _init.apply(this, arguments);
439
+ }
440
+ })();
441
+
442
+ module.exports = __webpack_exports__;
443
+ /******/ })()
444
+ ;
445
+ //# sourceMappingURL=client.js.map