@managesome/eposmatic-toolkit 0.4.77 → 0.4.78
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/esm/constants/ENUMS.js +1 -0
- package/esm/constants/enums/customer.js +5 -0
- package/esm/schemas/models/customers.js +0 -5
- package/lib/constants/ENUMS.d.ts +1 -0
- package/lib/constants/ENUMS.js +1 -0
- package/lib/constants/enums/customer.d.ts +4 -0
- package/lib/constants/enums/customer.js +8 -0
- package/lib/helpers/types/api-types.d.ts +13 -33
- package/lib/helpers/types/email-templates.d.ts +1 -1
- package/lib/schemas/models/customers.d.ts +0 -5
- package/lib/schemas/models/customers.js +0 -5
- package/package.json +1 -1
package/esm/constants/ENUMS.js
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export var CUSTOMER_EMAIL_LOGIN_STATUS_ENUM;
|
|
2
|
+
(function (CUSTOMER_EMAIL_LOGIN_STATUS_ENUM) {
|
|
3
|
+
CUSTOMER_EMAIL_LOGIN_STATUS_ENUM["LOGGED_IN"] = "logged_in";
|
|
4
|
+
CUSTOMER_EMAIL_LOGIN_STATUS_ENUM["NEEDS_PHONE"] = "needs_phone";
|
|
5
|
+
})(CUSTOMER_EMAIL_LOGIN_STATUS_ENUM || (CUSTOMER_EMAIL_LOGIN_STATUS_ENUM = {}));
|
|
@@ -220,7 +220,6 @@ export const CUSTOMER_COLLECTION_NAME = 'customers';
|
|
|
220
220
|
* - `_id`: unique primary key.
|
|
221
221
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
222
222
|
* - `brand_id__email`: per-brand customer lookups by email (email/Google login).
|
|
223
|
-
* - `brand_id__uid`: per-brand customer lookups by Firebase uid.
|
|
224
223
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
225
224
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
226
225
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -240,10 +239,6 @@ export const CUSTOMER_COLLECTION_INDEXES = {
|
|
|
240
239
|
brand_id: 1,
|
|
241
240
|
email: 1,
|
|
242
241
|
}, // per-brand customer lookups by email (email login / account resolution)
|
|
243
|
-
brand_id__uid: {
|
|
244
|
-
brand_id: 1,
|
|
245
|
-
uid: 1,
|
|
246
|
-
}, // per-brand customer lookups by Firebase uid
|
|
247
242
|
brand_id__createdAt: {
|
|
248
243
|
brand_id: 1,
|
|
249
244
|
createdAt: -1,
|
package/lib/constants/ENUMS.d.ts
CHANGED
package/lib/constants/ENUMS.js
CHANGED
|
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
__exportStar(require("./enums/accounting"), exports);
|
|
20
20
|
__exportStar(require("./enums/cash"), exports);
|
|
21
21
|
__exportStar(require("./enums/communications"), exports);
|
|
22
|
+
__exportStar(require("./enums/customer"), exports);
|
|
22
23
|
__exportStar(require("./enums/delivery"), exports);
|
|
23
24
|
__exportStar(require("./enums/geo"), exports);
|
|
24
25
|
__exportStar(require("./enums/hr"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CUSTOMER_EMAIL_LOGIN_STATUS_ENUM = void 0;
|
|
4
|
+
var CUSTOMER_EMAIL_LOGIN_STATUS_ENUM;
|
|
5
|
+
(function (CUSTOMER_EMAIL_LOGIN_STATUS_ENUM) {
|
|
6
|
+
CUSTOMER_EMAIL_LOGIN_STATUS_ENUM["LOGGED_IN"] = "logged_in";
|
|
7
|
+
CUSTOMER_EMAIL_LOGIN_STATUS_ENUM["NEEDS_PHONE"] = "needs_phone";
|
|
8
|
+
})(CUSTOMER_EMAIL_LOGIN_STATUS_ENUM || (exports.CUSTOMER_EMAIL_LOGIN_STATUS_ENUM = CUSTOMER_EMAIL_LOGIN_STATUS_ENUM = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { CUSTOMER_EMAIL_LOGIN_STATUS_ENUM } from '../../constants/enums/customer';
|
|
1
2
|
import { CUSTOMER_TARGET_MODE_ENUM, DIALER_TYPES_ENUM, WALLET_ASSET_TYPE_ENUM, WALLET_ASSIGNMENT_BEHAVIOR_ENUM } from '../../constants';
|
|
2
|
-
import { ICustomer } from '../../schemas/types/customers';
|
|
3
3
|
/**
|
|
4
4
|
* Request/response contracts for backend service APIs, shared between apps and
|
|
5
5
|
* services (items-service, POS frontends, provider integrations).
|
|
@@ -311,37 +311,17 @@ export interface IGoogleMapsRouteResponse {
|
|
|
311
311
|
distanceMeters: number;
|
|
312
312
|
}
|
|
313
313
|
/**
|
|
314
|
-
* Response for `
|
|
314
|
+
* Response for `POST /email/auth/verify-otp` (items-service).
|
|
315
315
|
*
|
|
316
|
-
* `
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* `
|
|
316
|
+
* - `logged_in`: the brand customer already proves both the email and the
|
|
317
|
+
* phone; `custom_token` opens the phone user's Firebase session.
|
|
318
|
+
* - `needs_phone`: verify the phone through the existing OTP flow, then
|
|
319
|
+
* exchange `email_proof` at `POST /email/auth/link-email`.
|
|
320
320
|
*/
|
|
321
|
-
export
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
customer: ICustomer | null;
|
|
329
|
-
canonical_token: string | null;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Outcome of `POST /customer-auth/link-phone` (items-service).
|
|
333
|
-
*
|
|
334
|
-
* - `created`: the phone was free and a new unverified row was created.
|
|
335
|
-
* - `linked`: the row already belonged to this identity.
|
|
336
|
-
* - `requires_otp`: an unverified row owned by someone else; send a code via
|
|
337
|
-
* `/wa/auth/send-otp` or `/sms/auth/send-otp`, then call again with `otp`.
|
|
338
|
-
* - `conflict`: a verified row owned by another account.
|
|
339
|
-
* - `verified`: the submitted `otp` was accepted and the phone now belongs to
|
|
340
|
-
* this account.
|
|
341
|
-
*/
|
|
342
|
-
export type TCustomerPhoneLinkStatus = 'created' | 'linked' | 'requires_otp' | 'conflict' | 'verified';
|
|
343
|
-
export interface ICustomerPhoneLinkResponse {
|
|
344
|
-
status: TCustomerPhoneLinkStatus;
|
|
345
|
-
phone_number_verified: boolean;
|
|
346
|
-
customer?: ICustomer | null;
|
|
347
|
-
}
|
|
321
|
+
export type TCustomerEmailLoginResponse = {
|
|
322
|
+
status: CUSTOMER_EMAIL_LOGIN_STATUS_ENUM.LOGGED_IN;
|
|
323
|
+
custom_token: string;
|
|
324
|
+
} | {
|
|
325
|
+
status: CUSTOMER_EMAIL_LOGIN_STATUS_ENUM.NEEDS_PHONE;
|
|
326
|
+
email_proof: string;
|
|
327
|
+
};
|
|
@@ -573,7 +573,6 @@ export declare const CUSTOMER_COLLECTION_NAME = "customers";
|
|
|
573
573
|
* - `_id`: unique primary key.
|
|
574
574
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
575
575
|
* - `brand_id__email`: per-brand customer lookups by email (email/Google login).
|
|
576
|
-
* - `brand_id__uid`: per-brand customer lookups by Firebase uid.
|
|
577
576
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
578
577
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
579
578
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -595,10 +594,6 @@ export declare const CUSTOMER_COLLECTION_INDEXES: {
|
|
|
595
594
|
brand_id: number;
|
|
596
595
|
email: number;
|
|
597
596
|
};
|
|
598
|
-
brand_id__uid: {
|
|
599
|
-
brand_id: number;
|
|
600
|
-
uid: number;
|
|
601
|
-
};
|
|
602
597
|
brand_id__createdAt: {
|
|
603
598
|
brand_id: number;
|
|
604
599
|
createdAt: number;
|
|
@@ -223,7 +223,6 @@ exports.CUSTOMER_COLLECTION_NAME = 'customers';
|
|
|
223
223
|
* - `_id`: unique primary key.
|
|
224
224
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
225
225
|
* - `brand_id__email`: per-brand customer lookups by email (email/Google login).
|
|
226
|
-
* - `brand_id__uid`: per-brand customer lookups by Firebase uid.
|
|
227
226
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
228
227
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
229
228
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -243,10 +242,6 @@ exports.CUSTOMER_COLLECTION_INDEXES = {
|
|
|
243
242
|
brand_id: 1,
|
|
244
243
|
email: 1,
|
|
245
244
|
}, // per-brand customer lookups by email (email login / account resolution)
|
|
246
|
-
brand_id__uid: {
|
|
247
|
-
brand_id: 1,
|
|
248
|
-
uid: 1,
|
|
249
|
-
}, // per-brand customer lookups by Firebase uid
|
|
250
245
|
brand_id__createdAt: {
|
|
251
246
|
brand_id: 1,
|
|
252
247
|
createdAt: -1,
|