@getsoren/shared-module 2.60.1 → 2.61.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.
package/dist/events/types.d.ts
CHANGED
|
@@ -18,7 +18,10 @@ export interface EventEndDate {
|
|
|
18
18
|
question: EventQuestionKey;
|
|
19
19
|
dayHint: EventDayHintKey;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* `credit` takes the days lost off at a daily amount (sent negative), `amount` bills a sum, or takes it off when the
|
|
23
|
+
* event leaves the choice (`hasCreditNoteChoice`).
|
|
24
|
+
*/
|
|
22
25
|
export type EventPriceRule = "credit" | "amount";
|
|
23
26
|
/**
|
|
24
27
|
* A yes/no asked before the amount: whether the client already has the supplier's price (`known`),
|
|
@@ -50,6 +53,11 @@ export interface EventDefinition {
|
|
|
50
53
|
amountGate?: EventAmountGate;
|
|
51
54
|
/** The amount asked can be left empty: the event is then declared without one. */
|
|
52
55
|
hasOptionalAmount?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The sum is billed or taken off the invoice, the user saying which (`answers.isCreditNote`): a credit note is
|
|
58
|
+
* declared like an extra.
|
|
59
|
+
*/
|
|
60
|
+
hasCreditNoteChoice?: boolean;
|
|
53
61
|
/**
|
|
54
62
|
* Most often declared the day it happens: its dates start on today, when the app proposes it.
|
|
55
63
|
*/
|
|
@@ -115,6 +123,11 @@ export interface EventAnswers {
|
|
|
115
123
|
reBillRatio: string;
|
|
116
124
|
/** Answer to the event's `amountGate`, unset until asked. */
|
|
117
125
|
amountGate?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Whether the sum is a credit note, taken off the invoice rather than billed, for an event with
|
|
128
|
+
* `hasCreditNoteChoice`.
|
|
129
|
+
*/
|
|
130
|
+
isCreditNote?: boolean;
|
|
118
131
|
}
|
|
119
132
|
export type EventStep = "kind" | "event" | "reason" | "dates" | "checks" | "fields" | "amountGate" | "amount" | "details";
|
|
120
133
|
/** An event and answers to open the declaration on, from a shortcut or the assistant. */
|
|
@@ -11,9 +11,9 @@ 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.
|
|
14
|
+
* positive, is sent negative, and so is a sum the user says is taken off.
|
|
15
15
|
*/
|
|
16
|
-
export declare const getUnitPrice: (event: EventDefinition, answers: Pick<EventAnswers, "amount" | "amountGate">) => number | null;
|
|
16
|
+
export declare const getUnitPrice: (event: EventDefinition, answers: Pick<EventAnswers, "amount" | "amountGate" | "isCreditNote">) => number | null;
|
|
17
17
|
/**
|
|
18
18
|
* What the event bills. `billableDays` counts the days of a period the line bills (the app knows its calendar).
|
|
19
19
|
* A period of one day counts one whatever the calendar, as the backend bills it, and so does an event without a period.
|
package/dist/events.js
CHANGED
|
@@ -207,6 +207,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
207
207
|
closesOnSubmit: !0,
|
|
208
208
|
dates: "single",
|
|
209
209
|
dayHint: "request",
|
|
210
|
+
hasCreditNoteChoice: !0,
|
|
210
211
|
hasOptionalAmount: !0,
|
|
211
212
|
hasTitle: !0,
|
|
212
213
|
id: "other_request",
|
|
@@ -435,7 +436,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
435
436
|
return d.test(t) ? Number(t) : null;
|
|
436
437
|
}, p = (e, t) => {
|
|
437
438
|
let n = f(t.amount);
|
|
438
|
-
return !e.price || e.amountGate && !t.amountGate || !n ? null : e.price === "credit" ? -Math.abs(n) : n;
|
|
439
|
+
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;
|
|
439
440
|
}, m = (e, t, n) => {
|
|
440
441
|
let { fromDate: r, toDate: i } = t.dates, a = e ? p(e, t) : null, o = e?.dates === "range" && r !== i ? n : 1;
|
|
441
442
|
return {
|
|
@@ -460,17 +461,20 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
460
461
|
...r && t?.price && t.amountGate ? ["amountGate"] : [],
|
|
461
462
|
...r && t?.price && (!t.amountGate || n.amountGate) ? ["amount"] : [],
|
|
462
463
|
...t ? ["details"] : []
|
|
463
|
-
], y = (e, t, n = !1) => e.find((e) => e !== "kind" && e !== "event" && (n || e !== "reason" || !t.reason)) ?? "details", b = (e, t, n) => {
|
|
464
|
+
], y = (e, t, n = !1) => e.find((e) => e !== "kind" && e !== "event" && (n || e !== "reason" || !t.reason)) ?? "details", b = ({ name: e, required: t, type: n }, { fields: r }) => {
|
|
465
|
+
let i = r[e]?.trim() ?? "";
|
|
466
|
+
return i ? n !== "number" || f(i) !== null : !t;
|
|
467
|
+
}, x = (e, t, n) => {
|
|
464
468
|
switch (e) {
|
|
465
469
|
case "reason": return !!n.reason;
|
|
466
470
|
case "dates": return !!(n.dates.fromDate && n.dates.toDate);
|
|
467
|
-
case "fields": return (!t.hasTitle || !!n.title.trim()) && (t.fields ?? []).every((
|
|
471
|
+
case "fields": return (!t.hasTitle || !!n.title.trim()) && (t.fields ?? []).every((e) => b(e, n));
|
|
468
472
|
case "amountGate": return n.amountGate !== void 0;
|
|
469
|
-
case "amount": return !!t.hasOptionalAmount || p(t, n) !== null;
|
|
473
|
+
case "amount": return !!t.hasOptionalAmount && !n.isCreditNote || p(t, n) !== null;
|
|
470
474
|
default: return !0;
|
|
471
475
|
}
|
|
472
|
-
},
|
|
473
|
-
let r =
|
|
476
|
+
}, S = (e, t) => e.hasTitle ? t.title.trim() : e.reasonDetail ? e.reason ?? "" : t.reason || (e.reason ?? ""), C = (e, t, n) => {
|
|
477
|
+
let r = S(e, t);
|
|
474
478
|
if (e.hasTitle) return {
|
|
475
479
|
label: n("values.title"),
|
|
476
480
|
name: a.reason,
|
|
@@ -489,7 +493,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
489
493
|
value: r
|
|
490
494
|
}
|
|
491
495
|
};
|
|
492
|
-
},
|
|
496
|
+
}, w = (e, { dates: { fromDate: t, toDate: n }, reason: r }, i) => {
|
|
493
497
|
let o = _(e, r);
|
|
494
498
|
return t && n ? o ? [{
|
|
495
499
|
label: i(`values.${o.name}`),
|
|
@@ -507,18 +511,18 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
507
511
|
type: "date",
|
|
508
512
|
value: t
|
|
509
513
|
}] : [] : [];
|
|
510
|
-
},
|
|
514
|
+
}, T = (e, t) => {
|
|
511
515
|
let n = e === "number" ? f(t) : null;
|
|
512
516
|
return n === null ? t.trim() : String(n);
|
|
513
|
-
},
|
|
517
|
+
}, E = "dedicated", D = (e, t) => ({
|
|
514
518
|
eventId: t,
|
|
515
|
-
funnel:
|
|
519
|
+
funnel: E,
|
|
516
520
|
side: e,
|
|
517
521
|
source: r,
|
|
518
522
|
version: 2
|
|
519
|
-
}),
|
|
523
|
+
}), O = (e) => typeof e == "object" && !!e && "source" in e && e.source === "soren-event" && "eventId" in e && typeof e.eventId == "string", k = ({ funnel: e, event: t, answers: n, translate: i, bookingItemId: o, withPrice: s, billableDays: c, withReBillRatio: l = e.pricing.asksReBillRatio }) => {
|
|
520
524
|
let { fromDate: u, toDate: d } = n.dates, m = !!(t.dates && u && d) && c !== 0, h = s ? p(t, n) : null, g = f(n.reBillRatio), _ = n.description.trim(), v = t.billingType === "DELTA", y = f(n.fields.quantity ?? ""), b = [
|
|
521
|
-
|
|
525
|
+
C(t, n, i),
|
|
522
526
|
...t.reasonDetail && n.reason ? [{
|
|
523
527
|
label: i(`values.${t.reasonDetail}`),
|
|
524
528
|
name: t.reasonDetail,
|
|
@@ -528,7 +532,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
528
532
|
value: n.reason
|
|
529
533
|
}
|
|
530
534
|
}] : [],
|
|
531
|
-
...
|
|
535
|
+
...w(t, n, i),
|
|
532
536
|
..._ ? [{
|
|
533
537
|
label: i("values.description"),
|
|
534
538
|
name: a.description,
|
|
@@ -546,7 +550,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
546
550
|
label: i(`fields.${e}`),
|
|
547
551
|
name: e,
|
|
548
552
|
type: t,
|
|
549
|
-
value:
|
|
553
|
+
value: T(t, n.fields[e])
|
|
550
554
|
})),
|
|
551
555
|
...t.hasIntervention ? [{
|
|
552
556
|
label: i("values.intervention"),
|
|
@@ -586,7 +590,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
586
590
|
quantity: y
|
|
587
591
|
}
|
|
588
592
|
};
|
|
589
|
-
},
|
|
593
|
+
}, A = {
|
|
590
594
|
amount: "",
|
|
591
595
|
checks: {},
|
|
592
596
|
dates: {
|
|
@@ -599,23 +603,23 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
599
603
|
reason: "",
|
|
600
604
|
reBillRatio: "",
|
|
601
605
|
title: ""
|
|
602
|
-
},
|
|
603
|
-
let [c, l] = t(), [u, d] = t(), [f, p] = t("kind"), [h, _] = t(
|
|
606
|
+
}, j = ({ funnel: n, countBillableDays: r, dailyPrice: i, lastReBillRatio: a = "", isEditing: o = !1, today: s }) => {
|
|
607
|
+
let [c, l] = t(), [u, d] = t(), [f, p] = t("kind"), [h, _] = t(A), [b, S] = t(!1), C = e(() => g(n), [n]), w = C.find(({ id: e }) => e === c), T = w?.events.find(({ id: e }) => e === u), { showsPrice: E, asksReBillRatio: D } = n.pricing, O = m(T, h, T?.dates === "range" ? r(h.dates) : 1), j = E && !!T?.price, M = j && !O.hasNothingToBill, N = v(w, T, h, M), P = N[N.indexOf(f) - 1], F = (e) => _((t) => ({
|
|
604
608
|
...t,
|
|
605
609
|
...e
|
|
606
610
|
})), I = (e) => e.price === "credit" && i ? String(Math.abs(i)) : "", L = (e, t) => {
|
|
607
611
|
let n = v(w, T, t, M);
|
|
608
612
|
return n[n.indexOf(e) + 1] ?? "details";
|
|
609
613
|
}, R = () => {
|
|
610
|
-
l(void 0), d(void 0), p("kind"), _(
|
|
614
|
+
l(void 0), d(void 0), p("kind"), _(A), S(!1);
|
|
611
615
|
}, z = (e, t, n = {}) => {
|
|
612
616
|
let r = {
|
|
613
|
-
...
|
|
617
|
+
...A,
|
|
614
618
|
amount: I(t),
|
|
615
619
|
dates: t.defaultsToToday && s ? {
|
|
616
620
|
fromDate: s,
|
|
617
621
|
toDate: s
|
|
618
|
-
} :
|
|
622
|
+
} : A.dates,
|
|
619
623
|
reason: t.reasons?.length ? "" : t.reason ?? "",
|
|
620
624
|
reBillRatio: D ? a : "",
|
|
621
625
|
...n
|
|
@@ -634,7 +638,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
634
638
|
w && z(w, e);
|
|
635
639
|
}, U = () => p(L(f, h)), W = (e) => {
|
|
636
640
|
let t = T?.endDates && e !== h.reason ? {
|
|
637
|
-
dates:
|
|
641
|
+
dates: A.dates,
|
|
638
642
|
reason: e
|
|
639
643
|
} : { reason: e }, n = {
|
|
640
644
|
...h,
|
|
@@ -656,14 +660,14 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
656
660
|
return;
|
|
657
661
|
}
|
|
658
662
|
p(P);
|
|
659
|
-
}, q = !!T && N.every((e) =>
|
|
663
|
+
}, q = !!T && N.every((e) => x(e, T, h)), J = o && !E && !O.hasNothingToBill;
|
|
660
664
|
return {
|
|
661
|
-
amounts:
|
|
665
|
+
amounts: O,
|
|
662
666
|
answers: h,
|
|
663
667
|
asksAmount: M,
|
|
664
|
-
buildPayload: (e, t) => T && q ?
|
|
668
|
+
buildPayload: (e, t) => T && q ? k({
|
|
665
669
|
answers: h,
|
|
666
|
-
billableDays:
|
|
670
|
+
billableDays: O.billableDays,
|
|
667
671
|
bookingItemId: t,
|
|
668
672
|
event: T,
|
|
669
673
|
funnel: n,
|
|
@@ -671,8 +675,8 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
671
675
|
withPrice: M || J,
|
|
672
676
|
withReBillRatio: D || o
|
|
673
677
|
}) : void 0,
|
|
674
|
-
canGoBack: f !== "kind" && !(
|
|
675
|
-
canGoNext: !!T &&
|
|
678
|
+
canGoBack: f !== "kind" && !(b && (P === "kind" || P === "event")),
|
|
679
|
+
canGoNext: !!T && x(f, T, h),
|
|
676
680
|
event: T,
|
|
677
681
|
goBack: K,
|
|
678
682
|
goNext: U,
|
|
@@ -691,7 +695,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
691
695
|
step: f,
|
|
692
696
|
steps: N
|
|
693
697
|
};
|
|
694
|
-
},
|
|
698
|
+
}, M = {
|
|
695
699
|
ar: {
|
|
696
700
|
checks: {
|
|
697
701
|
ce_conformity: "تم التحقق من شهادة أو إقرار CE",
|
|
@@ -1819,7 +1823,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1819
1823
|
title: "Título do evento"
|
|
1820
1824
|
}
|
|
1821
1825
|
}
|
|
1822
|
-
},
|
|
1826
|
+
}, N = ["companion", "operative"], P = {
|
|
1823
1827
|
...s,
|
|
1824
1828
|
breakage: {
|
|
1825
1829
|
...s.breakage,
|
|
@@ -1857,7 +1861,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1857
1861
|
...s.robbery,
|
|
1858
1862
|
reasons: ["robbery_machine", "robbery_option"]
|
|
1859
1863
|
}
|
|
1860
|
-
},
|
|
1864
|
+
}, F = [
|
|
1861
1865
|
"n1_control",
|
|
1862
1866
|
"other_request",
|
|
1863
1867
|
"breakdown",
|
|
@@ -1875,13 +1879,13 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1875
1879
|
"hours_record",
|
|
1876
1880
|
"robbery",
|
|
1877
1881
|
"other"
|
|
1878
|
-
],
|
|
1882
|
+
], I = [
|
|
1879
1883
|
"n1_control",
|
|
1880
1884
|
"n3_control",
|
|
1881
1885
|
"machine_assignment",
|
|
1882
1886
|
"operator_change",
|
|
1883
1887
|
"hours_record"
|
|
1884
|
-
],
|
|
1888
|
+
], L = [
|
|
1885
1889
|
c.controls,
|
|
1886
1890
|
c.admin_request,
|
|
1887
1891
|
c.machine_problem,
|
|
@@ -1890,81 +1894,88 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1890
1894
|
c.delivery,
|
|
1891
1895
|
c.documents,
|
|
1892
1896
|
c.other
|
|
1893
|
-
],
|
|
1894
|
-
events:
|
|
1895
|
-
groups:
|
|
1897
|
+
], R = {
|
|
1898
|
+
events: F.map((e) => P[e]),
|
|
1899
|
+
groups: L,
|
|
1896
1900
|
id: "bouygues",
|
|
1897
1901
|
pricing: {
|
|
1898
1902
|
asksReBillRatio: !0,
|
|
1899
1903
|
showsPrice: !0
|
|
1900
1904
|
},
|
|
1901
1905
|
side: "client"
|
|
1902
|
-
},
|
|
1903
|
-
events:
|
|
1904
|
-
groups:
|
|
1906
|
+
}, z = {
|
|
1907
|
+
events: F.filter((e) => !I.includes(e)).map((e) => P[e]),
|
|
1908
|
+
groups: L,
|
|
1905
1909
|
id: "bouyguesField",
|
|
1906
1910
|
pricing: {
|
|
1907
1911
|
asksReBillRatio: !1,
|
|
1908
1912
|
showsPrice: !1
|
|
1909
1913
|
},
|
|
1910
1914
|
side: "client"
|
|
1911
|
-
},
|
|
1912
|
-
funnels: [
|
|
1913
|
-
getFunnel: (e) =>
|
|
1915
|
+
}, B = [{
|
|
1916
|
+
funnels: [R, z],
|
|
1917
|
+
getFunnel: (e) => N.includes(e ?? "") ? z : R,
|
|
1914
1918
|
tenants: ["bouygues"]
|
|
1915
|
-
}],
|
|
1919
|
+
}], V = [
|
|
1916
1920
|
l,
|
|
1917
1921
|
u,
|
|
1918
|
-
...
|
|
1919
|
-
],
|
|
1920
|
-
let t =
|
|
1922
|
+
...B.flatMap(({ funnels: e }) => e)
|
|
1923
|
+
], H = ({ side: e, tenantName: t, roleName: n }) => e === "supplier" ? u : B.find(({ tenants: e }) => e.includes(t ?? ""))?.getFunnel(n) ?? l, U = (e) => V.find((t) => t.id === e), W = 10, G = (e) => e.slice(0, W), K = (e) => e.lineType === "booking_events", q = ({ workflowValues: e }, t) => Array.isArray(e) ? e.find((e) => typeof e == "object" && !!e && e.name === t) : void 0, J = (e) => {
|
|
1924
|
+
let t = q(e, a.unitPrice)?.value;
|
|
1921
1925
|
return typeof t == "string" || typeof t == "number" ? f(String(t)) : null;
|
|
1922
|
-
},
|
|
1923
|
-
let
|
|
1924
|
-
return
|
|
1925
|
-
|
|
1926
|
+
}, ee = (e) => {
|
|
1927
|
+
let t = J(e);
|
|
1928
|
+
return t !== null && t < 0 && !!q(e, a.dates);
|
|
1929
|
+
}, te = (e = [], t) => e.filter(K).flatMap((e) => {
|
|
1930
|
+
let [n, r] = e.dates ?? [];
|
|
1931
|
+
return e.id !== t && n && r && ee(e) ? [{
|
|
1932
|
+
fromDate: G(n),
|
|
1926
1933
|
line: e,
|
|
1927
|
-
toDate:
|
|
1934
|
+
toDate: G(r)
|
|
1928
1935
|
}] : [];
|
|
1929
|
-
}),
|
|
1936
|
+
}), ne = (e, t) => t.find(({ fromDate: t, toDate: n }) => G(t) <= G(e) && G(e) <= G(n)), re = ({ fromDate: e, toDate: t }, n) => e && t ? n.find((n) => G(e) <= G(n.toDate) && G(n.fromDate) <= G(t)) : void 0, Y = (e, t) => e.billingType !== "DELTA" || t?.qtyUnit === "HOURS", ie = (e, t) => ({
|
|
1930
1937
|
...e,
|
|
1931
|
-
events: e.events.filter((e) =>
|
|
1932
|
-
}),
|
|
1933
|
-
let
|
|
1938
|
+
events: e.events.filter((e) => Y(e, t))
|
|
1939
|
+
}), X = 10, Z = (e) => typeof e == "object" && e && "value" in e ? Z(e.value) : typeof e == "string" || typeof e == "number" ? String(e) : "", Q = (e) => e === !0 || e === "true", $ = (e) => {
|
|
1940
|
+
let t = f(e);
|
|
1941
|
+
return t === null ? e : String(t);
|
|
1942
|
+
}, ae = (e, t) => {
|
|
1943
|
+
let n = (e) => t.find((t) => t.name === e)?.value, r = Z(t.find(({ tag: e }) => e === "reason")?.value), i = t.find(({ tag: e }) => e === "description")?.value ?? n(a.description), o = e.hasTitle ? "" : Z(e.reasonDetail ? n(e.reasonDetail) : r), s = n(a.dates), [c = "", l = ""] = Array.isArray(s) ? s.map(Z) : [], u = Z(n(_(e, o)?.name ?? a.date)), d = Number(Z(n(a.unitPrice)) || NaN), f = Number.isFinite(d);
|
|
1934
1944
|
return {
|
|
1935
|
-
amount: f ? String(e.price === "credit" ? Math.abs(d) : d) : "",
|
|
1945
|
+
amount: f ? String(e.price === "credit" || e.hasCreditNoteChoice ? Math.abs(d) : d) : "",
|
|
1936
1946
|
...e.amountGate && { amountGate: f },
|
|
1937
|
-
|
|
1947
|
+
...e.hasCreditNoteChoice && f && { isCreditNote: d < 0 },
|
|
1948
|
+
checks: Object.fromEntries((e.checks ?? []).map((e) => [e, Q(n(e))])),
|
|
1938
1949
|
dates: {
|
|
1939
|
-
fromDate: (c || u).slice(0,
|
|
1940
|
-
toDate: (l || u).slice(0,
|
|
1950
|
+
fromDate: (c || u).slice(0, X),
|
|
1951
|
+
toDate: (l || u).slice(0, X)
|
|
1941
1952
|
},
|
|
1942
|
-
description:
|
|
1943
|
-
fields: Object.fromEntries((e.fields ?? []).map(({ name: e }) => [e,
|
|
1944
|
-
intervention:
|
|
1953
|
+
description: Z(i),
|
|
1954
|
+
fields: Object.fromEntries((e.fields ?? []).map(({ name: e, type: t }) => [e, t === "number" ? $(Z(n(e))) : Z(n(e))])),
|
|
1955
|
+
intervention: Q(n(a.intervention)),
|
|
1945
1956
|
reason: o,
|
|
1946
|
-
reBillRatio:
|
|
1957
|
+
reBillRatio: $(Z(n(a.reBillRatio))),
|
|
1947
1958
|
title: e.hasTitle ? r : ""
|
|
1948
1959
|
};
|
|
1949
|
-
},
|
|
1950
|
-
if (!
|
|
1951
|
-
let r =
|
|
1960
|
+
}, oe = (e, t, { reason: n }) => e.reasonDetail === t.reasonDetail && !!e.hasTitle == !!t.hasTitle && (!!e.hasTitle || !!e.reasonDetail || (e.reasons?.includes(n) ?? n === e.reason)), se = (e, t) => e === "client" && t === "supplier", ce = ({ workflow: e, workflowValues: t }, n) => {
|
|
1961
|
+
if (!O(e)) return;
|
|
1962
|
+
let r = U(e.funnel), i = n.side === e.side ? n.events.find(({ id: t }) => t === e.eventId) : void 0, a = r?.events.find(({ id: t }) => t === e.eventId) ?? i;
|
|
1952
1963
|
if (!a) return;
|
|
1953
|
-
let o =
|
|
1954
|
-
return i &&
|
|
1964
|
+
let o = ae(a, t ?? []);
|
|
1965
|
+
return i && oe(i, a, o) ? {
|
|
1955
1966
|
answers: o,
|
|
1956
1967
|
editFunnel: n,
|
|
1957
1968
|
event: i,
|
|
1958
1969
|
side: e.side
|
|
1959
1970
|
} : {
|
|
1960
1971
|
answers: o,
|
|
1961
|
-
editFunnel: r && !a.isProof &&
|
|
1972
|
+
editFunnel: r && !a.isProof && se(n.side, e.side) ? {
|
|
1962
1973
|
...r,
|
|
1963
1974
|
pricing: n.pricing
|
|
1964
1975
|
} : void 0,
|
|
1965
1976
|
event: a,
|
|
1966
1977
|
side: e.side
|
|
1967
1978
|
};
|
|
1968
|
-
},
|
|
1979
|
+
}, le = ({ answers: e, event: t }) => !!t.hasTitle && !!e.title || !t.reasons?.length;
|
|
1969
1980
|
//#endregion
|
|
1970
|
-
export { s as CLIENT_EVENTS, c as CLIENT_GROUPS,
|
|
1981
|
+
export { s as CLIENT_EVENTS, c as CLIENT_GROUPS, E as DEDICATED_FUNNEL, l as DEFAULT_CLIENT_FUNNEL, M as EVENT_LOCALES, n as EVENT_NAMESPACE, o as INVENTORY_ID, r as NATIVE_EVENT_SOURCE, i as NATIVE_EVENT_VERSION, u as SUPPLIER_FUNNEL, a as VALUE_NAMES, Y as billsOnLine, k as buildEventPayload, ne as findCreditOfDay, re as findCreditOverlap, U as findEventFunnel, te as getCreditedPeriods, D as getDedicatedEventWorkflow, _ as getEndDate, m as getEventAmounts, H as getEventFunnel, y as getFirstQuestion, g as getFunnelGroups, ie as getLineFunnel, S as getReason, v as getSteps, p as getUnitPrice, h as isAmountToComplete, le as isNamedByDeclaration, O as isNativeEventWorkflow, x as isStepAnswered, ce as readEvent, f as toDecimal, j as useEventDeclaration };
|