@ubnt/store.core 9.38.0 → 9.38.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.
- package/CHANGELOG.md +8 -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/assets/attention.svg +5 -5
- package/lib/assets/attention2.svg +5 -5
- package/lib/assets/close2.svg +3 -2
- package/lib/assets/close3.svg +2 -3
- package/lib/assets/plus2.svg +4 -1
- package/lib/assets/plus3.svg +1 -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/Badge/Badge.styles.js +11 -0
- package/lib/components/Badge/Badge.styles.js.map +1 -1
- package/lib/components/Badge/Badge.styles.mjs +11 -0
- package/lib/components/Badge/Badge.styles.mjs.map +1 -1
- package/lib/components/Badge/Badge.types.d.ts +2 -1
- package/lib/components/Badge/Badge.types.js +1 -0
- package/lib/components/Badge/Badge.types.js.map +1 -1
- package/lib/components/Badge/Badge.types.mjs +1 -0
- package/lib/components/Badge/Badge.types.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/AllFeaturesButton/AllFeaturesButton.js +1 -1
- package/lib/components/FeaturesSection_deprecated/AllFeaturesButton/AllFeaturesButton.mjs +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/close.svg.js +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/close.svg.mjs +2 -2
- package/lib/components/FeaturesSection_deprecated/assets/plus.svg.js +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/plus.svg.mjs +2 -2
- package/lib/components/Header/CartModalV2/Item/Item.js +3 -3
- package/lib/components/Header/CartModalV2/Item/Item.mjs +2 -2
- 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/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/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/VideoPlayerNew/VideoPlayer.js +1 -1
- package/lib/components/VideoPlayerNew/VideoPlayer.mjs +1 -1
- package/lib/components/VideoPlayerNew/assets/close.svg.js +1 -1
- package/lib/components/VideoPlayerNew/assets/close.svg.mjs +2 -2
- package/lib/constants/icons/generic/index.js +3 -3
- package/lib/constants/icons/generic/index.mjs +1 -1
- package/lib/constants/icons/generic/plus.svg.js +5 -5
- package/lib/constants/icons/generic/plus.svg.mjs +2 -2
- package/lib/utils/blackFriday.d.ts +20 -0
- package/lib/utils/blackFriday.js +88 -0
- package/lib/utils/blackFriday.js.map +1 -0
- package/lib/utils/blackFriday.mjs +76 -0
- package/lib/utils/blackFriday.mjs.map +1 -0
- package/lib/utils/blackFriday.test.d.ts +1 -0
- 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/package.json +2 -1
|
@@ -0,0 +1,88 @@
|
|
|
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 generated = require('../types/generated.js');
|
|
9
|
+
function _interopDefault(e) {
|
|
10
|
+
return e && e.__esModule ? e : {
|
|
11
|
+
default: e
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
15
|
+
var duration__default = /*#__PURE__*/_interopDefault(duration);
|
|
16
|
+
var timezone__default = /*#__PURE__*/_interopDefault(timezone);
|
|
17
|
+
var utc__default = /*#__PURE__*/_interopDefault(utc);
|
|
18
|
+
"use strict";
|
|
19
|
+
dayjs.extend(timezone__default["default"]);
|
|
20
|
+
dayjs.extend(duration__default["default"]);
|
|
21
|
+
dayjs.extend(utc__default["default"]);
|
|
22
|
+
const getStoreTimeZone = storeId => {
|
|
23
|
+
switch (storeId) {
|
|
24
|
+
case generated.StoreId.Br:
|
|
25
|
+
return {
|
|
26
|
+
label: "UTC-3",
|
|
27
|
+
timezone: "America/Fortaleza"
|
|
28
|
+
};
|
|
29
|
+
case generated.StoreId.Uk:
|
|
30
|
+
return {
|
|
31
|
+
label: "GMT",
|
|
32
|
+
timezone: "Etc/GMT"
|
|
33
|
+
};
|
|
34
|
+
case generated.StoreId.Eu:
|
|
35
|
+
case generated.StoreId.Za:
|
|
36
|
+
return {
|
|
37
|
+
label: "EET",
|
|
38
|
+
timezone: "EET"
|
|
39
|
+
};
|
|
40
|
+
case generated.StoreId.Me:
|
|
41
|
+
return {
|
|
42
|
+
label: "GST",
|
|
43
|
+
timezone: "Asia/Dubai"
|
|
44
|
+
};
|
|
45
|
+
case generated.StoreId.Sg:
|
|
46
|
+
return {
|
|
47
|
+
label: "SGT",
|
|
48
|
+
timezone: "Asia/Singapore"
|
|
49
|
+
};
|
|
50
|
+
case generated.StoreId.Tw:
|
|
51
|
+
return {
|
|
52
|
+
label: "CST",
|
|
53
|
+
timezone: "Asia/Shanghai"
|
|
54
|
+
};
|
|
55
|
+
case generated.StoreId.Jp:
|
|
56
|
+
return {
|
|
57
|
+
label: "JST",
|
|
58
|
+
timezone: "Asia/Tokyo"
|
|
59
|
+
};
|
|
60
|
+
case generated.StoreId.Ca:
|
|
61
|
+
case generated.StoreId.Us:
|
|
62
|
+
default:
|
|
63
|
+
return {
|
|
64
|
+
label: "PST",
|
|
65
|
+
timezone: "US/Pacific"
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const getTimeUntilEndOfBlackFridayByStore = storeId => {
|
|
70
|
+
const {
|
|
71
|
+
timezone: storeTimezone
|
|
72
|
+
} = getStoreTimeZone(storeId);
|
|
73
|
+
const now = dayjs__default["default"]().tz(storeTimezone);
|
|
74
|
+
const endOfBlackFriday = dayjs__default["default"].tz("2024-12-02 23:59:59", storeTimezone);
|
|
75
|
+
if (now.isAfter(endOfBlackFriday)) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const diff = dayjs__default["default"].duration(endOfBlackFriday.diff(now));
|
|
79
|
+
return {
|
|
80
|
+
days: diff.days(),
|
|
81
|
+
hours: diff.hours(),
|
|
82
|
+
minutes: diff.minutes(),
|
|
83
|
+
seconds: diff.seconds()
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
exports.getStoreTimeZone = getStoreTimeZone;
|
|
87
|
+
exports.getTimeUntilEndOfBlackFridayByStore = getTimeUntilEndOfBlackFridayByStore;
|
|
88
|
+
//# sourceMappingURL=blackFriday.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blackFriday.js","sources":["../../src/utils/blackFriday.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\";\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 */\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 default:\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\n/**\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 = (\n storeId: StoreId,\n): 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 endOfBlackFriday = dayjs.tz(\"2024-12-02 23:59:59\", storeTimezone); // Black Friday end in the store's timezone\n\n // If it is passed the end of Black Friday, return null\n if (now.isAfter(endOfBlackFriday)) {\n return null;\n }\n\n const diff = dayjs.duration(endOfBlackFriday.diff(now));\n\n return {\n days: diff.days(),\n hours: diff.hours(),\n minutes: diff.minutes(),\n seconds: diff.seconds(),\n };\n};\n"],"names":["extend","timezone","duration","utc","getStoreTimeZone","storeId","StoreId","Br","label","Uk","Eu","Za","Me","Sg","Tw","Jp","Ca","Us","getTimeUntilEndOfBlackFridayByStore","storeTimezone","now","dayjs","tz","endOfBlackFriday","isAfter","diff","days","hours","minutes","seconds"],"mappings":";;;;;;;;;;;;;;;;;;AAOAA,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;AAMG,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;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OAAOJ,cAAAA,CAAAA,SAAAA,CAAM,CAAAnB,QAAA,CAASqB,gBAAiB,CAAAE,IAAA,CAAKL,GAAG,CAAC,CAAA;EAE/C,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;;"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { StoreId } from '../types/generated.mjs';
|
|
7
|
+
"use strict";
|
|
8
|
+
extend(timezone);
|
|
9
|
+
extend(duration);
|
|
10
|
+
extend(utc);
|
|
11
|
+
const getStoreTimeZone = storeId => {
|
|
12
|
+
switch (storeId) {
|
|
13
|
+
case StoreId.Br:
|
|
14
|
+
return {
|
|
15
|
+
label: "UTC-3",
|
|
16
|
+
timezone: "America/Fortaleza"
|
|
17
|
+
};
|
|
18
|
+
case StoreId.Uk:
|
|
19
|
+
return {
|
|
20
|
+
label: "GMT",
|
|
21
|
+
timezone: "Etc/GMT"
|
|
22
|
+
};
|
|
23
|
+
case StoreId.Eu:
|
|
24
|
+
case StoreId.Za:
|
|
25
|
+
return {
|
|
26
|
+
label: "EET",
|
|
27
|
+
timezone: "EET"
|
|
28
|
+
};
|
|
29
|
+
case StoreId.Me:
|
|
30
|
+
return {
|
|
31
|
+
label: "GST",
|
|
32
|
+
timezone: "Asia/Dubai"
|
|
33
|
+
};
|
|
34
|
+
case StoreId.Sg:
|
|
35
|
+
return {
|
|
36
|
+
label: "SGT",
|
|
37
|
+
timezone: "Asia/Singapore"
|
|
38
|
+
};
|
|
39
|
+
case StoreId.Tw:
|
|
40
|
+
return {
|
|
41
|
+
label: "CST",
|
|
42
|
+
timezone: "Asia/Shanghai"
|
|
43
|
+
};
|
|
44
|
+
case StoreId.Jp:
|
|
45
|
+
return {
|
|
46
|
+
label: "JST",
|
|
47
|
+
timezone: "Asia/Tokyo"
|
|
48
|
+
};
|
|
49
|
+
case StoreId.Ca:
|
|
50
|
+
case StoreId.Us:
|
|
51
|
+
default:
|
|
52
|
+
return {
|
|
53
|
+
label: "PST",
|
|
54
|
+
timezone: "US/Pacific"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const getTimeUntilEndOfBlackFridayByStore = storeId => {
|
|
59
|
+
const {
|
|
60
|
+
timezone: storeTimezone
|
|
61
|
+
} = getStoreTimeZone(storeId);
|
|
62
|
+
const now = dayjs().tz(storeTimezone);
|
|
63
|
+
const endOfBlackFriday = dayjs.tz("2024-12-02 23:59:59", storeTimezone);
|
|
64
|
+
if (now.isAfter(endOfBlackFriday)) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const diff = dayjs.duration(endOfBlackFriday.diff(now));
|
|
68
|
+
return {
|
|
69
|
+
days: diff.days(),
|
|
70
|
+
hours: diff.hours(),
|
|
71
|
+
minutes: diff.minutes(),
|
|
72
|
+
seconds: diff.seconds()
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export { getStoreTimeZone, getTimeUntilEndOfBlackFridayByStore };
|
|
76
|
+
//# sourceMappingURL=blackFriday.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blackFriday.mjs","sources":["../../src/utils/blackFriday.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\";\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 */\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 default:\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\n/**\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 = (\n storeId: StoreId,\n): 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 endOfBlackFriday = dayjs.tz(\"2024-12-02 23:59:59\", storeTimezone); // Black Friday end in the store's timezone\n\n // If it is passed the end of Black Friday, return null\n if (now.isAfter(endOfBlackFriday)) {\n return null;\n }\n\n const diff = dayjs.duration(endOfBlackFriday.diff(now));\n\n return {\n days: diff.days(),\n hours: diff.hours(),\n minutes: diff.minutes(),\n seconds: diff.seconds(),\n };\n};\n"],"names":["extend","timezone","duration","utc","getStoreTimeZone","storeId","StoreId","Br","label","Uk","Eu","Za","Me","Sg","Tw","Jp","Ca","Us","getTimeUntilEndOfBlackFridayByStore","stor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e,GAAM,GAAAC,KAAA,CAAA,CAAQ,CAAAC,EAAA,CAAGH,aAAa,CAAA;EAEpC,MAAMI,gBAAmB,GAAAF,KAAA,CAAMC,EAAG,CAAA,qBAAA,EAAuBH,aAAa,CAAA;EAGlE,IAAAC,GAAA,CAAII,OAAQ,CAAAD,gBAAgB,CAAG,EAAA;IAC1B,OAAA,IAAA;EACT;EAEA,MAAME,OAAOJ,KAAM,CAAAnB,QAAA,CAASqB,gBAAiB,CAAAE,IAAA,CAAKL,GAAG,CAAC,CAAA;EAE/C,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;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var asset$1 = require('./asset.js');
|
|
|
22
22
|
var imageOptimizer$1 = require('./imageOptimizer.js');
|
|
23
23
|
var styles$1 = require('./styles.js');
|
|
24
24
|
var storeId$1 = require('./storeId.js');
|
|
25
|
+
var blackFriday$1 = require('./blackFriday.js');
|
|
25
26
|
"use strict";
|
|
26
27
|
exports.url = url$1;
|
|
27
28
|
exports.money = misc;
|
|
@@ -45,4 +46,5 @@ exports.asset = asset$1;
|
|
|
45
46
|
exports.imageOptimizer = imageOptimizer$1;
|
|
46
47
|
exports.styles = styles$1;
|
|
47
48
|
exports.storeId = storeId$1;
|
|
49
|
+
exports.blackFriday = blackFriday$1;
|
|
48
50
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/utils/index.mjs
CHANGED
|
@@ -42,5 +42,7 @@ import * as styles$1 from './styles.mjs';
|
|
|
42
42
|
export { styles$1 as styles };
|
|
43
43
|
import * as storeId$1 from './storeId.mjs';
|
|
44
44
|
export { storeId$1 as storeId };
|
|
45
|
+
import * as blackFriday$1 from './blackFriday.mjs';
|
|
46
|
+
export { blackFriday$1 as blackFriday };
|
|
45
47
|
"use strict";
|
|
46
48
|
//# sourceMappingURL=index.mjs.map
|
package/lib/utils/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubnt/store.core",
|
|
3
|
-
"version": "9.38.
|
|
3
|
+
"version": "9.38.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"scripts": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"big.js": "^6.2.2",
|
|
34
34
|
"convert-units": "3.0.0-beta.5",
|
|
35
35
|
"countup.js": "^2.6.2",
|
|
36
|
+
"dayjs": "1.11.13",
|
|
36
37
|
"dinero.js": "2.0.0-alpha.8",
|
|
37
38
|
"intl-messageformat": "^10.5.14",
|
|
38
39
|
"libphonenumber-js": "^1.11.15",
|