@tulipnpm/timekit_project_selector 1.0.6 → 1.0.7

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.
@@ -2197,7 +2197,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, "/* open-sans-cyrillic-ext-400-normal*/
2197
2197
 
2198
2198
  var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
2199
2199
  // Module
2200
- ___CSS_LOADER_EXPORT___.push([module.id, ".selector-card-container {\n display: flex;\n flex-flow: row wrap;\n justify-content: left;\n}\n\n.selector-card-container-image {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));\n}\n\n.project-card-container {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n margin: 8px 8px;\n justify-content: flex-start;\n}\n\n.card-container {\n width: 100%;\n border-radius: 8px;\n background-color: #FFFFFF;\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.05);\n margin-top: 10px;\n padding: 8px;\n display: flex;\n flex-direction: column;\n transition: 0.3s;\n}\n\n.card-container:hover {\n box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);\n cursor: pointer;\n}\n \n.card-container:hover .card-title {\n color: #214de6;\n}\n\n.card-container-image {\n flex-basis: 100%;\n background-color: #FFFFFF;\n border-radius: 8px;\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.05);\n margin: 5px;\n padding: 8px;\n display: flex;\n flex-direction: column;\n transition: 0.3s;\n}\n\n.card-container-image:hover {\n box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);\n cursor: pointer;\n}\n \n.card-container-image:hover .card-title {\n color: #214de6;\n}\n\n.card-container.hide {\n display: none;\n}\n\n.card-container-image.hide {\n display: none;\n}\n\n.card-title {\n margin-top: 8px;\n margin-right: auto;\n font-family: 'Open Sans';;\n font-size: 14px;\n font-weight: 600;\n text-rendering: geometricPrecision;\n font-stretch: normal;\n font-style: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n color: #14141a;\n}\n\n.card-body {\n margin-top: 8px;\n margin-right: auto;\n font-family: 'Open Sans';\n font-size: 14px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n color: #8e8e93;\n}\n\n.card-footer {\n margin-top: 8px;\n margin-bottom: 8px;\n font-family: 'Open Sans';\n font-size: 14px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n color: #8e8e93;\n}\n\n.card-image-container {\n height: auto;\n text-align: center;\n}\n\n.card-image {\n object-fit: cover;\n width: 100%;\n border-radius: 4px;\n background-color: #ebebee;\n overflow: hidden;\n}", ""]);
2200
+ ___CSS_LOADER_EXPORT___.push([module.id, ".selector-card-container {\n display: flex;\n flex-flow: row wrap;\n justify-content: left;\n}\n\n.selector-card-container-image {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));\n}\n\n.project-card-container {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n margin: 8px 8px;\n justify-content: flex-start;\n}\n\n.card-container {\n width: 100%;\n border-radius: 8px;\n background-color: #FFFFFF;\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.05);\n margin-top: 10px;\n padding: 8px;\n display: flex;\n flex-direction: column;\n transition: 0.3s;\n}\n\n.card-container:hover {\n box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);\n cursor: pointer;\n}\n \n.card-container:hover .card-title {\n color: #214de6;\n}\n\n.card-container-image {\n flex-basis: 100%;\n background-color: #FFFFFF;\n border-radius: 8px;\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.05);\n margin: 5px;\n padding: 8px;\n display: flex;\n flex-direction: column;\n transition: 0.3s;\n}\n\n.card-container-image:hover {\n box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);\n cursor: pointer;\n}\n \n.card-container-image:hover .card-title {\n color: #214de6;\n}\n\n.card-container.hide {\n display: none;\n}\n\n.card-container-image.hide {\n display: none;\n}\n\n.card-title {\n margin-top: 8px;\n margin-right: auto;\n font-family: 'Open Sans';;\n font-size: 14px;\n font-weight: 600;\n text-rendering: geometricPrecision;\n font-stretch: normal;\n font-style: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n color: #14141a;\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n}\n\n.card-title-distance {\n font-family: 'Open Sans';\n font-weight: 400;\n font-size: 12px;\n}\n\n.card-body {\n margin-top: 8px;\n margin-right: auto;\n font-family: 'Open Sans';\n font-size: 14px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n color: #8e8e93;\n}\n\n.card-footer {\n margin-top: 8px;\n margin-bottom: 8px;\n font-family: 'Open Sans';\n font-size: 14px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n color: #8e8e93;\n}\n\n.card-image-container {\n height: auto;\n text-align: center;\n}\n\n.card-image {\n object-fit: cover;\n width: 100%;\n border-radius: 4px;\n background-color: #ebebee;\n overflow: hidden;\n}", ""]);
2201
2201
  // Exports
2202
2202
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
2203
2203
 
@@ -2246,16 +2246,19 @@ ___CSS_LOADER_EXPORT___.push([module.id, ":root {\n --line-length: 60px;\n}\n
2246
2246
  /* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_1__);
2247
2247
  /* harmony import */ var _assets_icon_search_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7209);
2248
2248
  /* harmony import */ var _assets_icon_clear_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(802);
2249
+ /* harmony import */ var _assets_icon_geolocation_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2446);
2249
2250
  // Imports
