@managesome/eposmatic-toolkit 0.4.77 → 0.4.80

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.
@@ -3,6 +3,7 @@
3
3
  export * from './enums/accounting';
4
4
  export * from './enums/cash';
5
5
  export * from './enums/communications';
6
+ export * from './enums/customer';
6
7
  export * from './enums/delivery';
7
8
  export * from './enums/geo';
8
9
  export * from './enums/hr';
@@ -290,6 +290,11 @@ export const BLACKLISTED_SMS_COUNTRY_CODES = [
290
290
  '+263', // Zimbabwe
291
291
  ];
292
292
  export const WHITELISTED_API_SMS_COUNTRY_CODES = ['+92']; // Pakistan
293
+ /**
294
+ * @deprecated WhatsApp is offered regardless of country now. Keep this export
295
+ * only until the POS/console/ordering consumers stop importing it; deleting it
296
+ * breaks their builds.
297
+ */
293
298
  export const BLACKLISTED_WHATSAPP_COUNTRY_CODES = ['+92']; // Pakistan
294
299
  // ======================>> <<====================== //
295
300
  export var ALERT_NOTIFICATIONS_TYPE_ENUM;
@@ -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,
@@ -1,6 +1,7 @@
1
1
  export * from './enums/accounting';
2
2
  export * from './enums/cash';
3
3
  export * from './enums/communications';
4
+ export * from './enums/customer';
4
5
  export * from './enums/delivery';
5
6
  export * from './enums/geo';
6
7
  export * from './enums/hr';
@@ -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);
@@ -46,6 +46,11 @@ export declare enum MARKETING_RECEIPIENT_ENUM {
46
46
  export declare const ALL_MARKETING_RECEIPIENT_TYPES: MARKETING_RECEIPIENT_ENUM[];
47
47
  export declare const BLACKLISTED_SMS_COUNTRY_CODES: string[];
48
48
  export declare const WHITELISTED_API_SMS_COUNTRY_CODES: string[];
49
+ /**
50
+ * @deprecated WhatsApp is offered regardless of country now. Keep this export
51
+ * only until the POS/console/ordering consumers stop importing it; deleting it
52
+ * breaks their builds.
53
+ */
49
54
  export declare const BLACKLISTED_WHATSAPP_COUNTRY_CODES: string[];
50
55
  export declare enum ALERT_NOTIFICATIONS_TYPE_ENUM {
51
56
  UNCONFIRMED_ORDER_DELAY = "UNCONFIRMED_ORDER_DELAY",
@@ -293,6 +293,11 @@ exports.BLACKLISTED_SMS_COUNTRY_CODES = [
293
293
  '+263', // Zimbabwe
294
294
  ];
295
295
  exports.WHITELISTED_API_SMS_COUNTRY_CODES = ['+92']; // Pakistan
296
+ /**
297
+ * @deprecated WhatsApp is offered regardless of country now. Keep this export
298
+ * only until the POS/console/ordering consumers stop importing it; deleting it
299
+ * breaks their builds.
300
+ */
296
301
  exports.BLACKLISTED_WHATSAPP_COUNTRY_CODES = ['+92']; // Pakistan
297
302
  // ======================>> <<====================== //
298
303
  var ALERT_NOTIFICATIONS_TYPE_ENUM;
@@ -0,0 +1,4 @@
1
+ export declare enum CUSTOMER_EMAIL_LOGIN_STATUS_ENUM {
2
+ LOGGED_IN = "logged_in",
3
+ NEEDS_PHONE = "needs_phone"
4
+ }
@@ -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 `GET /customer-auth/session` (items-service).
314
+ * Response for `POST /email/auth/verify-otp` (items-service).
315
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.
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 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
- }
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
+ };
@@ -242,17 +242,25 @@ export interface IEmailTemplateForSaleOrder {
242
242
  description: string;
243
243
  theme_color?: string | null;
244
244
  }
245
+ /**
246
+ * Template model for the Postmark `otp-verification` template (id `48566213`).
247
+ *
248
+ * Every key listed in the template is REQUIRED here. Postmark renders a blank
249
+ * value for a missing key rather than failing, so callers must always send the
250
+ * full object and use `null` (or `""`) when a value does not apply.
251
+ */
245
252
  export interface IEmailTemplateForOTP {
253
+ otp_code: string;
246
254
  brand_name: string;
247
- brand_logo_url: string;
248
- header_color: string;
249
- footer_color: string;
255
+ expiry_minutes: number;
256
+ theme_color: string;
257
+ brand_logo_url: string | null;
258
+ theme_contrast: string;
250
259
  user_name: string;
251
260
  user_email: string;
252
- otp_code: string;
253
- expiry_minutes: number;
254
- anti_phishing_code?: string | null;
261
+ anti_phishing_code: string | null;
255
262
  support_email: string;
263
+ subject: string;
256
264
  }
257
265
  export type ITemplateModel = IEmailAccountActivated | IEmailAccountDeactivated | IEmailLateDeliveryAlert | IEmailLowInventoryAlert | IEmailOrderReceipt | IEmailOrderStatusUpdate | IEmailRateOrder | IEmailReceivedOrderReview | IEmailSubscriptionDueSoon | IEmailSubscriptionPending | IEmailSubscriptionExpired | IEmailSubscriptionRenewed | IEmailUnconfirmOrderAlert | IEmailWelcome | IEmailMarketingFormSubmission | IEmailTemplateForRFQ | IEmailTemplateForPurchaseOrder | IEmailTemplateForSaleOrder | IEmailTemplateForOTP;
258
266
  export {};
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.4.77",
3
+ "version": "0.4.80",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",