@onereach/billing-shared 11.32.2-beta.2830.0 → 11.32.2-beta.2838.0

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,19 +1,9 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
5
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./math"), exports);
18
- __exportStar(require("./date"), exports);
6
+ exports.roundToTwoDecimals = void 0;
7
+ var roundToTwoDecimals_1 = require("./roundToTwoDecimals");
8
+ Object.defineProperty(exports, "roundToTwoDecimals", { enumerable: true, get: function () { return __importDefault(roundToTwoDecimals_1).default; } });
19
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAqE;AAA5D,yIAAA,OAAO,OAAsB"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = roundToTwoDecimals;
4
+ function roundToTwoDecimals(value) {
5
+ return Math.round(value * 100) / 100;
6
+ }
7
+ //# sourceMappingURL=roundToTwoDecimals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToTwoDecimals.js","sourceRoot":"","sources":["../../../src/utils/roundToTwoDecimals.ts"],"names":[],"mappings":";;AAGA,qCAEC;AAFD,SAAwB,kBAAkB,CAAC,KAAa;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
@@ -1,3 +1,2 @@
1
- export * from './math';
2
- export * from './date';
1
+ export { default as roundToTwoDecimals } from './roundToTwoDecimals';
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export default function roundToTwoDecimals(value) {
2
+ return Math.round(value * 100) / 100;
3
+ }
4
+ //# sourceMappingURL=roundToTwoDecimals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToTwoDecimals.js","sourceRoot":"","sources":["../../../src/utils/roundToTwoDecimals.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAa;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
@@ -1,3 +1,2 @@
1
- export * from './math';
2
- export * from './date';
1
+ export { default as roundToTwoDecimals } from './roundToTwoDecimals';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function roundToTwoDecimals(value: number): number;
2
+ //# sourceMappingURL=roundToTwoDecimals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToTwoDecimals.d.ts","sourceRoot":"","sources":["../../../src/utils/roundToTwoDecimals.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/billing-shared",
3
- "version": "11.32.2-beta.2830.0",
3
+ "version": "11.32.2-beta.2838.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,2 +1 @@
1
- export * from './math';
2
- export * from './date';
1
+ export { default as roundToTwoDecimals } from './roundToTwoDecimals';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Rounds a number to 2 decimal places
3
+ */
4
+ export default function roundToTwoDecimals(value: number): number {
5
+ return Math.round(value * 100) / 100;
6
+ }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatDateToString = formatDateToString;
4
- function formatDateToString(date) {
5
- var targetDate = date || new Date();
6
- return targetDate.toISOString().split('T')[0];
7
- }
8
- //# sourceMappingURL=date.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":";;AASA,gDAGC;AAHD,SAAgB,kBAAkB,CAAC,IAAW;IAC5C,IAAM,UAAU,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;IACtC,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.round = round;
4
- exports.roundToTwoDecimals = roundToTwoDecimals;
5
- function round(value, decimalPlaces) {
6
- if (decimalPlaces === void 0) { decimalPlaces = 2; }
7
- if (!Number.isFinite(value)) {
8
- return value;
9
- }
10
- if (!Number.isInteger(decimalPlaces) || decimalPlaces < 0) {
11
- throw new Error('decimalPlaces must be a non-negative integer');
12
- }
13
- var multiplier = Math.pow(10, decimalPlaces);
14
- return Math.round(value * multiplier) / multiplier;
15
- }
16
- function roundToTwoDecimals(value) {
17
- return round(value, 2);
18
- }
19
- //# sourceMappingURL=math.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math.js","sourceRoot":"","sources":["../../../src/utils/math.ts"],"names":[],"mappings":";;AAUA,sBAWC;AAWD,gDAEC;AAxBD,SAAgB,KAAK,CAAC,KAAa,EAAE,aAAyB;IAAzB,8BAAA,EAAA,iBAAyB;IAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,IAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;AACrD,CAAC;AAWD,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC"}
@@ -1,5 +0,0 @@
1
- export function formatDateToString(date) {
2
- const targetDate = date || new Date();
3
- return targetDate.toISOString().split('T')[0];
4
- }
5
- //# sourceMappingURL=date.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,kBAAkB,CAAC,IAAW;IAC5C,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;IACtC,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
@@ -1,14 +0,0 @@
1
- export function round(value, decimalPlaces = 2) {
2
- if (!Number.isFinite(value)) {
3
- return value;
4
- }
5
- if (!Number.isInteger(decimalPlaces) || decimalPlaces < 0) {
6
- throw new Error('decimalPlaces must be a non-negative integer');
7
- }
8
- const multiplier = Math.pow(10, decimalPlaces);
9
- return Math.round(value * multiplier) / multiplier;
10
- }
11
- export function roundToTwoDecimals(value) {
12
- return round(value, 2);
13
- }
14
- //# sourceMappingURL=math.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math.js","sourceRoot":"","sources":["../../../src/utils/math.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,gBAAwB,CAAC;IAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;AACrD,CAAC;AAWD,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function formatDateToString(date?: Date): string;
2
- //# sourceMappingURL=date.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AASA,wBAAgB,kBAAkB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAGtD"}
@@ -1,3 +0,0 @@
1
- export declare function round(value: number, decimalPlaces?: number): number;
2
- export declare function roundToTwoDecimals(value: number): number;
3
- //# sourceMappingURL=math.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/utils/math.ts"],"names":[],"mappings":"AAUA,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,GAAE,MAAU,GAAG,MAAM,CAWtE;AAWD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD"}
package/src/utils/date.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * Formats a Date object to YYYY-MM-DD string format
3
- * Uses ISO string format and extracts only the date portion
4
- * @param date The date to format (defaults to current date if not provided)
5
- * @returns Date string in YYYY-MM-DD format
6
- * @example
7
- * formatDateToString() // returns current date like "2024-03-15"
8
- * formatDateToString(new Date(2024, 0, 1)) // returns "2024-01-01"
9
- */
10
- export function formatDateToString(date?: Date): string {
11
- const targetDate = date || new Date();
12
- return targetDate.toISOString().split('T')[0];
13
- }
package/src/utils/math.ts DELETED
@@ -1,35 +0,0 @@
1
- /**
2
- * Rounds a number to a specified number of decimal places
3
- * @param value The number to round
4
- * @param decimalPlaces The number of decimal places to round to (default: 2)
5
- * @returns The rounded number
6
- * @throws Error if decimalPlaces is not a non-negative integer
7
- * @example
8
- * round(3.14159, 2) // returns 3.14
9
- * round(123.456789, 4) // returns 123.4568
10
- */
11
- export function round(value: number, decimalPlaces: number = 2): number {
12
- if (!Number.isFinite(value)) {
13
- return value;
14
- }
15
-
16
- if (!Number.isInteger(decimalPlaces) || decimalPlaces < 0) {
17
- throw new Error('decimalPlaces must be a non-negative integer');
18
- }
19
-
20
- const multiplier = Math.pow(10, decimalPlaces);
21
- return Math.round(value * multiplier) / multiplier;
22
- }
23
-
24
- /**
25
- * Rounds a number to exactly 2 decimal places
26
- * Commonly used for currency calculations in the billing system
27
- * @param value The number to round
28
- * @returns The number rounded to 2 decimal places
29
- * @example
30
- * roundToTwoDecimals(3.14159) // returns 3.14
31
- * roundToTwoDecimals(125.999) // returns 126.00
32
- */
33
- export function roundToTwoDecimals(value: number): number {
34
- return round(value, 2);
35
- }