ai12z 3.18.1-alpha.1 → 3.18.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/cjs/ai12z-beacon.cjs.entry.js +1 -1
  2. package/dist/cjs/ai12z-bot.cjs.entry.js +3 -3
  3. package/dist/cjs/ai12z-chat-message.cjs.entry.js +1 -1
  4. package/dist/cjs/ai12z-chat_2.cjs.entry.js +3 -3
  5. package/dist/cjs/ai12z-container.cjs.entry.js +2 -2
  6. package/dist/cjs/ai12z-cta.cjs.entry.js +1 -1
  7. package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +3 -3
  8. package/dist/cjs/{beacon-JlWjtnTj.js → beacon-Dzm5dknI.js} +12 -20
  9. package/dist/cjs/{botHelpers-C-q-Cx6l.js → botHelpers-B_lFspU6.js} +34 -43
  10. package/dist/cjs/{index-DrVymXMa.js → index-DN109Evg.js} +460 -137
  11. package/dist/cjs/index.cjs.js +3 -3
  12. package/dist/cjs/item-list.cjs.entry.js +1 -1
  13. package/dist/cjs/search-results-page.cjs.entry.js +1 -1
  14. package/dist/collection/utils/beacon.js +3 -0
  15. package/dist/collection/utils/botHelpers/botHelpers.js +34 -43
  16. package/dist/collection/utils/referralDomain/engine-map.js +7 -18
  17. package/dist/components/ai12z-beacon.js +1 -1
  18. package/dist/components/ai12z-bot.js +1 -1
  19. package/dist/components/ai12z-chat-message.js +1 -1
  20. package/dist/components/ai12z-chat.js +1 -1
  21. package/dist/components/ai12z-container.js +1 -1
  22. package/dist/components/ai12z-cta.js +1 -1
  23. package/dist/components/ai12z-form.js +1 -1
  24. package/dist/components/ai12z-inline-search.js +1 -1
  25. package/dist/components/ai12z-input-form.js +1 -1
  26. package/dist/components/ai12z-knowledge-box.js +1 -1
  27. package/dist/components/ai12z-search-panel.js +1 -1
  28. package/dist/components/audio-recorder.js +1 -1
  29. package/dist/components/dynamic-form.js +1 -1
  30. package/dist/components/index.js +1 -1
  31. package/dist/components/interaction-buttons.js +1 -1
  32. package/dist/components/item-list.js +1 -1
  33. package/dist/{library/p-DevVHZsi.js → components/p-6XEM7ZLl.js} +1 -1
  34. package/dist/components/{p-BcMpGTRl.js → p-B1v9MUA3.js} +1 -1
  35. package/dist/components/{p-Dhsmr2uw.js → p-BBkshCs2.js} +1 -1
  36. package/dist/components/{p-Dp7_8HKH.js → p-BDfPuPOG.js} +1 -1
  37. package/dist/components/{p-41s-w9LX.js → p-BGvClrhu.js} +1 -1
  38. package/dist/components/{p-DQqcZs9L.js → p-BN2-aIWf.js} +1 -1
  39. package/dist/components/p-BYO6vh73.js +1 -0
  40. package/dist/components/{p-QKs3RShR.js → p-BaWiE0V_.js} +1 -1
  41. package/dist/components/{p-B95EoLWn.js → p-C5WJ7k2H.js} +1 -1
  42. package/dist/components/{p-BjHiaDK1.js → p-C8xryOSN.js} +1 -1
  43. package/dist/components/{p-BbcOl4b9.js → p-CLWMGEhc.js} +1 -1
  44. package/dist/components/{p-o0KfLH-y.js → p-CPRWfcS6.js} +3 -3
  45. package/dist/components/{p-BeQb-NnR.js → p-Cyx_DKRP.js} +1 -1
  46. package/dist/components/{p-sc5m_KRK.js → p-D-LWGuqg.js} +1 -1
  47. package/dist/components/{p-BeHgjKno.js → p-D6-f0_II.js} +1 -1
  48. package/dist/components/{p-DKR021JM.js → p-D7e8HNXM.js} +1 -1
  49. package/dist/components/{p-GhNL1QgZ.js → p-Dkus1tH4.js} +1 -1
  50. package/dist/components/p-DrKpCVS_.js +1 -0
  51. package/dist/components/{p-D_3qXJcI.js → p-DxzrIzcK.js} +1 -1
  52. package/dist/components/{p-C_JPcL6x.js → p-bpEiYuDq.js} +1 -1
  53. package/dist/components/{p-vXHMCBxR.js → p-tvFvUUjk.js} +1 -1
  54. package/dist/components/{p-CS_Lu4XU.js → p-xPuA7imU.js} +1 -1
  55. package/dist/components/p-yp55Zv6C.js +1 -0
  56. package/dist/components/{p-DvRct8Md.js → p-zb604YaC.js} +1 -1
  57. package/dist/components/privacy-modal.js +1 -1
  58. package/dist/components/search-results-page.js +1 -1
  59. package/dist/esm/ai12z-beacon.entry.js +1 -1
  60. package/dist/esm/ai12z-bot.entry.js +3 -3
  61. package/dist/esm/ai12z-chat-message.entry.js +1 -1
  62. package/dist/esm/ai12z-chat_2.entry.js +3 -3
  63. package/dist/esm/ai12z-container.entry.js +2 -2
  64. package/dist/esm/ai12z-cta.entry.js +1 -1
  65. package/dist/esm/ai12z-knowledge-box.entry.js +3 -3
  66. package/dist/esm/{beacon-CCcNZqoa.js → beacon-QqHlhBch.js} +12 -20
  67. package/dist/esm/{botHelpers-DevVHZsi.js → botHelpers-CIEjV6Hg.js} +34 -43
  68. package/dist/esm/{index-DUiyv997.js → index-CXzW7Axh.js} +460 -137
  69. package/dist/esm/index.js +3 -3
  70. package/dist/esm/item-list.entry.js +1 -1
  71. package/dist/esm/search-results-page.entry.js +1 -1
  72. package/dist/library/index.esm.js +1 -1
  73. package/dist/library/library.esm.js +1 -1
  74. package/dist/library/p-0KFBScvP.js +31 -0
  75. package/dist/library/{p-03893ff4.entry.js → p-26368908.entry.js} +1 -1
  76. package/dist/library/{p-dd698eca.entry.js → p-66441613.entry.js} +1 -1
  77. package/dist/library/{p-7bf430d1.entry.js → p-6ad5e049.entry.js} +1 -1
  78. package/dist/library/{p-e3879503.entry.js → p-77bec202.entry.js} +1 -1
  79. package/dist/library/{p-54dbd259.entry.js → p-8bcfd6de.entry.js} +1 -1
  80. package/dist/{components/p-BbtKQtBC.js → library/p-CIEjV6Hg.js} +1 -1
  81. package/dist/library/p-D82dKYwS.js +1 -0
  82. package/dist/library/{p-a0f243db.entry.js → p-a3933c45.entry.js} +1 -1
  83. package/dist/library/{p-34388093.entry.js → p-b27a2375.entry.js} +1 -1
  84. package/dist/library/{p-a945aea5.entry.js → p-e15861ae.entry.js} +1 -1
  85. package/dist/library/{p-2eb0bfb6.entry.js → p-fde77918.entry.js} +1 -1
  86. package/package.json +3 -3
  87. package/dist/components/p-D_PBBpdt.js +0 -1
  88. package/dist/components/p-DfKwQvja.js +0 -1
  89. package/dist/components/p-DmCuT5dg.js +0 -1
  90. package/dist/library/p-Dd_HpGgX.js +0 -31
  91. package/dist/library/p-PFgBCUAH.js +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var beacon = require('./beacon-JlWjtnTj.js');
