@ubnt/store.core 9.45.0-beta.3 → 9.45.0-beta.4
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.
- package/CHANGELOG.md +10 -0
- package/lib/_virtual/_virtual_multi-entry.js +2 -0
- package/lib/_virtual/_virtual_multi-entry.js.map +1 -1
- package/lib/_virtual/_virtual_multi-entry.mjs +2 -0
- package/lib/_virtual/_virtual_multi-entry.mjs.map +1 -1
- package/lib/apis/smartcat.d.ts +4 -4
- package/lib/apis/smartcat.js +1 -1
- package/lib/apis/smartcat.js.map +1 -1
- package/lib/apis/smartcat.mjs +1 -1
- package/lib/apis/smartcat.mjs.map +1 -1
- package/lib/assets/attention.svg +5 -5
- package/lib/assets/attention2.svg +5 -5
- package/lib/assets/poe2.svg +3 -2
- package/lib/assets/poe3.svg +2 -3
- package/lib/assets/port.svg +4 -2
- package/lib/assets/port2.svg +2 -4
- package/lib/assets/ucgMax.jpg +0 -0
- package/lib/assets/ucgMax2.jpg +0 -0
- package/lib/assets/ucgUltra.jpg +0 -0
- package/lib/assets/ucgUltra2.jpg +0 -0
- package/lib/assets/udmPro.jpg +0 -0
- package/lib/assets/udmPro2.jpg +0 -0
- package/lib/assets/udmProMax.jpg +0 -0
- package/lib/assets/udmProMax2.jpg +0 -0
- package/lib/assets/udmProSpecial.jpg +0 -0
- package/lib/assets/udmProSpecial2.jpg +0 -0
- package/lib/components/Accordion/Accordion.js +2 -2
- package/lib/components/Accordion/Accordion.js.map +1 -1
- package/lib/components/Accordion/Accordion.mjs +2 -2
- package/lib/components/Accordion/Accordion.mjs.map +1 -1
- package/lib/components/CustomImage/CustomImage.js +4 -4
- package/lib/components/CustomImage/CustomImage.js.map +1 -1
- package/lib/components/CustomImage/CustomImage.mjs +4 -4
- package/lib/components/CustomImage/CustomImage.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs.map +1 -1
- package/lib/components/Gallery/Gallery.context.js.map +1 -1
- package/lib/components/Gallery/Gallery.context.mjs.map +1 -1
- package/lib/components/Gallery/GalleryItem/GalleryItem.js +3 -1
- package/lib/components/Gallery/GalleryItem/GalleryItem.js.map +1 -1
- package/lib/components/Gallery/GalleryItem/GalleryItem.mjs +3 -1
- package/lib/components/Gallery/GalleryItem/GalleryItem.mjs.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.js +3 -3
- package/lib/components/Header/AccountFrame/AccountFrame.js.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.mjs +3 -3
- package/lib/components/Header/AccountFrame/AccountFrame.mjs.map +1 -1
- package/lib/components/Header/AccountMenu/AccountMenu.js.map +1 -1
- package/lib/components/Header/AccountMenu/AccountMenu.mjs.map +1 -1
- package/lib/components/Header/Header.js +3 -3
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/Header/Header.mjs +3 -3
- package/lib/components/Header/Header.mjs.map +1 -1
- package/lib/components/Header/Header.types.d.ts +1 -1
- package/lib/components/Header/Header.types.js.map +1 -1
- package/lib/components/Header/Header.types.mjs.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.js.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.mjs.map +1 -1
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.js +2 -2
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.js.map +1 -1
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.mjs +2 -2
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.mjs.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.js +11 -7
- package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.mjs +11 -7
- package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
- package/lib/components/Hero/Hero.js +1 -1
- package/lib/components/Hero/Hero.js.map +1 -1
- package/lib/components/Hero/Hero.mjs +1 -1
- package/lib/components/Hero/Hero.mjs.map +1 -1
- package/lib/components/HeroVideo/HeroVideo.js +5 -5
- package/lib/components/HeroVideo/HeroVideo.js.map +1 -1
- package/lib/components/HeroVideo/HeroVideo.mjs +5 -5
- package/lib/components/HeroVideo/HeroVideo.mjs.map +1 -1
- package/lib/components/ImageCarousel/ImageCarousel.js.map +1 -1
- package/lib/components/ImageCarousel/ImageCarousel.mjs.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.js +4 -1
- package/lib/components/LandingPagePro/LandingPagePro.js.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.mjs +4 -1
- package/lib/components/LandingPagePro/LandingPagePro.mjs.map +1 -1
- package/lib/components/LandingPageSidebar/LandingPageSidebar.js +8 -8
- package/lib/components/LandingPageSidebar/LandingPageSidebar.js.map +1 -1
- package/lib/components/LandingPageSidebar/LandingPageSidebar.mjs +8 -8
- package/lib/components/LandingPageSidebar/LandingPageSidebar.mjs.map +1 -1
- package/lib/components/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.js +4 -4
- package/lib/components/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.js.map +1 -1
- package/lib/components/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.mjs +4 -4
- package/lib/components/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.mjs.map +1 -1
- package/lib/components/MicrositeHero/MicrositeHero.js +2 -2
- package/lib/components/MicrositeHero/MicrositeHero.js.map +1 -1
- package/lib/components/MicrositeHero/MicrositeHero.mjs +2 -2
- package/lib/components/MicrositeHero/MicrositeHero.mjs.map +1 -1
- package/lib/components/Microsites/Microsites.types.js.map +1 -1
- package/lib/components/Microsites/Microsites.types.mjs.map +1 -1
- package/lib/components/ModelCompareV3/ModelComparePropertyValueGridItem.js +37 -26
- package/lib/components/ModelCompareV3/ModelComparePropertyValueGridItem.js.map +1 -1
- package/lib/components/ModelCompareV3/ModelComparePropertyValueGridItem.mjs +37 -26
- package/lib/components/ModelCompareV3/ModelComparePropertyValueGridItem.mjs.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.types.d.ts +1 -1
- package/lib/components/ModelCompareV3/StickyGrid/StickyGridItem.js +16 -8
- package/lib/components/ModelCompareV3/StickyGrid/StickyGridItem.js.map +1 -1
- package/lib/components/ModelCompareV3/StickyGrid/StickyGridItem.mjs +16 -8
- package/lib/components/ModelCompareV3/StickyGrid/StickyGridItem.mjs.map +1 -1
- package/lib/components/ModelCompareV3/StickyGrid/context.d.ts +3 -3
- package/lib/components/ModelCompareV3/StickyGrid/context.js.map +1 -1
- package/lib/components/ModelCompareV3/StickyGrid/context.mjs.map +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/poe.svg.js +1 -1
- package/lib/components/ModelCompareV3/assets/poe.svg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/port.svg.js +1 -1
- package/lib/components/ModelCompareV3/assets/port.svg.mjs +2 -2
- package/lib/components/ModelCompareV3/data/CloudGateways.js +15 -15
- package/lib/components/ModelCompareV3/data/CloudGateways.mjs +10 -10
- package/lib/components/ModelCompareV3/data/products/ucgMax.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgMax.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgUltra.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgUltra.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udmPro.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmPro.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProMax.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProMax.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs +1 -1
- package/lib/components/ModelCompareV3/data/properties/powerMethodPoe.js +1 -1
- package/lib/components/ModelCompareV3/data/properties/powerMethodPoe.mjs +1 -1
- package/lib/components/ModelCompareV3/data/properties/readerPowerMethod.js +1 -1
- package/lib/components/ModelCompareV3/data/properties/readerPowerMethod.mjs +1 -1
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.js +1 -1
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.mjs +1 -1
- package/lib/components/PriceRangeSlider/PriceRangeSlider.types.d.ts +2 -2
- package/lib/components/PriceRangeSlider/PriceRangeSlider.types.js.map +1 -1
- package/lib/components/PriceRangeSlider/PriceRangeSlider.types.mjs.map +1 -1
- package/lib/components/ProductCard/ProductCard.js +1 -1
- package/lib/components/ProductCard/ProductCard.js.map +1 -1
- package/lib/components/ProductCard/ProductCard.mjs +2 -2
- package/lib/components/ProductCard/ProductCard.mjs.map +1 -1
- package/lib/components/ProductCardPopup/ProductCardPopup.js +2 -2
- package/lib/components/ProductCardPopup/ProductCardPopup.js.map +1 -1
- package/lib/components/ProductCardPopup/ProductCardPopup.mjs +2 -2
- package/lib/components/ProductCardPopup/ProductCardPopup.mjs.map +1 -1
- package/lib/components/ProductSectionTabs/ProductSectionTabs.js +6 -1
- package/lib/components/ProductSectionTabs/ProductSectionTabs.js.map +1 -1
- package/lib/components/ProductSectionTabs/ProductSectionTabs.mjs +6 -1
- package/lib/components/ProductSectionTabs/ProductSectionTabs.mjs.map +1 -1
- package/lib/components/ProductWizard/ProductWizard.js +3 -3
- package/lib/components/ProductWizard/ProductWizard.js.map +1 -1
- package/lib/components/ProductWizard/ProductWizard.mjs +3 -3
- package/lib/components/ProductWizard/ProductWizard.mjs.map +1 -1
- package/lib/components/ProductWizardFootnotes/ProductWizardFootnotes.js +17 -4
- package/lib/components/ProductWizardFootnotes/ProductWizardFootnotes.js.map +1 -1
- package/lib/components/ProductWizardFootnotes/ProductWizardFootnotes.mjs +17 -4
- package/lib/components/ProductWizardFootnotes/ProductWizardFootnotes.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.js +4 -4
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.mjs +4 -4
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.js +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/assets/poe.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/assets/poe.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/assets/port.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/assets/port.svg.mjs +2 -2
- package/lib/components/ScrollWrapper/ScrollWrapper.styles.js +87 -64
- package/lib/components/ScrollWrapper/ScrollWrapper.styles.js.map +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.styles.mjs +87 -64
- package/lib/components/ScrollWrapper/ScrollWrapper.styles.mjs.map +1 -1
- package/lib/components/StorageSliders/StorageSliders.context.js +17 -14
- package/lib/components/StorageSliders/StorageSliders.context.js.map +1 -1
- package/lib/components/StorageSliders/StorageSliders.context.mjs +17 -14
- package/lib/components/StorageSliders/StorageSliders.context.mjs.map +1 -1
- package/lib/components/StorybookUtils/StoryFaker.js.map +1 -1
- package/lib/components/StorybookUtils/StoryFaker.mjs.map +1 -1
- package/lib/components/VariantSelector/VariantSelector.js +4 -4
- package/lib/components/VariantSelector/VariantSelector.js.map +1 -1
- package/lib/components/VariantSelector/VariantSelector.mjs +4 -4
- package/lib/components/VariantSelector/VariantSelector.mjs.map +1 -1
- package/lib/components/VideoPlayerNew/VideoPlayer.js +12 -14
- package/lib/components/VideoPlayerNew/VideoPlayer.js.map +1 -1
- package/lib/components/VideoPlayerNew/VideoPlayer.mjs +12 -14
- package/lib/components/VideoPlayerNew/VideoPlayer.mjs.map +1 -1
- package/lib/constants/address.d.ts +1 -1
- package/lib/constants/address.js +34 -34
- package/lib/constants/address.js.map +1 -1
- package/lib/constants/address.mjs +34 -34
- package/lib/constants/address.mjs.map +1 -1
- package/lib/constants/postalCode.js +10 -10
- package/lib/constants/postalCode.js.map +1 -1
- package/lib/constants/postalCode.mjs +10 -10
- package/lib/constants/postalCode.mjs.map +1 -1
- package/lib/contexts/MenuContext/context.js +27 -26
- package/lib/contexts/MenuContext/context.js.map +1 -1
- package/lib/contexts/MenuContext/context.mjs +27 -26
- package/lib/contexts/MenuContext/context.mjs.map +1 -1
- package/lib/helpers/ux.d.ts +0 -11
- package/lib/hooks/useScrollToY.js.map +1 -1
- package/lib/hooks/useScrollToY.mjs.map +1 -1
- package/lib/utils/blackFriday.d.ts +1 -20
- package/lib/utils/blackFriday.js +3 -84
- package/lib/utils/blackFriday.js.map +1 -1
- package/lib/utils/blackFriday.mjs +1 -74
- package/lib/utils/blackFriday.mjs.map +1 -1
- package/lib/utils/collectionSlug.js +2 -2
- package/lib/utils/collectionSlug.js.map +1 -1
- package/lib/utils/collectionSlug.mjs +2 -2
- package/lib/utils/collectionSlug.mjs.map +1 -1
- package/lib/utils/errors.js.map +1 -1
- package/lib/utils/errors.mjs.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/index.mjs +2 -0
- package/lib/utils/index.mjs.map +1 -1
- package/lib/utils/measures.js +1 -0
- package/lib/utils/measures.js.map +1 -1
- package/lib/utils/measures.mjs +1 -0
- package/lib/utils/measures.mjs.map +1 -1
- package/lib/utils/money/format.js.map +1 -1
- package/lib/utils/money/format.mjs.map +1 -1
- package/lib/utils/money/misc.js +1 -1
- package/lib/utils/money/misc.js.map +1 -1
- package/lib/utils/money/misc.mjs +1 -1
- package/lib/utils/money/misc.mjs.map +1 -1
- package/lib/utils/nextjs/ssr/transform-css-module.js.map +1 -1
- package/lib/utils/nextjs/ssr/transform-css-module.mjs.map +1 -1
- package/lib/utils/number.js.map +1 -1
- package/lib/utils/number.mjs.map +1 -1
- package/lib/utils/product.js +4 -4
- package/lib/utils/product.js.map +1 -1
- package/lib/utils/product.mjs +4 -4
- package/lib/utils/product.mjs.map +1 -1
- package/lib/utils/sales.d.ts +34 -0
- package/lib/utils/sales.js +113 -0
- package/lib/utils/sales.js.map +1 -0
- package/lib/utils/sales.mjs +99 -0
- package/lib/utils/sales.mjs.map +1 -0
- package/lib/utils/sales.test.d.ts +1 -0
- package/lib/utils/tags.js +2 -2
- package/lib/utils/tags.js.map +1 -1
- package/lib/utils/tags.mjs +2 -2
- package/lib/utils/tags.mjs.map +1 -1
- package/package.json +1 -1
- package/lib/helpers/ux.js +0 -53
- package/lib/helpers/ux.js.map +0 -1
- package/lib/helpers/ux.mjs +0 -49
- package/lib/helpers/ux.mjs.map +0 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dayjs = require('dayjs');
|
|
4
|
+
var duration = require('dayjs/plugin/duration');
|
|
5
|
+
var timezone = require('dayjs/plugin/timezone');
|
|
6
|
+
var utc = require('dayjs/plugin/utc');
|
|
7
|
+
require('../types/index.js');
|
|
8
|
+
var errors = require('./errors.js');
|
|
9
|
+
var generated = require('../types/generated.js');
|
|
10
|
+
function _interopDefault(e) {
|
|
11
|
+
return e && e.__esModule ? e : {
|
|
12
|
+
default: e
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
16
|
+
var duration__default = /*#__PURE__*/_interopDefault(duration);
|
|
17
|
+
var timezone__default = /*#__PURE__*/_interopDefault(timezone);
|
|
18
|
+
var utc__default = /*#__PURE__*/_interopDefault(utc);
|
|
19
|
+
"use strict";
|
|
20
|
+
dayjs.extend(timezone__default["default"]);
|
|
21
|
+
dayjs.extend(duration__default["default"]);
|
|
22
|
+
dayjs.extend(utc__default["default"]);
|
|
23
|
+
const getStoreTimeZone = storeId => {
|
|
24
|
+
switch (storeId) {
|
|
25
|
+
case generated.StoreId.Br:
|
|
26
|
+
return {
|
|
27
|
+
label: "UTC-3",
|
|
28
|
+
timezone: "America/Fortaleza"
|
|
29
|
+
};
|
|
30
|
+
case generated.StoreId.Uk:
|
|
31
|
+
return {
|
|
32
|
+
label: "GMT",
|
|
33
|
+
timezone: "Etc/GMT"
|
|
34
|
+
};
|
|
35
|
+
case generated.StoreId.Eu:
|
|
36
|
+
case generated.StoreId.Za:
|
|
37
|
+
return {
|
|
38
|
+
label: "EET",
|
|
39
|
+
timezone: "EET"
|
|
40
|
+
};
|
|
41
|
+
case generated.StoreId.Me:
|
|
42
|
+
return {
|
|
43
|
+
label: "GST",
|
|
44
|
+
timezone: "Asia/Dubai"
|
|
45
|
+
};
|
|
46
|
+
case generated.StoreId.Sg:
|
|
47
|
+
return {
|
|
48
|
+
label: "SGT",
|
|
49
|
+
timezone: "Asia/Singapore"
|
|
50
|
+
};
|
|
51
|
+
case generated.StoreId.Tw:
|
|
52
|
+
return {
|
|
53
|
+
label: "CST",
|
|
54
|
+
timezone: "Asia/Shanghai"
|
|
55
|
+
};
|
|
56
|
+
case generated.StoreId.Jp:
|
|
57
|
+
return {
|
|
58
|
+
label: "JST",
|
|
59
|
+
timezone: "Asia/Tokyo"
|
|
60
|
+
};
|
|
61
|
+
case generated.StoreId.Ca:
|
|
62
|
+
case generated.StoreId.Us:
|
|
63
|
+
return {
|
|
64
|
+
label: "PST",
|
|
65
|
+
timezone: "US/Pacific"
|
|
66
|
+
};
|
|
67
|
+
case generated.StoreId.Mx:
|
|
68
|
+
return {
|
|
69
|
+
label: "CST",
|
|
70
|
+
timezone: "America/Mexico_City"
|
|
71
|
+
};
|
|
72
|
+
case generated.StoreId.In:
|
|
73
|
+
return {
|
|
74
|
+
label: "IST",
|
|
75
|
+
timezone: "Asia/Kolkata"
|
|
76
|
+
};
|
|
77
|
+
case generated.StoreId.Ph:
|
|
78
|
+
return {
|
|
79
|
+
label: "PHT",
|
|
80
|
+
timezone: "Asia/Manila"
|
|
81
|
+
};
|
|
82
|
+
default:
|
|
83
|
+
errors.checkUnreachable(storeId);
|
|
84
|
+
return {
|
|
85
|
+
label: "PST",
|
|
86
|
+
timezone: "US/Pacific"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const getSaleEndMethod = saleEndDatetime => storeId => {
|
|
91
|
+
const {
|
|
92
|
+
timezone: storeTimezone
|
|
93
|
+
} = getStoreTimeZone(storeId);
|
|
94
|
+
const now = dayjs__default["default"]().tz(storeTimezone);
|
|
95
|
+
const endOfSaleDatetime = dayjs__default["default"].tz(saleEndDatetime, storeTimezone);
|
|
96
|
+
if (now.isAfter(endOfSaleDatetime)) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const diff = dayjs__default["default"].duration(endOfSaleDatetime.diff(now));
|
|
100
|
+
return {
|
|
101
|
+
days: diff.days(),
|
|
102
|
+
hours: diff.hours(),
|
|
103
|
+
minutes: diff.minutes(),
|
|
104
|
+
seconds: diff.seconds()
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
const getTimeUntilEndOfBlackFridayByStore = getSaleEndMethod("2024-12-02 23:59:59");
|
|
108
|
+
const getTimeUntilEndOfHolidaySaleByStore = getSaleEndMethod("2024-12-27 23:59:59");
|
|
109
|
+
exports.getSaleEndMethod = getSaleEndMethod;
|
|
110
|
+
exports.getStoreTimeZone = getStoreTimeZone;
|
|
111
|
+
exports.getTimeUntilEndOfBlackFridayByStore = getTimeUntilEndOfBlackFridayByStore;
|
|
112
|
+
exports.getTimeUntilEndOfHolidaySaleByStore = getTimeUntilEndOfHolidaySaleByStore;
|
|
113
|
+
//# sourceMappingURL=sales.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sales.js","sources":["../../src/utils/sales.ts"],"sourcesContent":["import dayjs, { extend } from \"dayjs\";\nimport duration from \"dayjs/plugin/duration\";\nimport timezone from \"dayjs/plugin/timezone\";\nimport utc from \"dayjs/plugin/utc\";\n\nimport { StoreId } from \"../types\";\nimport { checkUnreachable } from \"./errors\";\n\nextend(timezone);\nextend(duration);\nextend(utc);\n\n/**\n * Returns label and timezone for a given store according\n * to IANA timezone database\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n */\nexport const getStoreTimeZone = (\n storeId: StoreId,\n): {\n label: string;\n timezone: string;\n} => {\n switch (storeId) {\n case StoreId.Br:\n return {\n label: \"UTC-3\",\n timezone: \"America/Fortaleza\",\n };\n case StoreId.Uk:\n return {\n label: \"GMT\",\n timezone: \"Etc/GMT\",\n };\n case StoreId.Eu:\n case StoreId.Za:\n return {\n label: \"EET\",\n timezone: \"EET\",\n };\n case StoreId.Me:\n return {\n label: \"GST\",\n timezone: \"Asia/Dubai\",\n };\n case StoreId.Sg:\n return {\n label: \"SGT\",\n timezone: \"Asia/Singapore\",\n };\n case StoreId.Tw:\n return {\n label: \"CST\",\n timezone: \"Asia/Shanghai\",\n };\n case StoreId.Jp:\n return {\n label: \"JST\",\n timezone: \"Asia/Tokyo\",\n };\n case StoreId.Ca:\n case StoreId.Us:\n return {\n label: \"PST\",\n timezone: \"US/Pacific\",\n };\n case StoreId.Mx:\n return {\n label: \"CST\",\n timezone: \"America/Mexico_City\",\n };\n case StoreId.In:\n return {\n label: \"IST\",\n timezone: \"Asia/Kolkata\",\n };\n case StoreId.Ph:\n return {\n label: \"PHT\",\n timezone: \"Asia/Manila\",\n };\n default:\n checkUnreachable(storeId);\n // Fallback to US/CA timezone\n return {\n label: \"PST\",\n timezone: \"US/Pacific\",\n };\n }\n};\n\nexport interface TimeLeft {\n days: number;\n hours: number;\n minutes: number;\n seconds: number;\n}\n\nexport type SaleEndMethod = (storeId: StoreId) => TimeLeft | null;\n\n/**\n * Returns the time left until the end of the sale for a given store\n * @returns {SaleEndMethod} TimeLeft object if the sale is still active, null otherwise\n */\nexport const getSaleEndMethod =\n (saleEndDatetime: string): SaleEndMethod =>\n (storeId: StoreId): TimeLeft | null => {\n const { timezone: storeTimezone } = getStoreTimeZone(storeId);\n\n const now = dayjs().tz(storeTimezone); // Current time in the store's timezone\n\n const endOfSaleDatetime = dayjs.tz(saleEndDatetime, storeTimezone); // The sale's end datetime in the store's timezone\n\n // If it is passed the end of sale datetime, return null\n if (now.isAfter(endOfSaleDatetime)) {\n return null;\n }\n\n const diff = dayjs.duration(endOfSaleDatetime.diff(now));\n\n return {\n days: diff.days(),\n hours: diff.hours(),\n minutes: diff.minutes(),\n seconds: diff.seconds(),\n };\n };\n\n// #############################################################################\n// Sales methods\n// #############################################################################\n/**\n * Black Friday Sale\n * Returns the time left until the end of Black Friday for a given store\n * @returns {TimeLeft | null} TimeLeft object if it is still Black Friday, null otherwise\n */\nexport const getTimeUntilEndOfBlackFridayByStore = getSaleEndMethod(\n \"2024-12-02 23:59:59\",\n);\n\n/**\n * Holiday Sale\n * Returns the time left until the end of Holiday Sale for a given store\n * @returns {TimeLeft | null} TimeLeft object if it is still Holiday Sale, null otherwise\n */\nexport const getTimeUntilEndOfHolidaySaleByStore = getSaleEndMethod(\n \"2024-12-27 23:59:59\",\n);\n"],"names":["extend","timezone","duration","utc","getStoreTimeZone","storeId","StoreId","Br","label","Uk","Eu","Za","Me","Sg","Tw","Jp","Ca","Us","Mx","In","Ph","checkUnreachable","getSaleEndMethod","saleEndDatetime","storeTimezone","now","dayjs","tz","endOfSaleDatetime","isAfter","diff","days","hours","minutes","seconds","getTimeUntilEndOfBlackFridayByStore","getTimeUntilEndOfHolidaySaleByStore"],"mappings":";;;;;;;;;;;;;;;;;;;AAQAA,KAAA,CAAAA,MAAA,CAAOC,iBAAQ,CAAA,SAAA,CAAA,CAAA;AACfD,KAAA,CAAAA,MAAA,CAAOE,iBAAQ,CAAA,SAAA,CAAA,CAAA;AACfF,KAAA,CAAAA,MAAA,CAAOG,YAAG,CAAA,SAAA,CAAA,CAAA;AAOG,MAAAC,gBAAA,GACXC,OAIG,IAAA;EACH,QAAQA,OAAS;IACf,KAAKC,SAAQ,CAAAA,OAAA,CAAAC,EAAA;MACJ,OAAA;QACLC,KAAO,EAAA,OAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,SAAQ,CAAAA,OAAA,CAAAG,EAAA;MACJ,OAAA;QACLD,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,SAAAA,CAAAA,OAAQ,CAAAI,EAAA;IACb,KAAKJ,SAAQ,CAAAA,OAAA,CAAAK,EAAA;MACJ,OAAA;QACLH,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,SAAQ,CAAAA,OAAA,CAAAM,EAAA;MACJ,OAAA;QACLJ,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,SAAQ,CAAAA,OAAA,CAAAO,EAAA;MACJ,OAAA;QACLL,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MA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CAAAD,iBAAiB,CAAG,EAAA;IAC3B,OAAA,IAAA;EACT;EAEA,MAAME,OAAOJ,cAAAA,CAAAA,SAAAA,CAAM,CAAAxB,QAAA,CAAS0B,iBAAkB,CAAAE,IAAA,CAAKL,GAAG,CAAC,CAAA;EAEhD,OAAA;IACLM,IAAA,EAAMD,KAAKC,IAAK,CAAA,CAAA;IAChBC,KAAA,EAAOF,KAAKE,KAAM,CAAA,CAAA;IAClBC,OAAA,EAASH,KAAKG,OAAQ,CAAA,CAAA;IACtBC,OAAA,EAASJ,KAAKI,OAAQ,CAAA;EAAA,CACxB;AACF,CAAA;AAUK,MAAMC,mCAAsC,GAAAb,gBAAA,CACjD,qBACF,CAAA;AAOO,MAAMc,mCAAsC,GAAAd,gBAAA,CACjD,qBACF,CAAA;;;;"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import dayjs, { extend } from 'dayjs';
|
|
2
|
+
import duration from 'dayjs/plugin/duration';
|
|
3
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
4
|
+
import utc from 'dayjs/plugin/utc';
|
|
5
|
+
import '../types/index.mjs';
|
|
6
|
+
import { checkUnreachable } from './errors.mjs';
|
|
7
|
+
import { StoreId } from '../types/generated.mjs';
|
|
8
|
+
"use strict";
|
|
9
|
+
extend(timezone);
|
|
10
|
+
extend(duration);
|
|
11
|
+
extend(utc);
|
|
12
|
+
const getStoreTimeZone = storeId => {
|
|
13
|
+
switch (storeId) {
|
|
14
|
+
case StoreId.Br:
|
|
15
|
+
return {
|
|
16
|
+
label: "UTC-3",
|
|
17
|
+
timezone: "America/Fortaleza"
|
|
18
|
+
};
|
|
19
|
+
case StoreId.Uk:
|
|
20
|
+
return {
|
|
21
|
+
label: "GMT",
|
|
22
|
+
timezone: "Etc/GMT"
|
|
23
|
+
};
|
|
24
|
+
case StoreId.Eu:
|
|
25
|
+
case StoreId.Za:
|
|
26
|
+
return {
|
|
27
|
+
label: "EET",
|
|
28
|
+
timezone: "EET"
|
|
29
|
+
};
|
|
30
|
+
case StoreId.Me:
|
|
31
|
+
return {
|
|
32
|
+
label: "GST",
|
|
33
|
+
timezone: "Asia/Dubai"
|
|
34
|
+
};
|
|
35
|
+
case StoreId.Sg:
|
|
36
|
+
return {
|
|
37
|
+
label: "SGT",
|
|
38
|
+
timezone: "Asia/Singapore"
|
|
39
|
+
};
|
|
40
|
+
case StoreId.Tw:
|
|
41
|
+
return {
|
|
42
|
+
label: "CST",
|
|
43
|
+
timezone: "Asia/Shanghai"
|
|
44
|
+
};
|
|
45
|
+
case StoreId.Jp:
|
|
46
|
+
return {
|
|
47
|
+
label: "JST",
|
|
48
|
+
timezone: "Asia/Tokyo"
|
|
49
|
+
};
|
|
50
|
+
case StoreId.Ca:
|
|
51
|
+
case StoreId.Us:
|
|
52
|
+
return {
|
|
53
|
+
label: "PST",
|
|
54
|
+
timezone: "US/Pacific"
|
|
55
|
+
};
|
|
56
|
+
case StoreId.Mx:
|
|
57
|
+
return {
|
|
58
|
+
label: "CST",
|
|
59
|
+
timezone: "America/Mexico_City"
|
|
60
|
+
};
|
|
61
|
+
case StoreId.In:
|
|
62
|
+
return {
|
|
63
|
+
label: "IST",
|
|
64
|
+
timezone: "Asia/Kolkata"
|
|
65
|
+
};
|
|
66
|
+
case StoreId.Ph:
|
|
67
|
+
return {
|
|
68
|
+
label: "PHT",
|
|
69
|
+
timezone: "Asia/Manila"
|
|
70
|
+
};
|
|
71
|
+
default:
|
|
72
|
+
checkUnreachable(storeId);
|
|
73
|
+
return {
|
|
74
|
+
label: "PST",
|
|
75
|
+
timezone: "US/Pacific"
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const getSaleEndMethod = saleEndDatetime => storeId => {
|
|
80
|
+
const {
|
|
81
|
+
timezone: storeTimezone
|
|
82
|
+
} = getStoreTimeZone(storeId);
|
|
83
|
+
const now = dayjs().tz(storeTimezone);
|
|
84
|
+
const endOfSaleDatetime = dayjs.tz(saleEndDatetime, storeTimezone);
|
|
85
|
+
if (now.isAfter(endOfSaleDatetime)) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
const diff = dayjs.duration(endOfSaleDatetime.diff(now));
|
|
89
|
+
return {
|
|
90
|
+
days: diff.days(),
|
|
91
|
+
hours: diff.hours(),
|
|
92
|
+
minutes: diff.minutes(),
|
|
93
|
+
seconds: diff.seconds()
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const getTimeUntilEndOfBlackFridayByStore = getSaleEndMethod("2024-12-02 23:59:59");
|
|
97
|
+
const getTimeUntilEndOfHolidaySaleByStore = getSaleEndMethod("2024-12-27 23:59:59");
|
|
98
|
+
export { getSaleEndMethod, getStoreTimeZone, getTimeUntilEndOfBlackFridayByStore, getTimeUntilEndOfHolidaySaleByStore };
|
|
99
|
+
//# sourceMappingURL=sales.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sales.mjs","sources":["../../src/utils/sales.ts"],"sourcesContent":["import dayjs, { extend } from \"dayjs\";\nimport duration from \"dayjs/plugin/duration\";\nimport timezone from \"dayjs/plugin/timezone\";\nimport utc from \"dayjs/plugin/utc\";\n\nimport { StoreId } from \"../types\";\nimport { checkUnreachable } from \"./errors\";\n\nextend(timezone);\nextend(duration);\nextend(utc);\n\n/**\n * Returns label and timezone for a given store according\n * to IANA timezone database\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n */\nexport const getStoreTimeZone = (\n storeId: StoreId,\n): {\n label: string;\n timezone: string;\n} => {\n switch (storeId) {\n case StoreId.Br:\n return {\n label: \"UTC-3\",\n timezone: \"America/Fortaleza\",\n };\n case StoreId.Uk:\n return {\n label: \"GMT\",\n timezone: \"Etc/GMT\",\n };\n case StoreId.Eu:\n case StoreId.Za:\n return {\n label: \"EET\",\n timezone: \"EET\",\n };\n case StoreId.Me:\n return {\n label: \"GST\",\n timezone: \"Asia/Dubai\",\n };\n case StoreId.Sg:\n return {\n label: \"SGT\",\n timezone: \"Asia/Singapore\",\n };\n case StoreId.Tw:\n return {\n label: \"CST\",\n timezone: \"Asia/Shanghai\",\n };\n case StoreId.Jp:\n return {\n label: \"JST\",\n timezone: \"Asia/Tokyo\",\n };\n case StoreId.Ca:\n case StoreId.Us:\n return {\n label: \"PST\",\n timezone: \"US/Pacific\",\n };\n case StoreId.Mx:\n return {\n label: \"CST\",\n timezone: \"America/Mexico_City\",\n };\n case StoreId.In:\n return {\n label: \"IST\",\n timezone: \"Asia/Kolkata\",\n };\n case StoreId.Ph:\n return {\n label: \"PHT\",\n timezone: \"Asia/Manila\",\n };\n default:\n checkUnreachable(storeId);\n // Fallback to US/CA timezone\n return {\n label: \"PST\",\n timezone: \"US/Pacific\",\n };\n }\n};\n\nexport interface TimeLeft {\n days: number;\n hours: number;\n minutes: number;\n seconds: number;\n}\n\nexport type SaleEndMethod = (storeId: StoreId) => TimeLeft | null;\n\n/**\n * Returns the time left until the end of the sale for a given store\n * @returns {SaleEndMethod} TimeLeft object if the sale is still active, null otherwise\n */\nexport const getSaleEndMethod =\n (saleEndDatetime: string): SaleEndMethod =>\n (storeId: StoreId): TimeLeft | null => {\n const { timezone: storeTimezone } = getStoreTimeZone(storeId);\n\n const now = dayjs().tz(storeTimezone); // Current time in the store's timezone\n\n const endOfSaleDatetime = dayjs.tz(saleEndDatetime, storeTimezone); // The sale's end datetime in the store's timezone\n\n // If it is passed the end of sale datetime, return null\n if (now.isAfter(endOfSaleDatetime)) {\n return null;\n }\n\n const diff = dayjs.duration(endOfSaleDatetime.diff(now));\n\n return {\n days: diff.days(),\n hours: diff.hours(),\n minutes: diff.minutes(),\n seconds: diff.seconds(),\n };\n };\n\n// #############################################################################\n// Sales methods\n// #############################################################################\n/**\n * Black Friday Sale\n * Returns the time left until the end of Black Friday for a given store\n * @returns {TimeLeft | null} TimeLeft object if it is still Black Friday, null otherwise\n */\nexport const getTimeUntilEndOfBlackFridayByStore = getSaleEndMethod(\n \"2024-12-02 23:59:59\",\n);\n\n/**\n * Holiday Sale\n * Returns the time left until the end of Holiday Sale for a given store\n * @returns {TimeLeft | null} TimeLeft object if it is still Holiday Sale, null otherwise\n */\nexport const getTimeUntilEndOfHolidaySaleByStore = getSaleEndMethod(\n \"2024-12-27 23:59:59\",\n);\n"],"names":["extend","timezone","duration","utc","getStoreTimeZone","storeId","StoreId","Br","label","Uk","Eu","Za","Me","Sg","Tw","Jp","Ca","Us","Mx","In","Ph","checkUnreachable","getSaleEndMethod","saleEndDatetime","storeTimezone","now","dayjs","tz","endOfSaleDatetime","isAfter","diff","days","hours","minutes","seconds","getTimeUntilEndOfBlackFridayByStore","getTimeUntilEndOfHolidaySaleByStore"],"mappings":";;;;;;;;AAQAA,MAAA,CAAOC,QAAQ,CAAA;AACfD,MAAA,CAAOE,QAAQ,CAAA;AACfF,MAAA,CAAOG,GAAG,CAAA;AAOG,MAAAC,gBAAA,GACXC,OAIG,IAAA;EACH,QAAQA,OAAS;IACf,KAAKC,OAAQ,CAAAC,EAAA;MACJ,OAAA;QACLC,KAAO,EAAA,OAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,OAAQ,CAAAG,EAAA;MACJ,OAAA;QACLD,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,OAAQ,CAAAI,EAAA;IACb,KAAKJ,OAAQ,CAAAK,EAAA;MACJ,OAAA;QACLH,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,OAAQ,CAAAM,EAAA;MACJ,OAAA;QACLJ,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,OAAQ,CAAAO,EAAA;MACJ,OAAA;QACLL,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,OAAQ,CAAAQ,EAAA;MACJ,OAAA;QACLN,KAAO,EAAA,KAAA;QACPP,QAAU,EAAA;MAAA,CACZ;IACF,KAAKK,OAAQ,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AAKG,OAAQ,CAAA,CAAA;IACtBC,OAAA,EAASJ,KAAKI,OAAQ,CAAA;EAAA,CACxB;AACF,CAAA;AAUK,MAAMC,mCAAsC,GAAAb,gBAAA,CACjD,qBACF,CAAA;AAOO,MAAMc,mCAAsC,GAAAd,gBAAA,CACjD,qBACF,CAAA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/utils/tags.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
const formatTag = str => {
|
|
5
5
|
let formattedString = str.trim();
|
|
6
6
|
formattedString = formattedString.replaceAll(/\s/g, ":");
|
|
7
|
-
formattedString = formattedString.replaceAll(/[^a-zA-Z0-
|
|
7
|
+
formattedString = formattedString.replaceAll(/[^a-zA-Z0-9:-]/g, "").toLowerCase();
|
|
8
8
|
formattedString = formattedString.replace(/[:|-]+/g, match => match.charAt(0));
|
|
9
|
-
return formattedString.
|
|
9
|
+
return formattedString.replace(/^[:-]+/, "").replace(/[:-]+$/, "");
|
|
10
10
|
};
|
|
11
11
|
exports.formatTag = formatTag;
|
|
12
12
|
//# sourceMappingURL=tags.js.map
|
package/lib/utils/tags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","sources":["../../src/utils/tags.ts"],"sourcesContent":["export const formatTag = (str: string): string => {\n // Remove leading/trailing whitespace\n let formattedString = str.trim();\n // Replace spaces with \":\"\n formattedString = formattedString.replaceAll(/\\s/g, \":\");\n // Only allow alphanumeric characters and \":\", \"-\"\n formattedString = formattedString\n .replaceAll(/[^a-zA-Z0-
|
|
1
|
+
{"version":3,"file":"tags.js","sources":["../../src/utils/tags.ts"],"sourcesContent":["export const formatTag = (str: string): string => {\n // Remove leading/trailing whitespace\n let formattedString = str.trim();\n // Replace spaces with \":\"\n formattedString = formattedString.replaceAll(/\\s/g, \":\");\n // Only allow alphanumeric characters and \":\", \"-\"\n formattedString = formattedString\n .replaceAll(/[^a-zA-Z0-9:-]/g, \"\")\n .toLowerCase();\n // Replace multiple \":-\" adjacent combinations with the first instance so:\n // \":--\" becomes \":\"\n // \":--:\" becomes \":\"\n // \"-:-:\" becomes \"-\"\n formattedString = formattedString.replace(/[:|-]+/g, (match) =>\n match.charAt(0),\n );\n // Remove leading and trailing \":\", \"-\"\n\n return (\n formattedString\n .replace(/^[:-]+/, \"\")\n // Ignore slow regex warning as this is only called from internal source that are have certain max-length\n // eslint-disable-next-line sonarjs/slow-regex\n .replace(/[:-]+$/, \"\")\n );\n};\n"],"names":["formatTag","str","formattedString","trim","replaceAll","toLowerCase","replace","match","charAt"],"mappings":";;;AAAa,MAAAA,SAAA,GAAaC,GAAwB,IAAA;EAE5C,IAAAC,eAAA,GAAkBD,IAAIE,IAAK,EAAA;EAEbD,eAAA,GAAAA,eAAA,CAAgBE,UAAW,CAAA,KAAA,EAAO,GAAG,CAAA;EAEvDF,eAAA,GAAkBA,eACf,CAAAE,UAAA,CAAW,iBAAmB,EAAA,EAAE,EAChCC,WAAY,EAAA;EAKfH,eAAA,GAAkBA,eAAgB,CAAAI,OAAA,CAAQ,SAAA,EAAYC,KAAA,IACpDA,KAAM,CAAAC,MAAA,CAAO,CAAC,CAAA,CAChB;EAGA,OACEN,gBACGI,OAAQ,CAAA,QAAA,EAAU,EAAE,CAGpB,CAAAA,OAAA,CAAQ,UAAU,EAAE,CAAA;AAE3B,CAAA;"}
|
package/lib/utils/tags.mjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const formatTag = str => {
|
|
4
4
|
let formattedString = str.trim();
|
|
5
5
|
formattedString = formattedString.replaceAll(/\s/g, ":");
|
|
6
|
-
formattedString = formattedString.replaceAll(/[^a-zA-Z0-
|
|
6
|
+
formattedString = formattedString.replaceAll(/[^a-zA-Z0-9:-]/g, "").toLowerCase();
|
|
7
7
|
formattedString = formattedString.replace(/[:|-]+/g, match => match.charAt(0));
|
|
8
|
-
return formattedString.
|
|
8
|
+
return formattedString.replace(/^[:-]+/, "").replace(/[:-]+$/, "");
|
|
9
9
|
};
|
|
10
10
|
export { formatTag };
|
|
11
11
|
//# sourceMappingURL=tags.mjs.map
|
package/lib/utils/tags.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.mjs","sources":["../../src/utils/tags.ts"],"sourcesContent":["export const formatTag = (str: string): string => {\n // Remove leading/trailing whitespace\n let formattedString = str.trim();\n // Replace spaces with \":\"\n formattedString = formattedString.replaceAll(/\\s/g, \":\");\n // Only allow alphanumeric characters and \":\", \"-\"\n formattedString = formattedString\n .replaceAll(/[^a-zA-Z0-
|
|
1
|
+
{"version":3,"file":"tags.mjs","sources":["../../src/utils/tags.ts"],"sourcesContent":["export const formatTag = (str: string): string => {\n // Remove leading/trailing whitespace\n let formattedString = str.trim();\n // Replace spaces with \":\"\n formattedString = formattedString.replaceAll(/\\s/g, \":\");\n // Only allow alphanumeric characters and \":\", \"-\"\n formattedString = formattedString\n .replaceAll(/[^a-zA-Z0-9:-]/g, \"\")\n .toLowerCase();\n // Replace multiple \":-\" adjacent combinations with the first instance so:\n // \":--\" becomes \":\"\n // \":--:\" becomes \":\"\n // \"-:-:\" becomes \"-\"\n formattedString = formattedString.replace(/[:|-]+/g, (match) =>\n match.charAt(0),\n );\n // Remove leading and trailing \":\", \"-\"\n\n return (\n formattedString\n .replace(/^[:-]+/, \"\")\n // Ignore slow regex warning as this is only called from internal source that are have certain max-length\n // eslint-disable-next-line sonarjs/slow-regex\n .replace(/[:-]+$/, \"\")\n );\n};\n"],"names":["formatTag","str","formattedString","trim","replaceAll","toLowerCase","replace","match","charAt"],"mappings":";;AAAa,MAAAA,SAAA,GAAaC,GAAwB,IAAA;EAE5C,IAAAC,eAAA,GAAkBD,IAAIE,IAAK,EAAA;EAEbD,eAAA,GAAAA,eAAA,CAAgBE,UAAW,CAAA,KAAA,EAAO,GAAG,CAAA;EAEvDF,eAAA,GAAkBA,eACf,CAAAE,UAAA,CAAW,iBAAmB,EAAA,EAAE,EAChCC,WAAY,EAAA;EAKfH,eAAA,GAAkBA,eAAgB,CAAAI,OAAA,CAAQ,SAAA,EAAYC,KAAA,IACpDA,KAAM,CAAAC,MAAA,CAAO,CAAC,CAAA,CAChB;EAGA,OACEN,gBACGI,OAAQ,CAAA,QAAA,EAAU,EAAE,CAGpB,CAAAA,OAAA,CAAQ,UAAU,EAAE,CAAA;AAE3B,CAAA;"}
|
package/package.json
CHANGED
package/lib/helpers/ux.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
const SCROLL_INTO_VIEW_DEFAULT_DURATION = 600;
|
|
5
|
-
const scrollToY = (targetY, duration) => {
|
|
6
|
-
let start;
|
|
7
|
-
let previousTimeStamp;
|
|
8
|
-
const initY = window.scrollY;
|
|
9
|
-
const limit = document.documentElement.scrollHeight - document.documentElement.clientHeight;
|
|
10
|
-
function step(timestamp) {
|
|
11
|
-
if (start === void 0) {
|
|
12
|
-
start = timestamp;
|
|
13
|
-
}
|
|
14
|
-
const elapsed = timestamp - start;
|
|
15
|
-
const progress = (timestamp - start) / duration;
|
|
16
|
-
if (previousTimeStamp !== timestamp) {
|
|
17
|
-
window.scroll({
|
|
18
|
-
top: ((targetY > limit ? limit : targetY) - initY) * progress + initY
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
if (elapsed < duration) {
|
|
22
|
-
previousTimeStamp = timestamp;
|
|
23
|
-
window.requestAnimationFrame(step);
|
|
24
|
-
} else {
|
|
25
|
-
window.scroll({
|
|
26
|
-
top: targetY
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
window.requestAnimationFrame(step);
|
|
31
|
-
};
|
|
32
|
-
const scrollIntoView = (element, duration = SCROLL_INTO_VIEW_DEFAULT_DURATION) => {
|
|
33
|
-
if (typeof window === "undefined") return;
|
|
34
|
-
if (!element) return;
|
|
35
|
-
const elementWindowY = element.getBoundingClientRect().top + window.scrollY;
|
|
36
|
-
const y = elementWindowY - window.innerHeight * (1 / 3);
|
|
37
|
-
scrollToY(y, duration);
|
|
38
|
-
};
|
|
39
|
-
function styledSwitch(value, cases) {
|
|
40
|
-
return cases[value];
|
|
41
|
-
}
|
|
42
|
-
const getTrueOffsetY = el => {
|
|
43
|
-
let offset = el.offsetTop;
|
|
44
|
-
if (el.parentElement) {
|
|
45
|
-
offset += getTrueOffsetY(el.parentElement);
|
|
46
|
-
}
|
|
47
|
-
return offset;
|
|
48
|
-
};
|
|
49
|
-
exports.getTrueOffsetY = getTrueOffsetY;
|
|
50
|
-
exports.scrollIntoView = scrollIntoView;
|
|
51
|
-
exports.scrollToY = scrollToY;
|
|
52
|
-
exports.styledSwitch = styledSwitch;
|
|
53
|
-
//# sourceMappingURL=ux.js.map
|
package/lib/helpers/ux.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ux.js","sources":["../../src/helpers/ux.ts"],"sourcesContent":["import type { FlattenSimpleInterpolation } from \"styled-components\";\n\nconst SCROLL_INTO_VIEW_DEFAULT_DURATION = 600;\n\n/**\n * Same as `window.scrollTo` but allows custom duration\n *\n * ! The scroll action won't be replaced if called multiple times\n * ? Instead `useScrollToY` hook will do that if needed\n */\nexport const scrollToY = (targetY: number, duration: number) => {\n let start: number;\n let previousTimeStamp: number;\n const initY = window.scrollY;\n const limit =\n document.documentElement.scrollHeight -\n document.documentElement.clientHeight;\n\n function step(timestamp: number) {\n if (start === undefined) {\n start = timestamp;\n }\n const elapsed = timestamp - start;\n const progress = (timestamp - start) / duration;\n\n if (previousTimeStamp !== timestamp) {\n window.scroll({\n top: ((targetY > limit ? limit : targetY) - initY) * progress + initY,\n });\n }\n\n if (elapsed < duration) {\n previousTimeStamp = timestamp;\n window.requestAnimationFrame(step);\n } else {\n window.scroll({\n top: targetY,\n });\n }\n }\n\n window.requestAnimationFrame(step);\n};\n\n/**\n * Scrolls to the element on the page\n *\n * ! This will scroll the entire page, do not use for inline scrolling\n *\n * @todo use Element.scrollIntoView() or Element.scrollIntoViewIfNeeded() when it's fully supported\n */\nexport const scrollIntoView = (\n element: Element | null,\n duration = SCROLL_INTO_VIEW_DEFAULT_DURATION,\n) => {\n if (typeof window === \"undefined\") return;\n if (!element) return;\n\n // Get scroll y target position\n const elementWindowY = element.getBoundingClientRect().top + window.scrollY;\n // Scroll to the element minus one third of the window height (so that it's at an optimal eye level)\n const y = elementWindowY - window.innerHeight * (1 / 3);\n\n // Animate\n scrollToY(y, duration);\n};\n\n/**\n * For use in styled components to reduce switch noise\n *\n * @deprecated Let's replace this with native switches - if ain't broke...\n * @example styledSwitch(variableWithMultipleCases, {\n * whenValueIsX: css`background: red;`,\n * whenValueIsY: css`background: blue;`,\n * })\n */\nexport function styledSwitch(\n value: string,\n cases: Record<string, FlattenSimpleInterpolation | string>,\n) {\n return cases[value];\n}\n\n/**\n * Get true page offset Y summing own and all parent offsets\n */\nexport const getTrueOffsetY = (el: HTMLElement) => {\n let offset = el.offsetTop;\n\n if (el.parentElement) {\n offset += getTrueOffsetY(el.parentElement);\n }\n\n return offset;\n};\n"],"names":["SCROLL_INTO_VIEW_DEFAULT_DURATION","scrollToY","targetY","duration","start","previousTimeStamp","initY","window","scrollY","limit","document","documentElement","scrollHeight","clientHeight","step","timestamp","elapsed","progress","scroll","top","requestAnimationFrame","scrollIntoView","element","elementWindowY","getBoundingClientRect","y","innerHeight","styledSwitch","value","cases","getTrueOffsetY","el","offset","offsetTop","parentElement"],"mappings":";;;AAEA,MAAMA,iCAAoC,GAAA,GAAA;AAQ7B,MAAAC,SAAA,GAAYA,CAACC,OAAA,EAAiBC,QAAqB,KAAA;EAC1D,IAAAC,KAAA;EACA,IAAAC,iBAAA;EACJ,MAAMC,QAAQC,MAAO,CAAAC,OAAA;EACrB,MAAMC,KACJ,GAAAC,QAAA,CAASC,eAAgB,CAAAC,YAAA,GACzBF,SAASC,eAAgB,CAAAE,YAAA;EAE3B,SAASC,KAAKC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AGG,aAAa,CAAA;EAC3C;EAEO,OAAAF,MAAA;AACT,CAAA;;;;"}
|
package/lib/helpers/ux.mjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const SCROLL_INTO_VIEW_DEFAULT_DURATION = 600;
|
|
4
|
-
const scrollToY = (targetY, duration) => {
|
|
5
|
-
let start;
|
|
6
|
-
let previousTimeStamp;
|
|
7
|
-
const initY = window.scrollY;
|
|
8
|
-
const limit = document.documentElement.scrollHeight - document.documentElement.clientHeight;
|
|
9
|
-
function step(timestamp) {
|
|
10
|
-
if (start === void 0) {
|
|
11
|
-
start = timestamp;
|
|
12
|
-
}
|
|
13
|
-
const elapsed = timestamp - start;
|
|
14
|
-
const progress = (timestamp - start) / duration;
|
|
15
|
-
if (previousTimeStamp !== timestamp) {
|
|
16
|
-
window.scroll({
|
|
17
|
-
top: ((targetY > limit ? limit : targetY) - initY) * progress + initY
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
if (elapsed < duration) {
|
|
21
|
-
previousTimeStamp = timestamp;
|
|
22
|
-
window.requestAnimationFrame(step);
|
|
23
|
-
} else {
|
|
24
|
-
window.scroll({
|
|
25
|
-
top: targetY
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
window.requestAnimationFrame(step);
|
|
30
|
-
};
|
|
31
|
-
const scrollIntoView = (element, duration = SCROLL_INTO_VIEW_DEFAULT_DURATION) => {
|
|
32
|
-
if (typeof window === "undefined") return;
|
|
33
|
-
if (!element) return;
|
|
34
|
-
const elementWindowY = element.getBoundingClientRect().top + window.scrollY;
|
|
35
|
-
const y = elementWindowY - window.innerHeight * (1 / 3);
|
|
36
|
-
scrollToY(y, duration);
|
|
37
|
-
};
|
|
38
|
-
function styledSwitch(value, cases) {
|
|
39
|
-
return cases[value];
|
|
40
|
-
}
|
|
41
|
-
const getTrueOffsetY = el => {
|
|
42
|
-
let offset = el.offsetTop;
|
|
43
|
-
if (el.parentElement) {
|
|
44
|
-
offset += getTrueOffsetY(el.parentElement);
|
|
45
|
-
}
|
|
46
|
-
return offset;
|
|
47
|
-
};
|
|
48
|
-
export { getTrueOffsetY, scrollIntoView, scrollToY, styledSwitch };
|
|
49
|
-
//# sourceMappingURL=ux.mjs.map
|
package/lib/helpers/ux.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ux.mjs","sources":["../../src/helpers/ux.ts"],"sourcesContent":["import type { FlattenSimpleInterpolation } from \"styled-components\";\n\nconst SCROLL_INTO_VIEW_DEFAULT_DURATION = 600;\n\n/**\n * Same as `window.scrollTo` but allows custom duration\n *\n * ! The scroll action won't be replaced if called multiple times\n * ? Instead `useScrollToY` hook will do that if needed\n */\nexport const scrollToY = (targetY: number, duration: number) => {\n let start: number;\n let previousTimeStamp: number;\n const initY = window.scrollY;\n const limit =\n document.documentElement.scrollHeight -\n document.documentElement.clientHeight;\n\n function step(timestamp: number) {\n if (start === undefined) {\n start = timestamp;\n }\n const elapsed = timestamp - start;\n const progress = (timestamp - start) / duration;\n\n if (previousTimeStamp !== timestamp) {\n window.scroll({\n top: ((targetY > limit ? limit : targetY) - initY) * progress + initY,\n });\n }\n\n if (elapsed < duration) {\n previousTimeStamp = timestamp;\n window.requestAnimationFrame(step);\n } else {\n window.scroll({\n top: targetY,\n });\n }\n }\n\n window.requestAnimationFrame(step);\n};\n\n/**\n * Scrolls to the element on the page\n *\n * ! This will scroll the entire page, do not use for inline scrolling\n *\n * @todo use Element.scrollIntoView() or Element.scrollIntoViewIfNeeded() when it's fully supported\n */\nexport const scrollIntoView = (\n element: Element | null,\n duration = SCROLL_INTO_VIEW_DEFAULT_DURATION,\n) => {\n if (typeof window === \"undefined\") return;\n if (!element) return;\n\n // Get scroll y target position\n const elementWindowY = element.getBoundingClientRect().top + window.scrollY;\n // Scroll to the element minus one third of the window height (so that it's at an optimal eye level)\n const y = elementWindowY - window.innerHeight * (1 / 3);\n\n // Animate\n scrollToY(y, duration);\n};\n\n/**\n * For use in styled components to reduce switch noise\n *\n * @deprecated Let's replace this with native switches - if ain't broke...\n * @example styledSwitch(variableWithMultipleCases, {\n * whenValueIsX: css`background: red;`,\n * whenValueIsY: css`background: blue;`,\n * })\n */\nexport function styledSwitch(\n value: string,\n cases: Record<string, FlattenSimpleInterpolation | string>,\n) {\n return cases[value];\n}\n\n/**\n * Get true page offset Y summing own and all parent offsets\n */\nexport const getTrueOffsetY = (el: HTMLElement) => {\n let offset = el.offsetTop;\n\n if (el.parentElement) {\n offset += getTrueOffsetY(el.parentElement);\n }\n\n return offset;\n};\n"],"names":["SCROLL_INTO_VIEW_DEFAULT_DURATION","scrollToY","targetY","duration","start","previousTimeStamp","initY","window","scrollY","limit","document","documentElement","scrollHeight","clientHeight","step","timestamp","elapsed","progress","scroll","top","requestAnimationFrame","scrollIntoView","element","elementWindowY","getBoundingClientRect","y","innerHeight","styledSwitch","value","cases","getTrueOffsetY","el","offset","offsetTop","parentElement"],"mappings":";;AAEA,MAAMA,iCAAoC,GAAA,GAAA;AAQ7B,MAAAC,SAAA,GAAYA,CAACC,OAAA,EAAiBC,QAAqB,KAAA;EAC1D,IAAAC,KAAA;EACA,IAAAC,iBAAA;EACJ,MAAMC,QAAQC,MAAO,CAAAC,OAAA;EACrB,MAAMC,KACJ,GAAAC,QAAA,CAASC,eAAgB,CAAAC,YAAA,GACzBF,SAASC,eAAgB,CAAAE,YAAA;EAE3B,SAASC,KAAKC,SAAmB,EAAA;IAC/B,IAAIX,UAAU,KAAW,CAAA,EAAA;MACfA,KAAA,GAAAW,SAAA;IACV;IACA,MAAMC,UAAUD,SAAY,GAAAX,KAAA;IACtB,MAAAa,QAAA,GAAA,CAAYF,YAAYX,KAAS,IAAAD,QAAA;IAEvC,IAAIE,sBAAsBU,SAAW,EAAA;MACnCR,MAAA,CAAOW,MAAO,CAAA;QACZC,OAAOjB,OAAU,GAAAO,KAAA,GAAQA,KAAQ,GAAAP,O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