@ancon/wildcat-utils 1.50.5 → 1.50.7

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"),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
+ "use strict";const t=require("lodash-es"),n=require("@ancon/wildcat-types"),a=require("../string/getParsedJSONFromString.js");function s(e){const r=a(e);return t.isObject(r)?{cardNumber:r.walletNumber,walletNumberType:n.CardNumberType.AutoGenerated}:{cardNumber:e.replace(/[\D]/gi,""),walletNumberType:void 0}}module.exports=s;
@@ -1,5 +1,5 @@
1
1
  import { isObject as t } from "lodash-es";
2
- import { CardNumberType as m } from "@ancon/wildcat-types";
2
+ import { CardNumberType as a } 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: m.AutoGenerated
12
+ walletNumberType: a.AutoGenerated
13
13
  } : {
14
- cardNumber: e.trim(),
14
+ cardNumber: e.replace(/[\D]/gi, ""),
15
15
  walletNumberType: void 0
16
16
  };
17
17
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@ancon/wildcat-types"),i=require("./getSettingsForOrderFormat.js");var o=(e=>(e[e.Preset1=1]="Preset1",e[e.Preset2=2]="Preset2",e[e.Preset3=3]="Preset3",e))(o||{});function a(e){if(e){const t=[];return e.percentage1Enabled&&t.push({value:e.percentage1Value,preset:1}),e.percentage2Enabled&&t.push({value:e.percentage2Value,preset:2}),e.percentage3Enabled&&t.push({value:e.percentage3Value,preset:3}),t}return[]}function d(e,t){const{orderFormatSettings:s}=e,n=i(t,s);if((r.OrderFormatOption.AOTipEnabled&n.options)===r.OrderFormatOption.AOTipEnabled){const u=(r.OrderFormatOption.AOCustomTipsEnabled&n.options)===r.OrderFormatOption.AOCustomTipsEnabled,l=a(n.aoTippingPercentages);return{aoAllowCustomTipping:u,tipPercentages:l}}return null}exports.TipPercentagePreset=o;exports.default=d;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("@ancon/wildcat-types"),i=require("./getSettingsForOrderFormat.js");var o=(e=>(e[e.Preset1=1]="Preset1",e[e.Preset2=2]="Preset2",e[e.Preset3=3]="Preset3",e))(o||{});function a(e){if(e){const t=[];return e.percentage1Enabled&&t.push({value:e.percentage1Value,preset:1}),e.percentage2Enabled&&t.push({value:e.percentage2Value,preset:2}),e.percentage3Enabled&&t.push({value:e.percentage3Value,preset:3}),t}return[]}function d(e,t){const{orderFormatSettings:s}=e,r=i(t,s);if(r!=null&&(n.OrderFormatOption.AOTipEnabled&r.options)===n.OrderFormatOption.AOTipEnabled){const u=(n.OrderFormatOption.AOCustomTipsEnabled&r.options)===n.OrderFormatOption.AOCustomTipsEnabled,l=a(r.aoTippingPercentages);return{aoAllowCustomTipping:u,tipPercentages:l}}return null}exports.TipPercentagePreset=o;exports.default=d;
@@ -1,5 +1,5 @@
1
- import { OrderFormatOption as r } from "@ancon/wildcat-types";
2
- import l from "./getSettingsForOrderFormat.mjs";
1
+ import { OrderFormatOption as n } from "@ancon/wildcat-types";
2
+ import u from "./getSettingsForOrderFormat.mjs";
3
3
  var a = /* @__PURE__ */ ((t) => (t[t.Preset1 = 1] = "Preset1", t[t.Preset2 = 2] = "Preset2", t[t.Preset3 = 3] = "Preset3", t))(a || {});
4
4
  function i(t) {
5
5
  if (t) {
@@ -21,12 +21,12 @@ function i(t) {
21
21
  return [];
22
22
  }
23
23
  function f(t, e) {
24
- const { orderFormatSettings: o } = t, n = l(e, o);
25
- if ((r.AOTipEnabled & n.options) === r.AOTipEnabled) {
26
- const s = (r.AOCustomTipsEnabled & n.options) === r.AOCustomTipsEnabled, u = i(n.aoTippingPercentages);
24
+ const { orderFormatSettings: o } = t, r = u(e, o);
25
+ if (r != null && (n.AOTipEnabled & r.options) === n.AOTipEnabled) {
26
+ const s = (n.AOCustomTipsEnabled & r.options) === n.AOCustomTipsEnabled, l = i(r.aoTippingPercentages);
27
27
  return {
28
28
  aoAllowCustomTipping: s,
29
- tipPercentages: u
29
+ tipPercentages: l
30
30
  };
31
31
  }
32
32
  return null;
@@ -1,2 +1,2 @@
1
1
  import { OrderFormatSetting, OrderFormat } from '@ancon/wildcat-types';
2
- export default function getSettingsForOrderFormat(orderFormat: OrderFormat, orderFormatSettings?: OrderFormatSetting[]): OrderFormatSetting;
2
+ export default function getSettingsForOrderFormat(orderFormat: OrderFormat, orderFormatSettings?: OrderFormatSetting[]): OrderFormatSetting | undefined;
@@ -1 +1 @@
1
- "use strict";function o(r,t=[]){return t.filter(e=>e.orderFormat===r)[0]}module.exports=o;
1
+ "use strict";function o(r,t=[]){return t.find(e=>e.orderFormat===r)}module.exports=o;
@@ -1,7 +1,7 @@
1
1
  function o(r, t = []) {
2
- return t.filter(
2
+ return t.find(
3
3
  (e) => e.orderFormat === r
4
- )[0];
4
+ );
5
5
  }
6
6
  export {
7
7
  o as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.50.5",
3
+ "version": "1.50.7",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",