@getsoren/shared-module 2.59.0 → 2.60.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/index.d.ts +2 -0
- package/dist/events/locales/fr.d.ts +1 -1
- package/dist/events/utils/amounts/amounts.d.ts +6 -0
- package/dist/events/utils/credits/credits.d.ts +41 -0
- package/dist/events/utils/credits/credits.test.d.ts +1 -0
- package/dist/events/utils/lineFunnel/lineFunnel.d.ts +16 -0
- package/dist/events/utils/lineFunnel/lineFunnel.test.d.ts +1 -0
- package/dist/events/utils/readEvent/readEvent.d.ts +10 -1
- package/dist/events.js +90 -77
- package/package.json +1 -1
package/dist/events/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { EVENT_LOCALES } from './locales/locales';
|
|
|
12
12
|
export * from './tenants';
|
|
13
13
|
export type * from './types';
|
|
14
14
|
export * from './utils/amounts/amounts';
|
|
15
|
+
export * from './utils/credits/credits';
|
|
16
|
+
export * from './utils/lineFunnel/lineFunnel';
|
|
15
17
|
export * from './utils/payload/payload';
|
|
16
18
|
export { default as buildEventPayload } from './utils/payload/payload';
|
|
17
19
|
export * from './utils/readEvent/readEvent';
|
|
@@ -104,7 +104,7 @@ declare const EVENTS_FR: {
|
|
|
104
104
|
readonly materialUsageKind: "Quel est le problème ?";
|
|
105
105
|
readonly newEnd: "Jusqu'à quand prolonger ?";
|
|
106
106
|
readonly period: "Sur quels jours ?";
|
|
107
|
-
readonly photos: "
|
|
107
|
+
readonly photos: "Des photos ou documents à joindre ?";
|
|
108
108
|
readonly priceKnown: "Avez-vous déjà le montant du fournisseur ?";
|
|
109
109
|
readonly robberyDay: "Quand avez-vous constaté le vol ?";
|
|
110
110
|
readonly robberyKind: "Qu'est-ce qui a été volé ?";
|
|
@@ -19,3 +19,9 @@ export declare const getUnitPrice: (event: EventDefinition, answers: Pick<EventA
|
|
|
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.
|
|
20
20
|
*/
|
|
21
21
|
export declare const getEventAmounts: (event: EventDefinition | undefined, answers: EventAnswers, billableDays: number) => EventAmounts;
|
|
22
|
+
/**
|
|
23
|
+
* Whether an event still waits for its amount: it has a price and none goes with it, though its days are billed and
|
|
24
|
+
* nobody answered that there was nothing to bill. `isSent` is false for a user who sees no price, whose amount on
|
|
25
|
+
* hand (a credit starts from the daily price) is not sent.
|
|
26
|
+
*/
|
|
27
|
+
export declare const isAmountToComplete: (event: EventDefinition, { hasNothingToBill, unitPrice }: Pick<EventAmounts, "hasNothingToBill" | "unitPrice">, isSent?: boolean) => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EventDates } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A line of an order's timeline, as each app's generated client types it: only what the credit rule reads.
|
|
4
|
+
*/
|
|
5
|
+
export interface TimelineLine {
|
|
6
|
+
id?: string | null;
|
|
7
|
+
lineType?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The first and last days the event bills.
|
|
10
|
+
*/
|
|
11
|
+
dates?: readonly string[] | null;
|
|
12
|
+
/**
|
|
13
|
+
* Typed loosely by some clients: read defensively.
|
|
14
|
+
*/
|
|
15
|
+
workflowValues?: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* An event line of the timeline.
|
|
19
|
+
*/
|
|
20
|
+
export type TimelineEventLine<Line extends TimelineLine> = Extract<Line, {
|
|
21
|
+
lineType: "booking_events";
|
|
22
|
+
}>;
|
|
23
|
+
export interface CreditedPeriod<Line> extends EventDates {
|
|
24
|
+
/**
|
|
25
|
+
* The credit that takes these days off the invoice.
|
|
26
|
+
*/
|
|
27
|
+
line: Line;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The days the order's credits already take off the invoice, whatever their status: a credit still open is billed at
|
|
31
|
+
* its closing. The event being edited is left out, since its own days are the ones it changes.
|
|
32
|
+
*/
|
|
33
|
+
export declare const getCreditedPeriods: <Line extends TimelineLine>(lines?: readonly Line[], editedEventId?: string | null) => CreditedPeriod<TimelineEventLine<Line>>[];
|
|
34
|
+
/**
|
|
35
|
+
* The credit that already takes this day (YYYY-MM-DD) off the invoice.
|
|
36
|
+
*/
|
|
37
|
+
export declare const findCreditOfDay: <Period extends EventDates>(day: string, periods: readonly Period[]) => Period | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The first credit that already takes off one of these days: a day is never credited twice.
|
|
40
|
+
*/
|
|
41
|
+
export declare const findCreditOverlap: <Period extends EventDates>({ fromDate, toDate }: EventDates, periods: readonly Period[]) => Period | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventDefinition, EventFunnel } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* An order line, as each app's generated client types it: only the unit it is priced in.
|
|
4
|
+
*/
|
|
5
|
+
export interface BilledLine {
|
|
6
|
+
qtyUnit?: string | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Whether the order line can bill the event: hours replace the hours of a line priced by the hour, and on any other
|
|
10
|
+
* line they would be billed as that many more days.
|
|
11
|
+
*/
|
|
12
|
+
export declare const billsOnLine: (event: EventDefinition, line?: BilledLine | null) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The funnel without the events the order line cannot bill.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getLineFunnel: (funnel: EventFunnel, line?: BilledLine | null) => EventFunnel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeclaredEvent, EventFunnel } from '../../types';
|
|
1
|
+
import { DeclaredEvent, EventAnswers, EventDefinition, EventFunnel } from '../../types';
|
|
2
2
|
/** A stored value, as each app's generated client types it. */
|
|
3
3
|
export interface StoredWorkflowValue {
|
|
4
4
|
name?: string | null;
|
|
@@ -16,4 +16,13 @@ interface StoredEvent {
|
|
|
16
16
|
* team's, a client's read by a supplier, a proof read by the other side). Undefined for a Treege event.
|
|
17
17
|
*/
|
|
18
18
|
declare const readEvent: ({ workflow, workflowValues }: StoredEvent, readerFunnel: EventFunnel) => DeclaredEvent | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Whether an event declared natively is named as its declaration names it rather than by its stored reason: a typed
|
|
21
|
+
* title, or an event with no reason to pick ("Casse", where the stored reason reads "Casses importantes"). An event
|
|
22
|
+
* whose reason was picked keeps the name the timeline has always given it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const isNamedByDeclaration: ({ answers, event }: {
|
|
25
|
+
answers: Pick<EventAnswers, "title">;
|
|
26
|
+
event: EventDefinition;
|
|
27
|
+
}) => boolean;
|
|
19
28
|
export default readEvent;
|
package/dist/events.js
CHANGED
|
@@ -444,23 +444,23 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
444
444
|
total: a === null ? null : a * o,
|
|
445
445
|
unitPrice: a
|
|
446
446
|
};
|
|
447
|
-
}, h = ({ groups: e, events: t }) => e.flatMap((e) => {
|
|
447
|
+
}, h = (e, { hasNothingToBill: t, unitPrice: n }, r = !0) => !!e.price && !(r && n !== null) && !t && e.amountGate !== "billed", g = ({ groups: e, events: t }) => e.flatMap((e) => {
|
|
448
448
|
let n = t.filter(({ id: t }) => e.events.includes(t));
|
|
449
449
|
return n.length ? [{
|
|
450
450
|
...e,
|
|
451
451
|
events: n
|
|
452
452
|
}] : [];
|
|
453
|
-
}),
|
|
453
|
+
}), _ = (e, t) => e.endDates?.[t], v = (e, t, n, r) => [
|
|
454
454
|
"kind",
|
|
455
455
|
...(e?.events.length ?? 0) > 1 ? ["event"] : [],
|
|
456
456
|
...t?.reasons?.length ? ["reason"] : [],
|
|
457
|
-
...t?.dates || t &&
|
|
457
|
+
...t?.dates || t && _(t, n.reason) ? ["dates"] : [],
|
|
458
458
|
...t?.checks?.length ? ["checks"] : [],
|
|
459
459
|
...t?.hasTitle || t?.fields?.length ? ["fields"] : [],
|
|
460
460
|
...r && t?.price && t.amountGate ? ["amountGate"] : [],
|
|
461
461
|
...r && t?.price && (!t.amountGate || n.amountGate) ? ["amount"] : [],
|
|
462
462
|
...t ? ["details"] : []
|
|
463
|
-
],
|
|
463
|
+
], y = (e, t, n = !1) => e.find((e) => e !== "kind" && e !== "event" && (n || e !== "reason" || !t.reason)) ?? "details", b = (e, t, n) => {
|
|
464
464
|
switch (e) {
|
|
465
465
|
case "reason": return !!n.reason;
|
|
466
466
|
case "dates": return !!(n.dates.fromDate && n.dates.toDate);
|
|
@@ -469,8 +469,8 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
469
469
|
case "amount": return !!t.hasOptionalAmount || p(t, n) !== null;
|
|
470
470
|
default: return !0;
|
|
471
471
|
}
|
|
472
|
-
},
|
|
473
|
-
let r =
|
|
472
|
+
}, x = (e, t) => e.hasTitle ? t.title.trim() : e.reasonDetail ? e.reason ?? "" : t.reason || (e.reason ?? ""), S = (e, t, n) => {
|
|
473
|
+
let r = x(e, t);
|
|
474
474
|
if (e.hasTitle) return {
|
|
475
475
|
label: n("values.title"),
|
|
476
476
|
name: a.reason,
|
|
@@ -489,8 +489,8 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
489
489
|
value: r
|
|
490
490
|
}
|
|
491
491
|
};
|
|
492
|
-
},
|
|
493
|
-
let o =
|
|
492
|
+
}, C = (e, { dates: { fromDate: t, toDate: n }, reason: r }, i) => {
|
|
493
|
+
let o = _(e, r);
|
|
494
494
|
return t && n ? o ? [{
|
|
495
495
|
label: i(`values.${o.name}`),
|
|
496
496
|
name: o.name,
|
|
@@ -507,18 +507,18 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
507
507
|
type: "date",
|
|
508
508
|
value: t
|
|
509
509
|
}] : [] : [];
|
|
510
|
-
},
|
|
510
|
+
}, w = (e, t) => {
|
|
511
511
|
let n = e === "number" ? f(t) : null;
|
|
512
512
|
return n === null ? t.trim() : String(n);
|
|
513
|
-
},
|
|
513
|
+
}, T = "dedicated", E = (e, t) => ({
|
|
514
514
|
eventId: t,
|
|
515
|
-
funnel:
|
|
515
|
+
funnel: T,
|
|
516
516
|
side: e,
|
|
517
517
|
source: r,
|
|
518
518
|
version: 2
|
|
519
|
-
}),
|
|
519
|
+
}), D = (e) => typeof e == "object" && !!e && "source" in e && e.source === "soren-event" && "eventId" in e && typeof e.eventId == "string", O = ({ funnel: e, event: t, answers: n, translate: i, bookingItemId: o, withPrice: s, billableDays: c, withReBillRatio: l = e.pricing.asksReBillRatio }) => {
|
|
520
520
|
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
|
-
|
|
521
|
+
S(t, n, i),
|
|
522
522
|
...t.reasonDetail && n.reason ? [{
|
|
523
523
|
label: i(`values.${t.reasonDetail}`),
|
|
524
524
|
name: t.reasonDetail,
|
|
@@ -528,7 +528,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
528
528
|
value: n.reason
|
|
529
529
|
}
|
|
530
530
|
}] : [],
|
|
531
|
-
...
|
|
531
|
+
...C(t, n, i),
|
|
532
532
|
..._ ? [{
|
|
533
533
|
label: i("values.description"),
|
|
534
534
|
name: a.description,
|
|
@@ -546,7 +546,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
546
546
|
label: i(`fields.${e}`),
|
|
547
547
|
name: e,
|
|
548
548
|
type: t,
|
|
549
|
-
value:
|
|
549
|
+
value: w(t, n.fields[e])
|
|
550
550
|
})),
|
|
551
551
|
...t.hasIntervention ? [{
|
|
552
552
|
label: i("values.intervention"),
|
|
@@ -586,7 +586,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
586
586
|
quantity: y
|
|
587
587
|
}
|
|
588
588
|
};
|
|
589
|
-
},
|
|
589
|
+
}, k = {
|
|
590
590
|
amount: "",
|
|
591
591
|
checks: {},
|
|
592
592
|
dates: {
|
|
@@ -599,28 +599,28 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
599
599
|
reason: "",
|
|
600
600
|
reBillRatio: "",
|
|
601
601
|
title: ""
|
|
602
|
-
},
|
|
603
|
-
let [c, l] = t(), [u, d] = t(), [f, p] = t("kind"), [
|
|
602
|
+
}, A = ({ funnel: n, countBillableDays: r, dailyPrice: i, lastReBillRatio: a = "", isEditing: o = !1, today: s }) => {
|
|
603
|
+
let [c, l] = t(), [u, d] = t(), [f, p] = t("kind"), [h, _] = t(k), [x, 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, A = m(T, h, T?.dates === "range" ? r(h.dates) : 1), j = E && !!T?.price, M = j && !A.hasNothingToBill, N = v(w, T, h, M), P = N[N.indexOf(f) - 1], F = (e) => _((t) => ({
|
|
604
604
|
...t,
|
|
605
605
|
...e
|
|
606
606
|
})), I = (e) => e.price === "credit" && i ? String(Math.abs(i)) : "", L = (e, t) => {
|
|
607
|
-
let n =
|
|
607
|
+
let n = v(w, T, t, M);
|
|
608
608
|
return n[n.indexOf(e) + 1] ?? "details";
|
|
609
609
|
}, R = () => {
|
|
610
|
-
l(void 0), d(void 0), p("kind"),
|
|
610
|
+
l(void 0), d(void 0), p("kind"), _(k), S(!1);
|
|
611
611
|
}, z = (e, t, n = {}) => {
|
|
612
612
|
let r = {
|
|
613
|
-
...
|
|
613
|
+
...k,
|
|
614
614
|
amount: I(t),
|
|
615
615
|
dates: t.defaultsToToday && s ? {
|
|
616
616
|
fromDate: s,
|
|
617
617
|
toDate: s
|
|
618
|
-
} :
|
|
618
|
+
} : k.dates,
|
|
619
619
|
reason: t.reasons?.length ? "" : t.reason ?? "",
|
|
620
|
-
reBillRatio:
|
|
620
|
+
reBillRatio: D ? a : "",
|
|
621
621
|
...n
|
|
622
622
|
};
|
|
623
|
-
l(e.id), d(t.id),
|
|
623
|
+
l(e.id), d(t.id), _(r), p(y(v(e, t, r, E && !!t.price), r, o));
|
|
624
624
|
}, B = ({ eventId: e, answers: t }) => {
|
|
625
625
|
let n = C.find(({ events: t }) => t.some(({ id: t }) => t === e)), r = n?.events.find(({ id: t }) => t === e);
|
|
626
626
|
return n && r ? (z(n, r, t), S(!0), !0) : !1;
|
|
@@ -632,22 +632,22 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
632
632
|
l(e.id), d(void 0), p("event");
|
|
633
633
|
}, H = (e) => {
|
|
634
634
|
w && z(w, e);
|
|
635
|
-
}, U = () => p(L(f,
|
|
636
|
-
let t = T?.endDates && e !==
|
|
637
|
-
dates:
|
|
635
|
+
}, U = () => p(L(f, h)), W = (e) => {
|
|
636
|
+
let t = T?.endDates && e !== h.reason ? {
|
|
637
|
+
dates: k.dates,
|
|
638
638
|
reason: e
|
|
639
639
|
} : { reason: e }, n = {
|
|
640
|
-
...
|
|
640
|
+
...h,
|
|
641
641
|
...t
|
|
642
642
|
};
|
|
643
643
|
F(t), p(L("reason", n));
|
|
644
644
|
}, G = (e) => {
|
|
645
645
|
let t = {
|
|
646
|
-
amount: e && T ?
|
|
646
|
+
amount: e && T ? h.amount || I(T) : "",
|
|
647
647
|
amountGate: e
|
|
648
648
|
};
|
|
649
649
|
F(t), p(L("amountGate", {
|
|
650
|
-
...
|
|
650
|
+
...h,
|
|
651
651
|
...t
|
|
652
652
|
}));
|
|
653
653
|
}, K = () => {
|
|
@@ -656,23 +656,23 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
656
656
|
return;
|
|
657
657
|
}
|
|
658
658
|
p(P);
|
|
659
|
-
}, q = !!T && N.every((e) =>
|
|
659
|
+
}, q = !!T && N.every((e) => b(e, T, h)), J = o && !E && !A.hasNothingToBill;
|
|
660
660
|
return {
|
|
661
661
|
amounts: A,
|
|
662
|
-
answers:
|
|
662
|
+
answers: h,
|
|
663
663
|
asksAmount: M,
|
|
664
|
-
buildPayload: (e, t) => T && q ?
|
|
665
|
-
answers:
|
|
664
|
+
buildPayload: (e, t) => T && q ? O({
|
|
665
|
+
answers: h,
|
|
666
666
|
billableDays: A.billableDays,
|
|
667
667
|
bookingItemId: t,
|
|
668
668
|
event: T,
|
|
669
669
|
funnel: n,
|
|
670
670
|
translate: e,
|
|
671
671
|
withPrice: M || J,
|
|
672
|
-
withReBillRatio:
|
|
672
|
+
withReBillRatio: D || o
|
|
673
673
|
}) : void 0,
|
|
674
674
|
canGoBack: f !== "kind" && !(x && (P === "kind" || P === "event")),
|
|
675
|
-
canGoNext: !!T &&
|
|
675
|
+
canGoNext: !!T && b(f, T, h),
|
|
676
676
|
event: T,
|
|
677
677
|
goBack: K,
|
|
678
678
|
goNext: U,
|
|
@@ -686,12 +686,12 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
686
686
|
selectGroup: V,
|
|
687
687
|
selectReason: W,
|
|
688
688
|
setAnswers: F,
|
|
689
|
-
showsReBillRatio:
|
|
689
|
+
showsReBillRatio: D && j,
|
|
690
690
|
startPrefill: B,
|
|
691
691
|
step: f,
|
|
692
692
|
steps: N
|
|
693
693
|
};
|
|
694
|
-
},
|
|
694
|
+
}, j = {
|
|
695
695
|
ar: {
|
|
696
696
|
checks: {
|
|
697
697
|
ce_conformity: "تم التحقق من شهادة أو إقرار CE",
|
|
@@ -798,7 +798,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
798
798
|
materialUsageKind: "ما هي المشكلة؟",
|
|
799
799
|
newEnd: "حتى متى التمديد؟",
|
|
800
800
|
period: "أي أيام؟",
|
|
801
|
-
photos: "
|
|
801
|
+
photos: "هل تريد إرفاق صور أو مستندات؟",
|
|
802
802
|
priceKnown: "هل لديك مبلغ المورد بالفعل؟",
|
|
803
803
|
robberyDay: "متى لاحظت السرقة؟",
|
|
804
804
|
robberyKind: "ما الذي سُرق؟",
|
|
@@ -959,7 +959,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
959
959
|
materialUsageKind: "Was ist das Problem?",
|
|
960
960
|
newEnd: "Bis wann verlängern?",
|
|
961
961
|
period: "An welchen Tagen?",
|
|
962
|
-
photos: "
|
|
962
|
+
photos: "Fotos oder Dokumente anhängen?",
|
|
963
963
|
priceKnown: "Haben Sie den Betrag des Lieferanten schon?",
|
|
964
964
|
robberyDay: "Wann haben Sie den Diebstahl bemerkt?",
|
|
965
965
|
robberyKind: "Was wurde gestohlen?",
|
|
@@ -1120,7 +1120,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1120
1120
|
materialUsageKind: "What is the problem?",
|
|
1121
1121
|
newEnd: "Extend until when?",
|
|
1122
1122
|
period: "Which days?",
|
|
1123
|
-
photos: "
|
|
1123
|
+
photos: "Any photos or documents to attach?",
|
|
1124
1124
|
priceKnown: "Do you already have the supplier's amount?",
|
|
1125
1125
|
robberyDay: "When did you notice the theft?",
|
|
1126
1126
|
robberyKind: "What was stolen?",
|
|
@@ -1281,7 +1281,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1281
1281
|
materialUsageKind: "¿Cuál es el problema?",
|
|
1282
1282
|
newEnd: "¿Hasta cuándo prolongar?",
|
|
1283
1283
|
period: "¿Qué días?",
|
|
1284
|
-
photos: "¿
|
|
1284
|
+
photos: "¿Fotos o documentos que adjuntar?",
|
|
1285
1285
|
priceKnown: "¿Ya tiene el importe del proveedor?",
|
|
1286
1286
|
robberyDay: "¿Cuándo detectó el robo?",
|
|
1287
1287
|
robberyKind: "¿Qué han robado?",
|
|
@@ -1442,7 +1442,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1442
1442
|
materialUsageKind: "Quel est le problème ?",
|
|
1443
1443
|
newEnd: "Jusqu'à quand prolonger ?",
|
|
1444
1444
|
period: "Sur quels jours ?",
|
|
1445
|
-
photos: "
|
|
1445
|
+
photos: "Des photos ou documents à joindre ?",
|
|
1446
1446
|
priceKnown: "Avez-vous déjà le montant du fournisseur ?",
|
|
1447
1447
|
robberyDay: "Quand avez-vous constaté le vol ?",
|
|
1448
1448
|
robberyKind: "Qu'est-ce qui a été volé ?",
|
|
@@ -1603,7 +1603,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1603
1603
|
materialUsageKind: "Qual è il problema?",
|
|
1604
1604
|
newEnd: "Fino a quando prolungare?",
|
|
1605
1605
|
period: "Quali giorni?",
|
|
1606
|
-
photos: "
|
|
1606
|
+
photos: "Foto o documenti da allegare?",
|
|
1607
1607
|
priceKnown: "Ha già l'importo del fornitore?",
|
|
1608
1608
|
robberyDay: "Quando ha notato il furto?",
|
|
1609
1609
|
robberyKind: "Che cosa è stato rubato?",
|
|
@@ -1764,7 +1764,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1764
1764
|
materialUsageKind: "Qual é o problema?",
|
|
1765
1765
|
newEnd: "Prolongar até quando?",
|
|
1766
1766
|
period: "Que dias?",
|
|
1767
|
-
photos: "
|
|
1767
|
+
photos: "Fotos ou documentos a anexar?",
|
|
1768
1768
|
priceKnown: "Já tem o valor do fornecedor?",
|
|
1769
1769
|
robberyDay: "Quando notou o roubo?",
|
|
1770
1770
|
robberyKind: "O que foi roubado?",
|
|
@@ -1819,7 +1819,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1819
1819
|
title: "Título do evento"
|
|
1820
1820
|
}
|
|
1821
1821
|
}
|
|
1822
|
-
},
|
|
1822
|
+
}, M = ["companion", "operative"], N = {
|
|
1823
1823
|
...s,
|
|
1824
1824
|
breakage: {
|
|
1825
1825
|
...s.breakage,
|
|
@@ -1857,7 +1857,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1857
1857
|
...s.robbery,
|
|
1858
1858
|
reasons: ["robbery_machine", "robbery_option"]
|
|
1859
1859
|
}
|
|
1860
|
-
},
|
|
1860
|
+
}, P = [
|
|
1861
1861
|
"n1_control",
|
|
1862
1862
|
"other_request",
|
|
1863
1863
|
"breakdown",
|
|
@@ -1875,13 +1875,13 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1875
1875
|
"hours_record",
|
|
1876
1876
|
"robbery",
|
|
1877
1877
|
"other"
|
|
1878
|
-
],
|
|
1878
|
+
], F = [
|
|
1879
1879
|
"n1_control",
|
|
1880
1880
|
"n3_control",
|
|
1881
1881
|
"machine_assignment",
|
|
1882
1882
|
"operator_change",
|
|
1883
1883
|
"hours_record"
|
|
1884
|
-
],
|
|
1884
|
+
], I = [
|
|
1885
1885
|
c.controls,
|
|
1886
1886
|
c.admin_request,
|
|
1887
1887
|
c.machine_problem,
|
|
@@ -1890,68 +1890,81 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1890
1890
|
c.delivery,
|
|
1891
1891
|
c.documents,
|
|
1892
1892
|
c.other
|
|
1893
|
-
],
|
|
1894
|
-
events:
|
|
1895
|
-
groups:
|
|
1893
|
+
], L = {
|
|
1894
|
+
events: P.map((e) => N[e]),
|
|
1895
|
+
groups: I,
|
|
1896
1896
|
id: "bouygues",
|
|
1897
1897
|
pricing: {
|
|
1898
1898
|
asksReBillRatio: !0,
|
|
1899
1899
|
showsPrice: !0
|
|
1900
1900
|
},
|
|
1901
1901
|
side: "client"
|
|
1902
|
-
},
|
|
1903
|
-
events:
|
|
1904
|
-
groups:
|
|
1902
|
+
}, R = {
|
|
1903
|
+
events: P.filter((e) => !F.includes(e)).map((e) => N[e]),
|
|
1904
|
+
groups: I,
|
|
1905
1905
|
id: "bouyguesField",
|
|
1906
1906
|
pricing: {
|
|
1907
1907
|
asksReBillRatio: !1,
|
|
1908
1908
|
showsPrice: !1
|
|
1909
1909
|
},
|
|
1910
1910
|
side: "client"
|
|
1911
|
-
},
|
|
1912
|
-
funnels: [
|
|
1913
|
-
getFunnel: (e) =>
|
|
1911
|
+
}, z = [{
|
|
1912
|
+
funnels: [L, R],
|
|
1913
|
+
getFunnel: (e) => M.includes(e ?? "") ? R : L,
|
|
1914
1914
|
tenants: ["bouygues"]
|
|
1915
|
-
}],
|
|
1915
|
+
}], B = [
|
|
1916
1916
|
l,
|
|
1917
1917
|
u,
|
|
1918
|
-
...
|
|
1919
|
-
],
|
|
1920
|
-
let
|
|
1918
|
+
...z.flatMap(({ funnels: e }) => e)
|
|
1919
|
+
], V = ({ side: e, tenantName: t, roleName: n }) => e === "supplier" ? u : z.find(({ tenants: e }) => e.includes(t ?? ""))?.getFunnel(n) ?? l, H = (e) => B.find((t) => t.id === e), U = 10, W = (e) => e.slice(0, U), G = (e) => e.lineType === "booking_events", K = ({ workflowValues: e }) => {
|
|
1920
|
+
let t = Array.isArray(e) ? e.find((e) => typeof e == "object" && !!e && e.name === a.unitPrice)?.value : void 0;
|
|
1921
|
+
return typeof t == "string" || typeof t == "number" ? f(String(t)) : null;
|
|
1922
|
+
}, q = (e = [], t) => e.filter(G).flatMap((e) => {
|
|
1923
|
+
let [n, r] = e.dates ?? [], i = K(e);
|
|
1924
|
+
return e.id !== t && n && r && i !== null && i < 0 ? [{
|
|
1925
|
+
fromDate: W(n),
|
|
1926
|
+
line: e,
|
|
1927
|
+
toDate: W(r)
|
|
1928
|
+
}] : [];
|
|
1929
|
+
}), J = (e, t) => t.find(({ fromDate: t, toDate: n }) => W(t) <= W(e) && W(e) <= W(n)), Y = ({ fromDate: e, toDate: t }, n) => e && t ? n.find((n) => W(e) <= W(n.toDate) && W(n.fromDate) <= W(t)) : void 0, X = (e, t) => e.billingType !== "DELTA" || t?.qtyUnit === "HOURS", ee = (e, t) => ({
|
|
1930
|
+
...e,
|
|
1931
|
+
events: e.events.filter((e) => X(e, t))
|
|
1932
|
+
}), Z = 10, Q = (e) => typeof e == "object" && e && "value" in e ? Q(e.value) : typeof e == "string" || typeof e == "number" ? String(e) : "", $ = (e) => e === !0 || e === "true", te = (e, t) => {
|
|
1933
|
+
let n = (e) => t.find((t) => t.name === e)?.value, r = Q(t.find(({ tag: e }) => e === "reason")?.value), i = t.find(({ tag: e }) => e === "description")?.value ?? n(a.description), o = e.hasTitle ? "" : Q(e.reasonDetail ? n(e.reasonDetail) : r), s = n(a.dates), [c = "", l = ""] = Array.isArray(s) ? s.map(Q) : [], u = Q(n(_(e, o)?.name ?? a.date)), d = Number(Q(n(a.unitPrice)) || NaN), f = Number.isFinite(d);
|
|
1921
1934
|
return {
|
|
1922
1935
|
amount: f ? String(e.price === "credit" ? Math.abs(d) : d) : "",
|
|
1923
1936
|
...e.amountGate && { amountGate: f },
|
|
1924
|
-
checks: Object.fromEntries((e.checks ?? []).map((e) => [e,
|
|
1937
|
+
checks: Object.fromEntries((e.checks ?? []).map((e) => [e, $(n(e))])),
|
|
1925
1938
|
dates: {
|
|
1926
|
-
fromDate: (c || u).slice(0,
|
|
1927
|
-
toDate: (l || u).slice(0,
|
|
1939
|
+
fromDate: (c || u).slice(0, Z),
|
|
1940
|
+
toDate: (l || u).slice(0, Z)
|
|
1928
1941
|
},
|
|
1929
|
-
description:
|
|
1930
|
-
fields: Object.fromEntries((e.fields ?? []).map(({ name: e }) => [e,
|
|
1931
|
-
intervention:
|
|
1942
|
+
description: Q(i),
|
|
1943
|
+
fields: Object.fromEntries((e.fields ?? []).map(({ name: e }) => [e, Q(n(e))])),
|
|
1944
|
+
intervention: $(n(a.intervention)),
|
|
1932
1945
|
reason: o,
|
|
1933
|
-
reBillRatio:
|
|
1946
|
+
reBillRatio: Q(n(a.reBillRatio)),
|
|
1934
1947
|
title: e.hasTitle ? r : ""
|
|
1935
1948
|
};
|
|
1936
|
-
},
|
|
1937
|
-
if (!
|
|
1938
|
-
let r =
|
|
1949
|
+
}, ne = (e, t, { reason: n }) => e.reasonDetail === t.reasonDetail && !!e.hasTitle == !!t.hasTitle && (!!e.hasTitle || !!e.reasonDetail || (e.reasons?.includes(n) ?? n === e.reason)), re = (e, t) => e === "client" && t === "supplier", ie = ({ workflow: e, workflowValues: t }, n) => {
|
|
1950
|
+
if (!D(e)) return;
|
|
1951
|
+
let r = H(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;
|
|
1939
1952
|
if (!a) return;
|
|
1940
|
-
let o =
|
|
1941
|
-
return i &&
|
|
1953
|
+
let o = te(a, t ?? []);
|
|
1954
|
+
return i && ne(i, a, o) ? {
|
|
1942
1955
|
answers: o,
|
|
1943
1956
|
editFunnel: n,
|
|
1944
1957
|
event: i,
|
|
1945
1958
|
side: e.side
|
|
1946
1959
|
} : {
|
|
1947
1960
|
answers: o,
|
|
1948
|
-
editFunnel: r && !a.isProof &&
|
|
1961
|
+
editFunnel: r && !a.isProof && re(n.side, e.side) ? {
|
|
1949
1962
|
...r,
|
|
1950
1963
|
pricing: n.pricing
|
|
1951
1964
|
} : void 0,
|
|
1952
1965
|
event: a,
|
|
1953
1966
|
side: e.side
|
|
1954
1967
|
};
|
|
1955
|
-
};
|
|
1968
|
+
}, ae = ({ answers: e, event: t }) => !!t.hasTitle && !!e.title || !t.reasons?.length;
|
|
1956
1969
|
//#endregion
|
|
1957
|
-
export { s as CLIENT_EVENTS, c as CLIENT_GROUPS,
|
|
1970
|
+
export { s as CLIENT_EVENTS, c as CLIENT_GROUPS, T as DEDICATED_FUNNEL, l as DEFAULT_CLIENT_FUNNEL, j 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, X as billsOnLine, O as buildEventPayload, J as findCreditOfDay, Y as findCreditOverlap, H as findEventFunnel, q as getCreditedPeriods, E as getDedicatedEventWorkflow, _ as getEndDate, m as getEventAmounts, V as getEventFunnel, y as getFirstQuestion, g as getFunnelGroups, ee as getLineFunnel, x as getReason, v as getSteps, p as getUnitPrice, h as isAmountToComplete, ae as isNamedByDeclaration, D as isNativeEventWorkflow, b as isStepAnswered, ie as readEvent, f as toDecimal, A as useEventDeclaration };
|