4
+ var beacon = require('./beacon-Dzm5dknI.js');
5
5
  require('./utils-kaVdO3ki.js');
6
6
 
7
7
  const Ai12zBeacon = class {
@@ -5,17 +5,17 @@ var responseAdapter = require('./response-adapter-BSZc0N1k.js');
5
5
  var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
6
6
  var logger$2 = require('./logger-D--BUQGx.js');
7
7
  var utils = require('./utils-kaVdO3ki.js');
8
- var index$1 = require('./index-DrVymXMa.js');
8
+ var index$1 = require('./index-DN109Evg.js');
9
9
  var globalStore = require('./global-store-R6x06KvJ.js');
10
10
  var reCaptchaHelpers = require('./reCaptchaHelpers-C8v6BB6z.js');
11
- var botHelpers = require('./botHelpers-C-q-Cx6l.js');
11
+ var botHelpers = require('./botHelpers-B_lFspU6.js');
12
12
  var surveyHelpers = require('./surveyHelpers-DpChOjp8.js');
13
13
  var scriptStyleLoader = require('./scriptStyleLoader-D-bqKqSb.js');
14
14
  var keyboardShortcuts = require('./keyboard-shortcuts-g_HyNYT-.js');
15
15
  var ctaHelpers = require('./ctaHelpers-CFn_XVtl.js');
16
16
  var appStore = require('./app-store-BtkiHvcw.js');
17
17
  var parseHelper = require('./parseHelper-DGQ2ETjm.js');
18
- var beacon = require('./beacon-JlWjtnTj.js');
18
+ var beacon = require('./beacon-Dzm5dknI.js');
19
19
  var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
20
20
  require('./_commonjsHelpers-MBWFX2dn.js');
21
21
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var botHelpers = require('./botHelpers-C-q-Cx6l.js');
4
+ var botHelpers = require('./botHelpers-B_lFspU6.js');
5
5
  var styleSheetRegistry = require('./styleSheetRegistry-Cv84KUXj.js');
6
6
  require('./utils-kaVdO3ki.js');
7
7
 
@@ -5,13 +5,13 @@ var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
5
5
  var parseHelper = require('./parseHelper-DGQ2ETjm.js');
6
6
  var utils = require('./utils-kaVdO3ki.js');
7
7
  var ctaHelpers = require('./ctaHelpers-CFn_XVtl.js');
8
- var index$1 = require('./index-DrVymXMa.js');
8
+ var index$1 = require('./index-DN109Evg.js');
9
9
  var socketService = require('./socket-service-Bcv9pRTP.js');
10
10
  var surveyHelpers = require('./surveyHelpers-DpChOjp8.js');
11
11
  var keyboardShortcuts = require('./keyboard-shortcuts-g_HyNYT-.js');
12
12
  var analyticsService = require('./analyticsService-CkAva47S.js');
13
- var botHelpers = require('./botHelpers-C-q-Cx6l.js');
14
- var beacon = require('./beacon-JlWjtnTj.js');
13
+ var botHelpers = require('./botHelpers-B_lFspU6.js');
14
+ var beacon = require('./beacon-Dzm5dknI.js');
15
15
  require('./_commonjsHelpers-MBWFX2dn.js');
16
16
  require('./logger-D--BUQGx.js');
17
17
  require('./response-adapter-BSZc0N1k.js');
@@ -3,8 +3,8 @@
3
3
  var index = require('./index-v8T1EJAJ.js');
4
4
  var utils = require('./utils-kaVdO3ki.js');
5
5
  var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
6
- var botHelpers = require('./botHelpers-C-q-Cx6l.js');
7
- var index$1 = require('./index-DrVymXMa.js');
6
+ var botHelpers = require('./botHelpers-B_lFspU6.js');
7
+ var index$1 = require('./index-DN109Evg.js');
8
8
  var purify_es = require('./purify.es-B7Ashs9w.js');
9
9
  require('./_commonjsHelpers-MBWFX2dn.js');
10
10
 
@@ -7,7 +7,7 @@ var socketService = require('./socket-service-Bcv9pRTP.js');
7
7
  var globalStore = require('./global-store-R6x06KvJ.js');
8
8
  var reCaptchaHelpers = require('./reCaptchaHelpers-C8v6BB6z.js');
9
9
  var ctaHelpers = require('./ctaHelpers-CFn_XVtl.js');
10
- var beacon = require('./beacon-JlWjtnTj.js');
10
+ var beacon = require('./beacon-Dzm5dknI.js');
11
11
  var appStore = require('./app-store-BtkiHvcw.js');
12
12
  var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
13
13
  var purify_es = require('./purify.es-B7Ashs9w.js');
@@ -6,11 +6,11 @@ var styleSheetRegistry = require('./styleSheetRegistry-Cv84KUXj.js');
6
6
  var responseAdapter = require('./response-adapter-BSZc0N1k.js');
7
7
  var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
8
8
  var globalStore = require('./global-store-R6x06KvJ.js');
9
- var index$1 = require('./index-DrVymXMa.js');
9
+ var index$1 = require('./index-DN109Evg.js');
10
10
  var surveyHelpers = require('./surveyHelpers-DpChOjp8.js');
11
- var botHelpers = require('./botHelpers-C-q-Cx6l.js');
11
+ var botHelpers = require('./botHelpers-B_lFspU6.js');
12
12
  var analyticsService = require('./analyticsService-CkAva47S.js');
13
- var beacon = require('./beacon-JlWjtnTj.js');
13
+ var beacon = require('./beacon-Dzm5dknI.js');
14
14
  require('./_commonjsHelpers-MBWFX2dn.js');
15
15
 
16
16
  const ai12zKnowledgeBoxCss = () => `:host{font-family:var(--ai12z-knowledge-box-font-family) !important;font-size:var(--ai12z-knowledge-box-font-size) !important;color:var(--ai12z-knowledge-box-font-color, black);text-align:var(--ai12z-knowledge-box-text-align, left)}.ai12z-kb-wrapper{background-color:var(--ai12z-knowledge-box-bg-color)}.ai12z-suggest-container{padding:32px 32px 32px 32px;flex:none}.ai12z-suggest-answer{font-size:var(--ai12z-knowledge-box-font-size)}.ai12z-suggest-title{font-weight:700}.ai12z-suggest-align{float:left}.ai12z-suggest-relevance{text-align:end}.ai12z-suggest-error-msg{color:rgb(239 68 68)}.ai12z-suggest-hide{display:none}.ai12z-suggest-thumbs{margin-left:90%}.ai12z-suggest-thumbs-up{fill:var(--ai12z-feedback-selected);width:24px}.ai12z-suggest-thumbs-down{fill:var(--ai12z-feedback-selected);width:24px}.not-allowed{cursor:not-allowed}.ai12zBtn{background-color:var(--ai12z-knowledge-box-button-bgcolor);color:var(--ai12z-knowledge-box-button-color) !important;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none !important;margin:5px}.custom-privacy{color:var(--ai12z-knowledge-box-privacy-color);text-align:center;font-size:var(--ai12z-knowledge-box-privacy-font-size);margin-top:10px}button:focus-visible{outline:2px solid var(--ai12z-knowledge-box-focus-visible-color, #0A2A43);outline-offset:2px}button.kb-btn-primary:focus-visible{outline:2px solid var(--ai12z-knowledge-box-focus-visible-color-primary, --ai12z-knowledge-box-focus-visible-color);outline-offset:2px}button.kb-btn-secondary:focus-visible{outline:2px solid var(--ai12z-knowledge-box-focus-visible-color-secondary, --ai12z-knowledge-box-focus-visible-color)}.diamond-icon{color:var(--ai12z-knowledge-box-icon-color, #a5e6e6);width:28px;height:28px;transform-origin:center;}.diamond-icon.loading{animation:rotate 2s linear infinite}@keyframes rotate{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}`;
@@ -255,9 +255,9 @@ const csvToSet = (csv) => new Set(csv
255
255
  const SUPPORTED_GOOGLE_DOMAINS = csvToSet(SUPPORTED_GOOGLE_DOMAINS_CSV);
256
256
  const SUPPORTED_BING_DOMAINS = csvToSet(SUPPORTED_BING_DOMAINS_CSV);
257
257
  const SUPPORTED_YAHOO_DOMAINS = csvToSet(SUPPORTED_YAHOO_DOMAINS_CSV);
258
- csvToSet(SUPPORTED_DUCKDUCKGO_DOMAINS_CSV);
259
- csvToSet(SUPPORTED_KAGI_DOMAINS_CSV);
260
- csvToSet(SUPPORTED_BRAVE_DOMAINS_CSV);
258
+ const SUPPORTED_DUCKDUCKGO_DOMAINS = csvToSet(SUPPORTED_DUCKDUCKGO_DOMAINS_CSV);
259
+ const SUPPORTED_KAGI_DOMAINS = csvToSet(SUPPORTED_KAGI_DOMAINS_CSV);
260
+ const SUPPORTED_BRAVE_DOMAINS = csvToSet(SUPPORTED_BRAVE_DOMAINS_CSV);
261
261
 
262
262
  const ENGINE_MAP = [
263
263
  // AI engines
@@ -313,21 +313,6 @@ const matchesSupportedDomain = (hostname, supportedDomains) => {
313
313
  }
314
314
  return false;
315
315
  };
316
- // export const matchesEngineHost = (hostname: string, host: string): boolean => {
317
- // // Normal exact/subdomain matching
318
- // if (hostname === host || hostname.endsWith(`.${host}`)) {
319
- // return true
320
- // }
321
- // // Engine family matching for Google/Bing/Yahoo
322
- // if (host === "google" || host === "bing" || host === "yahoo") {
323
- // const domain = getDomain(hostname)
324
- // if (!domain) {
325
- // return false
326
- // }
327
- // return domain.split(".")[0] === host
328
- // }
329
- // return false
330
- // }
331
316
  const matchesEngineHost = (hostname, host) => {
332
317
  const normalizedHostname = hostname
333
318
  .toLowerCase()
@@ -340,8 +325,12 @@ const matchesEngineHost = (hostname, host) => {
340
325
  return matchesSupportedDomain(normalizedHostname, SUPPORTED_BING_DOMAINS);
341
326
  case "yahoo":
342
327
  return matchesSupportedDomain(normalizedHostname, SUPPORTED_YAHOO_DOMAINS);
343
- case "gemini":
344
- return matchesSupportedDomain(normalizedHostname, new Set(["gemini.google.com"]));
328
+ case "duckduckgo.com":
329
+ return matchesSupportedDomain(normalizedHostname, SUPPORTED_DUCKDUCKGO_DOMAINS);
330
+ case "kagi.com":
331
+ return matchesSupportedDomain(normalizedHostname, SUPPORTED_KAGI_DOMAINS);
332
+ case "search.brave.com":
333
+ return matchesSupportedDomain(normalizedHostname, SUPPORTED_BRAVE_DOMAINS);
345
334
  default:
346
335
  return normalizedHostname === host || normalizedHostname.endsWith(`.${host}`);
347
336
  }
@@ -393,12 +382,15 @@ const ENGINE_TYPE_MAP = {
393
382
  youtube: "social",
394
383
  twitter: "social"
395
384
  };
385
+ // Do not add a short real-domain host that is a suffix of a supported Google,
386
+ // Bing, or Yahoo search domain: hostLength measures the token, not the matched hostname.
396
387
  function getBestMatchingEngine(hostname) {
397
388
  var _a;
398
389
  let bestMatch = null;
399
390
  for (const item of ENGINE_MAP) {
400
391
  for (const host of item.hosts) {
401
392
  if (matchesEngineHost(hostname, host)) {
393
+ // Length is the character count of the matching family token (host entry).
402
394
  if (!bestMatch || host.length > bestMatch.hostLength) {
403
395
  bestMatch = {
404
396
  engine: item.engine,
@@ -236,12 +236,7 @@ function getBotStateFromSession(projectId, configId, botType) {
236
236
  const parsedState = JSON.parse(rawState);
237
237
  if (Array.isArray(parsedState)) {
238
238
  // return parsedState.find(item => item.projectId === projectId) || null
239
- return (parsedState.find(item => item.projectId === projectId &&
240
- (configId
241
- ? item.configId === configId
242
- : botType
243
- ? item.botType === botType
244
- : true)) || null);
239
+ return parsedState.find(item => item.projectId === projectId && (configId ? item.configId === configId : botType ? item.botType === botType : true)) || null;
245
240
  }
246
241
  return parsedState;
247
242
  }
@@ -262,7 +257,6 @@ function checkBusinessHours(businessHours, timezone) {
262
257
  weekday: "long",
263
258
  hour: "2-digit",
264
259
  minute: "2-digit",
265
- // hour12: false,
266
260
  hourCycle: "h23",
267
261
  }).formatToParts(nowUtc);
268
262
  }
@@ -282,39 +276,40 @@ function checkBusinessHours(businessHours, timezone) {
282
276
  console.error("AI12Z: checkBusinessHours — cannot evaluate current time", e);
283
277
  return false;
284
278
  }
285
- // ------------------------------------------------------------
286
- // 1. Check today's schedule
287
- // ------------------------------------------------------------
279
+ // ------------------------------------------------------------
280
+ // 1. Check today's schedule
281
+ // ------------------------------------------------------------
288
282
  const todayConfig = businessHours.find(item => item.day === currentDay);
289
- if (todayConfig === null || todayConfig === void 0 ? void 0 : todayConfig.enabled) { // 24 hours open
283
+ if (todayConfig === null || todayConfig === void 0 ? void 0 : todayConfig.enabled) {
290
284
  if (todayConfig.allDay) {
285
+ // 24 hours open
291
286
  return true;
292
287
  }
293
288
  try {
294
289
  const startMinutes = getMinutes(todayConfig.startTime);
295
290
  const endMinutes = getMinutes(todayConfig.endTime);
296
- // Normal same-day shift.
297
- //
298
- // Example:
299
- // Friday 09:00 - 17:00
300
- //
301
- // Friday 12:00 -> open
291
+ // Normal same-day shift.
292
+ //
293
+ // Example:
294
+ // Friday 09:00 - 17:00
295
+ //
296
+ // Friday 12:00 -> open
302
297
  if (startMinutes <= endMinutes) {
303
298
  if (currentMinutes >= startMinutes && currentMinutes <= endMinutes) {
304
299
  return true;
305
300
  }
306
301
  }
307
302
  else {
308
- // Overnight shift.
309
- //
310
- // Example:
311
- // Friday 22:00 - 02:00
312
- //
313
- // On Friday we only consider the evening portion:
314
- // Friday 22:00 -> 23:59
315
- //
316
- // The Saturday 00:00 -> 02:00 portion is handled below
317
- // using Friday's configuration.
303
+ // Overnight shift.
304
+ //
305
+ // Example:
306
+ // Friday 22:00 - 02:00
307
+ //
308
+ // On Friday we only consider the evening portion:
309
+ // Friday 22:00 -> 23:59
310
+ //
311
+ // The Saturday 00:00 -> 02:00 portion is handled below
312
+ // using Friday's configuration.
318
313
  if (currentMinutes >= startMinutes) {
319
314
  return true;
320
315
  }
@@ -325,14 +320,13 @@ function checkBusinessHours(businessHours, timezone) {
325
320
  return false;
326
321
  }
327
322
  }
328
- // ------------------------------------------------------------
329
- // 2. Check yesterday's overnight schedule
330
- // ------------------------------------------------------------
331
- const dayIndex = DAYS.indexOf(currentDay);
332
- if (dayIndex === -1) {
323
+ // ------------------------------------------------------------
324
+ // 2. Check yesterday's overnight schedule
325
+ // ------------------------------------------------------------
326
+ const previousDay = getPreviousDay(currentDay);
327
+ if (!previousDay) {
333
328
  return false;
334
329
  }
335
- const previousDay = getPreviousDay(currentDay);
336
330
  const previousDayConfig = businessHours.find(item => item.day === previousDay && item.enabled);
337
331
  if (!previousDayConfig || previousDayConfig.allDay) {
338
332
  return false;
@@ -340,12 +334,12 @@ function checkBusinessHours(businessHours, timezone) {
340
334
  try {
341
335
  const previousStartMinutes = getMinutes(previousDayConfig.startTime);
342
336
  const previousEndMinutes = getMinutes(previousDayConfig.endTime);
343
- // Only yesterday's overnight shifts can continue into today. //
344
- // Example:
345
- // Friday 22:00 - 02:00
346
- //
347
- // Saturday 01:30 -> open
348
- // Saturday 02:01 -> closed
337
+ // Only yesterday's overnight shifts can continue into today.
338
+ // Example:
339
+ // Friday 22:00 - 02:00
340
+ //
341
+ // Saturday 01:30 -> open
342
+ // Saturday 02:01 -> closed
349
343
  if (previousStartMinutes > previousEndMinutes && currentMinutes <= previousEndMinutes) {
350
344
  return true;
351
345
  }
@@ -358,10 +352,7 @@ function checkBusinessHours(businessHours, timezone) {
358
352
  }
359
353
  function getPreviousDay(day) {
360
354
  const dayIndex = DAYS.indexOf(day);
361
- if (dayIndex === -1) {
362
- return "";
363
- }
364
- return DAYS[(dayIndex + DAYS.length - 1) % DAYS.length];
355
+ return dayIndex === -1 ? null : DAYS[(dayIndex + DAYS.length - 1) % DAYS.length];
365
356
  }
366
357
  function getMinutes(time) {
367
358
  if (!/^\d{2}:\d{2}$/.test(time)) {