@getsoren/shared-module 2.71.0 → 2.71.1

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/dist/events.js CHANGED
@@ -438,7 +438,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
438
438
  return d.test(t) ? Number(t) : null;
439
439
  }, p = (e, t) => {
440
440
  let n = f(t.amount);
441
- return !e.price || e.amountGate && !t.amountGate || !n ? null : e.hasCreditNoteChoice ? t.isCreditNote ? -Math.abs(n) : Math.abs(n) : e.price === "credit" ? -Math.abs(n) : n;
441
+ return !e.price || e.amountGate && !t.amountGate || n === null ? null : n === 0 ? e.suggestsDailyShare ? 0 : null : e.hasCreditNoteChoice ? t.isCreditNote ? -Math.abs(n) : Math.abs(n) : e.price === "credit" ? -Math.abs(n) : n;
442
442
  }, m = (e, t, n) => {
443
443
  let { fromDate: r, toDate: i } = t.dates, a = e ? p(e, t) : null, o = e?.dates === "range" && r !== i ? n : 1;
444
444
  return {
@@ -11,7 +11,8 @@ export interface EventAmounts {
11
11
  export declare const toDecimal: (text: string) => number | null;
12
12
  /**
13
13
  * Null without a price, behind a gate answered no, or while no amount is typed, zero being none; a credit, typed
14
- * positive, is sent negative, and so is a sum the user says is taken off.
14
+ * positive, is sent negative, and so is a sum the user says is taken off. Zero is an amount where the credit is a share
15
+ * of the daily price: a supplier who bills the days in full takes nothing off, which is an answer and not a blank.
15
16
  */
16
17
  export declare const getUnitPrice: (event: EventDefinition, answers: Pick<EventAnswers, "amount" | "amountGate" | "isCreditNote">) => number | null;
17
18
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getsoren/shared-module",
3
- "version": "2.71.0",
3
+ "version": "2.71.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "types": "./dist/main.d.ts",