@tulipnpm/timekit_project_selector 1.0.5 → 1.0.8

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
 
@@ -20978,7 +20992,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
20978
20992
  }, {
20979
20993
  key: "getMetaQueryForStoreAppointments",
20980
20994
  value: function getMetaQueryForStoreAppointments() {
20981
- return 'meta.t_project_type:store_appointment_type_project;meta.t_store_disabled:0;meta.t_disabled:0;meta.t_private:0';
20995
+ return 'meta.t_project_type:store_appointment_type_project;meta.t_store_disabled:0;meta.t_disabled:0';
20982
20996
  }
20983
20997
  }, {
20984
20998
  key: "getMetaQueryForStores",
@@ -20988,7 +21002,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
20988
21002
  }, {
20989
21003
  key: "getMetaQueryForGlobalAppointments",
20990
21004
  value: function getMetaQueryForGlobalAppointments() {
20991
- return 'meta.t_project_type:global_appointment_type_project;meta.t_disabled:0;meta.t_private:0';
21005
+ return 'meta.t_project_type:global_appointment_type_project;meta.t_disabled:0';
20992
21006
  } // TODO: Move to helper method area
20993
21007
  // TODO: Add pagaination unit tests
20994
21008
 
@@ -21079,6 +21093,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21079
21093
  value: function () {
21080
21094
  var _getAllProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee3() {
21081
21095
  var storeQuery,
21096
+ includePrivateAppointmentTypes,
21082
21097
  stores,
21083
21098
  storeAppointments,
21084
21099
  globalAppointments,
@@ -21088,24 +21103,25 @@ var TimekitApiClient = /*#__PURE__*/function () {
21088
21103
  switch (_context3.prev = _context3.next) {
21089
21104
  case 0:
21090
21105
  storeQuery = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : null;
21091
- _context3.next = 3;
21106
+ includePrivateAppointmentTypes = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
21107
+ _context3.next = 4;
21092
21108
  return this.getStoreProjects(storeQuery);
21093
21109
 
21094
- case 3:
21110
+ case 4:
21095
21111
  stores = _context3.sent;
21096
- _context3.next = 6;
21097
- return this.getStoreAppointmentProjects();
21112
+ _context3.next = 7;
21113
+ return this.getStoreAppointmentProjects(includePrivateAppointmentTypes);
21098
21114
 
21099
- case 6:
21115
+ case 7:
21100
21116
  storeAppointments = _context3.sent;
21101
- _context3.next = 9;
21102
- return this.getGlobalAppointmentProjects();
21117
+ _context3.next = 10;
21118
+ return this.getGlobalAppointmentProjects(includePrivateAppointmentTypes);
21103
21119
 
21104
- case 9:
21120
+ case 10:
21105
21121
  globalAppointments = _context3.sent;
21106
21122
  return _context3.abrupt("return", [].concat(toConsumableArray_default()(stores), toConsumableArray_default()(storeAppointments), toConsumableArray_default()(globalAppointments)));
21107
21123
 
21108
- case 11:
21124
+ case 12:
21109
21125
  case "end":
21110
21126
  return _context3.stop();
21111
21127
  }
@@ -21160,20 +21176,25 @@ var TimekitApiClient = /*#__PURE__*/function () {
21160
21176
  }, {
21161
21177
  key: "getStoreAppointmentProjects",
21162
21178
  value: function () {
21163
- var _getStoreAppointmentProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee5() {
21179
+ var _getStoreAppointmentProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee5(includePrivate) {
21164
21180
  var query;
21165
21181
  return regenerator_default().wrap(function _callee5$(_context5) {
21166
21182
  while (1) {
21167
21183
  switch (_context5.prev = _context5.next) {
21168
21184
  case 0:
21169
21185
  query = this.getMetaQueryForStoreAppointments();
21170
- _context5.next = 3;
21186
+
21187
+ if (!includePrivate) {
21188
+ query = query + ';meta.t_private:0';
21189
+ }
21190
+
21191
+ _context5.next = 4;
21171
21192
  return this.getProjectsByMetaQuery(query);
21172
21193
 
21173
- case 3:
21194
+ case 4:
21174
21195
  return _context5.abrupt("return", _context5.sent);
21175
21196
 
21176
- case 4:
21197
+ case 5:
21177
21198
  case "end":
21178
21199
  return _context5.stop();
21179
21200
  }
@@ -21181,7 +21202,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21181
21202
  }, _callee5, this);
21182
21203
  }));
21183
21204
 
21184
- function getStoreAppointmentProjects() {
21205
+ function getStoreAppointmentProjects(_x3) {
21185
21206
  return _getStoreAppointmentProjects.apply(this, arguments);
21186
21207
  }
21187
21208
 
@@ -21190,20 +21211,25 @@ var TimekitApiClient = /*#__PURE__*/function () {
21190
21211
  }, {
21191
21212
  key: "getGlobalAppointmentProjects",
21192
21213
  value: function () {
21193
- var _getGlobalAppointmentProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee6() {
21214
+ var _getGlobalAppointmentProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee6(includePrivate) {
21194
21215
  var query;
21195
21216
  return regenerator_default().wrap(function _callee6$(_context6) {
21196
21217
  while (1) {
21197
21218
  switch (_context6.prev = _context6.next) {
21198
21219
  case 0:
21199
21220
  query = this.getMetaQueryForGlobalAppointments();
21200
- _context6.next = 3;
21221
+
21222
+ if (!includePrivate) {
21223
+ query = query + ';meta.t_private:0';
21224
+ }
21225
+
21226
+ _context6.next = 4;
21201
21227
  return this.getProjectsByMetaQuery(query);
21202
21228
 
21203
- case 3:
21229
+ case 4:
21204
21230
  return _context6.abrupt("return", _context6.sent);
21205
21231
 
21206
- case 4:
21232
+ case 5:
21207
21233
  case "end":
21208
21234
  return _context6.stop();
21209
21235
  }
@@ -21211,7 +21237,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21211
21237
  }, _callee6, this);
21212
21238
  }));
21213
21239
 
21214
- function getGlobalAppointmentProjects() {
21240
+ function getGlobalAppointmentProjects(_x4) {
21215
21241
  return _getGlobalAppointmentProjects.apply(this, arguments);
21216
21242
  }
21217
21243
 
@@ -21247,7 +21273,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21247
21273
  }, _callee7);
21248
21274
  }));
21249
21275
 
21250
- return function (_x4) {
21276
+ return function (_x6) {
21251
21277
  return _ref.apply(this, arguments);
21252
21278
  };
21253
21279
  }()));
@@ -21260,7 +21286,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21260
21286
  }, _callee8, this);
21261
21287
  }));