2250
2251
 
2251
2252
 
2252
2253
 
2253
2254
 
2255
+
2254
2256
  var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
2255
2257
  var ___CSS_LOADER_URL_REPLACEMENT_0___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_1___default()(_assets_icon_search_svg__WEBPACK_IMPORTED_MODULE_2__/* .default */ .Z);
2256
2258
  var ___CSS_LOADER_URL_REPLACEMENT_1___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_1___default()(_assets_icon_clear_svg__WEBPACK_IMPORTED_MODULE_3__/* .default */ .Z);
2259
+ var ___CSS_LOADER_URL_REPLACEMENT_2___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_1___default()(_assets_icon_geolocation_svg__WEBPACK_IMPORTED_MODULE_4__/* .default */ .Z);
2257
2260
  // Module
2258
- ___CSS_LOADER_EXPORT___.push([module.id, ".search-bar-wrapper {\n position: relative;\n}\n\n.search-bar {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n margin-top: 4px;\n padding: 10px 30px 11px 8px;\n border-radius: 8px;\n border: none;\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.05);\n background-color: #ffffff;\n font-size: 14px;\n font-family: 'Open Sans';\n width: -webkit-fill-available;\n background: url(" + ___CSS_LOADER_URL_REPLACEMENT_0___ + ") no-repeat scroll 8px 12px;\n padding-left: 30px;\n transition: 0.3s;\n}\n\n.search-bar:hover {\n box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);\n}\n\n.search-bar-wrapper.hide {\n display: none;\n}\n\n.search-bar::placeholder {\n color: #c7c7cc;\n font-size: 14px;\n font-family: 'Open Sans';\n}\n\n.empty-results-wrapper {\n display: flex;\n margin-top: 48px;\n flex-direction: column;\n height: 100%;\n align-items: center;\n}\n\n.empty-results-image {\n background: url(" + ___CSS_LOADER_URL_REPLACEMENT_0___ + ") no-repeat;\n background-size: 24.5px 24.5px;\n width: 24.5px;\n height: 24.5px;\n}\n\n.empty-results-text {\n font-family: 'Open Sans';\n font-size: 14px;\n font-weight: 600;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n text-align: center;\n color: #c7c7cc;\n}\n\n.search-bar-clear {\n background: url(" + ___CSS_LOADER_URL_REPLACEMENT_1___ + ") no-repeat;\n background-size: 20px 20px;\n position: absolute;\n right: 0.5em;\n top: 0.9em;\n width: 20px;\n height: 20px;\n}\n\n.search-bar-clear:hover {\n cursor: pointer;\n}\n\n.search-bar-clear.hide {\n display: none;\n}", ""]);
2261
+ ___CSS_LOADER_EXPORT___.push([module.id, ".search-bar-wrapper {\n position: relative;\n}\n\n.search-bar {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n margin-top: 4px;\n padding: 10px 30px 11px 8px;\n border-radius: 8px;\n border: none;\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.05);\n background-color: #ffffff;\n font-size: 14px;\n font-family: 'Open Sans';\n width: -webkit-fill-available;\n background: url(" + ___CSS_LOADER_URL_REPLACEMENT_0___ + ") no-repeat scroll 8px 12px;\n padding-left: 30px;\n transition: 0.3s;\n}\n\n.search-bar:hover {\n box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);\n}\n\n.search-bar-wrapper.hide {\n display: none;\n}\n\n.search-bar::placeholder {\n color: #c7c7cc;\n font-size: 14px;\n font-family: 'Open Sans';\n}\n\n.empty-results-wrapper {\n display: flex;\n margin-top: 48px;\n flex-direction: column;\n height: 100%;\n align-items: center;\n}\n\n.empty-results-image {\n background: url(" + ___CSS_LOADER_URL_REPLACEMENT_0___ + ") no-repeat;\n background-size: 24.5px 24.5px;\n width: 24.5px;\n height: 24.5px;\n}\n\n.empty-results-text {\n font-family: 'Open Sans';\n font-size: 14px;\n font-weight: 600;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n text-align: center;\n color: #c7c7cc;\n}\n\n.search-bar-clear {\n background: url(" + ___CSS_LOADER_URL_REPLACEMENT_1___ + ") no-repeat;\n background-size: 20px 20px;\n position: absolute;\n right: 0.5em;\n top: 0.9em;\n width: 20px;\n height: 20px;\n}\n\n.search-bar-clear:hover {\n cursor: pointer;\n}\n\n.search-bar-clear.hide {\n display: none;\n}\n\n.search-bar-geolocation-button {\n position: absolute;\n width: 100%;\n padding: 12px 30px;\n left: 0px;\n top: 3.3em;\n text-align: left;\n box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);\n border: 0;\n border-radius: 3px;\n font-weight: 600;\n font-family: 'Open Sans';\n cursor: pointer;\n background: url(" + ___CSS_LOADER_URL_REPLACEMENT_2___ + ") no-repeat scroll 6px 6px, #FFFFFF;\n}\n\n.search-bar-geolocation-button:hover {\n color: #214DE6\n}\n\n#show-more-cards-text {\n cursor: pointer;\n color: #214DE6;\n font-weight: bold;\n font-size: 14px;\n font-family: 'Open Sans';\n line-height: 21px;\n margin: 40px 0;\n}", ""]);
2259
2262
  // Exports
