@nimee/shared-types 1.0.328 → 1.0.331

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.
@@ -220,6 +220,7 @@ export interface IAccountModel {
220
220
  subscriptionWalletDesign?: IWalletDesign;
221
221
  marketplaceDistributionId: string;
222
222
  isAllowSeasonTicket: boolean;
223
+ diningDefaultMonthlyAmount?: number;
223
224
  lockEndUserProfile?: boolean;
224
225
  hideCustomerChargesTab?: boolean;
225
226
  seasonTicketGrantsEntrance: boolean;
@@ -246,6 +247,8 @@ export interface IAccountModel {
246
247
  isBookable?: boolean;
247
248
  isBookableWithTickets?: boolean;
248
249
  hasCashier?: boolean;
250
+ /** Dashboard "הזמנות קבוצות" (CRM group orders) enabled — lives on the top-level seller account */
251
+ hasGroupOrders?: boolean;
249
252
  origin?: string;
250
253
  shouldSendInvoice?: boolean;
251
254
  invoiceProvider?: InvoiceProviderType;
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":";;;AAMA,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,iEAAW,CAAA;IACX,iEAAW,CAAA;IACX,iEAAW,CAAA;IACX,mEAAY,CAAA;IACZ,+DAAU,CAAA;IACV,+DAAU,CAAA;IACV,iEAAW,CAAA;IACX,6DAAS,CAAA;IACT,6DAAS,CAAA;AACX,CAAC,EAVW,kBAAkB,kCAAlB,kBAAkB,QAU7B;AACD,IAAY,aAUX;AAVD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,gCAAe,CAAA;IACf,sCAAqB,CAAA;AACvB,CAAC,EAVW,aAAa,6BAAb,aAAa,QAUxB;AACD,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,kDAA6B,C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ACnB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,gCAAe,CAAA;IACf,sCAAqB,CAAA;AACvB,CAAC,EAVW,aAAa,6BAAb,aAAa,QAUxB;AACD,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,kDAA6B,CAAA;IAC7B,kDAA6B,CAAA;IAC7B,sCAAiB,CAAA;IACjB,oCAAe,CAAA;IACf,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,0CAAqB,CAAA;AACvB,CAAC,EARW,iBAAiB,iCAAjB,iBAAiB,QAQ5B;AAgBD,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,4CAAmB,CAAA;IACnB,8CAAqB,CAAA;AACvB,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC;AAMD,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,wCAAiB,CAAA;IACjB,wEAAwE;IACxE,oCAAa,CAAA;AACf,CAAC,EAJW,mBAAmB,mCAAnB,mBAAmB,QAI9B;AAED,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,gDAA0B,CAAA;IAC1B,yCAAmB,CAAA;IACnB,uCAAiB,CAAA;IACjB,gGAAgG;IAChG,uDAAiC,CAAA;AACnC,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B;AA6QD,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,yCAAmB,CAAA;IACnB,uCAAiB,CAAA;IACjB,6CAAuB,CAAA;IACvB,yCAAmB,CAAA;AACrB,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B"}
@@ -24,12 +24,14 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  /// <reference types="mongoose/types/inferrawdoctype" />
26
26
  import mongoose from "mongoose";
27
+ import { IGroupOrderStatus } from "./groupOrder";
27
28
  export declare enum ICalendarEventType {
28
29
  TABLE_RESERVATION = "TABLE_RESERVATION",
29
30
  TOUR = "TOUR",
30
31
  TASK = "TASK",
31
32
  REGULAR = "REGULAR",
32
- WELLNESS = "WELLNESS"
33
+ WELLNESS = "WELLNESS",
34
+ GROUP_VISIT = "GROUP_VISIT"
33
35
  }
34
36
  export declare enum TaskStatus {
35
37
  PENDING = "pending",
@@ -95,6 +97,12 @@ export interface ICalendarEventModel {
95
97
  createdAt: Date;
96
98
  }[];
97
99
  };
100
+ /** GROUP_VISIT only — the calendar `status` stays "scheduled"; the order status lives here */
101
+ groupVisit?: {
102
+ groupOrderId: string | mongoose.Types.ObjectId;
103
+ status: IGroupOrderStatus;
104
+ headcount: number;
105
+ };
98
106
  metadata?: Record<string, any>;
99
107
  createdAt?: Date;
100
108
  updatedAt?: Date;
@@ -8,6 +8,9 @@ var ICalendarEventType;
8
8
  ICalendarEventType["TASK"] = "TASK";
9
9
  ICalendarEventType["REGULAR"] = "REGULAR";
10
10
  ICalendarEventType["WELLNESS"] = "WELLNESS";
11
+ // Mirror of a CRM group order slot (הזמנות קבוצות, #989): one calendar-event per order slot so
12
+ // the dashboard Calendar tab shows group visits with the order status.
13
+ ICalendarEventType["GROUP_VISIT"] = "GROUP_VISIT";
11
14
  })(ICalendarEventType || (exports.ICalendarEventType = ICalendarEventType = {}));
