@managesome/eposmatic-toolkit 0.4.68 → 0.4.72

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.
@@ -219,6 +219,8 @@ export const CUSTOMER_COLLECTION_NAME = 'customers';
219
219
  * be passed straight to `.hint()`.
220
220
  * - `_id`: unique primary key.
221
221
  * - `brand_id__phone_number`: per-brand customer lookups by phone number.
222
+ * - `brand_id__email`: per-brand customer lookups by email (email/Google login).
223
+ * - `brand_id__uid`: per-brand customer lookups by Firebase uid.
222
224
  * - `brand_id__createdAt`: per-brand customer lookups newest first.
223
225
  * - `brand_id__total_spent`: per-brand customer lookups by total spent.
224
226
  * - `brand_id__total_orders`: per-brand customer lookups by total orders.
@@ -234,6 +236,14 @@ export const CUSTOMER_COLLECTION_INDEXES = {
234
236
  brand_id: 1,
235
237
  phone_number: 1,
236
238
  }, // per-brand customer lookups by phone number
239
+ brand_id__email: {
240
+ brand_id: 1,
241
+ email: 1,
242
+ }, // 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
237
247
  brand_id__createdAt: {
238
248
  brand_id: 1,
239
249
  createdAt: -1,
@@ -1,4 +1,5 @@
1
1
  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';
2
3
  /**
3
4
  * Request/response contracts for backend service APIs, shared between apps and
4
5
  * services (items-service, POS frontends, provider integrations).
@@ -309,3 +310,38 @@ export interface IGoogleMapsRouteResponse {
309
310
  polyline?: [number, number][];
310
311
  distanceMeters: number;
311
312
  }
313
+ /**
314
+ * Response for `GET /customer-auth/session` (items-service).
315
+ *
316
+ * `uid` is the session's Firebase uid. When an email/Google credential maps to
317
+ * a phone-verified account, the backend returns `canonical_token`; signing in
318
+ * with it switches the session to that uid before wallet data is read.
319
+ * `needs_phone` is true when the account has no customer record yet.
320
+ */
321
+ export interface ICustomerAccountSessionResponse {
322
+ uid: string;
323
+ email: string | null;
324
+ email_verified: boolean;
325
+ phone_number: string | null;
326
+ phone_verified: boolean;
327
+ needs_phone: boolean;
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
+ }
@@ -572,6 +572,8 @@ export declare const CUSTOMER_COLLECTION_NAME = "customers";
572
572
  * be passed straight to `.hint()`.
573
573
  * - `_id`: unique primary key.
574
574
  * - `brand_id__phone_number`: per-brand customer lookups by phone number.
575
+ * - `brand_id__email`: per-brand customer lookups by email (email/Google login).
576
+ * - `brand_id__uid`: per-brand customer lookups by Firebase uid.
575
577
  * - `brand_id__createdAt`: per-brand customer lookups newest first.
576
578
  * - `brand_id__total_spent`: per-brand customer lookups by total spent.
577
579
  * - `brand_id__total_orders`: per-brand customer lookups by total orders.
@@ -589,6 +591,14 @@ export declare const CUSTOMER_COLLECTION_INDEXES: {
589
591
  brand_id: number;
590
592
  phone_number: number;
591
593
  };
594
+ brand_id__email: {
595
+ brand_id: number;
596
+ email: number;
597
+ };
598
+ brand_id__uid: {
599
+ brand_id: number;
600
+ uid: number;
601
+ };
592
602
  brand_id__createdAt: {
593
603
  brand_id: number;
594
604
  createdAt: number;
@@ -222,6 +222,8 @@ exports.CUSTOMER_COLLECTION_NAME = 'customers';
222
222
  * be passed straight to `.hint()`.
223
223
  * - `_id`: unique primary key.
224
224
  * - `brand_id__phone_number`: per-brand customer lookups by phone number.
225
+ * - `brand_id__email`: per-brand customer lookups by email (email/Google login).
226
+ * - `brand_id__uid`: per-brand customer lookups by Firebase uid.
225
227
  * - `brand_id__createdAt`: per-brand customer lookups newest first.
226
228
  * - `brand_id__total_spent`: per-brand customer lookups by total spent.
227
229
  * - `brand_id__total_orders`: per-brand customer lookups by total orders.
@@ -237,6 +239,14 @@ exports.CUSTOMER_COLLECTION_INDEXES = {
237
239
  brand_id: 1,
238
240
  phone_number: 1,
239
241
  }, // per-brand customer lookups by phone number
242
+ brand_id__email: {
243
+ brand_id: 1,
244
+ email: 1,
245
+ }, // 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
240
250
  brand_id__createdAt: {
241
251
  brand_id: 1,
242
252
  createdAt: -1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.4.68",
3
+ "version": "0.4.72",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",