shopoflex-types 1.0.99 → 1.0.102

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.
Files changed (2) hide show
  1. package/dist/common.d.ts +31 -20
  2. package/package.json +1 -1
package/dist/common.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import mongoose from 'mongoose';
2
2
  import { Category, GroupedCategory, ProductType } from 'shopoflex-types';
3
+ import { NameType } from './productCart';
3
4
  export interface Discount {
4
5
  _id?: mongoose.Types.ObjectId;
5
6
  code?: string;
@@ -178,11 +179,6 @@ export interface Customer {
178
179
  isAnonymos?: boolean;
179
180
  files?: FileType[];
180
181
  }
181
- export interface VendorAssociation {
182
- vendorId: string;
183
- role?: string;
184
- permissions?: string[];
185
- }
186
182
  export interface IUser {
187
183
  _id?: any;
188
184
  uid?: string;
@@ -192,14 +188,13 @@ export interface IUser {
192
188
  phone?: string;
193
189
  photoURL?: string;
194
190
  isAdmin?: boolean;
195
- vendors?: VendorAssociation[];
196
191
  createdAt?: Date;
197
192
  updatedAt?: Date;
198
193
  fcmTokens?: string[];
199
194
  files?: FileType[];
200
195
  }
201
196
  export interface CurrentUserType extends IUser {
202
- vendors?: {
197
+ vendors?: Array<{
203
198
  vendorId: string;
204
199
  name: {
205
200
  en: string;
@@ -210,17 +205,31 @@ export interface CurrentUserType extends IUser {
210
205
  en: string;
211
206
  ar: string;
212
207
  };
213
- }[];
208
+ role: IRole;
209
+ }>;
214
210
  hasAccesstoVendor?: boolean;
215
211
  }
216
- export type IRole = {
212
+ export type Permission = 'products.read' | 'products.create' | 'products.update' | 'products.delete' | 'products.cost' | 'products.inventory' | 'orders.read' | 'orders.create' | 'orders.update' | 'orders.delete' | 'orders.refund' | 'orders.status' | 'customers.read' | 'customers.create' | 'customers.update' | 'customers.delete' | 'accounting.read' | 'accounting.create' | 'accounting.update' | 'accounting.delete' | 'analytics.dashboard' | 'analytics.revenue' | 'analytics.customers' | 'analytics.products' | 'analytics.traffic' | 'analytics.financial' | 'analytics.inventory' | 'analytics.export' | 'branches.read' | 'branches.create' | 'branches.update' | 'branches.delete' | 'users.read' | 'users.create' | 'users.update' | 'users.delete' | 'users.invite' | 'users.permissions.view' | 'roles.read' | 'roles.create' | 'roles.update' | 'roles.delete' | 'system.vendor.update' | 'system.discounts.read' | 'system.discounts.create' | 'system.discounts.update' | 'system.discounts.delete' | 'system.wallet.view' | 'traffic.read' | 'traffic.analytics' | 'traffic.network';
213
+ export interface IRole {
217
214
  _id?: string;
218
- name?: {
215
+ name: {
216
+ en: string;
217
+ ar?: string;
218
+ };
219
+ description?: {
219
220
  en?: string;
220
221
  ar?: string;
221
222
  };
222
- permissions?: string[];
223
- };
223
+ permissions: Permission[];
224
+ vendorId?: string;
225
+ isActive?: boolean;
226
+ branchRestrictions?: Array<{
227
+ branchId: string;
228
+ permissions: Permission[];
229
+ }>;
230
+ createdAt?: Date;
231
+ updatedAt?: Date;
232
+ }
224
233
  type PaymentConfig<T extends PaymentMethodType> = {
225
234
  active: boolean;
226
235
  status: string;
@@ -235,12 +244,17 @@ type PaymentConfig<T extends PaymentMethodType> = {
235
244
  type VendorPayments = {
236
245
  [K in PaymentMethodType]?: PaymentConfig<K>;
237
246
  };
247
+ type LanguageCode = 'en' | 'ar' | 'fr' | 'es' | 'de' | 'zh' | 'ja' | 'ru' | 'hi' | 'th' | 'pt';
248
+ export interface LanguageConfig {
249
+ active: boolean;
250
+ font: string;
251
+ }
238
252
  export interface Vendor {
239
253
  _id?: string;
240
- name: {
241
- en: string;
242
- ar: string;
243
- };
254
+ industry?: string;
255
+ languages: Partial<Record<LanguageCode, LanguageConfig>>;
256
+ defaultLanguage: LanguageCode;
257
+ name: NameType;
244
258
  domains: string[];
245
259
  description: {
246
260
  en: string;
@@ -249,10 +263,6 @@ export interface Vendor {
249
263
  logo: FileType[];
250
264
  cover: FileType[];
251
265
  favicon: FileType[];
252
- font: {
253
- en: any;
254
- ar: any;
255
- };
256
266
  colors: {
257
267
  primaryColor: string;
258
268
  textColor: string;
@@ -471,4 +481,5 @@ export interface successResponse {
471
481
  hasNextPage: boolean;
472
482
  hasPrevPage: boolean;
473
483
  }
484
+ export type Industry = "restaurant" | "grocery" | "retail" | "pharmacy" | "services";
474
485
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopoflex-types",
3
- "version": "1.0.99",
3
+ "version": "1.0.102",
4
4
  "description": "Shared TypeScript types for Shopoflex applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",