@ancon/wildcat-utils 1.51.0-check-optimizations.3 → 1.51.0-check-optimizations.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CheckDetailsV2 } from '@ancon/wildcat-types';
|
|
2
2
|
/**
|
|
3
3
|
* This creates localized check details by replacing following properties with localized values based on current app language.
|
|
4
4
|
* Affected properties on each check item (and its sub-items):
|
|
@@ -12,5 +12,5 @@ import { CheckDetails } from '@ancon/wildcat-types';
|
|
|
12
12
|
* @param locale - locale to be used for localization
|
|
13
13
|
* @returns localized check details
|
|
14
14
|
*/
|
|
15
|
-
declare function createLocalizedCheckDetails(checkDetails:
|
|
15
|
+
declare function createLocalizedCheckDetails(checkDetails: CheckDetailsV2, locale: string): CheckDetailsV2;
|
|
16
16
|
export default createLocalizedCheckDetails;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const r=require("@ancon/wildcat-types");function d(e){switch(e){case"sv":return r.IETFLanguageTag.Swedish;case"nb":return r.IETFLanguageTag.Norwegian;case"en":return r.IETFLanguageTag.English;default:return null}}function s(e,a){var t,i;if(e){const c=e,n=(t=e.localizedProductNames)==null?void 0:t[a],o=(i=e.localizedVariantNames)==null?void 0:i[a];return n&&(c.productName=n),o&&(c.variantName=o),c}return e}function m(e,a){var n,o;const t=e,i=(n=e.localizedNames)==null?void 0:n[a],c=(o=e.localizedReplacementNames)==null?void 0:o[a];return i&&(t.name=i),c&&(t.replacementName=c),t}function z(e,a){const t=e;return t.product=s(e.product,a),t}function u(e,a){const t=e,{product:i,modifications:c,addOnProducts:n,subCheckItems:o}=e;return t.product=s(i,a),c!=null&&c.length&&(t.modifications=c.map(l=>m(l,a))),n!=null&&n.length&&(t.addOnProducts=n==null?void 0:n.map(l=>z(l,a))),o!=null&&o.length&&(t.subCheckItems=o.map(l=>u(l,a))),t}function f(e,a){var i;const t=d(a);if(t){const c=e;return c.items=(i=e.items)==null?void 0:i.map(n=>u(n,t)),c}return e}module.exports=f;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IETFLanguageTag as r } from "@ancon/wildcat-types";
|
|
2
|
-
function
|
|
2
|
+
function m(e) {
|
|
3
3
|
switch (e) {
|
|
4
4
|
case "sv":
|
|
5
5
|
return r.Swedish;
|
|
@@ -11,43 +11,47 @@ function u(e) {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
function u(e, a) {
|
|
15
|
+
var t, i;
|
|
16
|
+
if (e) {
|
|
17
|
+
const c = e, n = (t = e.localizedProductNames) == null ? void 0 : t[a], o = (i = e.localizedVariantNames) == null ? void 0 : i[a];
|
|
18
|
+
return n && (c.productName = n), o && (c.variantName = o), c;
|
|
19
|
+
}
|
|
20
|
+
return e;
|
|
18
21
|
}
|
|
19
|
-
function
|
|
20
|
-
var
|
|
21
|
-
const t = e,
|
|
22
|
-
return
|
|
22
|
+
function s(e, a) {
|
|
23
|
+
var n, o;
|
|
24
|
+
const t = e, i = (n = e.localizedNames) == null ? void 0 : n[a], c = (o = e.localizedReplacementNames) == null ? void 0 : o[a];
|
|
25
|
+
return i && (t.name = i), c && (t.replacementName = c), t;
|
|
23
26
|
}
|
|
24
|
-
function f(e,
|
|
27
|
+
function f(e, a) {
|
|
25
28
|
const t = e;
|
|
26
|
-
return t.product =
|
|
29
|
+
return t.product = u(
|
|
27
30
|
e.product,
|
|
28
|
-
|
|
31
|
+
a
|
|
29
32
|
), t;
|
|
30
33
|
}
|
|
31
|
-
function
|
|
32
|
-
const t = e, { product:
|
|
33
|
-
return t.product =
|
|
34
|
-
(l) =>
|
|
35
|
-
)),
|
|
36
|
-
(l) => f(l,
|
|
37
|
-
)),
|
|
38
|
-
(l) =>
|
|
34
|
+
function d(e, a) {
|
|
35
|
+
const t = e, { product: i, modifications: c, addOnProducts: n, subCheckItems: o } = e;
|
|
36
|
+
return t.product = u(i, a), c != null && c.length && (t.modifications = c.map(
|
|
37
|
+
(l) => s(l, a)
|
|
38
|
+
)), n != null && n.length && (t.addOnProducts = n == null ? void 0 : n.map(
|
|
39
|
+
(l) => f(l, a)
|
|
40
|
+
)), o != null && o.length && (t.subCheckItems = o.map(
|
|
41
|
+
(l) => d(l, a)
|
|
39
42
|
)), t;
|
|
40
43
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
44
|
+
function N(e, a) {
|
|
45
|
+
var i;
|
|
46
|
+
const t = m(a);
|
|
43
47
|
if (t) {
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
(
|
|
47
|
-
),
|
|
48
|
+
const c = e;
|
|
49
|
+
return c.items = (i = e.items) == null ? void 0 : i.map(
|
|
50
|
+
(n) => d(n, t)
|
|
51
|
+
), c;
|
|
48
52
|
}
|
|
49
53
|
return e;
|
|
50
54
|
}
|
|
51
55
|
export {
|
|
52
|
-
|
|
56
|
+
N as default
|
|
53
57
|
};
|