2260
2263
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
2261
2264
 
@@ -2537,6 +2540,17 @@ module.exports = function (url, options) {
2537
2540
 
2538
2541
  /***/ }),
2539
2542
 
2543
+ /***/ 2446:
2544
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2545
+
2546
+ "use strict";
2547
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2548
+ /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
2549
+ /* harmony export */ });
2550
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + "229ef5cc3f6050f3239dc04035170b4d.svg");
2551
+
2552
+ /***/ }),
2553
+
2540
2554
  /***/ 7209:
2541
2555
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2542
2556
 
@@ -21434,12 +21448,13 @@ var StepOptions = /*#__PURE__*/function () {
21434
21448
  createClass_default()(StepOptions, [{
21435
21449
  key: "init",
21436
21450
  value: function init() {
21437
- var _options$title, _options$description, _options$search_bar;
21451
+ var _options$title, _options$description, _options$search_bar, _options$geo_search_b;
21438
21452
 
21439
21453
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21440
21454
  this.title = (_options$title = options['title']) !== null && _options$title !== void 0 ? _options$title : '';
21441
21455
  this.description = (_options$description = options['description']) !== null && _options$description !== void 0 ? _options$description : '';
21442
21456
  this.searchBar = (_options$search_bar = options['search_bar']) !== null && _options$search_bar !== void 0 ? _options$search_bar : undefined;
21457
+ this.geoSearchBar = (_options$geo_search_b = options['geo_search_bar']) !== null && _options$geo_search_b !== void 0 ? _options$geo_search_b : undefined;
21443
21458
  }
21444
21459
  }]);
21445
21460
 
@@ -22062,11 +22077,507 @@ var SearchBar = /*#__PURE__*/function () {
22062
22077
  }();
22063
22078
 
22064
22079
 
22080
+ ;// CONCATENATED MODULE: ./src/ui/location.js
22081
+
22082
+
22083
+
22084
+
22085
+
22086
+ var Location = /*#__PURE__*/function () {
22087
+ function Location() {
22088
+ var latitude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
22089
+ var longitude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
22090
+
22091
+ classCallCheck_default()(this, Location);
22092
+
22093
+ this.latitude = latitude;
22094
+ this.longitude = longitude;
22095
+ }
22096
+
22097
+ createClass_default()(Location, [{
22098
+ key: "setup",
22099
+ value: function () {
22100
+ var _setup = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee2() {
22101
+ var _this = this;
22102
+
22103
+ return regenerator_default().wrap(function _callee2$(_context2) {
22104
+ while (1) {
22105
+ switch (_context2.prev = _context2.next) {
22106
+ case 0:
22107
+ _context2.next = 2;
22108
+ return new Promise( /*#__PURE__*/function () {
22109
+ var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee(resolve) {
22110
+ var options;
22111
+ return regenerator_default().wrap(function _callee$(_context) {
22112
+ while (1) {
22113
+ switch (_context.prev = _context.next) {
22114
+ case 0:
22115
+ if (!_this.isLocationSet()) {
22116
+ _context.next = 2;
22117
+ break;
22118
+ }
22119
+
22120
+ return _context.abrupt("return", resolve(_this.get()));
22121
+
22122
+ case 2:
22123
+ options = {
22124
+ enableHighAccuracy: false,
22125
+ timeout: 5000,
22126
+ maximumAge: 600000 // Keep cached data for 10 mins
22127
+
22128
+ };
22129
+ _context.next = 5;
22130
+ return window.navigator.geolocation.getCurrentPosition(function (position) {
22131
+ var location = {
22132
+ latitude: position.coords.latitude,
22133
+ longitude: position.coords.longitude,
22134
+ accuracy: position.coords.accuracy,
22135
+ timestamp: position.timestamp
22136
+ };
22137
+ _this.latitude = location.latitude;
22138
+ _this.longitude = location.longitude;
22139
+ return resolve(_this.get());
22140
+ }, function () {
22141
+ _this.latitude = null;
22142
+ _this.longitude = null;
22143
+ return resolve(_this.get());
22144
+ }, options);
22145
+
22146
+ case 5:
22147
+ return _context.abrupt("return", _context.sent);
22148
+
22149
+ case 6:
22150
+ case "end":
22151
+ return _context.stop();
22152
+ }
22153
+ }
22154
+ }, _callee);
22155
+ }));
22156
+
22157
+ return function (_x) {
22158
+ return _ref.apply(this, arguments);
22159
+ };
22160
+ }());
22161
+
22162
+ case 2:
22163
+ return _context2.abrupt("return", _context2.sent);
22164
+
22165
+ case 3:
22166
+ case "end":
22167
+ return _context2.stop();
22168
+ }
22169
+ }
22170
+ }, _callee2);
22171
+ }));
22172
+
22173
+ function setup() {
22174
+ return _setup.apply(this, arguments);
22175
+ }
22176
+
22177
+ return setup;
22178
+ }()
22179
+ }, {
22180
+ key: "get",
22181
+ value: function get() {
22182
+ return {
22183
+ latitude: this.latitude,
22184
+ longitude: this.longitude
22185
+ };
22186
+ }
22187
+ }, {
22188
+ key: "isLocationSet",
22189
+ value: function isLocationSet() {
22190
+ return this.latitude !== null && this.longitude !== null;
22191
+ }
22192
+ }, {
22193
+ key: "asyncGetBrowserLocation",
22194
+ value: function () {
22195
+ var _asyncGetBrowserLocation = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee3() {
22196
+ return regenerator_default().wrap(function _callee3$(_context3) {
22197
+ while (1) {
22198
+ switch (_context3.prev = _context3.next) {
22199
+ case 0:
22200
+ _context3.next = 2;
22201
+ return this.setup();
22202
+
22203
+ case 2:
22204
+ return _context3.abrupt("return", _context3.sent);
22205
+
22206
+ case 3:
22207
+ case "end":
22208
+ return _context3.stop();
22209
+ }
22210
+ }
22211
+ }, _callee3, this);
22212
+ }));
22213
+
22214
+ function asyncGetBrowserLocation() {
22215
+ return _asyncGetBrowserLocation.apply(this, arguments);
22216
+ }
22217
+
22218
+ return asyncGetBrowserLocation;
22219
+ }()
22220
+ }, {
22221
+ key: "degreesToRadians",
22222
+ value: function degreesToRadians(degrees) {
22223
+ return degrees * Math.PI / 180;
22224
+ }
22225
+ }, {
22226
+ key: "getDistanceInKmBetweenEarthCoordinates",
22227
+ value: function getDistanceInKmBetweenEarthCoordinates(latitude, longitude) {
22228
+ var earthRadiusKm = 6371;
22229
+ var destLatitudeInRadians = this.degreesToRadians(this.latitude - latitude);
22230
+ var destLongitudeInRadians = this.degreesToRadians(this.longitude - longitude);
22231
+ latitude = this.degreesToRadians(latitude);
22232
+ var latitudeInRadiants = this.degreesToRadians(this.latitude);
22233
+ var a = Math.sin(destLatitudeInRadians / 2) * Math.sin(destLatitudeInRadians / 2) + Math.sin(destLongitudeInRadians / 2) * Math.sin(destLongitudeInRadians / 2) * Math.cos(latitude) * Math.cos(latitudeInRadiants);
22234
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
22235
+ return parseFloat((earthRadiusKm * c).toFixed(1));
22236
+ }
22237
+ }]);
22238
+
22239
+ return Location;
22240
+ }();
22241
+
22242
+
22243
+ // EXTERNAL MODULE: ./node_modules/lodash/lodash.js
22244
+ var lodash = __webpack_require__(6486);
22245
+ var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);
22246
+ ;// CONCATENATED MODULE: ./src/ui/helpers.js
22247
+
22248
+
22249
+ var doesIdExist = function doesIdExist(id) {
22250
+ return document.getElementById(id) !== null;
22251
+ };
22252
+ var getKeyValue = function getKeyValue(option, project) {
22253
+ if (typeof option === 'undefined') {
22254
+ return null;
22255
+ }
22256
+
22257
+ if (option.includes('{{') && option.includes('}}')) {
22258
+ var result = option;
22259
+
22260
+ toConsumableArray_default()(option.matchAll(/{{(.*?)}}/mg)).forEach(function (match) {
22261
+ result = result.replace(match[0], getValueForReplacementTerm(match[1], project));
22262
+ });
22263
+
22264
+ ;
22265
+ return result;
22266
+ }
22267
+
22268
+ return getValueForReplacementTerm(option, project);
22269
+ };
22270
+
22271
+ var getValueForReplacementTerm = function getValueForReplacementTerm(option, project) {
22272
+ if (option.startsWith('[meta]')) {
22273
+ return lodash_default().get(project, "meta.".concat(option.substring(6))) || '';
22274
+ }
22275
+
22276
+ if (option.startsWith('[project]')) {
22277
+ return lodash_default().get(project, option.substring(9)) || '';
22278
+ }
22279
+
22280
+ return option;
22281
+ };
22282
+ ;// CONCATENATED MODULE: ./src/ui/geosearchbar.js
22283
+
22284
+
22285
+
22286
+ function geosearchbar_createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = geosearchbar_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 = o[Symbol.iterator](); }, 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; } } }; }
22287
+
22288
+ function geosearchbar_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return geosearchbar_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 geosearchbar_arrayLikeToArray(o, minLen); }
22289
+
22290
+ function geosearchbar_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; }
22291
+
22292
+
22293
+
22294
+
22295
+
22296
+ var GeoSearchBar = /*#__PURE__*/function () {
22297
+ function GeoSearchBar() {
22298
+ classCallCheck_default()(this, GeoSearchBar);
22299
+
22300
+ this.searchBarContent = this.createSearchbar();
22301
+ this.searchBarInput = this.searchBarContent.children[0];
22302
+ this.closeButton = this.searchBarContent.children[1];
22303
+ this.geoLocationButton = this.searchBarContent.children[2];
22304
+ this.showCloseButton(false);
22305
+ this.showGeolocationButton(false);
22306
+ this.stores = [];
22307
+ this.options = [];
22308
+ this.cardsKey = '';
22309
+ this.addCard = null;
22310
+ this.location = new Location();
22311
+ }
22312
+
22313
+ createClass_default()(GeoSearchBar, [{
22314
+ key: "createSearchbar",
22315
+ value: function createSearchbar() {
22316
+ var _this = this;
22317
+
22318
+ var searchBarWrapper = document.createElement('div');
22319
+ searchBarWrapper.className = 'search-bar-wrapper';
22320
+ searchBarWrapper.id = 'geo-search-bar-wrapper';
22321
+ var geoSearchBar = document.createElement('input');
22322
+ geoSearchBar.className = 'search-bar';
22323
+ geoSearchBar.id = 'geo-search-bar';
22324
+ geoSearchBar.setAttribute('type', 'text');
22325
+ geoSearchBar.setAttribute('autocomplete', 'off');
22326
+
22327
+ geoSearchBar.oninput = function () {
22328
+ _this.showGeolocationButton(false);
22329
+
22330
+ var userInput = document.getElementById('geo-search-bar').value;
22331
+
22332
+ if (userInput.length >= 3) {
22333
+ _this.showCloseButton(true);
22334
+
22335
+ var searchTerm = new RegExp(userInput, 'i');
22336
+
22337
+ var storesCopy = _this.stores.filter(function (store) {
22338
+ return lodash_default().get(store, 'name').search(searchTerm) !== -1 || lodash_default().get(store, 'meta.t_store_city').search(searchTerm) !== -1 || lodash_default().get(store, 'meta.t_store_country_name').search(searchTerm) !== -1 || lodash_default().get(store, 'meta.t_store_postal_code').search(searchTerm) !== -1;
22339
+ });
22340
+
22341
+ document.getElementById('timekit-selector-card-container').innerHTML = '';
22342
+
22343
+ if (storesCopy.length !== 0) {
22344
+ _this.emptySearchState(false);
22345
+
22346
+ _this.updateContent(storesCopy);
22347
+ } else {
22348
+ _this.emptySearchState(true);
22349
+ }
22350
+ } else {
22351
+ _this.clearCardContainer();
22352
+ }
22353
+ };
22354
+
22355
+ geoSearchBar.onfocus = function () {
22356
+ _this.showGeolocationButton(true);
22357
+ };
22358
+
22359
+ geoSearchBar.addEventListener("focusout", function (event) {
22360
+ if (event.relatedTarget != null && event.relatedTarget.tagName == 'BUTTON') return;
22361
+
22362
+ _this.showGeolocationButton(false);
22363
+ });
22364
+ var geoLocationButton = document.createElement('button');
22365
+ geoLocationButton.innerHTML = "Use my current location";
22366
+ geoLocationButton.className = 'search-bar-geolocation-button'; // Click action
22367
+
22368
+ geoLocationButton.onclick = function () {
22369
+ _this.showGeolocationButton(false);
22370
+
22371
+ _this.location.setup().then(function () {
22372
+ _this.setDistanceInStores();
22373
+
22374
+ _this.stores.sort(function (prev, next) {
22375
+ return prev.distance - next.distance;
22376
+ });
22377
+
22378
+ document.getElementById('timekit-selector-card-container').innerHTML = '';
22379
+
22380
+ _this.updateContent(_this.stores);
22381
+ });
22382
+ };
22383
+
22384
+ var clearButton = document.createElement('i');
22385
+ clearButton.className = 'search-bar-clear';
22386
+ clearButton.id = 'geo-search-bar-clear';
22387
+
22388
+ clearButton.onclick = function () {
22389
+ _this.clearInput();
22390
+ };
22391
+
22392
+ searchBarWrapper.appendChild(geoSearchBar);
22393
+ searchBarWrapper.appendChild(clearButton);
22394
+ searchBarWrapper.appendChild(geoLocationButton, geoSearchBar.nextSibling);
22395
+ return searchBarWrapper;
22396
+ }
22397
+ }, {
22398
+ key: "clearInput",
22399
+ value: function clearInput() {
22400
+ document.getElementById('geo-search-bar').value = '';
22401
+ this.clearCardContainer();
22402
+ }
22403
+ }, {
22404
+ key: "clearCardContainer",
22405
+ value: function clearCardContainer() {
22406
+ document.getElementById('timekit-selector-card-container').innerHTML = '';
22407
+ this.emptySearchState(false);
22408
+ this.showCloseButton(false);
22409
+ }
22410
+ }, {
22411
+ key: "emptySearchState",
22412
+ value: function emptySearchState(showEmptyState) {
22413
+ var doesEmptyStateExist = document.getElementById('empty-results-wrapper') === null;
22414
+
22415
+ if (showEmptyState && doesEmptyStateExist) {
22416
+ // Create divs that tell the user that no results were found when searching
22417
+ var body = document.getElementById('body-container-scrollable');
22418
+ var emptyResultsDiv = document.createElement('div');
22419
+ emptyResultsDiv.className = 'empty-results-wrapper';
22420
+ emptyResultsDiv.id = 'empty-results-wrapper';
22421
+ var searchImage = document.createElement('i');
22422
+ searchImage.className = 'empty-results-image';
22423
+ var searchText = document.createElement('div');
22424
+ searchText.className = 'empty-results-text';
22425
+ searchText.innerHTML = 'No results found';
22426
+ emptyResultsDiv.appendChild(searchImage);
22427
+ emptyResultsDiv.appendChild(searchText);
22428
+ body.appendChild(emptyResultsDiv);
22429
+ } else if (!showEmptyState && !doesEmptyStateExist) {
22430
+ document.getElementById('empty-results-wrapper').remove();
22431
+ }
22432
+ }
22433
+ }, {
22434
+ key: "setSearchBarPlaceholder",
22435
+ value: function setSearchBarPlaceholder(placeholderText) {
22436
+ this.searchBarInput.setAttribute('placeholder', placeholderText);
22437
+ }
22438
+ }, {
22439
+ key: "showSearchBar",
22440
+ value: function showSearchBar() {
22441
+ var isSearchBarVisible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
22442
+
22443
+ if (!isSearchBarVisible) {
22444
+ this.searchBarContent.classList.add('hide');
22445
+ } else {
22446
+ this.searchBarContent.classList.remove('hide');
22447
+ }
22448
+ }
22449
+ }, {
22450
+ key: "showCloseButton",
22451
+ value: function showCloseButton() {
22452
+ var isCloseButtonActive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
22453
+
22454
+ if (!isCloseButtonActive) {
22455
+ this.closeButton.classList.add('hide');
22456
+ } else {
22457
+ this.closeButton.classList.remove('hide');
22458
+ }
22459
+ }
22460
+ }, {
22461
+ key: "showGeolocationButton",
22462
+ value: function showGeolocationButton() {
22463
+ var show = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
22464
+
22465
+ if (show) {
22466
+ this.geoLocationButton.classList.remove('hide');
22467
+ } else {
22468
+ this.geoLocationButton.classList.add('hide');
22469
+ }
22470
+ }
22471
+ }, {
22472
+ key: "setStores",
22473
+ value: function setStores(stores) {
22474
+ this.stores = stores;
22475
+ }
22476
+ }, {
22477
+ key: "setDistanceInStores",
22478
+ value: function setDistanceInStores() {
22479
+ var _this2 = this;
22480
+
22481
+ this.stores.forEach(function (projectData, index) {
22482
+ _this2.stores[index]['distance'] = _this2.getDistance(projectData);
22483
+ });
22484
+ }
22485
+ }, {
22486
+ key: "setOptions",
22487
+ value: function setOptions(options) {
22488
+ this.options = options;
22489
+ }
22490
+ }, {
22491
+ key: "setCardsKey",
22492
+ value: function setCardsKey(key) {
22493
+ this.cardsKey = key;
22494
+ }
22495
+ }, {
22496
+ key: "getDistance",
22497
+ value: function getDistance(project) {
22498
+ var longitude = lodash_default().get(project, 'meta.t_longitude') || 0;
22499
+ var latitude = lodash_default().get(project, 'meta.t_latitude') || 0;
22500
+ return this.location.getDistanceInKmBetweenEarthCoordinates(latitude, longitude);
22501
+ }
22502
+ }, {
22503
+ key: "setAddCardAction",
22504
+ value: function setAddCardAction(handler) {
22505
+ this.addCard = handler;
22506
+ }
22507
+ }, {
22508
+ key: "appendShowMoreCardsText",
22509
+ value: function appendShowMoreCardsText(onClick) {
22510
+ if (document.getElementById("show-more-cards-text")) {
22511
+ document.getElementById("show-more-cards-text").remove();
22512
+ }
22513
+
22514
+ var showMoreCardsText = document.createElement('a');
22515
+ showMoreCardsText.id = 'show-more-cards-text';
22516
+ showMoreCardsText.innerText = 'Show more';
22517
+ showMoreCardsText.onclick = onClick;
22518
+ document.getElementById('timekit-selector-card-container').append(showMoreCardsText);
22519
+ }
22520
+ }, {
22521
+ key: "updateContent",
22522
+ value: function updateContent(stores) {
22523
+ var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
22524
+ var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
22525
+ var index = 0;
22526
+
22527
+ var _iterator = geosearchbar_createForOfIteratorHelper(stores),
22528
+ _step;
22529
+
22530
+ try {
22531
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
22532
+ var projectData = _step.value;
22533
+
22534
+ if (index >= from + limit) {
22535
+ var onClick = function onClick() {
22536
+ this.updateContent(stores, from + limit);
22537
+ };
22538
+
22539
+ this.appendShowMoreCardsText(onClick.bind(this));
22540
+ return;
22541
+ }
22542
+
22543
+ if (index >= from) {
22544
+ var cardTitle = getKeyValue(this.options['cardTitle'], projectData);
22545
+ var cardBody = getKeyValue(this.options['cardBody'], projectData);
22546
+ var cardFooter = getKeyValue(this.options['cardFooter'], projectData);
22547
+ var cardImage = getKeyValue(this.options['cardImage'], projectData);
22548
+ var overriddenCardTitle = null;
22549
+
22550
+ if ('distance' in projectData) {
22551
+ overriddenCardTitle = "<div>".concat(cardTitle, "</div><div class=\"card-title-distance\">").concat(projectData['distance'], " km</div>");
22552
+ }
22553
+
22554
+ this.addCard(this.cardsKey, projectData.id, cardTitle, cardBody, cardFooter, cardImage, overriddenCardTitle);
22555
+ }
22556
+
22557
+ index++;
22558
+ }
22559
+ } catch (err) {
22560
+ _iterator.e(err);
22561
+ } finally {
22562
+ _iterator.f();
22563
+ }
22564
+
22565
+ if (index >= stores.length && document.getElementById("show-more-cards-text")) {
22566
+ document.getElementById("show-more-cards-text").remove();
22567
+ }
22568
+ }
22569
+ }]);
22570
+
22571
+ return GeoSearchBar;
22572
+ }();
22573
+
22574
+
22065
22575
  ;// CONCATENATED MODULE: ./src/ui/navigator.js