12
15
  var TaskStatus;
13
16
  (function (TaskStatus) {
@@ -1 +1 @@
1
- {"version":3,"file":"calendarEvent.js","sourceRoot":"","sources":["../../src/crm/calendarEvent.ts"],"names":[],"mappings":";;;AAEA,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,6DAAuC,CAAA;IACvC,mCAAa,CAAA;IACb,mCAAa,CAAA;IACb,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;AACvB,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,yCAA2B,CAAA;IAC3B,qCAAuB,CAAA;AACzB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,+CAAuB,CAAA;IACvB,+CAAuB,CAAA;IACvB,+CAAuB,CAAA;AACzB,CAAC,EAJW,oBAAoB,oCAApB,oBAAoB,QAI/B;AACD,IAAY,mBAUX;AAVD,WAAY,mBAAmB;IAC7B,kCAAW,CAAA;IACX,sCAAe,CAAA;IACf,oCAAa,CAAA;IACb,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,oCAAa,CAAA;IACb,oCAAa,CAAA;IACb,sCAAe,CAAA;AACjB,CAAC,EAVW,mBAAmB,mCAAnB,mBAAmB,QAU9B"}
1
+ {"version":3,"file":"calendarEvent.js","sourceRoot":"","sources":["../../src/crm/calendarEvent.ts"],"names":[],"mappings":";;;AAGA,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,6DAAuC,CAAA;IACvC,mCAAa,CAAA;IACb,mCAAa,CAAA;IACb,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;IACrB,+FAA+F;IAC/F,uEAAuE;IACvE,iDAA2B,CAAA;AAC7B,CAAC,EATW,kBAAkB,kCAAlB,kBAAkB,QAS7B;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,yCAA2B,CAAA;IAC3B,qCAAuB,CAAA;AACzB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,+CAAuB,CAAA;IACvB,+CAAuB,CAAA;IACvB,+CAAuB,CAAA;AACzB,CAAC,EAJW,oBAAoB,oCAApB,oBAAoB,QAI/B;AACD,IAAY,mBAUX;AAVD,WAAY,mBAAmB;IAC7B,kCAAW,CAAA;IACX,sCAAe,CAAA;IACf,oCAAa,CAAA;IACb,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,oCAAa,CAAA;IACb,oCAAa,CAAA;IACb,sCAAe,CAAA;AACjB,CAAC,EAVW,mBAAmB,mCAAnB,mBAAmB,QAU9B"}
@@ -0,0 +1,85 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/session" />
19
+ /// <reference types="mongoose/types/types" />
20
+ /// <reference types="mongoose/types/utility" />
21
+ /// <reference types="mongoose/types/validation" />
22
+ /// <reference types="mongoose/types/virtuals" />
23
+ /// <reference types="mongoose/types/schematypes" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import mongoose from "mongoose";
27
+ export interface IDiningCommitItem {
28
+ index?: number;
29
+ price?: number;
30
+ priceBeforeDiscount?: number;
31
+ posDiscount?: number;
32
+ qty?: number;
33
+ offerId?: string;
34
+ offerName?: string;
35
+ menuId?: string;
36
+ sectionId?: string;
37
+ sectionName?: string;
38
+ addedAt?: Date | string;
39
+ [key: string]: unknown;
40
+ }
41
+ export interface IDiningCommitModel {
42
+ _id?: string | mongoose.Types.ObjectId;
43
+ endUser: string | mongoose.Types.ObjectId;
44
+ seller: string | mongoose.Types.ObjectId;
45
+ marketplace: string | mongoose.Types.ObjectId;
46
+ amount: number;
47
+ orderTotal?: number;
48
+ orderId: string;
49
+ orderOpenTime?: Date;
50
+ orderEndTime?: Date;
51
+ /**
52
+ * When the meal was eaten — `orderOpenTime` if the POS sent one, otherwise the time we recorded
53
+ * it. This, not `createdAt`, is what the reports filter and sort on: a seller asking for August
54
+ * means meals eaten in August, and a POS that reports late would otherwise file a meal under the
55
+ * day we happened to save it rather than the day it appears on their screen.
56
+ */
57
+ visitDate?: Date;
58
+ items?: IDiningCommitItem[];
59
+ siteName?: string;
60
+ /**
61
+ * The customer's name and phone as they stood in OUR record when the meal was reported.
62
+ * A snapshot on purpose: a commit is a receipt, so reports about August must keep saying what
63
+ * they said in August even if the customer later changes their details.
64
+ */
65
+ endUserName?: string;
66
+ endUserPhone?: string;
67
+ /** The POS's own view of the customer, stored verbatim for reconciliation. Never used as identity. */
68
+ customer?: Record<string, unknown>;
69
+ settled: boolean;
70
+ chargeId?: string | mongoose.Types.ObjectId | null;
71
+ createdAt?: Date;
72
+ updatedAt?: Date;
73
+ }
74
+ export interface IDiningBalanceResponse {
75
+ balance: number;
76
+ monthlyAmount: number;
77
+ fname?: string;
78
+ lname?: string;
79
+ phone?: string;
80
+ }
81
+ export interface IDiningCommitCreateResult {
82
+ success: true;
83
+ duplicate?: boolean;
84
+ balance: number;
85
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=diningCommit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diningCommit.js","sourceRoot":"","sources":["../../src/crm/diningCommit.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/session" />
19
+ /// <reference types="mongoose/types/types" />
20
+ /// <reference types="mongoose/types/utility" />
21
+ /// <reference types="mongoose/types/validation" />
22
+ /// <reference types="mongoose/types/virtuals" />
23
+ /// <reference types="mongoose/types/schematypes" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import mongoose from "mongoose";
27
+ export interface IDiningMemberModel {
28
+ _id?: string | mongoose.Types.ObjectId;
29
+ endUser: string | mongoose.Types.ObjectId;
30
+ seller: string | mongoose.Types.ObjectId;
31
+ marketplace: string | mongoose.Types.ObjectId;
32
+ monthlyAmount: number;
33
+ isActive: boolean;
34
+ createdAt?: Date;
35
+ updatedAt?: Date;
36
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=diningMember.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diningMember.js","sourceRoot":"","sources":["../../src/crm/diningMember.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ import { IMarketPlace } from "../account/marketPlace";
2
+ /**
3
+ * Group orders (הזמנות קבוצות) — CRM-owned vertical for visiting groups (schools, companies)
4
+ * booked by back-office staff. Issue nimi-events/nimi-backend#989 (Phase 1), #990 (Phase 2).
5
+ * Only the cross-service shapes live here; the CRM models are service-local.
6
+ */
7
+ /** Status flow: open → sent (for signature) → signed (external or manual) → active */
8
+ export declare enum IGroupOrderStatus {
9
+ OPEN = "open",
10
+ SENT = "sent",
11
+ SIGNED = "signed",
12
+ ACTIVE = "active"
13
+ }
14
+ export declare enum IGroupOrderHistoryType {
15
+ CREATED = "created",
16
+ EDITED = "edited",
17
+ STATUS = "status",
18
+ DEBT_DOC = "debt_doc",
19
+ DEBT_DOC_FAILED = "debt_doc_failed",
20
+ DEBT_DOC_SKIPPED = "debt_doc_skipped"
21
+ }
22
+ export interface IGroupOrderEmailContact {
23
+ email: string;
24
+ name?: string;
25
+ }
26
+ /**
27
+ * SQS body for IPostSQSType.GROUP_ORDER_SEND_FOR_SIGNATURE (CRM → send-notification).
28
+ * send-notification never fetches the marketplace — the producer ships it whole, as every other
29
+ * mail type does. Dates/times are pre-formatted display strings; money is in shekels.
30
+ */
31
+ export interface IGroupOrderSignatureEmailPayload {
32
+ marketplace: IMarketPlace;
33
+ to: IGroupOrderEmailContact;
34
+ cc: IGroupOrderEmailContact[];
35
+ sellerName: string;
36
+ sellerContactEmail?: string;
37
+ sellerContactPhone?: string;
38
+ order: {
39
+ id: string;
40
+ number: number;
41
+ groupName: string;
42
+ orgName: string;
43
+ visitDate: string;
44
+ slots: Array<{
45
+ eventName: string;
46
+ startTime: string;
47
+ }>;
48
+ headcount: {
49
+ adults: number;
50
+ children: number;
51
+ chaperones: number;
52
+ };
53
+ total: number;
54
+ };
55
+ /** Public signing page: `${baseAppURL}/group-order/:orderId?t=<token>` */
56
+ signUrl: string;
57
+ linkValidDays: number;
58
+ notesToGroup?: string;
59
+ /** Presigned URL of the unsigned document; send-notification fetches and attaches it */
60
+ pdf?: {
61
+ url: string;
62
+ filename: string;
63
+ };
64
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IGroupOrderHistoryType = exports.IGroupOrderStatus = void 0;
4
+ /**
5
+ * Group orders (הזמנות קבוצות) — CRM-owned vertical for visiting groups (schools, companies)
6
+ * booked by back-office staff. Issue nimi-events/nimi-backend#989 (Phase 1), #990 (Phase 2).
7
+ * Only the cross-service shapes live here; the CRM models are service-local.
8
+ */
9
+ /** Status flow: open → sent (for signature) → signed (external or manual) → active */
10
+ var IGroupOrderStatus;
11
+ (function (IGroupOrderStatus) {
12
+ IGroupOrderStatus["OPEN"] = "open";
13
+ IGroupOrderStatus["SENT"] = "sent";
14
+ IGroupOrderStatus["SIGNED"] = "signed";
15
+ IGroupOrderStatus["ACTIVE"] = "active";
16
+ })(IGroupOrderStatus || (exports.IGroupOrderStatus = IGroupOrderStatus = {}));
17
+ var IGroupOrderHistoryType;
18
+ (function (IGroupOrderHistoryType) {
19
+ IGroupOrderHistoryType["CREATED"] = "created";
20
+ IGroupOrderHistoryType["EDITED"] = "edited";
21
+ IGroupOrderHistoryType["STATUS"] = "status";
22
+ IGroupOrderHistoryType["DEBT_DOC"] = "debt_doc";
23
+ IGroupOrderHistoryType["DEBT_DOC_FAILED"] = "debt_doc_failed";
24
+ IGroupOrderHistoryType["DEBT_DOC_SKIPPED"] = "debt_doc_skipped";
25
+ })(IGroupOrderHistoryType || (exports.IGroupOrderHistoryType = IGroupOrderHistoryType = {}));
26
+ //# sourceMappingURL=groupOrder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupOrder.js","sourceRoot":"","sources":["../../src/crm/groupOrder.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AAEH,sFAAsF;AACtF,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,kCAAa,CAAA;IACb,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;AACnB,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,6CAAmB,CAAA;IACnB,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,+CAAqB,CAAA;IACrB,6DAAmC,CAAA;IACnC,+DAAqC,CAAA;AACvC,CAAC,EAPW,sBAAsB,sCAAtB,sBAAsB,QAOjC"}
@@ -6,3 +6,6 @@ export * from "./calendarEvent";
6
6
  export * from "./generalComment";
7
7
  export * from "./endUserComment";
8
8
  export * from "./visit";
9
+ export * from "./diningCommit";
10
+ export * from "./diningMember";
11
+ export * from "./groupOrder";
package/dist/crm/index.js CHANGED
@@ -22,4 +22,7 @@ __exportStar(require("./calendarEvent"), exports);
22
22
  __exportStar(require("./generalComment"), exports);
23
23
  __exportStar(require("./endUserComment"), exports);
24
24
  __exportStar(require("./visit"), exports);
25
+ __exportStar(require("./diningCommit"), exports);
26
+ __exportStar(require("./diningMember"), exports);
27
+ __exportStar(require("./groupOrder"), exports);
25
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crm/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,uDAAqC;AACrC,wDAAsC;AACtC,+CAA6B;AAC7B,kDAAgC;AAChC,mDAAiC;AACjC,mDAAiC;AACjC,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crm/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,uDAAqC;AACrC,wDAAsC;AACtC,+CAA6B;AAC7B,kDAAgC;AAChC,mDAAiC;AACjC,mDAAiC;AACjC,0CAAwB;AACxB,iDAA+B;AAC/B,iDAA+B;AAC/B,+CAA6B"}
@@ -29,7 +29,8 @@ export declare enum IPostSQSType {
29
29
  ENDUSER_EMAIL_VERIFICATION = "ENDUSER_EMAIL_VERIFICATION",
30
30
  BASKET_COMPLETED = "BASKET_COMPLETED",
31
31
  Z_REPORT = "Z_REPORT",
32
- INVOICE_ISSUED = "INVOICE_ISSUED"
32
+ INVOICE_ISSUED = "INVOICE_ISSUED",
33
+ GROUP_ORDER_SEND_FOR_SIGNATURE = "GROUP_ORDER_SEND_FOR_SIGNATURE"
33
34
  }
34
35
  export declare enum IMailPostSQSType {
35
36
  FORGOT_PASSWORD_EMAIL = "FORGOT_PASSWORD_EMAIL",
@@ -48,7 +49,8 @@ export declare enum IMailPostSQSType {
48
49
  DASHBOARD_2FA = "DASHBOARD_2FA",
49
50
  ENDUSER_EMAIL_VERIFICATION = "ENDUSER_EMAIL_VERIFICATION",
50
51
  BASKET_COMPLETED = "BASKET_COMPLETED",
51
- INVOICE_ISSUED = "INVOICE_ISSUED"
52
+ INVOICE_ISSUED = "INVOICE_ISSUED",
53
+ GROUP_ORDER_SEND_FOR_SIGNATURE = "GROUP_ORDER_SEND_FOR_SIGNATURE"
52
54
  }
53
55
  export declare enum IMailFormatTypes {
54
56
  template = "template",
@@ -38,6 +38,9 @@ var IPostSQSType;
38
38
  // Nimi invoice provider issues a document at a public URL and never mails it (iCount mails
39
39
  // its own), so without this the buyer is never told the receipt exists.
40
40
  IPostSQSType["INVOICE_ISSUED"] = "INVOICE_ISSUED";
41
+ // CRM group orders (#989): "שגר לחתימה" — emails the paying organization the order summary, the
42
+ // signing link and the PDF (to = org contact, cc = group contact). Payload: IGroupOrderSignatureEmailPayload.
43
+ IPostSQSType["GROUP_ORDER_SEND_FOR_SIGNATURE"] = "GROUP_ORDER_SEND_FOR_SIGNATURE";
41
44
  })(IPostSQSType || (exports.IPostSQSType = IPostSQSType = {}));
42
45
  var IMailPostSQSType;
43
46
  (function (IMailPostSQSType) {
@@ -58,6 +61,7 @@ var IMailPostSQSType;
58
61
  IMailPostSQSType["ENDUSER_EMAIL_VERIFICATION"] = "ENDUSER_EMAIL_VERIFICATION";
59
62
  IMailPostSQSType["BASKET_COMPLETED"] = "BASKET_COMPLETED";
60
63
  IMailPostSQSType["INVOICE_ISSUED"] = "INVOICE_ISSUED";
64
+ IMailPostSQSType["GROUP_ORDER_SEND_FOR_SIGNATURE"] = "GROUP_ORDER_SEND_FOR_SIGNATURE";
61
65
  })(IMailPostSQSType || (exports.IMailPostSQSType = IMailPostSQSType = {}));
62
66
  var IMailFormatTypes;
63
67
  (function (IMailFormatTypes) {
@@ -1 +1 @@
1
- {"version":3,"file":"sqs.js","sourceRoot":"","sources":["../../src/send-notification/sqs.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAoCX;AApCD,WAAY,YAAY;IACtB,+DAA+C,CAAA;IAC/C,2DAA2C,CAAA;IAC3C,qEAAqD,CAAA;IACrD,6CAA6B,CAAA;IAC7B,yDAAyC,CAAA;IACzC,qDAAqC,CAAA;IACrC,+CAA+B,CAAA;IAC/B,yEAAyD,CAAA;IACzD,iDAAiC,CAAA;IACjC,yDAAyC,CAAA;IACzC,iEAAiD,CAAA;IACjD,+DAA+C,CAAA;IAC/C,iCAAiB,CAAA;IACjB,2DAA2C,CAAA;IAC3C,+DAA+C,CAAA;IAC/C,iEAAiD,CAAA;IACjD,mFAAmE,CAAA;IACnE,qEAAqD,CAAA;IACrD,qDAAqC,CAAA;IACrC,+DAA+C,CAAA;IAC/C,iEAAiD,CAAA;IACjD,2EAA2D,CAAA;IAC3D,6DAA6C,CAAA;IAC7C,6EAA6D,CAAA;IAC7D,iEAAiD,CAAA;IACjD,uDAAuC,CAAA;IACvC,+CAA+B,CAAA;IAC/B,yEAAyD,CAAA;IACzD,qDAAqC,CAAA;IACrC,qCAAqB,CAAA;IACrB,sFAAsF;IACtF,6FAA6F;IAC7F,2FAA2F;IAC3F,wEAAwE;IACxE,iDAAiC,CAAA;AACnC,CAAC,EApCW,YAAY,4BAAZ,YAAY,QAoCvB;AACD,IAAY,gBAkBX;AAlBD,WAAY,gBAAgB;IAC1B,mEAA+C,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,qDAAqC,CAAA;IACrC,qCAAqB,CAAA;IACrB,sFAAsF;IACtF,6FAA6F;IAC7F,2FAA2F;IAC3F,wEAAwE;IACxE,iDAAiC,CAAA;IACjC,gGAAgG;IAChG,8GAA8G;IAC9G,iFAAiE,CAAA;AACnE,CAAC,EAvCW,YAAY,4BAAZ,YAAY,QAuCvB;AACD,IAAY,gBAmBX;AAnBD,WAAY,gBAAgB;IAC1B,mEAA+C,CAAA;IAC/C,6DAAyC,CAAA;IACzC,6DAAyC,CAAA;IACzC,mDAA+B,CAAA;IAC/B,qCAAiB,CAAA;IACjB,6EAAyD,CAAA;IACzD,qEAAiD,CAAA;IACjD,mEAA+C,CAAA;IAC/C,qEAAiD,CAAA;IACjD,+EAA2D,CAAA;IAC3D,iEAA6C,CAAA;IAC7C,iFAA6D,CAAA;IAC7D,qDAAiC,CAAA;IACjC,mDAA+B,CAAA;IAC/B,6EAAyD,CAAA;IACzD,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,qFAAiE,CAAA;AACnE,CAAC,EAnBW,gBAAgB,gCAAhB,gBAAgB,QAmB3B;AACD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,yCAAqB,CAAA;IACrB,iCAAa,CAAA;AACf,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimee/shared-types",
3
- "version": "1.0.328",
3
+ "version": "1.0.331",
4
4
  "description": "Types and interfaces that any service can access if needed",
5
5
  "main": "dist/index.js",
6
6
  "author": "dan goldberg",
@@ -224,6 +224,7 @@ export interface IAccountModel {
224
224
  subscriptionWalletDesign?: IWalletDesign;
225
225
  marketplaceDistributionId: string;
226
226
  isAllowSeasonTicket: boolean;
227
+ diningDefaultMonthlyAmount?: number;
227
228
  lockEndUserProfile?: boolean;
228
229
  hideCustomerChargesTab?: boolean;
229
230
  seasonTicketGrantsEntrance: boolean;
@@ -250,6 +251,8 @@ export interface IAccountModel {
250
251
  isBookable?: boolean;
251
252
  isBookableWithTickets?: boolean;
252
253
  hasCashier?: boolean;
254
+ /** Dashboard "הזמנות קבוצות" (CRM group orders) enabled — lives on the top-level seller account */
255
+ hasGroupOrders?: boolean;
253
256
  origin?: string;
254
257
  shouldSendInvoice?: boolean;
255
258
  invoiceProvider?: InvoiceProviderType;
@@ -1,4 +1,5 @@
1
1
  import mongoose from "mongoose";
2
+ import { IGroupOrderStatus } from "./groupOrder";
2
3
 
3
4
  export enum ICalendarEventType {
4
5
  TABLE_RESERVATION = "TABLE_RESERVATION",
@@ -6,6 +7,9 @@ export enum ICalendarEventType {
6
7
  TASK = "TASK",
7
8
  REGULAR = "REGULAR",
8
9
  WELLNESS = "WELLNESS",
10
+ // Mirror of a CRM group order slot (הזמנות קבוצות, #989): one calendar-event per order slot so
11
+ // the dashboard Calendar tab shows group visits with the order status.
12
+ GROUP_VISIT = "GROUP_VISIT",
9
13
  }
10
14
 
11
15
  export enum TaskStatus {
@@ -75,6 +79,12 @@ export interface ICalendarEventModel {
75
79
  createdAt: Date;
76
80
  }[];
77
81
  };
82
+ /** GROUP_VISIT only — the calendar `status` stays "scheduled"; the order status lives here */
83
+ groupVisit?: {
84
+ groupOrderId: string | mongoose.Types.ObjectId;
85
+ status: IGroupOrderStatus;
86
+ headcount: number;
87
+ };
78
88
  metadata?: Record<string, any>;
79
89
  createdAt?: Date;
80
90
  updatedAt?: Date;
@@ -0,0 +1,64 @@
1
+ import mongoose from "mongoose";
2
+
3
+ export interface IDiningCommitItem {
4
+ index?: number;
5
+ price?: number;
6
+ priceBeforeDiscount?: number;
7
+ posDiscount?: number;
8
+ qty?: number;
9
+ offerId?: string;
10
+ offerName?: string;
11
+ menuId?: string;
12
+ sectionId?: string;
13
+ sectionName?: string;
14
+ addedAt?: Date | string;
15
+ [key: string]: unknown;
16
+ }
17
+
18
+ export interface IDiningCommitModel {
19
+ _id?: string | mongoose.Types.ObjectId;
20
+ endUser: string | mongoose.Types.ObjectId;
21
+ seller: string | mongoose.Types.ObjectId;
22
+ marketplace: string | mongoose.Types.ObjectId;
23
+ amount: number;
24
+ orderTotal?: number;
25
+ orderId: string;
26
+ orderOpenTime?: Date;
27
+ orderEndTime?: Date;
28
+ /**
29
+ * When the meal was eaten — `orderOpenTime` if the POS sent one, otherwise the time we recorded
30
+ * it. This, not `createdAt`, is what the reports filter and sort on: a seller asking for August
31
+ * means meals eaten in August, and a POS that reports late would otherwise file a meal under the
32
+ * day we happened to save it rather than the day it appears on their screen.
33
+ */
34
+ visitDate?: Date;
35
+ items?: IDiningCommitItem[];
36
+ siteName?: string;
37
+ /**
38
+ * The customer's name and phone as they stood in OUR record when the meal was reported.
39
+ * A snapshot on purpose: a commit is a receipt, so reports about August must keep saying what
40
+ * they said in August even if the customer later changes their details.
41
+ */
42
+ endUserName?: string;
43
+ endUserPhone?: string;
44
+ /** The POS's own view of the customer, stored verbatim for reconciliation. Never used as identity. */
45
+ customer?: Record<string, unknown>;
46
+ settled: boolean;
47
+ chargeId?: string | mongoose.Types.ObjectId | null;
48
+ createdAt?: Date;
49
+ updatedAt?: Date;
50
+ }
51
+
52
+ export interface IDiningBalanceResponse {
53
+ balance: number;
54
+ monthlyAmount: number;
55
+ fname?: string;
56
+ lname?: string;
57
+ phone?: string;
58
+ }
59
+
60
+ export interface IDiningCommitCreateResult {
61
+ success: true;
62
+ duplicate?: boolean;
63
+ balance: number;
64
+ }
@@ -0,0 +1,12 @@
1
+ import mongoose from "mongoose";
2
+
3
+ export interface IDiningMemberModel {
4
+ _id?: string | mongoose.Types.ObjectId;
5
+ endUser: string | mongoose.Types.ObjectId;
6
+ seller: string | mongoose.Types.ObjectId;
7
+ marketplace: string | mongoose.Types.ObjectId;
8
+ monthlyAmount: number;
9
+ isActive: boolean;
10
+ createdAt?: Date;
11
+ updatedAt?: Date;
12
+ }
@@ -0,0 +1,59 @@
1
+ import { IMarketPlace } from "../account/marketPlace";
2
+
3
+ /**
4
+ * Group orders (הזמנות קבוצות) — CRM-owned vertical for visiting groups (schools, companies)
5
+ * booked by back-office staff. Issue nimi-events/nimi-backend#989 (Phase 1), #990 (Phase 2).
6
+ * Only the cross-service shapes live here; the CRM models are service-local.
7
+ */
8
+
9
+ /** Status flow: open → sent (for signature) → signed (external or manual) → active */
10
+ export enum IGroupOrderStatus {
11
+ OPEN = "open",
12
+ SENT = "sent",
13
+ SIGNED = "signed",
14
+ ACTIVE = "active",
15
+ }
16
+
17
+ export enum IGroupOrderHistoryType {
18
+ CREATED = "created",
19
+ EDITED = "edited",
20
+ STATUS = "status",
21
+ DEBT_DOC = "debt_doc",
22
+ DEBT_DOC_FAILED = "debt_doc_failed",
23
+ DEBT_DOC_SKIPPED = "debt_doc_skipped",
24
+ }
25
+
26
+ export interface IGroupOrderEmailContact {
27
+ email: string;
28
+ name?: string;
29
+ }
30
+
31
+ /**
32
+ * SQS body for IPostSQSType.GROUP_ORDER_SEND_FOR_SIGNATURE (CRM → send-notification).
33
+ * send-notification never fetches the marketplace — the producer ships it whole, as every other
34
+ * mail type does. Dates/times are pre-formatted display strings; money is in shekels.
35
+ */
36
+ export interface IGroupOrderSignatureEmailPayload {
37
+ marketplace: IMarketPlace;
38
+ to: IGroupOrderEmailContact;
39
+ cc: IGroupOrderEmailContact[];
40
+ sellerName: string;
41
+ sellerContactEmail?: string;
42
+ sellerContactPhone?: string;
43
+ order: {
44
+ id: string;
45
+ number: number;
46
+ groupName: string;
47
+ orgName: string;
48
+ visitDate: string; // dd.mm.yyyy
49
+ slots: Array<{ eventName: string; startTime: string }>; // "10:00"
50
+ headcount: { adults: number; children: number; chaperones: number };
51
+ total: number; // shekels
52
+ };
53
+ /** Public signing page: `${baseAppURL}/group-order/:orderId?t=<token>` */
54
+ signUrl: string;
55
+ linkValidDays: number;
56
+ notesToGroup?: string;
57
+ /** Presigned URL of the unsigned document; send-notification fetches and attaches it */
58
+ pdf?: { url: string; filename: string };
59
+ }
package/src/crm/index.ts CHANGED
@@ -6,3 +6,6 @@ export * from "./calendarEvent";
6
6
  export * from "./generalComment";
7
7
  export * from "./endUserComment";
8
8
  export * from "./visit";
9
+ export * from "./diningCommit";
10
+ export * from "./diningMember";
11
+ export * from "./groupOrder";
@@ -34,6 +34,9 @@ export enum IPostSQSType {
34
34
  // Nimi invoice provider issues a document at a public URL and never mails it (iCount mails
35
35
  // its own), so without this the buyer is never told the receipt exists.
36
36
  INVOICE_ISSUED = "INVOICE_ISSUED",
37
+ // CRM group orders (#989): "שגר לחתימה" — emails the paying organization the order summary, the
38
+ // signing link and the PDF (to = org contact, cc = group contact). Payload: IGroupOrderSignatureEmailPayload.
39
+ GROUP_ORDER_SEND_FOR_SIGNATURE = "GROUP_ORDER_SEND_FOR_SIGNATURE",
37
40
  }
38
41
  export enum IMailPostSQSType {
39
42
  FORGOT_PASSWORD_EMAIL = "FORGOT_PASSWORD_EMAIL",
@@ -53,6 +56,7 @@ export enum IMailPostSQSType {
53
56
  ENDUSER_EMAIL_VERIFICATION = "ENDUSER_EMAIL_VERIFICATION",
54
57
  BASKET_COMPLETED = "BASKET_COMPLETED",
55
58
  INVOICE_ISSUED = "INVOICE_ISSUED",
59
+ GROUP_ORDER_SEND_FOR_SIGNATURE = "GROUP_ORDER_SEND_FOR_SIGNATURE",
56
60
  }
57
61
  export enum IMailFormatTypes {
58
62
  template = "template",