@ancon/wildcat-utils 1.50.3 → 1.50.5
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 +1 @@
|
|
|
1
|
-
"use strict";const t=require("lodash-es"),n=require("@ancon/wildcat-types"),
|
|
1
|
+
"use strict";const t=require("lodash-es"),n=require("@ancon/wildcat-types"),s=require("../string/getParsedJSONFromString.js");function u(e){const r=s(e);return t.isObject(r)?{cardNumber:r.walletNumber,walletNumberType:n.CardNumberType.AutoGenerated}:{cardNumber:e.trim(),walletNumberType:void 0}}module.exports=u;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isObject as t } from "lodash-es";
|
|
2
|
-
import { CardNumberType as
|
|
2
|
+
import { CardNumberType as m } from "@ancon/wildcat-types";
|
|
3
3
|
import o from "../string/getParsedJSONFromString.mjs";
|
|
4
4
|
function i(e) {
|
|
5
5
|
const r = o(e);
|
|
@@ -9,9 +9,9 @@ function i(e) {
|
|
|
9
9
|
Here we are overwriting the walletNumberType to Virtual
|
|
10
10
|
- Physical cards are exposed to FE as Virtual
|
|
11
11
|
*/
|
|
12
|
-
walletNumberType:
|
|
12
|
+
walletNumberType: m.AutoGenerated
|
|
13
13
|
} : {
|
|
14
|
-
cardNumber: e.
|
|
14
|
+
cardNumber: e.trim(),
|
|
15
15
|
walletNumberType: void 0
|
|
16
16
|
};
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function k
|
|
1
|
+
"use strict";function S(k,l,E){const r=new Map;k.forEach(c=>{var t;(t=c==null?void 0:c.products)==null||t.forEach(o=>{const e=o.selectedVariantId,s=o.selectedCount??0;!!e&&!!s&&r.set(e,(r.get(e)??0)+s)})});const a=new Map;l&&l.forEach(c=>{var t;(t=c.products)==null||t.forEach(o=>{var e;(e=o.variants)==null||e.forEach(s=>{var h;const n=s.id,u=(h=s.outletStocks)==null?void 0:h.find(i=>i.productVariantId===n);if(u){const{stockProductId:i,stockCount:d}=u;!!i&&d!==null&&a.set(n,(a.get(n)??0)+d)}})})});let f=!1;return r.forEach((c,t)=>{if(a.has(t)&&!f){const o=a.get(t);c*E>o&&(f=!0)}}),f}module.exports=S;
|
|
@@ -1,35 +1,40 @@
|
|
|
1
|
-
function k
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
function p(k, i, E) {
|
|
2
|
+
const r = /* @__PURE__ */ new Map();
|
|
3
|
+
k.forEach((c) => {
|
|
4
4
|
var t;
|
|
5
|
-
(t =
|
|
6
|
-
const
|
|
7
|
-
|
|
5
|
+
(t = c == null ? void 0 : c.products) == null || t.forEach((o) => {
|
|
6
|
+
const e = o.selectedVariantId, s = o.selectedCount ?? 0;
|
|
7
|
+
!!e && !!s && r.set(e, (r.get(e) ?? 0) + s);
|
|
8
8
|
});
|
|
9
9
|
});
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const a = /* @__PURE__ */ new Map();
|
|
11
|
+
i && i.forEach((c) => {
|
|
12
12
|
var t;
|
|
13
|
-
(t =
|
|
14
|
-
var
|
|
15
|
-
(
|
|
16
|
-
var
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
u,
|
|
20
|
-
(f.get(u) ?? 0) + a
|
|
13
|
+
(t = c.products) == null || t.forEach((o) => {
|
|
14
|
+
var e;
|
|
15
|
+
(e = o.variants) == null || e.forEach((s) => {
|
|
16
|
+
var d;
|
|
17
|
+
const n = s.id, u = (d = s.outletStocks) == null ? void 0 : d.find(
|
|
18
|
+
(l) => l.productVariantId === n
|
|
21
19
|
);
|
|
20
|
+
if (u) {
|
|
21
|
+
const { stockProductId: l, stockCount: h } = u;
|
|
22
|
+
!!l && h !== null && a.set(
|
|
23
|
+
n,
|
|
24
|
+
(a.get(n) ?? 0) + h
|
|
25
|
+
);
|
|
26
|
+
}
|
|
22
27
|
});
|
|
23
28
|
});
|
|
24
29
|
});
|
|
25
|
-
let
|
|
26
|
-
return
|
|
27
|
-
if (
|
|
28
|
-
const o =
|
|
29
|
-
|
|
30
|
+
let f = !1;
|
|
31
|
+
return r.forEach((c, t) => {
|
|
32
|
+
if (a.has(t) && !f) {
|
|
33
|
+
const o = a.get(t);
|
|
34
|
+
c * E > o && (f = !0);
|
|
30
35
|
}
|
|
31
|
-
}),
|
|
36
|
+
}), f;
|
|
32
37
|
}
|
|
33
38
|
export {
|
|
34
|
-
|
|
39
|
+
p as default
|
|
35
40
|
};
|