@tulipnpm/timekit_project_selector 1.0.6 → 1.0.9-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
 
@@ -21235,10 +21249,13 @@ var TimekitApiClient = /*#__PURE__*/function () {
21235
21249
  var _getProjectsByMetaQuery = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee8(query) {
21236
21250
  var _this = this;
21237
21251
 
21252
+ var limit,
21253
+ _args8 = arguments;
21238
21254
  return regenerator_default().wrap(function _callee8$(_context8) {
21239
21255
  while (1) {
21240
21256
  switch (_context8.prev = _context8.next) {
21241
21257
  case 0:
21258
+ limit = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : 100;
21242
21259
  return _context8.abrupt("return", this.timeKitPaginate( /*#__PURE__*/function () {
21243
21260
  var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee7(page) {
21244
21261
  return regenerator_default().wrap(function _callee7$(_context7) {
@@ -21246,7 +21263,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21246
21263
  switch (_context7.prev = _context7.next) {
21247
21264
  case 0:
21248
21265
  _context7.next = 2;
21249
- return _this.getProjects("search=".concat(query, "&page=").concat(page));
21266
+ return _this.getProjects("search=".concat(query, "&limit=").concat(limit, "&page=").concat(page));
21250
21267
 
21251
21268
  case 2:
21252
21269
  return _context7.abrupt("return", _context7.sent);
@@ -21264,7 +21281,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21264
21281
  };
21265
21282
  }()));
21266
21283
 
21267
- case 1:
21284
+ case 2:
21268
21285
  case "end":
21269
21286
  return _context8.stop();
21270
21287
  }
@@ -21284,10 +21301,13 @@ var TimekitApiClient = /*#__PURE__*/function () {
21284
21301
  var _getProjectsByMetaValue = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee10(key, value) {
21285
21302
  var _this2 = this;
21286
21303
 
21304
+ var limit,
21305
+ _args10 = arguments;
21287
21306
  return regenerator_default().wrap(function _callee10$(_context10) {
21288
21307
  while (1) {
21289
21308
  switch (_context10.prev = _context10.next) {
21290
21309
  case 0:
21310
+ limit = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : 100;
21291
21311
  return _context10.abrupt("return", this.timeKitPaginate( /*#__PURE__*/function () {
21292
21312
  var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee9(page) {
21293
21313
  return regenerator_default().wrap(function _callee9$(_context9) {
@@ -21295,7 +21315,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21295
21315
  switch (_context9.prev = _context9.next) {
21296
21316
  case 0:
21297
21317
  _context9.next = 2;
21298
- return _this2.getProjects("search=meta.".concat(key, ":").concat(value, "&page=").concat(page));
21318
+ return _this2.getProjects("search=meta.".concat(key, ":").concat(value, "&limit=").concat(limit, "&page=").concat(page));
21299
21319
 
21300
21320
  case 2:
21301
21321
  return _context9.abrupt("return", _context9.sent);
@@ -21313,7 +21333,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21313
21333
  };
21314
21334
  }()));
21315
21335
 
21316
- case 1:
21336
+ case 2:
21317
21337
  case "end":
21318
21338
  return _context10.stop();
21319
21339
  }
@@ -21434,12 +21454,13 @@ var StepOptions = /*#__PURE__*/function () {
21434
21454
  createClass_default()(StepOptions, [{
21435
21455
  key: "init",
21436
21456
  value: function init() {
21437
- var _options$title, _options$description, _options$search_bar;
21457
+ var _options$title, _options$description, _options$search_bar, _options$geo_search_b;
21438
21458
 
21439
21459
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21440
21460
  this.title = (_options$title = options['title']) !== null && _options$title !== void 0 ? _options$title : '';
21441
21461
  this.description = (_options$description = options['description']) !== null && _options$description !== void 0 ? _options$description : '';
21442
21462
  this.searchBar = (_options$search_bar = options['search_bar']) !== null && _options$search_bar !== void 0 ? _options$search_bar : undefined;
21463
+ this.geoSearchBar = (_options$geo_search_b = options['geo_search_bar']) !== null && _options$geo_search_b !== void 0 ? _options$geo_search_b : undefined;
21443
21464
  }
21444
21465
  }]);
21445
21466
 
@@ -22062,11 +22083,507 @@ var SearchBar = /*#__PURE__*/function () {
22062
22083
  }();
22063
22084
 
22064
22085
 
22086
+ ;// CONCATENATED MODULE: ./src/ui/location.js
22087
+
22088
+
22089
+
22090
+
22091
+
22092
+ var Location = /*#__PURE__*/function () {
22093
+ function Location() {
22094
+ var latitude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
22095
+ var longitude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
22096
+
22097
+ classCallCheck_default()(this, Location);
22098
+
22099
+ this.latitude = latitude;
22100
+ this.longitude = longitude;
22101
+ }
22102
+
22103
+ createClass_default()(Location, [{
22104
+ key: "setup",
22105
+ value: function () {
22106
+ var _setup = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee2() {
22107
+ var _this = this;
22108
+
22109
+ return regenerator_default().wrap(function _callee2$(_context2) {
22110
+ while (1) {
22111
+ switch (_context2.prev = _context2.next) {
22112
+ case 0:
22113
+ _context2.next = 2;
22114
+ return new Promise( /*#__PURE__*/function () {
22115
+ var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee(resolve) {
22116
+ var options;
22117
+ return regenerator_default().wrap(function _callee$(_context) {
22118
+ while (1) {
22119
+ switch (_context.prev = _context.next) {
22120
+ case 0:
22121
+ if (!_this.isLocationSet()) {
22122
+ _context.next = 2;
22123
+ break;
22124
+ }
22125
+
22126
+ return _context.abrupt("return", resolve(_this.get()));
22127
+
22128
+ case 2:
22129
+ options = {
22130
+ enableHighAccuracy: false,
22131
+ timeout: 5000,
22132
+ maximumAge: 600000 // Keep cached data for 10 mins
22133
+
22134
+ };
22135
+ _context.next = 5;
22136
+ return window.navigator.geolocation.getCurrentPosition(function (position) {
22137
+ var location = {
22138
+ latitude: position.coords.latitude,
22139
+ longitude: position.coords.longitude,
22140
+ accuracy: position.coords.accuracy,
22141
+ timestamp: position.timestamp
22142
+ };
22143
+ _this.latitude = location.latitude;
22144
+ _this.longitude = location.longitude;
22145
+ return resolve(_this.get());
22146
+ }, function () {
22147
+ _this.latitude = null;
22148
+ _this.longitude = null;
22149
+ return resolve(_this.get());
22150
+ }, options);
22151
+
22152
+ case 5:
22153
+ return _context.abrupt("return", _context.sent);
22154
+
22155
+ case 6:
22156
+ case "end":
22157
+ return _context.stop();
22158
+ }
22159
+ }
22160
+ }, _callee);
22161
+ }));
22162
+
22163
+ return function (_x) {
22164
+ return _ref.apply(this, arguments);
22165
+ };
22166
+ }());
22167
+
22168
+ case 2:
22169
+ return _context2.abrupt("return", _context2.sent);
22170
+
22171
+ case 3:
22172
+ case "end":
22173
+ return _context2.stop();
22174
+ }
22175
+ }
22176
+ }, _callee2);
22177
+ }));
22178
+
22179
+ function setup() {
22180
+ return _setup.apply(this, arguments);
22181
+ }
22182
+
22183
+ return setup;
22184
+ }()
22185
+ }, {
22186
+ key: "get",
22187
+ value: function get() {
22188
+ return {
22189
+ latitude: this.latitude,
22190
+ longitude: this.longitude
22191
+ };
22192
+ }
22193
+ }, {
22194
+ key: "isLocationSet",
22195
+ value: function isLocationSet() {
22196
+ return this.latitude !== null && this.longitude !== null;
22197
+ }
22198
+ }, {
22199
+ key: "asyncGetBrowserLocation",
22200
+ value: function () {
22201
+ var _asyncGetBrowserLocation = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee3() {
22202
+ return regenerator_default().wrap(function _callee3$(_context3) {
22203
+ while (1) {
22204
+ switch (_context3.prev = _context3.next) {
22205
+ case 0:
22206
+ _context3.next = 2;
22207
+ return this.setup();
22208
+
22209
+ case 2:
22210
+ return _context3.abrupt("return", _context3.sent);
22211
+
22212
+ case 3:
22213
+ case "end":
22214
+ return _context3.stop();
22215
+ }
22216
+ }
22217
+ }, _callee3, this);
22218
+ }));
22219
+
22220
+ function asyncGetBrowserLocation() {
22221
+ return _asyncGetBrowserLocation.apply(this, arguments);
22222
+ }
22223
+
22224
+ return asyncGetBrowserLocation;
22225
+ }()
22226
+ }, {
22227
+ key: "degreesToRadians",
22228
+ value: function degreesToRadians(degrees) {
22229
+ return degrees * Math.PI / 180;
22230
+ }
22231
+ }, {
22232
+ key: "getDistanceInKmBetweenEarthCoordinates",
22233
+ value: function getDistanceInKmBetweenEarthCoordinates(latitude, longitude) {
22234
+ var earthRadiusKm = 6371;
22235
+ var destLatitudeInRadians = this.degreesToRadians(this.latitude - latitude);
22236
+ var destLongitudeInRadians = this.degreesToRadians(this.longitude - longitude);
22237
+ latitude = this.degreesToRadians(latitude);
22238
+ var latitudeInRadiants = this.degreesToRadians(this.latitude);
22239
+ var a = Math.sin(destLatitudeInRadians / 2) * Math.sin(destLatitudeInRadians / 2) + Math.sin(destLongitudeInRadians / 2) * Math.sin(destLongitudeInRadians / 2) * Math.cos(latitude) * Math.cos(latitudeInRadiants);
22240
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
22241
+ return parseFloat((earthRadiusKm * c).toFixed(1));
22242
+ }
22243
+ }]);
22244
+
22245
+ return Location;
22246
+ }();
22247
+
22248
+
22249
+ // EXTERNAL MODULE: ./node_modules/lodash/lodash.js
22250
+ var lodash = __webpack_require__(6486);
22251
+ var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);
22252
+ ;// CONCATENATED MODULE: ./src/ui/helpers.js
22253
+
22254
+
22255
+ var doesIdExist = function doesIdExist(id) {
22256
+ return document.getElementById(id) !== null;
22257
+ };
22258
+ var getKeyValue = function getKeyValue(option, project) {
22259
+ if (typeof option === 'undefined') {
22260
+ return null;
22261
+ }
22262
+
22263
+ if (option.includes('{{') && option.includes('}}')) {
22264
+ var result = option;
22265
+
22266
+ toConsumableArray_default()(option.matchAll(/{{(.*?)}}/mg)).forEach(function (match) {
22267
+ result = result.replace(match[0], getValueForReplacementTerm(match[1], project));
22268
+ });
22269
+
22270
+ ;
22271
+ return result;
22272
+ }
22273
+
22274
+ return getValueForReplacementTerm(option, project);
22275
+ };
22276
+
22277
+ var getValueForReplacementTerm = function getValueForReplacementTerm(option, project) {
22278
+ if (option.startsWith('[meta]')) {
22279
+ return lodash_default().get(project, "meta.".concat(option.substring(6))) || '';
22280
+ }
22281
+
22282
+ if (option.startsWith('[project]')) {
22283
+ return lodash_default().get(project, option.substring(9)) || '';
22284
+ }
22285
+
22286
+ return option;
22287
+ };
22288
+ ;// CONCATENATED MODULE: ./src/ui/geosearchbar.js
22289
+
22290
+
22291
+
22292
+ 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; } } }; }
22293
+
22294
+ 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); }
22295
+
22296
+ 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; }
22297
+
22298
+
22299
+
22300
+
22301
+
22302
+ var GeoSearchBar = /*#__PURE__*/function () {
22303
+ function GeoSearchBar() {
22304
+ classCallCheck_default()(this, GeoSearchBar);
22305
+
22306
+ this.searchBarContent = this.createSearchbar();
22307
+ this.searchBarInput = this.searchBarContent.children[0];
22308
+ this.closeButton = this.searchBarContent.children[1];
22309
+ this.geoLocationButton = this.searchBarContent.children[2];
22310
+ this.showCloseButton(false);
22311
+ this.showGeolocationButton(false);
22312
+ this.stores = [];
22313
+ this.options = [];
22314
+ this.cardsKey = '';
22315
+ this.addCard = null;
22316
+ this.location = new Location();
22317
+ }
22318
+
22319
+ createClass_default()(GeoSearchBar, [{
22320
+ key: "createSearchbar",
22321
+ value: function createSearchbar() {
22322
+ var _this = this;
22323
+
22324
+ var searchBarWrapper = document.createElement('div');
22325
+ searchBarWrapper.className = 'search-bar-wrapper';
22326
+ searchBarWrapper.id = 'geo-search-bar-wrapper';
22327
+ var geoSearchBar = document.createElement('input');
22328
+ geoSearchBar.className = 'search-bar';
22329
+ geoSearchBar.id = 'geo-search-bar';
22330
+ geoSearchBar.setAttribute('type', 'text');
22331
+ geoSearchBar.setAttribute('autocomplete', 'off');
22332
+
22333
+ geoSearchBar.oninput = function () {
22334
+ _this.showGeolocationButton(false);
22335
+
22336
+ var userInput = document.getElementById('geo-search-bar').value;
22337
+
22338
+ if (userInput.length >= 3) {
22339
+ _this.showCloseButton(true);
22340
+
22341
+ var searchTerm = new RegExp(userInput, 'i');
22342
+
22343
+ var storesCopy = _this.stores.filter(function (store) {
22344
+ 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;
22345
+ });
22346
+
22347
+ document.getElementById('timekit-selector-card-container').innerHTML = '';
22348
+
22349
+ if (storesCopy.length !== 0) {
22350
+ _this.emptySearchState(false);
22351
+
22352
+ _this.updateContent(storesCopy);
22353
+ } else {
22354
+ _this.emptySearchState(true);
22355
+ }
22356
+ } else {
22357
+ _this.clearCardContainer();
22358
+ }
22359
+ };
22360
+
22361
+ geoSearchBar.onfocus = function () {
22362
+ _this.showGeolocationButton(true);
22363
+ };
22364
+
22365
+ geoSearchBar.addEventListener("focusout", function (event) {
22366
+ if (event.relatedTarget != null && event.relatedTarget.tagName == 'BUTTON') return;
22367
+
22368
+ _this.showGeolocationButton(false);
22369
+ });
22370
+ var geoLocationButton = document.createElement('button');
22371
+ geoLocationButton.innerHTML = "Use my current location";
22372
+ geoLocationButton.className = 'search-bar-geolocation-button'; // Click action
22373
+
22374
+ geoLocationButton.onclick = function () {
22375
+ _this.showGeolocationButton(false);
22376
+
22377
+ _this.location.setup().then(function () {
22378
+ _this.setDistanceInStores();
22379
+
22380
+ _this.stores.sort(function (prev, next) {
22381
+ return prev.distance - next.distance;
22382
+ });
22383
+
22384
+ document.getElementById('timekit-selector-card-container').innerHTML = '';
22385
+
22386
+ _this.updateContent(_this.stores);
22387
+ });
22388
+ };
22389
+
22390
+ var clearButton = document.createElement('i');
22391
+ clearButton.className = 'search-bar-clear';
22392
+ clearButton.id = 'geo-search-bar-clear';
22393
+
22394
+ clearButton.onclick = function () {
22395
+ _this.clearInput();
22396
+ };
22397
+
22398
+ searchBarWrapper.appendChild(geoSearchBar);
22399
+ searchBarWrapper.appendChild(clearButton);
22400
+ searchBarWrapper.appendChild(geoLocationButton, geoSearchBar.nextSibling);
22401
+ return searchBarWrapper;
22402
+ }
22403
+ }, {
22404
+ key: "clearInput",
22405
+ value: function clearInput() {
22406
+ document.getElementById('geo-search-bar').value = '';
22407
+ this.clearCardContainer();
22408
+ }
22409
+ }, {
22410
+ key: "clearCardContainer",
22411
+ value: function clearCardContainer() {
22412
+ document.getElementById('timekit-selector-card-container').innerHTML = '';
22413
+ this.emptySearchState(false);
22414
+ this.showCloseButton(false);
22415
+ }
22416
+ }, {
22417
+ key: "emptySearchState",
22418
+ value: function emptySearchState(showEmptyState) {
22419
+ var doesEmptyStateExist = document.getElementById('empty-results-wrapper') === null;
22420
+
22421
+ if (showEmptyState && doesEmptyStateExist) {
22422
+ // Create divs that tell the user that no results were found when searching
22423
+ var body = document.getElementById('body-container-scrollable');
22424
+ var emptyResultsDiv = document.createElement('div');
22425
+ emptyResultsDiv.className = 'empty-results-wrapper';
22426
+ emptyResultsDiv.id = 'empty-results-wrapper';
22427
+ var searchImage = document.createElement('i');
22428
+ searchImage.className = 'empty-results-image';
22429
+ var searchText = document.createElement('div');
22430
+ searchText.className = 'empty-results-text';
22431
+ searchText.innerHTML = 'No results found';
22432
+ emptyResultsDiv.appendChild(searchImage);
22433
+ emptyResultsDiv.appendChild(searchText);
22434
+ body.appendChild(emptyResultsDiv);
22435
+ } else if (!showEmptyState && !doesEmptyStateExist) {
22436
+ document.getElementById('empty-results-wrapper').remove();
22437
+ }
22438
+ }
22439
+ }, {
22440
+ key: "setSearchBarPlaceholder",
22441
+ value: function setSearchBarPlaceholder(placeholderText) {
22442
+ this.searchBarInput.setAttribute('placeholder', placeholderText);
22443
+ }
22444
+ }, {
22445
+ key: "showSearchBar",
22446
+ value: function showSearchBar() {
22447
+ var isSearchBarVisible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
22448
+
22449
+ if (!isSearchBarVisible) {
22450
+ this.searchBarContent.classList.add('hide');
22451
+ } else {
22452
+ this.searchBarContent.classList.remove('hide');
22453
+ }
22454
+ }
22455
+ }, {
22456
+ key: "showCloseButton",
22457
+ value: function showCloseButton() {
22458
+ var isCloseButtonActive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
22459
+
22460
+ if (!isCloseButtonActive) {
22461
+ this.closeButton.classList.add('hide');
22462
+ } else {
22463
+ this.closeButton.classList.remove('hide');
22464
+ }
22465
+ }
22466
+ }, {
22467
+ key: "showGeolocationButton",
22468
+ value: function showGeolocationButton() {
22469
+ var show = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
22470
+
22471
+ if (show) {
22472
+ this.geoLocationButton.classList.remove('hide');
22473
+ } else {
22474
+ this.geoLocationButton.classList.add('hide');
22475
+ }
22476
+ }
22477
+ }, {
22478
+ key: "setStores",
22479
+ value: function setStores(stores) {
22480
+ this.stores = stores;
22481
+ }
22482
+ }, {
22483
+ key: "setDistanceInStores",
22484
+ value: function setDistanceInStores() {
22485
+ var _this2 = this;
22486
+
22487
+ this.stores.forEach(function (projectData, index) {
22488
+ _this2.stores[index]['distance'] = _this2.getDistance(projectData);
22489
+ });
22490
+ }
22491
+ }, {
22492
+ key: "setOptions",
22493
+ value: function setOptions(options) {
22494
+ this.options = options;
22495
+ }
22496
+ }, {
22497
+ key: "setCardsKey",
22498
+ value: function setCardsKey(key) {
22499
+ this.cardsKey = key;
22500
+ }
22501
+ }, {
22502
+ key: "getDistance",
22503
+ value: function getDistance(project) {
22504
+ var longitude = lodash_default().get(project, 'meta.t_longitude') || 0;
22505
+ var latitude = lodash_default().get(project, 'meta.t_latitude') || 0;
22506
+ return this.location.getDistanceInKmBetweenEarthCoordinates(latitude, longitude);
22507
+ }
22508
+ }, {
22509
+ key: "setAddCardAction",
22510
+ value: function setAddCardAction(handler) {
22511
+ this.addCard = handler;
22512
+ }
22513
+ }, {
22514
+ key: "appendShowMoreCardsText",
22515
+ value: function appendShowMoreCardsText(onClick) {
22516
+ if (document.getElementById("show-more-cards-text")) {
22517
+ document.getElementById("show-more-cards-text").remove();
22518
+ }
22519
+
22520
+ var showMoreCardsText = document.createElement('a');
22521
+ showMoreCardsText.id = 'show-more-cards-text';
22522
+ showMoreCardsText.innerText = 'Show more';
22523
+ showMoreCardsText.onclick = onClick;
22524
+ document.getElementById('timekit-selector-card-container').append(showMoreCardsText);
22525
+ }
22526
+ }, {
22527
+ key: "updateContent",
22528
+ value: function updateContent(stores) {
22529
+ var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
22530
+ var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
22531
+ var index = 0;
22532
+
22533
+ var _iterator = geosearchbar_createForOfIteratorHelper(stores),
22534
+ _step;
22535
+
22536
+ try {
22537
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
22538
+ var projectData = _step.value;
22539
+
22540
+ if (index >= from + limit) {
22541
+ var onClick = function onClick() {
22542
+ this.updateContent(stores, from + limit);
22543
+ };
22544
+
22545
+ this.appendShowMoreCardsText(onClick.bind(this));
22546
+ return;
22547
+ }
22548
+
22549
+ if (index >= from) {
22550
+ var cardTitle = getKeyValue(this.options['cardTitle'], projectData);
22551
+ var cardBody = getKeyValue(this.options['cardBody'], projectData);
22552
+ var cardFooter = getKeyValue(this.options['cardFooter'], projectData);
22553
+ var cardImage = getKeyValue(this.options['cardImage'], projectData);
22554
+ var overriddenCardTitle = null;
22555
+
22556
+ if ('distance' in projectData) {
22557
+ overriddenCardTitle = "<div>".concat(cardTitle, "</div><div class=\"card-title-distance\">").concat(projectData['distance'], " km</div>");
22558
+ }
22559
+
22560
+ this.addCard(this.cardsKey, projectData.id, cardTitle, cardBody, cardFooter, cardImage, overriddenCardTitle);
22561
+ }
22562
+
22563
+ index++;
22564
+ }
22565
+ } catch (err) {
22566
+ _iterator.e(err);
22567
+ } finally {
22568
+ _iterator.f();
22569
+ }
22570
+
22571
+ if (index >= stores.length && document.getElementById("show-more-cards-text")) {
22572
+ document.getElementById("show-more-cards-text").remove();
22573
+ }
22574
+ }
22575
+ }]);
22576
+
22577
+ return GeoSearchBar;
22578
+ }();
22579
+
22580
+
22065
22581
  ;// CONCATENATED MODULE: ./src/ui/navigator.js
22066
22582
 
22067
22583
 
22068
22584
 
22069
22585
 
22586
+
22070
22587
  var Navigator = /*#__PURE__*/function () {
22071
22588
  function Navigator() {
22072
22589
  var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
@@ -22078,6 +22595,7 @@ var Navigator = /*#__PURE__*/function () {
22078
22595
  this.count = count;
22079
22596
  this.widthOfPanel = width;
22080
22597
  this.searchBar;
22598
+ this.geoSearchBar;
22081
22599
  }
22082
22600
 
22083
22601
  createClass_default()(Navigator, [{
@@ -22154,9 +22672,11 @@ var Navigator = /*#__PURE__*/function () {
22154
22672
  description.className = 'timekit-navigation-description';
22155
22673
  description.id = 'timekit-navigation-description';
22156
22674
  this.searchBar = new SearchBar();
22675
+ this.geoSearchBar = new GeoSearchBar();
22157
22676
  headerWrapper.appendChild(title);
22158
22677
  headerWrapper.appendChild(description);
22159
22678
  headerWrapper.appendChild(this.searchBar.searchBarContent);
22679
+ headerWrapper.appendChild(this.geoSearchBar.searchBarContent);
22160
22680
  var bodyContainerScrollable = document.createElement('div');
22161
22681
  bodyContainerScrollable.className = 'body-container-scrollable';
22162
22682
  bodyContainerScrollable.id = 'body-container-scrollable';
@@ -22263,45 +22783,6 @@ var Navigator = /*#__PURE__*/function () {
22263
22783
  }();
22264
22784
 
22265
22785
 
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
22786
  ;// CONCATENATED MODULE: ./src/ui/ui.js
22306
22787
 
22307
22788
 
@@ -22428,6 +22909,7 @@ var UI = /*#__PURE__*/function () {
22428
22909
  this.navigator.setDescription('Please select an appointment time and fill out the booking form.'); // And this too
22429
22910
 
22430
22911
  this.navigator.searchBar.showSearchBar(false);
22912
+ this.navigator.geoSearchBar.showSearchBar(false);
22431
22913
  bookingJSWrapper.appendChild(bookingJSContainer);
22432
22914
  container.appendChild(bookingJSWrapper);
22433
22915
 
@@ -22466,14 +22948,19 @@ var UI = /*#__PURE__*/function () {
22466
22948
  key = 'id';
22467
22949
  }
22468
22950
 
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);
22951
+ this.setupGeoSearchBar(options, dataOptions, projects, key);
22952
+
22953
+ if (!('geoSearchBar' in options) || options['geoSearchBar'] === undefined) {
22954
+ projects.forEach(function (projectData) {
22955
+ var cardTitle = getKeyValue(dataOptions['cardTitle'], projectData);
22956
+ var cardBody = getKeyValue(dataOptions['cardBody'], projectData);
22957
+ var cardFooter = getKeyValue(dataOptions['cardFooter'], projectData);
22958
+ var cardImage = getKeyValue(dataOptions['cardImage'], projectData);
22959
+
22960
+ _this2.addCardDefault(key, projectData.id, cardTitle, cardBody, cardFooter, cardImage);
22961
+ });
22962
+ }
22474
22963
 
22475
- _this2.addCardDefault(key, projectData.id, cardTitle, cardBody, cardFooter, cardImage);
22476
- });
22477
22964
  this.hideBackButtonIfFirstPage();
22478
22965
  }
22479
22966
  }, {
@@ -22515,6 +23002,7 @@ var UI = /*#__PURE__*/function () {
22515
23002
  var body = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
22516
23003
  var footer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
22517
23004
  var image = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
23005
+ var titleOverride = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
22518
23006
  // Build a card
22519
23007
  var card = document.createElement('div');
22520
23008
  card.id = "".concat(key, "-card-").concat(value);
@@ -22536,7 +23024,7 @@ var UI = /*#__PURE__*/function () {
22536
23024
  card.className = 'card-container';
22537
23025
  var titleDiv = document.createElement('div');
22538
23026
  titleDiv.className = 'card-title';
22539
- titleDiv.innerHTML = title;
23027
+ titleDiv.innerHTML = titleOverride !== null && titleOverride !== void 0 ? titleOverride : title;
22540
23028
  var bodyDiv = document.createElement('div');
22541
23029
  bodyDiv.className = 'card-body';
22542
23030
  bodyDiv.innerHTML = body;
@@ -22618,6 +23106,22 @@ var UI = /*#__PURE__*/function () {
22618
23106
  this.navigator.searchBar.showSearchBar(false);
22619
23107
  }
22620
23108
  }
23109
+ }, {
23110
+ key: "setupGeoSearchBar",
23111
+ value: function setupGeoSearchBar(options, dataOptions, stores, key) {
23112
+ if (typeof options['geoSearchBar'] === 'undefined') {
23113
+ this.navigator.geoSearchBar.showSearchBar(false);
23114
+ return;
23115
+ } else {
23116
+ 'placeholder' in options['geoSearchBar'] ? this.navigator.geoSearchBar.setSearchBarPlaceholder(options['geoSearchBar']['placeholder']) : this.navigator.geoSearchBar.setSearchBarPlaceholder('Please enter your search term');
23117
+ this.navigator.geoSearchBar.clearInput();
23118
+ this.navigator.geoSearchBar.setStores(stores);
23119
+ this.navigator.geoSearchBar.setOptions(dataOptions);
23120
+ this.navigator.geoSearchBar.setCardsKey(key);
23121
+ this.navigator.geoSearchBar.showSearchBar(true);
23122
+ this.navigator.geoSearchBar.setAddCardAction(this.addCardDefault.bind(this));
23123
+ }
23124
+ }
22621
23125
  }]);
22622
23126
 
22623
23127
  return UI;