21262
21288
 
21263
- function getProjectsByMetaQuery(_x3) {
21289
+ function getProjectsByMetaQuery(_x5) {
21264
21290
  return _getProjectsByMetaQuery.apply(this, arguments);
21265
21291
  }
21266
21292
 
@@ -21296,7 +21322,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21296
21322
  }, _callee9);
21297
21323
  }));
21298
21324
 
21299
- return function (_x7) {
21325
+ return function (_x9) {
21300
21326
  return _ref2.apply(this, arguments);
21301
21327
  };
21302
21328
  }()));
@@ -21309,7 +21335,7 @@ var TimekitApiClient = /*#__PURE__*/function () {
21309
21335
  }, _callee10, this);
21310
21336
  }));
21311
21337
 
21312
- function getProjectsByMetaValue(_x5, _x6) {
21338
+ function getProjectsByMetaValue(_x7, _x8) {
21313
21339
  return _getProjectsByMetaValue.apply(this, arguments);
21314
21340
  }
21315
21341
 
@@ -21337,6 +21363,7 @@ var ConfigurationManager = /*#__PURE__*/function () {
21337
21363
  this.widgetImageUrl = ''; // TOOD: Get URL
21338
21364
 
21339
21365
  this.debug = false;
21366
+ this.includePrivateAppointments = false;
21340
21367
  }
21341
21368
 
21342
21369
  createClass_default()(ConfigurationManager, [{
@@ -21421,12 +21448,13 @@ var StepOptions = /*#__PURE__*/function () {
21421
21448
  createClass_default()(StepOptions, [{
21422
21449
  key: "init",
21423
21450
  value: function init() {
21424
- var _options$title, _options$description, _options$search_bar;
21451
+ var _options$title, _options$description, _options$search_bar, _options$geo_search_b;
21425
21452
 
21426
21453
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21427
21454
  this.title = (_options$title = options['title']) !== null && _options$title !== void 0 ? _options$title : '';
21428
21455
  this.description = (_options$description = options['description']) !== null && _options$description !== void 0 ? _options$description : '';
21429
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;
21430
21458
  }
21431
21459
  }]);
21432
21460
 
@@ -22049,11 +22077,507 @@ var SearchBar = /*#__PURE__*/function () {
22049
22077
  }();
22050
22078
 
22051
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
+
22052
22575
  ;// CONCATENATED MODULE: ./src/ui/navigator.js
22053
22576
 
22054
22577
 
22055
22578
 
22056
22579
 
22580
+
22057
22581
  var Navigator = /*#__PURE__*/function () {
22058
22582
  function Navigator() {
22059
22583
  var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
@@ -22065,6 +22589,7 @@ var Navigator = /*#__PURE__*/function () {
22065
22589
  this.count = count;
22066
22590
  this.widthOfPanel = width;
22067
22591
  this.searchBar;
22592
+ this.geoSearchBar;
22068
22593
  }
22069
22594
 
22070
22595
  createClass_default()(Navigator, [{
@@ -22141,9 +22666,11 @@ var Navigator = /*#__PURE__*/function () {
22141
22666
  description.className = 'timekit-navigation-description';
22142
22667
  description.id = 'timekit-navigation-description';
22143
22668
  this.searchBar = new SearchBar();
22669
+ this.geoSearchBar = new GeoSearchBar();
22144
22670
  headerWrapper.appendChild(title);
22145
22671
  headerWrapper.appendChild(description);
22146
22672
  headerWrapper.appendChild(this.searchBar.searchBarContent);
22673
+ headerWrapper.appendChild(this.geoSearchBar.searchBarContent);
22147
22674
  var bodyContainerScrollable = document.createElement('div');
22148
22675
  bodyContainerScrollable.className = 'body-container-scrollable';
22149
22676
  bodyContainerScrollable.id = 'body-container-scrollable';
@@ -22250,45 +22777,6 @@ var Navigator = /*#__PURE__*/function () {
22250
22777
  }();
22251
22778
 
22252
22779
 
22253
- // EXTERNAL MODULE: ./node_modules/lodash/lodash.js
22254
- var lodash = __webpack_require__(6486);
22255
- var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);
22256
- ;// CONCATENATED MODULE: ./src/ui/helpers.js
22257
-
22258
-
22259
- var doesIdExist = function doesIdExist(id) {
22260
- return document.getElementById(id) !== null;
22261
- };
22262
- var getKeyValue = function getKeyValue(option, project) {
22263
- if (typeof option === 'undefined') {
22264
- return null;
22265
- }
22266
-
22267
- if (option.includes('{{') && option.includes('}}')) {
22268
- var result = option;
22269
-
22270
- toConsumableArray_default()(option.matchAll(/{{(.*?)}}/mg)).forEach(function (match) {
22271
- result = result.replace(match[0], getValueForReplacementTerm(match[1], project));
22272
- });
22273
-
22274
- ;
22275
- return result;
22276
- }
22277
-
22278
- return getValueForReplacementTerm(option, project);
22279
- };
22280
-
22281
- var getValueForReplacementTerm = function getValueForReplacementTerm(option, project) {
22282
- if (option.startsWith('[meta]')) {
22283
- return lodash_default().get(project, "meta.".concat(option.substring(6))) || '';
22284
- }
22285
-
22286
- if (option.startsWith('[project]')) {
22287
- return lodash_default().get(project, option.substring(9)) || '';
22288
- }
22289
-
22290
- return option;
22291
- };
22292
22780
  ;// CONCATENATED MODULE: ./src/ui/ui.js
22293
22781
 
22294
22782
 
@@ -22415,6 +22903,7 @@ var UI = /*#__PURE__*/function () {
22415
22903
  this.navigator.setDescription('Please select an appointment time and fill out the booking form.'); // And this too
22416
22904
 
22417
22905
  this.navigator.searchBar.showSearchBar(false);
22906
+ this.navigator.geoSearchBar.showSearchBar(false);
22418
22907
  bookingJSWrapper.appendChild(bookingJSContainer);
22419
22908
  container.appendChild(bookingJSWrapper);
22420
22909
 
@@ -22453,14 +22942,19 @@ var UI = /*#__PURE__*/function () {
22453
22942
  key = 'id';
22454
22943
  }
22455
22944
 
22456
- projects.forEach(function (projectData) {
22457
- var cardTitle = getKeyValue(dataOptions['cardTitle'], projectData);
22458
- var cardBody = getKeyValue(dataOptions['cardBody'], projectData);
22459
- var cardFooter = getKeyValue(dataOptions['cardFooter'], projectData);
22460
- 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
+ }
22461
22957
 
22462
- _this2.addCardDefault(key, projectData.id, cardTitle, cardBody, cardFooter, cardImage);
22463
- });
22464
22958
  this.hideBackButtonIfFirstPage();
22465
22959
  }
22466
22960
  }, {
@@ -22502,6 +22996,7 @@ var UI = /*#__PURE__*/function () {
22502
22996
  var body = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
22503
22997
  var footer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
22504
22998
  var image = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
22999
+ var titleOverride = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
22505
23000
  // Build a card
22506
23001
  var card = document.createElement('div');
22507
23002
  card.id = "".concat(key, "-card-").concat(value);
@@ -22523,7 +23018,7 @@ var UI = /*#__PURE__*/function () {
22523
23018
  card.className = 'card-container';
22524
23019
  var titleDiv = document.createElement('div');
22525
23020
  titleDiv.className = 'card-title';
22526
- titleDiv.innerHTML = title;
23021
+ titleDiv.innerHTML = titleOverride !== null && titleOverride !== void 0 ? titleOverride : title;
22527
23022
  var bodyDiv = document.createElement('div');
22528
23023
  bodyDiv.className = 'card-body';
22529
23024
  bodyDiv.innerHTML = body;
@@ -22605,6 +23100,22 @@ var UI = /*#__PURE__*/function () {
22605
23100
  this.navigator.searchBar.showSearchBar(false);
22606
23101
  }
22607
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
+ }
22608
23119
  }]);
22609
23120
 
22610
23121
  return UI;
@@ -22879,39 +23390,27 @@ var init = /*#__PURE__*/function () {
22879
23390
  case 9:
22880
23391
  apiClient.setAppKey(instance.app_key);
22881
23392
  projects = [];
23393
+ storeQuery = '';
22882
23394
 
22883
- if (!instance.region) {
22884
- _context.next = 18;
22885
- break;
23395
+ if (instance.region) {
23396
+ storeQuery = "meta.t_store_region:".concat(instance.region);
22886
23397
  }
22887
23398
 
22888
- storeQuery = "meta.t_store_region:".concat(instance.region);
22889
23399
  _context.next = 15;
22890
- return apiClient.getAllProjects(storeQuery);
23400
+ return apiClient.getAllProjects(storeQuery, instance.includePrivateAppointments);
22891
23401
 
22892
23402
  case 15:
22893
23403
  projects = _context.sent;
22894
- _context.next = 21;
22895
- break;
22896
-
22897
- case 18:
22898
- _context.next = 20;
22899
- return apiClient.getAllProjects();
22900
-
22901
- case 20:
22902
- projects = _context.sent;
22903
-
22904
- case 21:
22905
23404
  ProjectsStore_instance.mapProjects(projects);
22906
23405
  StepsFactory_instance.init(instance.getSelectorOptions()); // TODO: Move this
22907
23406
 
22908
23407
  if (!instance.shouldUseDefaultUI()) {
22909
- _context.next = 43;
23408
+ _context.next = 38;
22910
23409
  break;
22911
23410
  }
22912
23411
 
22913
23412
  if (!doesIdExist('bookingjs')) {
22914
- _context.next = 28;
23413
+ _context.next = 23;
22915
23414
  break;
22916
23415
  }
22917
23416
 
@@ -22919,14 +23418,14 @@ var init = /*#__PURE__*/function () {
22919
23418
  console.error(message);
22920
23419
  return _context.abrupt("return", reject(message));
22921
23420
 
22922
- case 28:
23421
+ case 23:
22923
23422
  if (!instance.isEmbedded()) {
22924
- _context.next = 37;
23423
+ _context.next = 32;
22925
23424
  break;
22926
23425
  }
22927
23426
 
22928
23427
  if (doesIdExist('timekit-project-selector-container')) {
22929
- _context.next = 33;
23428
+ _context.next = 28;
22930
23429
  break;
22931
23430
  }
22932
23431
 
@@ -22934,15 +23433,15 @@ var init = /*#__PURE__*/function () {
22934
23433
  console.error(_message);
22935
23434
  return _context.abrupt("return", reject(_message));
22936
23435
 
22937
- case 33:
23436
+ case 28:
22938
23437
  embed = new Embed(ProjectsStrategy_instance, selectProject, instance);
22939
23438
  embed.init();
22940
- _context.next = 43;
23439
+ _context.next = 38;
22941
23440
  break;
22942
23441
 
22943
- case 37:
23442
+ case 32:
22944
23443
  if (!doesIdExist('timekit-project-selector-container')) {
22945
- _context.next = 41;
23444
+ _context.next = 36;
22946
23445
  break;
22947
23446
  }
22948
23447
 
@@ -22950,14 +23449,14 @@ var init = /*#__PURE__*/function () {
22950
23449
  console.error(_message2);
22951
23450
  return _context.abrupt("return", reject(_message2));
22952
23451
 
22953
- case 41:
23452
+ case 36:
22954
23453
  widget = new Widget(ProjectsStrategy_instance, selectProject, instance);
22955
23454
  widget.init();
22956
23455
 
22957
- case 43:
23456
+ case 38:
22958
23457
  resolve(true);
22959
23458
 
22960
- case 44:
23459
+ case 39:
22961
23460
  case "end":
22962
23461
  return _context.stop();
22963
23462
  }