@tulipnpm/timekit_project_selector 1.0.4 → 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
 
@@ -20974,6 +20988,21 @@ var TimekitApiClient = /*#__PURE__*/function () {
20974
20988
  password: this.appKey
20975
20989
  }
20976
20990
  };
20991
+ }
20992
+ }, {
20993
+ key: "getMetaQueryForStoreAppointments",
20994
+ value: function getMetaQueryForStoreAppointments() {
20995
+ return 'meta.t_project_type:store_appointment_type_project;meta.t_store_disabled:0;meta.t_disabled:0';
20996
+ }
20997
+ }, {
20998
+ key: "getMetaQueryForStores",
20999
+ value: function getMetaQueryForStores() {
21000
+ return 'meta.t_project_type:store_project;meta.t_store_disabled:0';
21001
+ }
21002
+ }, {
21003
+ key: "getMetaQueryForGlobalAppointments",
21004
+ value: function getMetaQueryForGlobalAppointments() {
21005
+ return 'meta.t_project_type:global_appointment_type_project;meta.t_disabled:0';
20977
21006
  } // TODO: Move to helper method area
20978
21007
  // TODO: Add pagaination unit tests
20979
21008
 
@@ -21062,96 +21091,251 @@ var TimekitApiClient = /*#__PURE__*/function () {
21062
21091
  }, {
21063
21092
  key: "getAllProjects",
21064
21093
  value: function () {
21065
- var _getAllProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee4() {
21066
- var _this = this;
21094
+ var _getAllProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee3() {
21095
+ var storeQuery,
21096
+ includePrivateAppointmentTypes,
21097
+ stores,
21098
+ storeAppointments,
21099
+ globalAppointments,
21100
+ _args3 = arguments;
21101
+ return regenerator_default().wrap(function _callee3$(_context3) {
21102
+ while (1) {
21103
+ switch (_context3.prev = _context3.next) {
21104
+ case 0:
21105
+ storeQuery = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : null;
21106
+ includePrivateAppointmentTypes = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
21107
+ _context3.next = 4;
21108
+ return this.getStoreProjects(storeQuery);
21109
+
21110
+ case 4:
21111
+ stores = _context3.sent;
21112
+ _context3.next = 7;
21113
+ return this.getStoreAppointmentProjects(includePrivateAppointmentTypes);
21114
+
21115
+ case 7:
21116
+ storeAppointments = _context3.sent;
21117
+ _context3.next = 10;
21118
+ return this.getGlobalAppointmentProjects(includePrivateAppointmentTypes);
21119
+
21120
+ case 10:
21121
+ globalAppointments = _context3.sent;
21122
+ return _context3.abrupt("return", [].concat(toConsumableArray_default()(stores), toConsumableArray_default()(storeAppointments), toConsumableArray_default()(globalAppointments)));
21067
21123
 
21124
+ case 12:
21125
+ case "end":
21126
+ return _context3.stop();
21127
+ }
21128
+ }
21129
+ }, _callee3, this);
21130
+ }));
21131
+
21132
+ function getAllProjects() {
21133
+ return _getAllProjects.apply(this, arguments);
21134
+ }
21135
+
21136
+ return getAllProjects;
21137
+ }()
21138
+ }, {
21139
+ key: "getStoreProjects",
21140
+ value: function () {
21141
+ var _getStoreProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee4() {
21142
+ var storeQuery,
21143
+ query,
21144
+ _args4 = arguments;
21068
21145
  return regenerator_default().wrap(function _callee4$(_context4) {
21069
21146
  while (1) {
21070
21147
  switch (_context4.prev = _context4.next) {
21071
21148
  case 0:
21072
- return _context4.abrupt("return", this.timeKitPaginate( /*#__PURE__*/function () {
21073
- var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee3(page) {
21074
- return regenerator_default().wrap(function _callee3$(_context3) {
21149
+ storeQuery = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
21150
+ query = this.getMetaQueryForStores();
21151
+
21152
+ if (storeQuery) {
21153
+ query = query + ";".concat(storeQuery);
21154
+ }
21155
+
21156
+ _context4.next = 5;
21157
+ return this.getProjectsByMetaQuery(query);
21158
+
21159
+ case 5:
21160
+ return _context4.abrupt("return", _context4.sent);
21161
+
21162
+ case 6:
21163
+ case "end":
21164
+ return _context4.stop();
21165
+ }
21166
+ }
21167
+ }, _callee4, this);
21168
+ }));
21169
+
21170
+ function getStoreProjects() {
21171
+ return _getStoreProjects.apply(this, arguments);
21172
+ }
21173
+
21174
+ return getStoreProjects;
21175
+ }()
21176
+ }, {
21177
+ key: "getStoreAppointmentProjects",
21178
+ value: function () {
21179
+ var _getStoreAppointmentProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee5(includePrivate) {
21180
+ var query;
21181
+ return regenerator_default().wrap(function _callee5$(_context5) {
21182
+ while (1) {
21183
+ switch (_context5.prev = _context5.next) {
21184
+ case 0:
21185
+ query = this.getMetaQueryForStoreAppointments();
21186
+
21187
+ if (!includePrivate) {
21188
+ query = query + ';meta.t_private:0';
21189
+ }
21190
+
21191
+ _context5.next = 4;
21192
+ return this.getProjectsByMetaQuery(query);
21193
+
21194
+ case 4:
21195
+ return _context5.abrupt("return", _context5.sent);
21196
+
21197
+ case 5:
21198
+ case "end":
21199
+ return _context5.stop();
21200
+ }
21201
+ }
21202
+ }, _callee5, this);
21203
+ }));
21204
+
21205
+ function getStoreAppointmentProjects(_x3) {
21206
+ return _getStoreAppointmentProjects.apply(this, arguments);
21207
+ }
21208
+
21209
+ return getStoreAppointmentProjects;
21210
+ }()
21211
+ }, {
21212
+ key: "getGlobalAppointmentProjects",
21213
+ value: function () {
21214
+ var _getGlobalAppointmentProjects = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee6(includePrivate) {
21215
+ var query;
21216
+ return regenerator_default().wrap(function _callee6$(_context6) {
21217
+ while (1) {
21218
+ switch (_context6.prev = _context6.next) {
21219
+ case 0:
21220
+ query = this.getMetaQueryForGlobalAppointments();
21221
+
21222
+ if (!includePrivate) {
21223
+ query = query + ';meta.t_private:0';
21224
+ }
21225
+
21226
+ _context6.next = 4;
21227
+ return this.getProjectsByMetaQuery(query);
21228
+
21229
+ case 4:
21230
+ return _context6.abrupt("return", _context6.sent);
21231
+
21232
+ case 5:
21233
+ case "end":
21234
+ return _context6.stop();
21235
+ }
21236
+ }
21237
+ }, _callee6, this);
21238
+ }));
21239
+
21240
+ function getGlobalAppointmentProjects(_x4) {
21241
+ return _getGlobalAppointmentProjects.apply(this, arguments);
21242
+ }
21243
+
21244
+ return getGlobalAppointmentProjects;
21245
+ }()
21246
+ }, {
21247
+ key: "getProjectsByMetaQuery",
21248
+ value: function () {
21249
+ var _getProjectsByMetaQuery = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee8(query) {
21250
+ var _this = this;
21251
+
21252
+ return regenerator_default().wrap(function _callee8$(_context8) {
21253
+ while (1) {
21254
+ switch (_context8.prev = _context8.next) {
21255
+ case 0:
21256
+ return _context8.abrupt("return", this.timeKitPaginate( /*#__PURE__*/function () {
21257
+ var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee7(page) {
21258
+ return regenerator_default().wrap(function _callee7$(_context7) {
21075
21259
  while (1) {
21076
- switch (_context3.prev = _context3.next) {
21260
+ switch (_context7.prev = _context7.next) {
21077
21261
  case 0:
21078
- _context3.next = 2;
21079
- return _this.getProjects("page=".concat(page));
21262
+ _context7.next = 2;
21263
+ return _this.getProjects("search=".concat(query, "&page=").concat(page));
21080
21264
 
21081
21265
  case 2:
21082
- return _context3.abrupt("return", _context3.sent);
21266
+ return _context7.abrupt("return", _context7.sent);
21083
21267
 
21084
21268
  case 3:
21085
21269
  case "end":
21086
- return _context3.stop();
21270
+ return _context7.stop();
21087
21271
  }
21088
21272
  }
21089
- }, _callee3);
21273
+ }, _callee7);
21090
21274
  }));
21091
21275
 
21092
- return function (_x3) {
21276
+ return function (_x6) {
21093
21277
  return _ref.apply(this, arguments);
21094
21278
  };
21095
21279
  }()));
21096
21280
 
21097
21281
  case 1:
21098
21282
  case "end":
21099
- return _context4.stop();
21283
+ return _context8.stop();
21100
21284
  }
21101
21285
  }
21102
- }, _callee4, this);
21286
+ }, _callee8, this);
21103
21287
  }));
