@ancon/wildcat-utils 1.31.3 → 1.31.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/card/getWalletCardStatus.d.ts +3 -2
- package/card/getWalletCardStatus.js +1 -1
- package/card/getWalletCardStatus.mjs +10 -5
- package/card/types.d.ts +2 -1
- package/card/types.js +1 -1
- package/card/types.mjs +2 -2
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { CardStatus } from './types';
|
|
|
3
3
|
* Decides wallet card status
|
|
4
4
|
* @param {String} expiryDate Expire date of the wallet
|
|
5
5
|
* @param {Number} balanceAmount Current balance of the wallet
|
|
6
|
-
* @
|
|
6
|
+
* @param {Number} daysToWarnExpiry Number of days to warn expiry
|
|
7
|
+
* @returns {String} Wallet card status ['expired' | 'closed' | 'valid'| 'aboutToExpire'']
|
|
7
8
|
*/
|
|
8
|
-
export default function getWalletCardStatus(expiryDate?: string, balanceAmount?: number): CardStatus;
|
|
9
|
+
export default function getWalletCardStatus(expiryDate?: string, balanceAmount?: number, daysToWarnExpiry?: number): CardStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const i=require("moment"),n=require("./isCardExpired.js"),t=require("./types.js");function u(r,s=0,e){if(r?n(r):!1)return t.CardStatus.Expired;if(s===0)return t.CardStatus.Closed;const d=i(r).diff(i(),"day");return e&&d<=e?t.CardStatus.AboutToExpire:t.CardStatus.Valid}module.exports=u;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i from "moment";
|
|
2
|
+
import n from "./isCardExpired.mjs";
|
|
2
3
|
import { CardStatus as r } from "./types.mjs";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
function a(t, o = 0, e) {
|
|
5
|
+
if (t ? n(t) : !1)
|
|
6
|
+
return r.Expired;
|
|
7
|
+
if (o === 0)
|
|
8
|
+
return r.Closed;
|
|
9
|
+
const f = i(t).diff(i(), "day");
|
|
10
|
+
return e && f <= e ? r.AboutToExpire : r.Valid;
|
|
6
11
|
}
|
|
7
12
|
export {
|
|
8
|
-
|
|
13
|
+
a as default
|
|
9
14
|
};
|
package/card/types.d.ts
CHANGED
package/card/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var o=(e=>(e[e.Expired=0]="Expired",e[e.Closed=1]="Closed",e[e.Valid=2]="Valid",e[e.AboutToExpire=3]="AboutToExpire",e))(o||{});exports.CardStatus=o;
|
package/card/types.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var o = /* @__PURE__ */ ((e) => (e[e.Expired = 0] = "Expired", e[e.Closed = 1] = "Closed", e[e.Valid = 2] = "Valid", e[e.AboutToExpire = 3] = "AboutToExpire", e))(o || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
o as CardStatus
|
|
4
4
|
};
|