22066
22576
 
22067
22577
 
22068
22578
 
22069
22579
 
22580
+
22070
22581
  var Navigator = /*#__PURE__*/function () {
22071
22582
  function Navigator() {
22072
22583
  var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
@@ -22078,6 +22589,7 @@ var Navigator = /*#__PURE__*/function () {
22078
22589
  this.count = count;
22079
22590
  this.widthOfPanel = width;
22080
22591
  this.searchBar;
22592
+ this.geoSearchBar;
22081
22593
  }
22082
22594
 
22083
22595
  createClass_default()(Navigator, [{
@@ -22154,9 +22666,11 @@ var Navigator = /*#__PURE__*/function () {
22154
22666
  description.className = 'timekit-navigation-description';
22155
22667
  description.id = 'timekit-navigation-description';
22156
22668
  this.searchBar = new SearchBar();
22669
+ this.geoSearchBar = new GeoSearchBar();
22157
22670
  headerWrapper.appendChild(title);
22158
22671
  headerWrapper.appendChild(description);
22159
22672
  headerWrapper.appendChild(this.searchBar.searchBarContent);
22673
+ headerWrapper.appendChild(this.geoSearchBar.searchBarContent);
22160
22674
  var bodyContainerScrollable = document.createElement('div');
22161
22675
  bodyContainerScrollable.className = 'body-container-scrollable';
22162
22676
  bodyContainerScrollable.id = 'body-container-scrollable';
@@ -22263,45 +22777,6 @@ var Navigator = /*#__PURE__*/function () {
22263
22777
  }();
22264
22778
 
22265
22779
 
22266
- // EXTERNAL MODULE: ./node_modules/lodash/lodash.js
22267
- var lodash = __webpack_require__(6486);
22268
- var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);
22269
- ;// CONCATENATED MODULE: ./src/ui/helpers.js
22270
-
22271
-
22272
- var doesIdExist = function doesIdExist(id) {
22273
- return document.getElementById(id) !== null;
22274
- };
22275
- var getKeyValue = function getKeyValue(option, project) {
22276
- if (typeof option === 'undefined') {
22277
- return null;
22278
- }
22279
-
22280
- if (option.includes('{{') && option.includes('}}')) {
22281
- var result = option;
22282
-
22283
- toConsumableArray_default()(option.matchAll(/{{(.*?)}}/mg)).forEach(function (match) {
22284
- result = result.replace(match[0], getValueForReplacementTerm(match[1], project));
22285
- });
22286
-
22287
- ;
22288
- return result;
22289
- }
22290
-
22291
- return getValueForReplacementTerm(option, project);
22292
- };
22293
-
22294
- var getValueForReplacementTerm = function getValueForReplacementTerm(option, project) {
22295
- if (option.startsWith('[meta]')) {
22296
- return lodash_default().get(project, "meta.".concat(option.substring(6))) || '';
22297
- }
22298
-
22299
- if (option.startsWith('[project]')) {
22300
- return lodash_default().get(project, option.substring(9)) || '';
22301
- }
22302
-
22303
- return option;
22304
- };
22305
22780
  ;// CONCATENATED MODULE: ./src/ui/ui.js
22306
22781
 
22307
22782
 
@@ -22428,6 +22903,7 @@ var UI = /*#__PURE__*/function () {
22428
22903
  this.navigator.setDescription('Please select an appointment time and fill out the booking form.'); // And this too
22429
22904
 
22430
22905
  this.navigator.searchBar.showSearchBar(false);
22906
+ this.navigator.geoSearchBar.showSearchBar(false);
22431
22907
  bookingJSWrapper.appendChild(bookingJSContainer);
22432
22908
  container.appendChild(bookingJSWrapper);
22433
22909
 
@@ -22466,14 +22942,19 @@ var UI = /*#__PURE__*/function () {
22466
22942
  key = 'id';
22467
22943
  }
22468
22944
 
22469
- projects.forEach(function (projectData) {
22470
- var cardTitle = getKeyValue(dataOptions['cardTitle'], projectData);
22471
- var cardBody = getKeyValue(dataOptions['cardBody'], projectData);
22472
- var cardFooter = getKeyValue(dataOptions['cardFooter'], projectData);
22473
- var cardImage = getKeyValue(dataOptions['cardImage'], projectData);
22945
+ this.setupGeoSearchBar(options, dataOptions, projects, key);
22946
+
22947
+ if (!('geoSearchBar' in options) || options['geoSearchBar'] === undefined) {
22948
+ projects.forEach(function (projectData) {
22949
+ var cardTitle = getKeyValue(dataOptions['cardTitle'], projectData);
22950
+ var cardBody = getKeyValue(dataOptions['cardBody'], projectData);
22951
+ var cardFooter = getKeyValue(dataOptions['cardFooter'], projectData);
22952
+ var cardImage = getKeyValue(dataOptions['cardImage'], projectData);
22953
+
22954
+ _this2.addCardDefault(key, projectData.id, cardTitle, cardBody, cardFooter, cardImage);
22955
+ });
22956
+ }
22474
22957
 
22475
- _this2.addCardDefault(key, projectData.id, cardTitle, cardBody, cardFooter, cardImage);
22476
- });
22477
22958
  this.hideBackButtonIfFirstPage();
22478
22959
  }
22479
22960
  }, {
@@ -22515,6 +22996,7 @@ var UI = /*#__PURE__*/function () {
22515
22996
  var body = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
22516
22997
  var footer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
22517
22998
  var image = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
22999
+ var titleOverride = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
22518
23000
  // Build a card
22519
23001
  var card = document.createElement('div');
22520
23002
  card.id = "".concat(key, "-card-").concat(value);
@@ -22536,7 +23018,7 @@ var UI = /*#__PURE__*/function () {
22536
23018
  card.className = 'card-container';
22537
23019
  var titleDiv = document.createElement('div');
22538
23020
  titleDiv.className = 'card-title';
22539
- titleDiv.innerHTML = title;
23021
+ titleDiv.innerHTML = titleOverride !== null && titleOverride !== void 0 ? titleOverride : title;
22540
23022
  var bodyDiv = document.createElement('div');
22541
23023
  bodyDiv.className = 'card-body';
22542
23024
  bodyDiv.innerHTML = body;
@@ -22618,6 +23100,22 @@ var UI = /*#__PURE__*/function () {
22618
23100
  this.navigator.searchBar.showSearchBar(false);
22619
23101
  }
22620
23102
  }
23103
+ }, {
23104
+ key: "setupGeoSearchBar",
23105
+ value: function setupGeoSearchBar(options, dataOptions, stores, key) {
23106
+ if (typeof options['geoSearchBar'] === 'undefined') {
23107
+ this.navigator.geoSearchBar.showSearchBar(false);
23108
+ return;
23109
+ } else {
23110
+ 'placeholder' in options['geoSearchBar'] ? this.navigator.geoSearchBar.setSearchBarPlaceholder(options['geoSearchBar']['placeholder']) : this.navigator.geoSearchBar.setSearchBarPlaceholder('Please enter your search term');
23111
+ this.navigator.geoSearchBar.clearInput();
23112
+ this.navigator.geoSearchBar.setStores(stores);
23113
+ this.navigator.geoSearchBar.setOptions(dataOptions);
23114
+ this.navigator.geoSearchBar.setCardsKey(key);
23115
+ this.navigator.geoSearchBar.showSearchBar(true);
23116
+ this.navigator.geoSearchBar.setAddCardAction(this.addCardDefault.bind(this));
23117
+ }
23118
+ }
22621
23119
  }]);
22622
23120
 
22623
23121
  return UI;