21104
21288
 
21105
- function getAllProjects() {
21106
- return _getAllProjects.apply(this, arguments);
21289
+ function getProjectsByMetaQuery(_x5) {
21290
+ return _getProjectsByMetaQuery.apply(this, arguments);
21107
21291
  }
21108
21292
 
21109
- return getAllProjects;
21293
+ return getProjectsByMetaQuery;
21110
21294
  }()
21111
21295
  }, {
21112
21296
  key: "getProjectsByMetaValue",
21113
21297
  value: function () {
21114
- var _getProjectsByMetaValue = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee6(key, value) {
21298
+ var _getProjectsByMetaValue = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee10(key, value) {
21115
21299
  var _this2 = this;
21116
21300
 
21117
- return regenerator_default().wrap(function _callee6$(_context6) {
21301
+ return regenerator_default().wrap(function _callee10$(_context10) {
21118
21302
  while (1) {
21119
- switch (_context6.prev = _context6.next) {
21303
+ switch (_context10.prev = _context10.next) {
21120
21304
  case 0:
21121
- return _context6.abrupt("return", this.timeKitPaginate( /*#__PURE__*/function () {
21122
- var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee5(page) {
21123
- return regenerator_default().wrap(function _callee5$(_context5) {
21305
+ return _context10.abrupt("return", this.timeKitPaginate( /*#__PURE__*/function () {
21306
+ var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee9(page) {
21307
+ return regenerator_default().wrap(function _callee9$(_context9) {
21124
21308
  while (1) {
21125
- switch (_context5.prev = _context5.next) {
21309
+ switch (_context9.prev = _context9.next) {
21126
21310
  case 0:
21127
- _context5.next = 2;
21311
+ _context9.next = 2;
21128
21312
  return _this2.getProjects("search=meta.".concat(key, ":").concat(value, "&page=").concat(page));
21129
21313
 
21130
21314
  case 2:
21131
- return _context5.abrupt("return", _context5.sent);
21315
+ return _context9.abrupt("return", _context9.sent);
21132
21316
 
21133
21317
  case 3:
21134
21318
  case "end":
21135
- return _context5.stop();
21319
+ return _context9.stop();
21136
21320
  }
21137
21321
  }
21138
- }, _callee5);
21322
+ }, _callee9);
21139
21323
  }));
21140
21324
 
21141
- return function (_x6) {
21325
+ return function (_x9) {
21142
21326
  return _ref2.apply(this, arguments);
21143
21327
  };
21144
21328
  }()));
21145
21329
 
21146
21330
  case 1:
21147
21331
  case "end":
21148
- return _context6.stop();
21332
+ return _context10.stop();
21149
21333
  }
21150
21334
  }
21151
- }, _callee6, this);
21335
+ }, _callee10, this);
21152
21336
  }));
21153
21337
 
21154
- function getProjectsByMetaValue(_x4, _x5) {
21338
+ function getProjectsByMetaValue(_x7, _x8) {
21155
21339
  return _getProjectsByMetaValue.apply(this, arguments);
21156
21340
  }
21157
21341
 
@@ -21179,6 +21363,7 @@ var ConfigurationManager = /*#__PURE__*/function () {
21179
21363
  this.widgetImageUrl = ''; // TOOD: Get URL
21180
21364
 
21181
21365
  this.debug = false;
21366
+ this.includePrivateAppointments = false;
21182
21367
  }
21183
21368
 
21184
21369
  createClass_default()(ConfigurationManager, [{
@@ -21263,12 +21448,13 @@ var StepOptions = /*#__PURE__*/function () {
21263
21448
  createClass_default()(StepOptions, [{
21264
21449
  key: "init",
21265
21450
  value: function init() {
21266
- var _options$title, _options$description, _options$search_bar;
21451
+ var _options$title, _options$description, _options$search_bar, _options$geo_search_b;
21267
21452
 
21268
21453
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21269
21454
  this.title = (_options$title = options['title']) !== null && _options$title !== void 0 ? _options$title : '';
21270
21455
  this.description = (_options$description = options['description']) !== null && _options$description !== void 0 ? _options$description : '';
21271
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;
21272
21458
  }
21273
21459
  }]);
21274
21460
 
@@ -21522,6 +21708,10 @@ var ProjectsStore = /*#__PURE__*/function () {
21522
21708
 
21523
21709
  var allFilters = _objectSpread(_objectSpread({}, filters), this.filters);
21524
21710
 
21711
+ if (this.projects[type] === undefined) {
21712
+ return [];
21713
+ }
21714
+
21525
21715
  return this.projects[type].filter(function (project) {
21526
21716
  return Object.keys(allFilters).every(function (filterKey) {
21527
21717
  if (filterKey === 'id') {
@@ -21735,11 +21925,38 @@ var SearchBar = /*#__PURE__*/function () {
21735
21925
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
21736
21926
  var card = _step.value;
21737
21927
  var cardContent = card.children;
21738
- var cardTitle = cardContent[0].innerText;
21739
- var cardBody = cardContent[1].innerText;
21928
+ var cardTitle = '';
21929
+ var cardBody = '';
21930
+ var cardFooter = '';
21931
+
21932
+ var _iterator2 = _createForOfIteratorHelper(cardContent),
21933
+ _step2;
21934
+
21935
+ try {
21936
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
21937
+ var item = _step2.value;
21938
+
21939
+ if (item.className === 'card-title') {
21940
+ cardTitle = item.innerText;
21941
+ }
21942
+
21943
+ if (item.className === 'card-body') {
21944
+ cardBody = item.innerText;
21945
+ }
21946
+
21947
+ if (item.className === 'card-footer') {
21948
+ cardFooter = item.innerText;
21949
+ }
21950
+ }
21951
+ } catch (err) {
21952
+ _iterator2.e(err);
21953
+ } finally {
21954
+ _iterator2.f();
21955
+ }
21956
+
21740
21957
  var searchTerm = new RegExp(userInput, 'i');
21741
21958
 
21742
- if (cardTitle.search(searchTerm) === -1 && cardBody.search(searchTerm) === -1) {
21959
+ if (cardTitle.search(searchTerm) === -1 && cardBody.search(searchTerm) === -1 && cardFooter.search(searchTerm) === -1) {
21743
21960
  card.classList.add('hide');
21744
21961
  hiddenCardCounter++;
21745
21962
  } else {
@@ -21790,18 +22007,18 @@ var SearchBar = /*#__PURE__*/function () {
21790
22007
  }, {
21791
22008
  key: "resetContent",
21792
22009
  value: function resetContent(selector) {
21793
- var _iterator2 = _createForOfIteratorHelper(selector),
21794
- _step2;
22010
+ var _iterator3 = _createForOfIteratorHelper(selector),
22011
+ _step3;
21795
22012
 
21796
22013
  try {
21797
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
21798
- var card = _step2.value;
22014
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
22015
+ var card = _step3.value;
21799
22016
  card.classList.remove('hide');
21800
22017
  }
21801
22018
  } catch (err) {
21802
- _iterator2.e(err);
22019
+ _iterator3.e(err);
21803
22020
  } finally {
21804
- _iterator2.f();
22021
+ _iterator3.f();
21805
22022
  }
21806
22023
  }
21807
22024
  }, {
@@ -21860,11 +22077,507 @@ var SearchBar = /*#__PURE__*/function () {
21860
22077
  }();
21861
22078
 
21862
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
+
21863
22575
  ;// CONCATENATED MODULE: ./src/ui/navigator.js
21864
22576
 
21865
22577
 
21866
22578
 
21867
22579
 
22580
+
21868
22581
  var Navigator = /*#__PURE__*/function () {
21869
22582
  function Navigator() {
21870
22583
  var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
@@ -21876,6 +22589,7 @@ var Navigator = /*#__PURE__*/function () {
21876
22589
  this.count = count;
21877
22590
  this.widthOfPanel = width;
21878
22591
  this.searchBar;
22592
+ this.geoSearchBar;
21879
22593
  }
21880
22594
 
21881
22595
  createClass_default()(Navigator, [{
@@ -21952,9 +22666,11 @@ var Navigator = /*#__PURE__*/function () {
21952
22666
  description.className = 'timekit-navigation-description';
21953
22667
  description.id = 'timekit-navigation-description';
21954
22668
  this.searchBar = new SearchBar();
22669
+ this.geoSearchBar = new GeoSearchBar();
21955
22670
  headerWrapper.appendChild(title);
21956
22671
  headerWrapper.appendChild(description);
21957
22672
  headerWrapper.appendChild(this.searchBar.searchBarContent);
22673
+ headerWrapper.appendChild(this.geoSearchBar.searchBarContent);
21958
22674
  var bodyContainerScrollable = document.createElement('div');
21959
22675
  bodyContainerScrollable.className = 'body-container-scrollable';
21960
22676
  bodyContainerScrollable.id = 'body-container-scrollable';
@@ -22061,45 +22777,6 @@ var Navigator = /*#__PURE__*/function () {
22061
22777
  }();
22062
22778
 
22063
22779
 
22064
- // EXTERNAL MODULE: ./node_modules/lodash/lodash.js
22065
- var lodash = __webpack_require__(6486);
22066
- var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);
22067
- ;// CONCATENATED MODULE: ./src/ui/helpers.js
22068
-
22069
-
22070
- var doesIdExist = function doesIdExist(id) {
22071
- return document.getElementById(id) !== null;
22072
- };
22073
- var getKeyValue = function getKeyValue(option, project) {
22074
- if (typeof option === 'undefined') {
22075
- return null;
22076
- }
22077
-
22078
- if (option.includes('{{') && option.includes('}}')) {
22079
- var result = option;
22080
-
22081
- toConsumableArray_default()(option.matchAll(/{{(.*?)}}/mg)).forEach(function (match) {
22082
- result = result.replace(match[0], getValueForReplacementTerm(match[1], project));
22083
- });
22084
-
22085
- ;
22086
- return result;
22087
- }
22088
-
22089
- return getValueForReplacementTerm(option, project);
22090
- };
22091
-
22092
- var getValueForReplacementTerm = function getValueForReplacementTerm(option, project) {
22093
- if (option.startsWith('[meta]')) {
22094
- return lodash_default().get(project, "meta.".concat(option.substring(6))) || '';
22095
- }
22096
-
22097
- if (option.startsWith('[project]')) {
22098
- return lodash_default().get(project, option.substring(9)) || '';
22099
- }
22100
-
22101
- return option;
22102
- };
22103
22780
  ;// CONCATENATED MODULE: ./src/ui/ui.js
22104
22781
 
22105
22782
 
@@ -22226,6 +22903,7 @@ var UI = /*#__PURE__*/function () {
22226
22903
  this.navigator.setDescription('Please select an appointment time and fill out the booking form.'); // And this too
22227
22904
 
22228
22905
  this.navigator.searchBar.showSearchBar(false);
22906
+ this.navigator.geoSearchBar.showSearchBar(false);
22229
22907
  bookingJSWrapper.appendChild(bookingJSContainer);
22230
22908
  container.appendChild(bookingJSWrapper);
22231
22909
 
@@ -22257,21 +22935,26 @@ var UI = /*#__PURE__*/function () {
22257
22935
  this.navigator.setTitle(getKeyValue(options.title) || '');
22258
22936
  this.navigator.setDescription(getKeyValue(this.navigator.trimDescription(options.description)) || '');
22259
22937
  this.setupSearchBar(options);
22260
- 'card_image' in dataOptions ? cardContainer.className = 'selector-card-container-image' : cardContainer.className = 'selector-card-container';
22938
+ dataOptions['cardImage'] !== '' ? cardContainer.className = 'selector-card-container-image' : cardContainer.className = 'selector-card-container';
22261
22939
  var key = 't_' + projectType + '_uuid';
22262
22940
 
22263
22941
  if (projectType === 'store_appointment_type_project') {
22264
22942
  key = 'id';
22265
22943
  }
22266
22944
 
22267
- projects.forEach(function (projectData) {
22268
- var cardTitle = getKeyValue(dataOptions['cardTitle'], projectData);
22269
- var cardBody = getKeyValue(dataOptions['cardBody'], projectData);
22270
- var cardFooter = getKeyValue(dataOptions['cardFooter'], projectData);
22271
- 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
+ }
22272
22957
 
22273
- _this2.addCardDefault(key, projectData.id, cardTitle, cardBody, cardFooter, cardImage);
22274
- });
22275
22958
  this.hideBackButtonIfFirstPage();
22276
22959
  }
22277
22960
  }, {
@@ -22312,7 +22995,8 @@ var UI = /*#__PURE__*/function () {
22312
22995
  var title = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
22313
22996
  var body = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
22314
22997
  var footer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
22315
- var image = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
22998
+ var image = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
22999
+ var titleOverride = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
22316
23000
  // Build a card
22317
23001
  var card = document.createElement('div');
22318
23002
  card.id = "".concat(key, "-card-").concat(value);
@@ -22327,14 +23011,14 @@ var UI = /*#__PURE__*/function () {
22327
23011
  _this3.modifyUserSelectionText(title);
22328
23012
  };
22329
23013
 
22330
- if (image !== null) {
23014
+ if (image !== '') {
22331
23015
  return this.buildImageCard(card, title, body, footer, image);
22332
23016
  }
22333
23017
 
22334
23018
  card.className = 'card-container';
22335
23019
  var titleDiv = document.createElement('div');
22336
23020
  titleDiv.className = 'card-title';
22337
- titleDiv.innerHTML = title;
23021
+ titleDiv.innerHTML = titleOverride !== null && titleOverride !== void 0 ? titleOverride : title;
22338
23022
  var bodyDiv = document.createElement('div');
22339
23023
  bodyDiv.className = 'card-body';
22340
23024
  bodyDiv.innerHTML = body;
@@ -22416,6 +23100,22 @@ var UI = /*#__PURE__*/function () {
22416
23100
  this.navigator.searchBar.showSearchBar(false);
22417
23101
  }
22418
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
+ }
22419
23119
  }]);
22420
23120
 
22421
23121
  return UI;
@@ -22669,7 +23369,7 @@ var init = /*#__PURE__*/function () {
22669
23369
  case 0:
22670
23370
  return _context2.abrupt("return", new Promise( /*#__PURE__*/function () {
22671
23371
  var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee(resolve, reject) {
22672
- var projects, message, _message, embed, _message2, widget;
23372
+ var projects, storeQuery, message, _message, embed, _message2, widget;
22673
23373
 
22674
23374
  return regenerator_default().wrap(function _callee$(_context) {
22675
23375
  while (1) {
@@ -22690,39 +23390,27 @@ var init = /*#__PURE__*/function () {
22690
23390
  case 9:
22691
23391
  apiClient.setAppKey(instance.app_key);
22692
23392
  projects = [];
23393
+ storeQuery = '';
22693
23394
 
22694
- if (!instance.region) {
22695
- _context.next = 18;
22696
- break;
23395
+ if (instance.region) {
23396
+ storeQuery = "meta.t_store_region:".concat(instance.region);
22697
23397
  }
22698
23398
 
22699
- ProjectsStore_instance.addFilter('t_store_region', instance.region);
22700
23399
  _context.next = 15;
22701
- return apiClient.getProjectsByMetaValue('t_store_region', instance.region);
23400
+ return apiClient.getAllProjects(storeQuery, instance.includePrivateAppointments);
22702
23401
 
22703
23402
  case 15:
22704
23403
  projects = _context.sent;
22705
- _context.next = 21;
22706
- break;
22707
-
22708
- case 18:
22709
- _context.next = 20;
22710
- return apiClient.getAllProjects();
22711
-
22712
- case 20:
22713
- projects = _context.sent;
22714
-
22715
- case 21:
22716
23404
  ProjectsStore_instance.mapProjects(projects);
22717
23405
  StepsFactory_instance.init(instance.getSelectorOptions()); // TODO: Move this
22718
23406
 
22719
23407
  if (!instance.shouldUseDefaultUI()) {
22720
- _context.next = 43;
23408
+ _context.next = 38;
22721
23409
  break;
22722
23410
  }
22723
23411
 
22724
23412
  if (!doesIdExist('bookingjs')) {
22725
- _context.next = 28;
23413
+ _context.next = 23;
22726
23414
  break;
22727
23415
  }
22728
23416
 
@@ -22730,14 +23418,14 @@ var init = /*#__PURE__*/function () {
22730
23418
  console.error(message);
22731
23419
  return _context.abrupt("return", reject(message));
22732
23420
 
22733
- case 28:
23421
+ case 23:
22734
23422
  if (!instance.isEmbedded()) {
22735
- _context.next = 37;
23423
+ _context.next = 32;
22736
23424
  break;
22737
23425
  }
22738
23426
 
22739
23427
  if (doesIdExist('timekit-project-selector-container')) {
22740
- _context.next = 33;
23428
+ _context.next = 28;
22741
23429
  break;
22742
23430
  }
22743
23431
 
@@ -22745,15 +23433,15 @@ var init = /*#__PURE__*/function () {
22745
23433
  console.error(_message);
22746
23434
  return _context.abrupt("return", reject(_message));
22747
23435
 
22748
- case 33:
23436
+ case 28:
22749
23437
  embed = new Embed(ProjectsStrategy_instance, selectProject, instance);
22750
23438
  embed.init();
22751
- _context.next = 43;
23439
+ _context.next = 38;
22752
23440
  break;
22753
23441
 
22754
- case 37:
23442
+ case 32:
22755
23443
  if (!doesIdExist('timekit-project-selector-container')) {
22756
- _context.next = 41;
23444
+ _context.next = 36;
22757
23445
  break;
22758
23446
  }
22759
23447
 
@@ -22761,14 +23449,14 @@ var init = /*#__PURE__*/function () {
22761
23449
  console.error(_message2);
22762
23450
  return _context.abrupt("return", reject(_message2));
22763
23451
 
22764
- case 41:
23452
+ case 36:
22765
23453
  widget = new Widget(ProjectsStrategy_instance, selectProject, instance);
22766
23454
  widget.init();
22767
23455
 
22768
- case 43:
23456
+ case 38:
22769
23457
  resolve(true);
22770
23458
 
22771
- case 44:
23459
+ case 39:
22772
23460
  case "end":
22773
23461
  return _context.stop();
22774
23462
  }