feeef 0.6.3 → 0.6.5
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/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/feeef/feeef.ts","../src/feeef/repositories/repository.ts","../src/feeef/repositories/orders.ts","../src/feeef/repositories/products.ts","../src/feeef/repositories/stores.ts","../src/feeef/repositories/users.ts","../src/feeef/repositories/deposits.ts","../src/feeef/repositories/transfers.ts","../src/feeef/repositories/categories.ts","../src/feeef/repositories/countries.ts","../src/feeef/repositories/states.ts","../src/feeef/repositories/cities.ts","../src/feeef/repositories/currencies.ts","../src/feeef/repositories/shipping_prices.ts","../src/feeef/repositories/shipping_methods.ts","../src/feeef/repositories/feedbacks.ts","../src/core/entities/order.ts","../src/core/entities/shipping_method.ts","../src/core/entities/shipping_price.ts","../src/feeef/services/service.ts","../src/feeef/services/cart.ts","../src/feeef/services/actions.ts","../src/feeef/services/notifications.ts","../src/feeef/services/storage.ts","../src/feeef/services/integrations.ts","../src/core/entities/store.ts","../src/core/entities/product.ts","../src/core/entities/feedback.ts","../src/core/embadded/contact.ts","../src/utils.ts"],"sourcesContent":["import axios, { AxiosInstance } from 'axios'\n// Repositories\nimport { OrderRepository } from './repositories/orders.js'\nimport { ProductRepository } from './repositories/products.js'\nimport { StoreRepository } from './repositories/stores.js'\nimport { UserRepository } from './repositories/users.js'\nimport { DepositRepository } from './repositories/deposits.js'\nimport { TransferRepository } from './repositories/transfers.js'\nimport { CategoryRepository } from './repositories/categories.js'\nimport { CountryRepository } from './repositories/countries.js'\nimport { StateRepository } from './repositories/states.js'\nimport { CityRepository } from './repositories/cities.js'\nimport { CurrencyRepository } from './repositories/currencies.js'\nimport { ShippingPriceRepository } from './repositories/shipping_prices.js'\nimport { ShippingMethodRepository } from './repositories/shipping_methods.js'\nimport { FeedbackRepository } from './repositories/feedbacks.js'\n// Services\nimport { CartService } from './services/cart.js'\nimport { ActionsService } from './services/actions.js'\nimport { NotificationsService } from './services/notifications.js'\nimport { StorageService } from './services/storage.js'\nimport { IntegrationFactory } from './services/integrations.js'\n\n/**\n * Configuration options for the FeeeF module.\n */\nexport interface FeeeFConfig {\n /**\n * The API key to be used for authentication.\n */\n apiKey: string\n\n /**\n * An optional Axios instance to be used for making HTTP requests.\n */\n client?: AxiosInstance\n\n /**\n * Specifies whether caching should be enabled or disabled.\n * If set to a number, it represents the maximum number of seconds to cache the responses.\n * If set to `false`, caching will be disabled (5s).\n * cannot be less than 5 seconds\n */\n cache?: false | number\n\n /**\n * The base URL for the API.\n */\n baseURL?: string\n}\n\n/**\n * Represents the FeeeF class.\n */\nexport class FeeeF {\n /**\n * The API key used for authentication.\n */\n apiKey: string\n\n /**\n * The Axios instance used for making HTTP requests.\n */\n client: AxiosInstance\n\n /**\n * The repository for managing stores.\n */\n stores: StoreRepository\n\n /**\n * The repository for managing products.\n */\n products: ProductRepository\n\n /**\n * The repository for managing users.\n */\n users: UserRepository\n\n /**\n * The repository for managing orders.\n */\n orders: OrderRepository\n\n /**\n * The repository for managing deposits.\n */\n deposits: DepositRepository\n\n /**\n * The repository for managing transfers.\n */\n transfers: TransferRepository\n\n /**\n * The repository for managing categories.\n */\n categories: CategoryRepository\n\n /**\n * The repository for managing countries.\n */\n countries: CountryRepository\n\n /**\n * The repository for managing states.\n */\n states: StateRepository\n\n /**\n * The repository for managing cities.\n */\n cities: CityRepository\n\n /**\n * The repository for managing currencies.\n */\n currencies: CurrencyRepository\n\n /**\n * The repository for managing shipping prices.\n */\n shippingPrices: ShippingPriceRepository\n\n /**\n * The repository for managing shipping methods.\n */\n shippingMethods: ShippingMethodRepository\n\n /**\n * The repository for managing feedbacks.\n */\n feedbacks: FeedbackRepository\n\n /**\n * The cart service for managing the cart.\n */\n cart: CartService\n\n /**\n * The actions service for performing various actions (file uploads, etc.)\n */\n actions: ActionsService\n\n /**\n * The notifications service for sending push notifications\n */\n notifications: NotificationsService\n\n /**\n * The storage service for uploading files\n */\n storage: StorageService\n\n /**\n * The integration factory for creating integration API instances\n */\n integrations: IntegrationFactory\n\n /**\n * Constructs a new instance of the FeeeF class.\n * @param {FeeeFConfig} config - The configuration object.\n * @param {string} config.apiKey - The API key used for authentication.\n * @param {AxiosInstance} config.client - The Axios instance used for making HTTP requests.\n * @param {boolean | number} config.cache - The caching configuration. Set to `false` to disable caching, or provide a number to set the cache TTL in milliseconds.\n */\n constructor({ apiKey, client, cache, baseURL = 'http://localhost:3333/api/v1' }: FeeeFConfig) {\n console.log('feeef super cache', cache)\n this.apiKey = apiKey\n\n this.client = client || axios\n // set the api key\n this.client.defaults.headers.common['Authorization'] = `Bearer ${this.apiKey}`\n // set base url\n this.client.defaults.baseURL = baseURL\n // set accept header\n this.client.defaults.headers.common['Accept'] = 'application/json'\n this.client.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'\n\n // Initialize repositories\n this.stores = new StoreRepository(this.client)\n this.products = new ProductRepository(this.client)\n this.users = new UserRepository(this.client)\n this.orders = new OrderRepository(this.client)\n this.deposits = new DepositRepository(this.client)\n this.transfers = new TransferRepository(this.client)\n this.categories = new CategoryRepository(this.client)\n this.countries = new CountryRepository(this.client)\n this.states = new StateRepository(this.client)\n this.cities = new CityRepository(this.client)\n this.currencies = new CurrencyRepository(this.client)\n this.shippingPrices = new ShippingPriceRepository(this.client)\n this.shippingMethods = new ShippingMethodRepository(this.client)\n this.feedbacks = new FeedbackRepository(this.client)\n\n // Initialize services\n this.cart = new CartService()\n this.actions = new ActionsService(this.client)\n this.notifications = new NotificationsService(this.client)\n this.storage = new StorageService(this.client)\n this.integrations = new IntegrationFactory(this.client)\n }\n\n /**\n * Sets a header for all requests\n * @param {string} key - The header key.\n * @param {string} value - The header value.\n */\n setHeader(key: string, value: string) {\n this.client.defaults.headers.common[key] = value\n }\n\n /**\n * Removes a header from the default headers.\n * @param {string} key - The key of the header to remove.\n */\n removeHeader(key: string) {\n delete this.client.defaults.headers.common[key]\n }\n}\n","import { AxiosInstance } from 'axios'\n\n/**\n * Represents a generic model repository.\n * @template T - The type of the model.\n * @template C - The type of the create options.\n * @template U - The type of the update options.\n */\nexport abstract class ModelRepository<T, C, U> {\n resource: string\n // client\n client: AxiosInstance\n\n /**\n * Constructs a new instance of the ModelRepository class.\n * @param resource - The resource name.\n * @param client - The Axios instance used for making HTTP requests.\n */\n constructor(resource: string, client: AxiosInstance) {\n this.resource = resource\n this.client = client\n }\n\n /**\n * Finds a model by its ID or other criteria.\n * @param options - The options for finding the model.\n * @returns A promise that resolves to the found model.\n */\n async find(options: ModelFindOptions): Promise<T> {\n const { id, by, params } = options\n const res = await this.client.get(`/${this.resource}/${id}`, {\n params: {\n by: by || 'id',\n ...params,\n },\n })\n return res.data\n }\n\n /**\n * Lists models with optional pagination and filtering.\n * @param options - The options for listing the models.\n * @returns A promise that resolves to a list of models.\n */\n async list(options?: ModelListOptions): Promise<ListResponse<T>> {\n const { page, offset, limit, params } = options || {}\n const res = await this.client.get(`/${this.resource}`, {\n params: { page, offset, limit, ...params },\n })\n // if res.data is an array then create ListResponse\n if (Array.isArray(res.data)) {\n return {\n data: res.data,\n }\n } else {\n return {\n data: res.data.data,\n total: res.data.meta.total,\n page: res.data.meta.currentPage,\n limit: res.data.meta.perPage,\n }\n }\n }\n\n /**\n * Creates a new model.\n * Supports two call patterns:\n * 1. `create(data, params?)` - Pass data directly with optional params\n * 2. `create({ data, params })` - Pass options object\n * @param dataOrOptions - The data to create or options object containing data and params\n * @param params - Optional query parameters (only used when data is passed directly)\n * @returns A promise that resolves to the created model.\n */\n async create(dataOrOptions: C | ModelCreateOptions<C>, params?: Record<string, any>): Promise<T> {\n // If dataOrOptions is already wrapped in ModelCreateOptions, use it directly\n if (dataOrOptions && typeof dataOrOptions === 'object' && 'data' in dataOrOptions) {\n const options = dataOrOptions as ModelCreateOptions<C>\n const { data, params: optionsParams } = options\n const requestParams = optionsParams || params\n const res = await this.client.post(`/${this.resource}`, data, {\n params: requestParams,\n })\n return res.data\n }\n // Otherwise, wrap the data in ModelCreateOptions\n const options: ModelCreateOptions<C> = {\n data: dataOrOptions as C,\n }\n if (params) {\n options.params = params\n }\n const res = await this.client.post(`/${this.resource}`, options.data, {\n params: options.params,\n })\n return res.data\n }\n\n /**\n * Updates an existing model.\n * @param options - The options for updating the model.\n * @returns A promise that resolves to the updated model.\n */\n async update(options: ModelUpdateOptions<U>): Promise<T> {\n const { id, data, params } = options\n const res = await this.client.put(`/${this.resource}/${id}`, data, {\n params,\n })\n return res.data\n }\n\n /**\n * Deletes a model by its ID or other criteria.\n * @param options - The options for deleting the model.\n * @returns A promise that resolves when the model is deleted.\n */\n async delete(options: ModelFindOptions): Promise<void> {\n const { id, by, params } = options\n await this.client.delete(`/${this.resource}/${id}`, {\n params: {\n by: by || 'id',\n ...params,\n },\n })\n }\n}\n\n/**\n * Represents a list response containing an array of data of type T.\n */\nexport interface ListResponse<T> {\n data: T[]\n total?: number\n page?: number\n limit?: number\n}\n\n/**\n * Represents the options for making a request.\n */\ninterface RequestOptions {\n params?: Record<string, any>\n}\n\nexport interface ModelFindOptions extends RequestOptions {\n /**\n * The ID of the model to find or the value to find by.\n */\n id: string\n /**\n * The field to find by.\n * @default \"id\" - The ID field.\n */\n by?: string\n}\n\n/**\n * Options for listing models.\n */\nexport interface ModelListOptions extends RequestOptions {\n /**\n * The page number to retrieve.\n */\n page?: number\n\n /**\n * The offset from the beginning of the list.\n */\n offset?: number\n\n /**\n * The maximum number of models to retrieve per page.\n */\n limit?: number\n}\n\n/**\n * Represents the options for creating a model.\n * @template T - The type of data being created.\n */\nexport interface ModelCreateOptions<T> extends RequestOptions {\n data: T\n}\n\n/**\n * Represents the options for updating a model.\n * @template T - The type of the data being updated.\n */\nexport interface ModelUpdateOptions<T> extends RequestOptions {\n /**\n * The ID of the model to update.\n */\n id: string\n /**\n * The data to update the model with.\n */\n data: T\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n OrderEntity,\n OrderTrackEntity,\n OrderStatus,\n DeliveryStatus,\n PaymentStatus,\n ShippingType,\n OrderCreateInput,\n OrderUpdateInput,\n OrderPricing,\n CalculateOrderPricingOptions,\n} from '../../core/entities/order.js'\n\n/**\n * Represents the options for tracking an order.\n */\nexport interface OrderModelTrackOptions {\n id: string\n params?: Record<string, any>\n}\n\n/**\n * Schema for sending an order from an anonymous user\n */\nexport interface SendOrderSchema {\n id?: string\n customerName?: string\n customerNote?: string\n customerPhone: string\n customerEmail?: string\n source?: string\n shippingAddress?: string\n shippingCity?: string\n shippingState?: string\n shippingCountry?: string\n shippingType: ShippingType\n shippingMethodId?: string\n shippingNote?: string\n paymentMethodId?: string\n items: GuestOrderItemSchema[]\n coupon?: string\n status: 'pending' | 'draft'\n storeId: string\n customFields?: Record<string, any>\n metadata?: any\n}\n\n/**\n * Schema for guest order items\n */\nexport interface GuestOrderItemSchema {\n productId: string\n offerCode?: string\n variantPath?: string\n quantity: number\n addons?: Record<string, number>\n}\n\n/**\n * Schema for assigning a single order to a member\n */\nexport interface AssignOrderSchema {\n orderId: string\n memberId: string\n storeId: string\n}\n\n/**\n * Schema for assigning multiple orders to a member\n */\nexport interface AssignManyOrdersSchema {\n orderIds: string[]\n memberId: string\n storeId: string\n}\n\n/**\n * Delivery service filter enum\n */\nexport enum DeliveryServiceFilter {\n yalidine = 'yalidine',\n ecotrack = 'ecotrack',\n procolis = 'procolis',\n noest = 'noest',\n zimou = 'zimou',\n maystro = 'maystro',\n ecomanager = 'ecomanager',\n}\n\n/**\n * Options for listing orders\n */\nexport interface OrderListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n status?: OrderStatus | OrderStatus[]\n deliveryStatus?: DeliveryStatus\n paymentStatus?: PaymentStatus\n customStatus?: string | string[]\n source?: string | string[]\n tags?: string[]\n createdBefore?: Date | string\n createdAfter?: Date | string\n q?: string\n confirmer?: string\n products?: string[]\n shippingState?: string\n shippingCity?: string\n deliveryService?: DeliveryServiceFilter\n params?: Record<string, any>\n}\n\n/**\n * Represents a repository for managing orders.\n */\nexport class OrderRepository extends ModelRepository<\n OrderEntity,\n OrderCreateInput,\n OrderUpdateInput\n> {\n /**\n * Constructs a new OrderRepository instance.\n * @param client - The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('orders', client)\n }\n\n /**\n * Lists orders with optional filtering.\n * @param options - The options for listing orders.\n * @returns A Promise that resolves to a list of Order entities.\n */\n async list(options?: OrderListOptions): Promise<ListResponse<OrderEntity>> {\n const params: Record<string, any> = { ...options?.params }\n\n if (options) {\n if (options.page) params.page = options.page\n if (options.offset) params.offset = options.offset\n if (options.limit) params.limit = options.limit\n if (options.storeId) params.store_id = options.storeId\n if (options.status) {\n params.status = Array.isArray(options.status) ? options.status : [options.status]\n }\n if (options.deliveryStatus) params.deliveryStatus = options.deliveryStatus\n if (options.paymentStatus) params.paymentStatus = options.paymentStatus\n if (options.customStatus) params.customStatus = options.customStatus\n if (options.source) params.source = options.source\n if (options.tags) params.tags = options.tags\n if (options.createdBefore) {\n params.created_before =\n options.createdBefore instanceof Date\n ? options.createdBefore.toISOString()\n : options.createdBefore\n }\n if (options.createdAfter) {\n params.created_after =\n options.createdAfter instanceof Date\n ? options.createdAfter.toISOString()\n : options.createdAfter\n }\n if (options.q) params.q = options.q\n if (options.confirmer) params.confirmer = options.confirmer\n if (options.products) params.products = options.products\n if (options.shippingState) params.shippingState = options.shippingState\n if (options.shippingCity) params.shippingCity = options.shippingCity\n if (options.deliveryService) params.deliveryService = options.deliveryService\n }\n\n return super.list({ params })\n }\n\n /**\n * Sends an order from an anonymous user.\n * @param data - The data representing the order to be sent.\n * @returns A Promise that resolves to the sent OrderEntity.\n */\n async send(data: SendOrderSchema): Promise<OrderEntity> {\n const res = await this.client.post(`/${this.resource}/send`, data)\n return res.data\n }\n\n /**\n * Tracks the order by the order ID.\n * Returns the order status and history.\n * @param options - The options for tracking the order.\n * @returns A promise that resolves to the order track entity.\n */\n async track(options: OrderModelTrackOptions): Promise<OrderTrackEntity> {\n const { id, params } = options\n const res = await this.client.get(`/${this.resource}/${id}/track`, {\n params,\n })\n return res.data\n }\n\n /**\n * Calculates order pricing based on items, shipping details, etc.\n * @param options - The calculation options.\n * @returns A Promise that resolves to the calculated pricing.\n */\n async calculate(options: CalculateOrderPricingOptions): Promise<OrderPricing> {\n const res = await this.client.post(`/${this.resource}/calculate`, {\n storeId: options.storeId,\n items: options.items.map((item) => ({\n productId: item.productId,\n quantity: item.quantity,\n variantPath: item.variantPath,\n offerCode: item.offerCode,\n addons: item.addons,\n price: item.price,\n discount: item.discount,\n })),\n shippingState: options.shippingState,\n shippingCountry: options.shippingCountry,\n shippingType: options.shippingType,\n shippingAddress: options.shippingAddress,\n })\n\n return {\n subtotal: res.data.pricing.subtotal,\n shippingPrice: res.data.pricing.shippingPrice,\n calculatedTotal: res.data.pricing.calculatedTotal,\n }\n }\n\n /**\n * Assigns a single order to a member (as confirmer).\n * @param data - The data containing orderId, memberId, and storeId.\n * @returns A Promise that resolves to the updated OrderEntity.\n */\n async assign(data: AssignOrderSchema): Promise<OrderEntity> {\n const res = await this.client.post(`/${this.resource}/assign`, data)\n return res.data\n }\n\n /**\n * Assigns multiple orders to a member (as confirmer).\n * @param data - The data containing orderIds, memberId, and storeId.\n * @returns A Promise that resolves to a success message.\n */\n async assignMany(data: AssignManyOrdersSchema): Promise<{ message: string }> {\n const res = await this.client.post(`/${this.resource}/assignMany`, data)\n return res.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n ProductEntity,\n ProductCreateInput,\n ProductUpdateInput,\n ProductReport,\n ProductStatus,\n} from '../../core/entities/product.js'\n\n/**\n * Options for listing products\n */\nexport interface ProductListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n categoryId?: string\n status?: ProductStatus | ProductStatus[]\n q?: string\n minPrice?: number\n maxPrice?: number\n inStock?: boolean\n sortBy?: 'price' | 'createdAt' | 'sold' | 'views'\n sortOrder?: 'asc' | 'desc'\n params?: Record<string, any>\n}\n\n/**\n * Represents a repository for managing products.\n */\nexport class ProductRepository extends ModelRepository<\n ProductEntity,\n ProductCreateInput,\n ProductUpdateInput\n> {\n /**\n * Creates a new instance of the ProductRepository class.\n * @param client - The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('products', client)\n }\n\n /**\n * Lists products with optional filtering.\n * @param options - The options for listing products.\n * @returns A Promise that resolves to a list of Product entities.\n */\n async list(options?: ProductListOptions): Promise<ListResponse<ProductEntity>> {\n const {\n storeId,\n categoryId,\n status,\n q,\n minPrice,\n maxPrice,\n inStock,\n sortBy,\n sortOrder,\n ...listOptions\n } = options || {}\n\n const params: Record<string, any> = {\n ...listOptions.params,\n }\n\n if (storeId) params.store_id = storeId\n if (categoryId) params.category_id = categoryId\n if (status) params.status = Array.isArray(status) ? status : [status]\n if (q) params.q = q\n if (minPrice !== undefined) params.min_price = minPrice\n if (maxPrice !== undefined) params.max_price = maxPrice\n if (inStock !== undefined) params.in_stock = inStock\n if (sortBy) params.sort_by = sortBy\n if (sortOrder) params.sort_order = sortOrder\n\n return super.list({\n ...listOptions,\n params,\n })\n }\n\n /**\n * Retrieves random products from the repository.\n * @param limit - The number of random products to retrieve. Default is 12.\n * @returns A promise that resolves to an array of random ProductEntity objects.\n */\n async random(limit = 12): Promise<ProductEntity[]> {\n const response = await this.client.get<ProductEntity[]>(`/products/random`, {\n params: { limit },\n })\n return response.data\n }\n\n /**\n * Gets the sells chart for a product (last 7 days).\n * @param productId - The product ID.\n * @param storeId - The store ID.\n * @returns A Promise that resolves to a map of date to number of sells.\n */\n async sells(productId: string, storeId: string): Promise<Map<Date, number>> {\n const res = await this.client.get(`/stores/${storeId}/${this.resource}/${productId}/sells`)\n const sellsData = new Map<Date, number>()\n\n if (res.data) {\n for (const [key, value] of Object.entries(res.data)) {\n sellsData.set(new Date(key), Number(value) || 0)\n }\n }\n\n return sellsData\n }\n\n /**\n * Gets the analytics/report for a product.\n * @param productId - The product ID.\n * @param storeId - The store ID.\n * @returns A Promise that resolves to the product report.\n */\n async report(productId: string, storeId: string): Promise<ProductReport> {\n const res = await this.client.get(`/stores/${storeId}/${this.resource}/${productId}/report`)\n return res.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n StoreEntity,\n StoreSummary,\n StoreMember,\n StoreSubscriptionType,\n AddStoreMemberInput,\n UpdateStoreMemberInput,\n StoreCreateInput,\n StoreUpdateInput,\n} from '../../core/entities/store.js'\n\n/**\n * Options for listing stores\n */\nexport interface StoreListOptions {\n page?: number\n offset?: number\n limit?: number\n userId?: string\n params?: Record<string, any>\n}\n\n/**\n * Options for getting store summary\n */\nexport interface StoreSummaryOptions {\n id: string\n from?: Date | string\n to?: Date | string\n}\n\n/**\n * Result from paying store due\n */\nexport interface PayDueResult {\n success: boolean\n paidAmount: number\n remainingDue: number\n cost: number\n}\n\n/**\n * Repository for managing Store entities.\n */\nexport class StoreRepository extends ModelRepository<\n StoreEntity,\n StoreCreateInput,\n StoreUpdateInput\n> {\n /**\n * Constructs a new StoreRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('stores', client)\n }\n\n /**\n * Lists stores with optional filtering.\n * @param options - The options for listing stores.\n * @returns A Promise that resolves to a list of Store entities.\n */\n async list(options?: StoreListOptions): Promise<ListResponse<StoreEntity>> {\n const { userId, ...listOptions } = options || {}\n return super.list({\n ...listOptions,\n params: {\n ...listOptions.params,\n ...(userId && { user_id: userId }),\n },\n })\n }\n\n /**\n * Gets the summary for a store.\n * @param options - The summary options including store ID and date range.\n * @returns A Promise that resolves to the store summary.\n */\n async summary(options: StoreSummaryOptions): Promise<StoreSummary> {\n const { id, from, to } = options\n const params: Record<string, string> = {}\n if (from) params.from = from instanceof Date ? from.toISOString() : from\n if (to) params.to = to instanceof Date ? to.toISOString() : to\n\n const res = await this.client.get(`/${this.resource}/${id}/summary`, { params })\n return res.data\n }\n\n /**\n * Gets the orders chart data for a store.\n * @param id - The store ID.\n * @returns A Promise that resolves to a map of date to order count.\n */\n async chart(id: string): Promise<Map<Date, number>> {\n const res = await this.client.get(`/${this.resource}/${id}/chart`)\n const chartData = new Map<Date, number>()\n\n if (res.data.orders) {\n for (const [key, value] of Object.entries(res.data.orders)) {\n chartData.set(new Date(key), Number(value))\n }\n }\n\n return chartData\n }\n\n /**\n * Adds a member to the store.\n * @param storeId - The store ID.\n * @param data - The member data.\n * @returns A Promise that resolves to the added member.\n */\n async addMember(storeId: string, data: AddStoreMemberInput): Promise<StoreMember> {\n const res = await this.client.post(`/${this.resource}/${storeId}/members`, {\n email: data.email,\n role: data.role,\n name: data.name,\n metadata: data.metadata,\n })\n return res.data\n }\n\n /**\n * Edits a store member.\n * @param storeId - The store ID.\n * @param memberId - The member ID.\n * @param data - The update data.\n * @returns A Promise that resolves to the updated member.\n */\n async editMember(\n storeId: string,\n memberId: string,\n data: UpdateStoreMemberInput\n ): Promise<StoreMember> {\n const res = await this.client.put(`/${this.resource}/${storeId}/members/${memberId}`, {\n role: data.role,\n name: data.name,\n metadata: data.metadata,\n })\n return res.data\n }\n\n /**\n * Removes a member from the store.\n * @param storeId - The store ID.\n * @param memberId - The member ID.\n * @returns A Promise that resolves when the member is removed.\n */\n async removeMember(storeId: string, memberId: string): Promise<void> {\n await this.client.delete(`/${this.resource}/${storeId}/members/${memberId}`)\n }\n\n /**\n * Upgrades or renews a store's subscription plan.\n * @param id - The store ID.\n * @param plan - The plan type to upgrade to.\n * @param months - The number of months (1-12).\n * @returns A Promise that resolves when the upgrade is complete.\n */\n async upgrade(id: string, plan: StoreSubscriptionType, months: number): Promise<void> {\n await this.client.post(`/${this.resource}/${id}/subscription/upgrade`, {\n plan,\n months,\n })\n }\n\n /**\n * Purchases additional points for a store's subscription.\n * @param id - The store ID.\n * @param points - The number of points to purchase.\n * @returns A Promise that resolves when the charge is complete.\n */\n async charge(id: string, points: number): Promise<void> {\n await this.client.post(`/${this.resource}/${id}/subscription/charge`, {\n points,\n })\n }\n\n /**\n * Pays store due amount.\n * @param storeId - The store ID.\n * @param amount - The amount of due to pay (in points).\n * @returns A Promise that resolves to the payment result.\n */\n async payDue(storeId: string, amount: number): Promise<PayDueResult> {\n const res = await this.client.post(`/${this.resource}/${storeId}/subscription/payDue`, {\n amount,\n })\n return res.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository } from './repository.js'\nimport {\n AccessToken,\n AuthToken,\n CreateUserOptions,\n FinishPasskeyAuthenticationOptions,\n FinishPasskeyRegistrationOptions,\n LinkSocialAccountOptions,\n Passkey,\n SigninCredentials,\n SigninWithSocialOptions,\n SignupCredentials,\n TransferMoneyOptions,\n TransferMoneyResponse,\n UpdateUserOptions,\n UserEntity,\n UserUpdate,\n StartPasskeyAuthenticationOptions,\n StartPasskeyRegistrationOptions,\n} from '../../core/entities/user.js'\n\n/**\n * Represents the response returned by the authentication process.\n */\nexport interface AuthResponse {\n token: AuthToken\n user: UserEntity\n}\n\n/**\n * Represents a repository for managing user data and authentication.\n * Extends the ModelRepository class with authentication capabilities.\n */\nexport class UserRepository extends ModelRepository<\n UserEntity,\n CreateUserOptions,\n UpdateUserOptions\n> {\n /**\n * Represents the current authentication response.\n * Set automatically after signin, signup, or signinWithToken.\n */\n private _auth: AuthResponse | null = null\n\n /**\n * Gets the current authentication response.\n */\n get auth(): AuthResponse | null {\n return this._auth\n }\n\n /**\n * Sets the authentication response and updates the Authorization header.\n */\n private set auth(value: AuthResponse | null) {\n this._auth = value\n if (value?.token?.token) {\n this.client.defaults.headers.common['Authorization'] = `Bearer ${value.token.token}`\n } else {\n delete this.client.defaults.headers.common['Authorization']\n }\n }\n\n /**\n * Constructs a new UserRepository instance.\n * @param client - The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('users', client)\n }\n\n /**\n * Signs in a user with the provided credentials.\n * @param credentials - The user credentials (email, password, optional fcmToken).\n * @returns A promise that resolves to the authentication response.\n */\n async signin(credentials: SigninCredentials): Promise<AuthResponse> {\n const res = await this.client.post(`/${this.resource}/auth/signin`, credentials)\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Signs up a new user with the provided credentials.\n * @param credentials - The user signup credentials.\n * @returns A promise that resolves to the authentication response.\n */\n async signup(credentials: SignupCredentials): Promise<AuthResponse> {\n const res = await this.client.post(`/${this.resource}/auth/signup`, credentials)\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Signs in a user with an existing token.\n * Useful for restoring authentication state from localStorage.\n * @param token - The authentication token.\n * @param fcmToken - Optional FCM token for push notifications.\n * @returns A promise that resolves to the authentication response.\n */\n async signinWithToken(token: string, fcmToken?: string | null): Promise<AuthResponse> {\n // Set the token in headers first\n this.client.defaults.headers.common['Authorization'] = `Bearer ${token}`\n\n // Call the me endpoint to get user data\n const res = await this.client.get(`/${this.resource}/auth`)\n\n // Update FCM token if provided\n if (fcmToken) {\n try {\n await this.client.post(`/${this.resource}/auth/fcm-token`, { fcmToken })\n } catch (e) {\n // Ignore FCM token update errors\n console.warn('Failed to update FCM token:', e)\n }\n }\n\n this.auth = {\n user: res.data.user,\n token: { ...res.data.token, token },\n }\n\n return this.auth!\n }\n\n /**\n * Signs out the currently authenticated user.\n * Deletes the token on the server and clears local auth state.\n * @returns A promise that resolves when the user is signed out.\n */\n async signout(): Promise<void> {\n if (this.auth) {\n try {\n await this.client.post(`/${this.resource}/auth/signout`)\n } catch (e) {\n // Even if the request fails, clear local auth state\n console.warn('Signout request failed:', e)\n }\n }\n this.auth = null\n }\n\n /**\n * Gets the currently authenticated user.\n * @returns A promise that resolves to the authentication response with current user.\n */\n async me(): Promise<AuthResponse> {\n const res = await this.client.get(`/${this.resource}/auth`)\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Updates the authenticated user's profile.\n * @param data - The updated user data.\n * @returns A promise that resolves to the updated user entity.\n */\n async updateMe(data: UserUpdate): Promise<UserEntity> {\n const res = await this.client.put(`/${this.resource}/auth`, data)\n // Update local auth state if user was updated\n if (this.auth) {\n this.auth = {\n ...this.auth,\n user: res.data,\n }\n }\n return res.data\n }\n\n /**\n * Sends a password reset email to the user.\n * @param email - The user's email address.\n * @returns A promise that resolves when the email is sent.\n */\n async sendResetPasswordEmail(email: string): Promise<void> {\n await this.client.post(`/${this.resource}/auth/reset-password`, null, {\n params: { email },\n })\n }\n\n /**\n * Resets the password using a token from the reset email.\n * @param uid - The user ID.\n * @param token - The reset token from the email.\n * @returns A promise that resolves when the password is reset.\n */\n async resetPasswordWithToken(uid: string, token: string): Promise<void> {\n await this.client.get(`/${this.resource}/auth/reset-password`, {\n params: { uid, token },\n })\n }\n\n /**\n * Gets all access tokens for the authenticated user.\n * @returns A promise that resolves to an array of access tokens.\n */\n async tokens(): Promise<AccessToken[]> {\n const res = await this.client.get(`/${this.resource}/auth/tokens`)\n return res.data\n }\n\n /**\n * Signs in with Google OAuth.\n * @param options - The OAuth code and optional FCM token.\n * @returns A promise that resolves to the authentication response.\n */\n async signinWithGoogle(options: SigninWithSocialOptions): Promise<AuthResponse> {\n const res = await this.client.post('/social/google/callback', {\n code: options.code,\n fcmToken: options.fcmToken,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Signs in with GitHub OAuth.\n * @param options - The OAuth code and optional FCM token.\n * @returns A promise that resolves to the authentication response.\n */\n async signinWithGitHub(options: SigninWithSocialOptions): Promise<AuthResponse> {\n const res = await this.client.post('/social/github/callback', {\n code: options.code,\n fcmToken: options.fcmToken,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Signs in with Apple OAuth.\n * @param options - The OAuth code and optional FCM token.\n * @returns A promise that resolves to the authentication response.\n */\n async signinWithApple(options: SigninWithSocialOptions): Promise<AuthResponse> {\n const res = await this.client.post('/social/apple/callback', {\n code: options.code,\n fcmToken: options.fcmToken,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Links a social account to the current user.\n * @param options - The provider and OAuth code.\n * @returns A promise that resolves to the updated user entity.\n */\n async linkSocialAccount(options: LinkSocialAccountOptions): Promise<UserEntity> {\n const res = await this.client.post(`/social/${options.provider}/link/callback`, {\n code: options.code,\n })\n // Update local auth state if it's the current user\n if (this.auth && this.auth.user.id === res.data.user.id) {\n this.auth = {\n ...this.auth,\n user: res.data.user,\n }\n }\n return res.data.user\n }\n\n /**\n * Unlinks a social account from the current user.\n * @param provider - The social provider to unlink.\n * @returns A promise that resolves to the updated user entity.\n */\n async unlinkSocialAccount(provider: 'google' | 'github' | 'apple'): Promise<UserEntity> {\n const res = await this.client.post('/social/unlink', { provider })\n // Update local auth state if it's the current user\n if (this.auth && this.auth.user.id === res.data.user.id) {\n this.auth = {\n ...this.auth,\n user: res.data.user,\n }\n }\n return res.data.user\n }\n\n /**\n * Transfers money from the authenticated user to another user.\n * @param options - Transfer options including recipient and amount.\n * @returns A promise that resolves to the transfer response with updated users.\n */\n async transferMoney(options: TransferMoneyOptions): Promise<TransferMoneyResponse> {\n const res = await this.client.post(`/${this.resource}/auth/transfer`, options)\n // Update local auth state if sender is the current user\n if (this.auth && this.auth.user.id === res.data.sender.id) {\n this.auth = {\n ...this.auth,\n user: res.data.sender,\n }\n }\n return res.data\n }\n\n /**\n * Starts passkey registration.\n * @param options - Optional device name for the passkey.\n * @returns A promise that resolves to the registration challenge data.\n */\n async startPasskeyRegistration(\n options?: StartPasskeyRegistrationOptions\n ): Promise<Record<string, any>> {\n const res = await this.client.post('/passkeys/register/start', {\n deviceName: options?.deviceName,\n })\n return res.data\n }\n\n /**\n * Finishes passkey registration.\n * @param options - The registration response from the authenticator.\n * @returns A promise that resolves to the authentication response.\n */\n async finishPasskeyRegistration(\n options: FinishPasskeyRegistrationOptions\n ): Promise<AuthResponse> {\n const res = await this.client.post('/passkeys/register/finish', {\n response: options.registrationResponse,\n deviceName: options.deviceName,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Starts passkey authentication.\n * @param options - Optional email to identify the user.\n * @returns A promise that resolves to the authentication challenge data.\n */\n async startPasskeyAuthentication(\n options?: StartPasskeyAuthenticationOptions\n ): Promise<Record<string, any>> {\n const res = await this.client.post('/passkeys/authenticate/start', {\n email: options?.email,\n })\n return res.data\n }\n\n /**\n * Finishes passkey authentication.\n * @param options - The authentication response from the authenticator.\n * @returns A promise that resolves to the authentication response.\n */\n async finishPasskeyAuthentication(\n options: FinishPasskeyAuthenticationOptions\n ): Promise<AuthResponse> {\n const res = await this.client.post('/passkeys/authenticate/finish', {\n response: options.authenticationResponse,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Lists all passkeys for the authenticated user.\n * @returns A promise that resolves to an array of passkeys.\n */\n async listPasskeys(): Promise<Passkey[]> {\n const res = await this.client.get('/passkeys')\n return res.data.passkeys || []\n }\n\n /**\n * Deletes a passkey.\n * @param passkeyId - The ID of the passkey to delete.\n * @returns A promise that resolves when the passkey is deleted.\n */\n async deletePasskey(passkeyId: string): Promise<void> {\n await this.client.delete(`/passkeys/${passkeyId}`)\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\n\n/**\n * Deposit status enum\n */\nexport type DepositStatus = 'pending' | 'completed' | 'failed' | 'cancelled'\n\n/**\n * Represents a deposit entity for wallet transactions\n */\nexport interface DepositEntity {\n id: string\n externalId?: string | null\n userId: string\n amount: number\n currency: string\n paymentMethod?: string | null\n attachment?: string | null\n status: DepositStatus\n note?: string | null\n metadata: Record<string, any>\n history: Array<{\n status: string\n timestamp: string\n note?: string\n }>\n createdAt: any\n updatedAt: any\n}\n\n/**\n * Input data for creating a new deposit\n */\nexport interface DepositCreateInput {\n id?: string\n externalId?: string\n userId?: string\n amount: number\n currency?: string\n paymentMethod?: string\n attachment?: string\n status?: DepositStatus\n note?: string\n metadata?: Record<string, any>\n}\n\n/**\n * Input data for updating an existing deposit\n */\nexport interface DepositUpdateInput {\n externalId?: string\n amount?: number\n currency?: string\n paymentMethod?: string\n attachment?: string\n status?: DepositStatus\n note?: string\n metadata?: Record<string, any>\n}\n\n/**\n * Options for listing deposits\n */\nexport interface DepositListOptions {\n page?: number\n offset?: number\n limit?: number\n userId?: string\n status?: DepositStatus | DepositStatus[]\n paymentMethod?: string\n createdAfter?: Date | string\n createdBefore?: Date | string\n minAmount?: number\n maxAmount?: number\n q?: string\n params?: Record<string, any>\n}\n\n/**\n * PayPal order creation response\n */\nexport interface PayPalOrderResponse {\n id: string\n status: string\n approvalUrl?: string\n links: Array<{\n href: string\n rel: string\n method: string\n }>\n}\n\n/**\n * PayPal order capture response\n */\nexport interface PayPalCaptureResponse {\n id: string\n status: string\n captureId?: string\n amount?: number\n currency?: string\n}\n\n/**\n * Repository for managing deposit data and PayPal integration\n */\nexport class DepositRepository extends ModelRepository<\n DepositEntity,\n DepositCreateInput,\n DepositUpdateInput\n> {\n /**\n * Constructs a new DepositRepository instance\n * @param client - The AxiosInstance used for making HTTP requests\n */\n constructor(client: AxiosInstance) {\n super('deposits', client)\n }\n\n /**\n * Lists deposits with optional filtering.\n * @param options - The options for listing deposits.\n * @returns A Promise that resolves to a list of Deposit entities.\n */\n async list(options?: DepositListOptions): Promise<ListResponse<DepositEntity>> {\n const params: Record<string, any> = { ...options?.params }\n\n if (options) {\n if (options.page) params.page = options.page\n if (options.offset) params.offset = options.offset\n if (options.limit) params.limit = options.limit\n if (options.userId) params.user_id = options.userId\n if (options.status) {\n params.status = Array.isArray(options.status) ? options.status : [options.status]\n }\n if (options.paymentMethod) params.payment_method = options.paymentMethod\n if (options.createdAfter) {\n params.created_after =\n options.createdAfter instanceof Date\n ? options.createdAfter.toISOString()\n : options.createdAfter\n }\n if (options.createdBefore) {\n params.created_before =\n options.createdBefore instanceof Date\n ? options.createdBefore.toISOString()\n : options.createdBefore\n }\n if (options.minAmount !== undefined) params.min_amount = options.minAmount\n if (options.maxAmount !== undefined) params.max_amount = options.maxAmount\n if (options.q) params.q = options.q\n }\n\n return super.list({ params })\n }\n\n /**\n * Create a new deposit request (for anonymous/guest users)\n * @param data - The deposit data\n * @returns Promise that resolves to the created deposit\n */\n async send(data: DepositCreateInput): Promise<DepositEntity> {\n const res = await this.client.post(`/${this.resource}/send`, data)\n return res.data\n }\n\n /**\n * Create a PayPal order for deposit\n * @param params - PayPal order parameters\n * @returns Promise that resolves to PayPal order details\n */\n async createPayPalOrder(params: {\n amount: number\n currency?: string\n depositId?: string\n returnUrl: string\n cancelUrl: string\n }): Promise<PayPalOrderResponse> {\n const orderData = {\n amount: params.amount,\n currency: params.currency || 'USD',\n depositId: params.depositId,\n returnUrl: params.returnUrl,\n cancelUrl: params.cancelUrl,\n }\n\n const res = await this.client.post(`/${this.resource}/paypal/create-order`, orderData)\n\n // Extract approval URL from links\n const approvalLink = res.data.links?.find((link: any) => link.rel === 'approve')\n\n return {\n id: res.data.id,\n status: res.data.status,\n approvalUrl: approvalLink?.href,\n links: res.data.links || [],\n }\n }\n\n /**\n * Capture a PayPal order after user approval\n * @param orderId - PayPal order ID\n * @returns Promise that resolves to capture details\n */\n async capturePayPalOrder(orderId: string): Promise<PayPalCaptureResponse> {\n const res = await this.client.post(`/${this.resource}/paypal/capture-order`, {\n orderId,\n })\n return res.data\n }\n\n /**\n * Get PayPal order status\n * @param orderId - PayPal order ID\n * @returns Promise that resolves to order details\n */\n async getPayPalOrderStatus(orderId: string): Promise<{\n id: string\n status: string\n amount?: number\n currency?: string\n }> {\n const res = await this.client.get(`/${this.resource}/paypal/order/${orderId}`)\n return res.data\n }\n\n /**\n * Accept a pending deposit (admin only)\n * @param depositId - The deposit ID to accept\n * @param note - Optional note for the status change\n * @returns Promise that resolves to the updated deposit\n */\n async accept(depositId: string, note?: string): Promise<DepositEntity> {\n return this.update({\n id: depositId,\n data: {\n status: 'completed',\n note,\n },\n })\n }\n\n /**\n * Reject a pending deposit (admin only)\n * @param depositId - The deposit ID to reject\n * @param note - Optional note for the rejection reason\n * @returns Promise that resolves to the updated deposit\n */\n async reject(depositId: string, note?: string): Promise<DepositEntity> {\n return this.update({\n id: depositId,\n data: {\n status: 'failed',\n note,\n },\n })\n }\n\n /**\n * Cancel a pending deposit\n * @param depositId - The deposit ID to cancel\n * @param note - Optional note for the cancellation reason\n * @returns Promise that resolves to the updated deposit\n */\n async cancel(depositId: string, note?: string): Promise<DepositEntity> {\n return this.update({\n id: depositId,\n data: {\n status: 'cancelled',\n note,\n },\n })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\n\n/**\n * Transfer type enum\n */\nexport type TransferType =\n | 'deposit'\n | 'subscription'\n | 'points'\n | 'store_due'\n | 'user_transfer'\n | 'ai_generation'\n | 'refund'\n | 'adjustment'\n\n/**\n * Represents a transfer entity for double-entry accounting transactions\n */\nexport interface TransferEntity {\n id: string\n debitAccountId: string\n creditAccountId: string\n amount: number\n type: TransferType\n referenceId?: string | null\n description?: string | null\n metadata: Record<string, any>\n createdAt: any\n}\n\n/**\n * Input data for creating a new transfer\n */\nexport interface TransferCreateInput {\n debitAccountId: string\n creditAccountId: string\n amount: number\n type: TransferType\n referenceId?: string | null\n description?: string | null\n metadata?: Record<string, any>\n}\n\n/**\n * Input data for updating an existing transfer\n * Note: Transfers are typically immutable, but metadata/description may be updatable\n */\nexport interface TransferUpdateInput {\n description?: string | null\n metadata?: Record<string, any>\n}\n\n/**\n * Options for listing transfers\n */\nexport interface TransferListOptions {\n page?: number\n offset?: number\n limit?: number\n debitAccountId?: string\n creditAccountId?: string\n accountId?: string // Either debit or credit\n type?: TransferType | TransferType[]\n referenceId?: string\n createdAfter?: Date | string\n createdBefore?: Date | string\n minAmount?: number\n maxAmount?: number\n params?: Record<string, any>\n}\n\n/**\n * Repository for managing transfer data\n */\nexport class TransferRepository extends ModelRepository<\n TransferEntity,\n TransferCreateInput,\n TransferUpdateInput\n> {\n /**\n * Constructs a new TransferRepository instance\n * @param client - The AxiosInstance used for making HTTP requests\n */\n constructor(client: AxiosInstance) {\n super('transfers', client)\n }\n\n /**\n * Lists transfers with optional filtering.\n * @param options - The options for listing transfers.\n * @returns A Promise that resolves to a list of Transfer entities.\n */\n async list(options?: TransferListOptions): Promise<ListResponse<TransferEntity>> {\n const params: Record<string, any> = { ...options?.params }\n\n if (options) {\n if (options.page) params.page = options.page\n if (options.offset) params.offset = options.offset\n if (options.limit) params.limit = options.limit\n if (options.debitAccountId) params.debit_account_id = options.debitAccountId\n if (options.creditAccountId) params.credit_account_id = options.creditAccountId\n if (options.accountId) params.account_id = options.accountId\n if (options.type) {\n params.type = Array.isArray(options.type) ? options.type : [options.type]\n }\n if (options.referenceId) params.reference_id = options.referenceId\n if (options.createdAfter) {\n params.created_after =\n options.createdAfter instanceof Date\n ? options.createdAfter.toISOString()\n : options.createdAfter\n }\n if (options.createdBefore) {\n params.created_before =\n options.createdBefore instanceof Date\n ? options.createdBefore.toISOString()\n : options.createdBefore\n }\n if (options.minAmount !== undefined) params.min_amount = options.minAmount\n if (options.maxAmount !== undefined) params.max_amount = options.maxAmount\n }\n\n return super.list({ params })\n }\n\n /**\n * Lists transfers for a specific account (either as debit or credit).\n * @param accountId - The account ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of Transfer entities.\n */\n async listByAccount(\n accountId: string,\n options?: Omit<TransferListOptions, 'accountId'>\n ): Promise<ListResponse<TransferEntity>> {\n return this.list({ ...options, accountId })\n }\n\n /**\n * Lists transfers by type.\n * @param type - The transfer type(s).\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of Transfer entities.\n */\n async listByType(\n type: TransferType | TransferType[],\n options?: Omit<TransferListOptions, 'type'>\n ): Promise<ListResponse<TransferEntity>> {\n return this.list({ ...options, type })\n }\n\n /**\n * Lists transfers by reference ID.\n * @param referenceId - The reference ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of Transfer entities.\n */\n async listByReferenceId(\n referenceId: string,\n options?: Omit<TransferListOptions, 'referenceId'>\n ): Promise<ListResponse<TransferEntity>> {\n return this.list({ ...options, referenceId })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n CategoryEntity,\n CategoryCreateInput,\n CategoryUpdateInput,\n} from '../../core/entities/category.js'\n\n/**\n * Options for listing categories\n */\nexport interface CategoryListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n parentId?: string | null\n q?: string\n params?: Record<string, any>\n}\n\n/**\n * Represents a repository for managing categories.\n */\nexport class CategoryRepository extends ModelRepository<\n CategoryEntity,\n CategoryCreateInput,\n CategoryUpdateInput\n> {\n /**\n * Creates a new instance of the CategoryRepository class.\n * @param client - The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('categories', client)\n }\n\n /**\n * Lists categories with optional filtering.\n * @param options - The options for listing categories.\n * @returns A Promise that resolves to a list of Category entities.\n */\n async list(options?: CategoryListOptions): Promise<ListResponse<CategoryEntity>> {\n const { storeId, parentId, q, ...listOptions } = options || {}\n\n const params: Record<string, any> = {\n ...listOptions.params,\n }\n\n if (storeId) params.store_id = storeId\n if (parentId !== undefined) params.parent_id = parentId\n if (q) params.q = q\n\n return super.list({\n ...listOptions,\n params,\n })\n }\n\n /**\n * Lists categories for a specific store.\n * @param storeId - The store ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of Category entities.\n */\n async listByStore(\n storeId: string,\n options?: Omit<CategoryListOptions, 'storeId'>\n ): Promise<ListResponse<CategoryEntity>> {\n return this.list({ ...options, storeId })\n }\n\n /**\n * Lists root categories (no parent) for a store.\n * @param storeId - The store ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of root Category entities.\n */\n async listRootCategories(\n storeId: string,\n options?: Omit<CategoryListOptions, 'storeId' | 'parentId'>\n ): Promise<ListResponse<CategoryEntity>> {\n return this.list({ ...options, storeId, parentId: null })\n }\n\n /**\n * Lists child categories for a parent category.\n * @param storeId - The store ID.\n * @param parentId - The parent category ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of child Category entities.\n */\n async listChildren(\n storeId: string,\n parentId: string,\n options?: Omit<CategoryListOptions, 'storeId' | 'parentId'>\n ): Promise<ListResponse<CategoryEntity>> {\n return this.list({ ...options, storeId, parentId })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository } from './repository.js'\nimport { CountryEntity } from '../../core/entities/country.js'\n\n/**\n * Repository for managing Country entities.\n */\nexport class CountryRepository extends ModelRepository<CountryEntity, any, any> {\n /**\n * Constructs a new CountryRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('countries', client)\n }\n\n /**\n * Finds a country by its code (ID is the country code).\n * @param code - The country code (ISO 3166-1 alpha-2).\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the found Country entity.\n */\n async findByCode(code: string, params?: Record<string, any>): Promise<CountryEntity> {\n return this.find({ id: code.toUpperCase(), params })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ModelListOptions } from './repository.js'\nimport { StateEntity } from '../../core/entities/state.js'\n\n/**\n * Repository for managing State entities.\n * States have composite keys (countryCode + code) and can be nested under countries.\n */\nexport class StateRepository extends ModelRepository<StateEntity, any, any> {\n /**\n * Constructs a new StateRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('states', client)\n }\n\n /**\n * Lists states, optionally filtered by country code.\n * @param options - The options for listing states, including countryCode filter.\n * @returns A Promise that resolves to a list of State entities.\n */\n async list(options?: ModelListOptions & { countryCode?: string }): Promise<any> {\n const { countryCode, ...listOptions } = options || {}\n const params = {\n ...listOptions.params,\n ...(countryCode && { country_code: countryCode }),\n }\n return super.list({ ...listOptions, params })\n }\n\n /**\n * Lists states for a specific country (nested route).\n * @param countryCode - The country code.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of State entities.\n */\n async listByCountry(countryCode: string, options?: ModelListOptions): Promise<any> {\n const res = await this.client.get(`/countries/${countryCode}/states`, {\n params: {\n page: options?.page,\n offset: options?.offset,\n limit: options?.limit,\n ...options?.params,\n },\n })\n if (Array.isArray(res.data)) {\n return { data: res.data }\n } else {\n return {\n data: res.data.data,\n total: res.data.meta.total,\n page: res.data.meta.currentPage,\n limit: res.data.meta.perPage,\n }\n }\n }\n\n /**\n * Finds a state by country code and state code.\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the found State entity.\n */\n async findByCode(\n countryCode: string,\n stateCode: string,\n params?: Record<string, any>\n ): Promise<StateEntity> {\n const res = await this.client.get(`/countries/${countryCode}/states/${stateCode}`, { params })\n return res.data\n }\n\n /**\n * Creates a new state (nested under country).\n * @param countryCode - The country code.\n * @param data - The state data.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the created State entity.\n */\n async createByCountry(\n countryCode: string,\n data: any,\n params?: Record<string, any>\n ): Promise<StateEntity> {\n const res = await this.client.post(`/countries/${countryCode}/states`, data, { params })\n return res.data\n }\n\n /**\n * Updates a state (nested under country).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param data - The update data.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the updated State entity.\n */\n async updateByCountry(\n countryCode: string,\n stateCode: string,\n data: any,\n params?: Record<string, any>\n ): Promise<StateEntity> {\n const res = await this.client.put(`/countries/${countryCode}/states/${stateCode}`, data, {\n params,\n })\n return res.data\n }\n\n /**\n * Deletes a state (nested under country).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves when the state is deleted.\n */\n async deleteByCountry(\n countryCode: string,\n stateCode: string,\n params?: Record<string, any>\n ): Promise<void> {\n await this.client.delete(`/countries/${countryCode}/states/${stateCode}`, { params })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ModelListOptions } from './repository.js'\nimport { CityEntity } from '../../core/entities/city.js'\n\n/**\n * Repository for managing City entities.\n * Cities have composite keys (countryCode + stateCode + name) and are nested under states.\n */\nexport class CityRepository extends ModelRepository<CityEntity, any, any> {\n /**\n * Constructs a new CityRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('cities', client)\n }\n\n /**\n * Lists cities, optionally filtered by country code and/or state code.\n * @param options - The options for listing cities, including filters.\n * @returns A Promise that resolves to a list of City entities.\n */\n async list(\n options?: ModelListOptions & { countryCode?: string; stateCode?: string }\n ): Promise<any> {\n const { countryCode, stateCode, ...listOptions } = options || {}\n const params = {\n ...listOptions.params,\n ...(countryCode && { country_code: countryCode }),\n ...(stateCode && { state_code: stateCode }),\n }\n return super.list({ ...listOptions, params })\n }\n\n /**\n * Lists cities for a specific country and state (nested route).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of City entities.\n */\n async listByState(\n countryCode: string,\n stateCode: string,\n options?: ModelListOptions\n ): Promise<any> {\n const res = await this.client.get(`/countries/${countryCode}/states/${stateCode}/cities`, {\n params: {\n page: options?.page,\n offset: options?.offset,\n limit: options?.limit,\n ...options?.params,\n },\n })\n if (Array.isArray(res.data)) {\n return { data: res.data }\n } else {\n return {\n data: res.data.data,\n total: res.data.meta.total,\n page: res.data.meta.currentPage,\n limit: res.data.meta.perPage,\n }\n }\n }\n\n /**\n * Finds a city by country code, state code, and city name.\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param cityName - The city name.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the found City entity.\n */\n async findByName(\n countryCode: string,\n stateCode: string,\n cityName: string,\n params?: Record<string, any>\n ): Promise<CityEntity> {\n const res = await this.client.get(\n `/countries/${countryCode}/states/${stateCode}/cities/${cityName}`,\n { params }\n )\n return res.data\n }\n\n /**\n * Creates a new city (nested under country/state).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param data - The city data.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the created City entity.\n */\n async createByState(\n countryCode: string,\n stateCode: string,\n data: any,\n params?: Record<string, any>\n ): Promise<CityEntity> {\n const res = await this.client.post(\n `/countries/${countryCode}/states/${stateCode}/cities`,\n data,\n { params }\n )\n return res.data\n }\n\n /**\n * Updates a city (nested under country/state).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param cityName - The city name.\n * @param data - The update data.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the updated City entity.\n */\n async updateByState(\n countryCode: string,\n stateCode: string,\n cityName: string,\n data: any,\n params?: Record<string, any>\n ): Promise<CityEntity> {\n const res = await this.client.put(\n `/countries/${countryCode}/states/${stateCode}/cities/${cityName}`,\n data,\n { params }\n )\n return res.data\n }\n\n /**\n * Deletes a city (nested under country/state).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param cityName - The city name.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves when the city is deleted.\n */\n async deleteByState(\n countryCode: string,\n stateCode: string,\n cityName: string,\n params?: Record<string, any>\n ): Promise<void> {\n await this.client.delete(`/countries/${countryCode}/states/${stateCode}/cities/${cityName}`, {\n params,\n })\n }\n\n /**\n * Searches cities by name (autocomplete).\n * @param query - The search query.\n * @param options - Optional filters (countryCode, stateCode).\n * @returns A Promise that resolves to a list of matching City entities.\n */\n async search(\n query: string,\n options?: { countryCode?: string; stateCode?: string }\n ): Promise<CityEntity[]> {\n const params: Record<string, any> = { q: query }\n if (options?.countryCode) params.country_code = options.countryCode\n if (options?.stateCode) params.state_code = options.stateCode\n\n const res = await this.client.get('/cities/search', { params })\n return res.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository } from './repository.js'\nimport { CurrencyEntity } from '../../core/entities/currency.js'\n\n/**\n * Repository for managing Currency entities.\n */\nexport class CurrencyRepository extends ModelRepository<CurrencyEntity, any, any> {\n /**\n * Constructs a new CurrencyRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('currencies', client)\n }\n\n /**\n * Finds a currency by its code (ID is the currency code).\n * @param code - The currency code (ISO 4217, e.g., USD, EUR).\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the found Currency entity.\n */\n async findByCode(code: string, params?: Record<string, any>): Promise<CurrencyEntity> {\n return this.find({ id: code.toUpperCase(), params })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n ShippingPriceEntity,\n ShippingPriceCreateInput,\n ShippingPriceUpdateInput,\n ShippingPriceStatus,\n} from '../../core/entities/shipping_price.js'\n\n/**\n * Options for listing shipping prices\n */\nexport interface ShippingPriceListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n status?: ShippingPriceStatus | ShippingPriceStatus[]\n params?: Record<string, any>\n}\n\n/**\n * Repository for managing ShippingPrice entities.\n *\n * ShippingPrice is the new geo-based shipping system that replaces\n * the legacy array-based ShippingMethod rates.\n */\nexport class ShippingPriceRepository extends ModelRepository<\n ShippingPriceEntity,\n ShippingPriceCreateInput,\n ShippingPriceUpdateInput\n> {\n /**\n * Constructs a new ShippingPriceRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('shipping_prices', client)\n }\n\n /**\n * Lists shipping prices with optional filtering.\n * @param options - The options for listing shipping prices.\n * @returns A Promise that resolves to a list of ShippingPrice entities.\n */\n async list(options?: ShippingPriceListOptions): Promise<ListResponse<ShippingPriceEntity>> {\n const { storeId, status, ...listOptions } = options || {}\n\n const params: Record<string, any> = {\n ...listOptions.params,\n }\n\n if (storeId) params.store_id = storeId\n if (status) params.status = Array.isArray(status) ? status : [status]\n\n return super.list({\n ...listOptions,\n params,\n })\n }\n\n /**\n * Lists shipping prices for a specific store.\n * @param storeId The store ID to search for.\n * @returns A Promise that resolves to the ShippingPrice entities for the store.\n */\n async listByStore(storeId: string): Promise<ShippingPriceEntity[]> {\n const response = await this.list({ storeId })\n return response.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n ShippingMethodEntity,\n ShippingMethodCreateInput,\n ShippingMethodUpdateInput,\n ShippingMethodStatus,\n ShippingMethodPolicy,\n} from '../../core/entities/shipping_method.js'\n\n/**\n * Options for listing shipping methods\n */\nexport interface ShippingMethodListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n status?: ShippingMethodStatus | ShippingMethodStatus[]\n policy?: ShippingMethodPolicy\n params?: Record<string, any>\n}\n\n/**\n * Repository for managing ShippingMethod entities.\n */\nexport class ShippingMethodRepository extends ModelRepository<\n ShippingMethodEntity,\n ShippingMethodCreateInput,\n ShippingMethodUpdateInput\n> {\n /**\n * Constructs a new ShippingMethodRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('shipping_methods', client)\n }\n\n /**\n * Lists shipping methods with optional filtering.\n * @param options - The options for listing shipping methods.\n * @returns A Promise that resolves to a list of ShippingMethod entities.\n */\n async list(options?: ShippingMethodListOptions): Promise<ListResponse<ShippingMethodEntity>> {\n const { storeId, status, policy, ...listOptions } = options || {}\n\n const params: Record<string, any> = {\n ...listOptions.params,\n }\n\n if (storeId) params.store_id = storeId\n if (status) params.status = Array.isArray(status) ? status : [status]\n if (policy) params.policy = policy\n\n return super.list({\n ...listOptions,\n params,\n })\n }\n\n /**\n * Lists shipping methods for a specific store.\n * @param storeId - The store ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of ShippingMethod entities.\n */\n async listByStore(\n storeId: string,\n options?: Omit<ShippingMethodListOptions, 'storeId'>\n ): Promise<ListResponse<ShippingMethodEntity>> {\n return this.list({ ...options, storeId })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n FeedbackEntity,\n FeedbackCreateInput,\n FeedbackUpdateInput,\n FeedbackListOptions,\n} from '../../core/entities/feedback.js'\n\n/**\n * Repository for managing Feedback entities.\n */\nexport class FeedbackRepository extends ModelRepository<\n FeedbackEntity,\n FeedbackCreateInput,\n FeedbackUpdateInput\n> {\n /**\n * Constructs a new FeedbackRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('feedbacks', client)\n }\n\n /**\n * Lists feedbacks with optional filtering.\n * @param options - The options for listing feedbacks.\n * @returns A Promise that resolves to a list of Feedback entities.\n */\n async list(options?: FeedbackListOptions): Promise<ListResponse<FeedbackEntity>> {\n const params: Record<string, any> = {}\n\n if (options) {\n if (options.page) params.page = options.page\n if (options.offset) params.offset = options.offset\n if (options.limit) params.limit = options.limit\n if (options.status) params.status = options.status\n if (options.priority) params.priority = options.priority\n if (options.tags) params.tags = options.tags\n if (options.q) params.q = options.q\n if (options.createdAfter) {\n params.created_after =\n options.createdAfter instanceof Date\n ? options.createdAfter.toISOString()\n : options.createdAfter\n }\n if (options.createdBefore) {\n params.created_before =\n options.createdBefore instanceof Date\n ? options.createdBefore.toISOString()\n : options.createdBefore\n }\n if (options.updatedAfter) {\n params.updated_after =\n options.updatedAfter instanceof Date\n ? options.updatedAfter.toISOString()\n : options.updatedAfter\n }\n if (options.updatedBefore) {\n params.updated_before =\n options.updatedBefore instanceof Date\n ? options.updatedBefore.toISOString()\n : options.updatedBefore\n }\n if (options.resolvedAfter) {\n params.resolved_after =\n options.resolvedAfter instanceof Date\n ? options.resolvedAfter.toISOString()\n : options.resolvedAfter\n }\n if (options.resolvedBefore) {\n params.resolved_before =\n options.resolvedBefore instanceof Date\n ? options.resolvedBefore.toISOString()\n : options.resolvedBefore\n }\n if (options.resolved !== undefined) params.resolved = options.resolved\n }\n\n return super.list({ params })\n }\n\n /**\n * Adds a comment to existing feedback.\n * @param id - The feedback ID.\n * @param comment - The comment to add.\n * @returns A Promise that resolves to the updated Feedback entity.\n */\n async addComment(id: string, comment: string): Promise<FeedbackEntity> {\n const res = await this.client.post(`/${this.resource}/${id}/comments`, { comment })\n return res.data\n }\n\n /**\n * Creates feedback with file attachments.\n * @param data - The feedback data.\n * @param files - Optional array of files to attach.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the created Feedback entity.\n */\n async createWithFiles(\n data: FeedbackCreateInput,\n files?: File[],\n params?: Record<string, any>\n ): Promise<FeedbackEntity> {\n const formData = new FormData()\n\n // Add feedback data\n formData.append('title', data.title)\n if (data.details) formData.append('details', data.details)\n if (data.priority) formData.append('priority', data.priority)\n if (data.appVersion) formData.append('appVersion', data.appVersion)\n if (data.tags) formData.append('tags', JSON.stringify(data.tags))\n if (data.attachments) formData.append('attachments', JSON.stringify(data.attachments))\n if (data.metadata) formData.append('metadata', JSON.stringify(data.metadata))\n\n // Add files\n if (files) {\n for (const file of files) {\n formData.append('files', file)\n }\n }\n\n // Add additional params\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n formData.append(key, String(value))\n }\n }\n\n const res = await this.client.post(`/${this.resource}`, formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n })\n\n return res.data\n }\n\n /**\n * Updates feedback with additional files.\n * @param id - The feedback ID.\n * @param data - The update data.\n * @param files - Optional array of files to attach.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the updated Feedback entity.\n */\n async updateWithFiles(\n id: string,\n data: FeedbackUpdateInput,\n files?: File[],\n params?: Record<string, any>\n ): Promise<FeedbackEntity> {\n const formData = new FormData()\n\n // Add update data\n if (data.title) formData.append('title', data.title)\n if (data.details) formData.append('details', data.details)\n if (data.status) formData.append('status', data.status)\n if (data.priority) formData.append('priority', data.priority)\n if (data.appVersion) formData.append('appVersion', data.appVersion)\n if (data.tags) formData.append('tags', JSON.stringify(data.tags))\n if (data.attachments) formData.append('attachments', JSON.stringify(data.attachments))\n if (data.metadata) formData.append('metadata', JSON.stringify(data.metadata))\n if (data.comment) formData.append('comment', data.comment)\n\n // Add files\n if (files) {\n for (const file of files) {\n formData.append('files', file)\n }\n }\n\n // Add additional params\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n formData.append(key, String(value))\n }\n }\n\n const res = await this.client.put(`/${this.resource}/${id}`, formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n })\n\n return res.data\n }\n}\n","export enum OrderStatus {\n draft = 'draft',\n pending = 'pending',\n review = 'review',\n accepted = 'accepted',\n processing = 'processing',\n completed = 'completed',\n cancelled = 'cancelled',\n}\n\n// PaymentStatus\nexport enum PaymentStatus {\n unpaid = 'unpaid',\n paid = 'paid',\n received = 'received',\n}\nexport enum DeliveryStatus {\n pending = 'pending',\n delivering = 'delivering',\n delivered = 'delivered',\n returned = 'returned',\n}\n\nexport enum ShippingType {\n // delivery to customer home\n home = 'home',\n // the customer picks up the order from the local shipping center\n pickup = 'pickup',\n // the customer picks up the order from the store\n store = 'store',\n}\n\nexport interface OrderEntity {\n id: string\n customerName?: string | null\n customerPhone: string\n customerEmail?: string | null\n customerNote?: string | null\n customerIp?: string | null\n shippingAddress?: string | null\n shippingCity?: string | null\n shippingState?: string | null\n shippingCountry?: string | null\n shippingMethodId?: string | null\n shippingType: ShippingType\n trackingCode: string | null\n paymentMethodId?: string | null\n items: OrderItem[]\n subtotal: number\n shippingPrice: number\n total: number\n discount: number\n // @Deprecated\n coupon?: string | null\n couponId?: string | null\n couponCode?: string | null\n couponDiscount?: string | null\n storeId: string\n source: string | null\n confirmerId: string | null\n customFields?: Record<string, any> | null\n metadata: OrderMetadata\n status: OrderStatus\n paymentStatus: PaymentStatus\n deliveryStatus: DeliveryStatus\n customStatus?: string | null\n tags: string[] | null\n createdAt: any\n updatedAt: any\n}\nexport interface OrderItem {\n productId: string\n productName: string\n productPhotoUrl?: string | null\n variantPath?: string\n sku?: string | null\n discount?: number | null\n quantity: number\n price: number\n offerCode?: string | null\n offerName?: string | null\n addons?: Record<string, number>\n}\n\n// order track entity\nexport interface OrderTrackEntity {\n id: string\n customerName?: string | null\n items: OrderItem[]\n total: number\n createdAt: any\n storeId: string\n status: OrderStatus\n history: OrderTrackHistory[]\n}\n\n// order track history\nexport interface OrderTrackHistory {\n status: OrderStatus\n deliveryStatus: string\n paymentStatus: string\n createdAt: string\n}\n\n// order metadata history\ninterface OrderMetadataHistory {\n status: OrderStatus\n deliveryStatus: string\n paymentStatus: string\n createdAt: string\n message: string\n code: string\n userId: string\n}\n\n// order metadata\ninterface OrderMetadata {\n note?: string\n history?: OrderMetadataHistory[]\n metaPixel?: any\n customOrderTagHistories?: any[]\n [key: string]: any\n}\n\n// utils\n// order entity to order track entity\nexport const convertOrderEntityToOrderTrackEntity = (order: OrderEntity): OrderTrackEntity => {\n return {\n id: order.id,\n customerName: order.customerName,\n items: order.items,\n total: order.total,\n createdAt: order.createdAt,\n storeId: order.storeId,\n status: order.status,\n history:\n order.metadata.history?.map((history) => ({\n status: history.status,\n deliveryStatus: history.deliveryStatus,\n paymentStatus: history.paymentStatus,\n createdAt: history.createdAt,\n })) || [],\n }\n}\n\n/**\n * Input for creating a new order (admin/merchant)\n */\nexport interface OrderCreateInput {\n id?: string\n customerName?: string\n customerPhone: string\n customerEmail?: string\n customerNote?: string\n shippingAddress?: string\n shippingCity?: string\n shippingState?: string\n shippingCountry?: string\n shippingType: ShippingType\n shippingMethodId?: string\n paymentMethodId?: string\n items: OrderItemInput[]\n coupon?: string\n couponId?: string\n source?: string\n status?: OrderStatus\n paymentStatus?: PaymentStatus\n deliveryStatus?: DeliveryStatus\n customStatus?: string\n customFields?: Record<string, any>\n metadata?: Record<string, any>\n storeId: string\n tags?: string[]\n}\n\n/**\n * Input for order items when creating/updating an order\n */\nexport interface OrderItemInput {\n productId: string\n quantity: number\n variantPath?: string\n offerCode?: string\n addons?: Record<string, number>\n price?: number\n discount?: number\n}\n\n/**\n * Input data for updating an existing order\n */\nexport interface OrderUpdateInput {\n customerName?: string\n customerPhone?: string\n customerEmail?: string\n customerNote?: string\n shippingAddress?: string\n shippingCity?: string\n shippingState?: string\n shippingCountry?: string\n shippingType?: ShippingType\n shippingMethodId?: string\n trackingCode?: string\n paymentMethodId?: string\n items?: OrderItemInput[]\n subtotal?: number\n shippingPrice?: number\n total?: number\n discount?: number\n coupon?: string\n couponId?: string\n source?: string\n confirmerId?: string\n status?: OrderStatus\n paymentStatus?: PaymentStatus\n deliveryStatus?: DeliveryStatus\n customStatus?: string\n customFields?: Record<string, any>\n metadata?: Record<string, any>\n tags?: string[]\n}\n\n/**\n * Order pricing calculation result\n */\nexport interface OrderPricing {\n subtotal: number\n shippingPrice: number | null\n calculatedTotal: number\n}\n\n/**\n * Options for calculating order pricing\n */\nexport interface CalculateOrderPricingOptions {\n storeId: string\n items: OrderItemInput[]\n shippingState?: string\n shippingCountry?: string\n shippingType?: ShippingType\n shippingAddress?: string\n}\n","import { OrderEntity } from './order.js'\n\nexport interface ShippingMethodEntity {\n id: string\n name: string\n description: string | null\n logoUrl: string | null\n ondarkLogoUrl: string | null\n price: number\n forks: number\n sourceId: string\n storeId: string\n rates: (number | null)[][] | null\n status: ShippingMethodStatus\n policy: ShippingMethodPolicy\n verifiedAt: any\n createdAt: any\n updatedAt: any\n orders: OrderEntity[]\n source: ShippingMethodEntity | null\n}\n\nexport enum ShippingMethodStatus {\n draft = 'draft',\n published = 'published',\n archived = 'archived',\n}\n\nexport enum ShippingMethodPolicy {\n private = 'private',\n public = 'public',\n}\n\n/**\n * Input data for creating a new shipping method\n */\nexport interface ShippingMethodCreateInput {\n name: string\n storeId: string\n description?: string\n logoUrl?: string\n ondarkLogoUrl?: string\n price?: number\n rates?: (number | null)[][] | null\n status?: ShippingMethodStatus\n policy?: ShippingMethodPolicy\n sourceId?: string\n}\n\n/**\n * Input data for updating an existing shipping method\n */\nexport interface ShippingMethodUpdateInput {\n name?: string\n description?: string\n logoUrl?: string\n ondarkLogoUrl?: string\n price?: number\n rates?: (number | null)[][] | null\n status?: ShippingMethodStatus\n policy?: ShippingMethodPolicy\n}\n","/**\n * Shipping Price Entity\n *\n * A simplified, country-aware shipping pricing system that replaces\n * the legacy array-based shipping rates with a structured approach.\n *\n * Key features:\n * - Country codes as keys (ISO 3166-1 alpha-2)\n * - State codes as keys (no fragile array indexes)\n * - Named price types for extensibility\n * - Gradual migration path from legacy system\n *\n * @example\n * ```typescript\n * const prices: ShippingPriceRates = {\n * \"DZ\": {\n * \"01\": { home: 800, desk: 400, pickup: 0 },\n * \"16\": { home: 600, desk: 300, pickup: 0 }\n * },\n * \"IQ\": {\n * \"01\": { home: 15000, desk: 10000, pickup: 5000 }\n * }\n * }\n * ```\n */\n\n/**\n * Individual state shipping rates with named price types.\n * Using named properties instead of array indexes for clarity and extensibility.\n */\nexport interface ShippingStateRates {\n /** Price for home delivery (nullable if unavailable) */\n home: number | null\n /** Price for desk/office pickup (nullable if unavailable) */\n desk: number | null\n /** Price for store pickup (nullable if unavailable) */\n pickup: number | null\n}\n\n/**\n * Shipping rates organized by country code and state code.\n * Structure: { [countryCode]: { [stateCode]: ShippingStateRates } }\n */\nexport type ShippingPriceRates = Record<string, Record<string, ShippingStateRates>>\n\n/**\n * Status of the shipping price configuration.\n */\nexport enum ShippingPriceStatus {\n /** Not yet published, only visible to store owner */\n draft = 'draft',\n /** Active and used for shipping calculations */\n published = 'published',\n}\n\n/**\n * Shipping Price Entity\n *\n * Represents a shipping pricing configuration for a store.\n * Supports multi-country operations with state-level pricing.\n */\nexport interface ShippingPriceEntity {\n /** Unique identifier (24-char string) */\n id: string\n\n /** Display name for this pricing configuration */\n name: string\n\n /** Optional logo URL for branding */\n logoUrl: string | null\n\n /** Store this pricing belongs to */\n storeId: string\n\n /**\n * Pricing data structured by country and state codes.\n * @see ShippingPriceRates\n */\n prices: ShippingPriceRates\n\n /** Publication status */\n status: ShippingPriceStatus\n\n /** Creation timestamp */\n createdAt: any\n\n /** Last update timestamp */\n updatedAt: any\n}\n\n/**\n * Shipping type enumeration for order shipping type.\n * Maps to the pricing structure keys.\n */\nexport type ShippingPriceType = keyof ShippingStateRates\n\n/**\n * Helper function to get shipping price from rates.\n *\n * @param prices - The shipping price rates object\n * @param countryCode - ISO 3166-1 alpha-2 country code\n * @param stateCode - State/province code\n * @param type - Shipping type (home, desk, pickup)\n * @returns The price or null if not available\n *\n * @example\n * ```typescript\n * const price = getShippingPrice(shippingPrice.prices, 'DZ', '16', 'home')\n * // Returns 600 or null\n * ```\n */\nexport function getShippingPrice(\n prices: ShippingPriceRates,\n countryCode: string,\n stateCode: string,\n type: ShippingPriceType\n): number | null {\n const countryRates = prices[countryCode]\n if (!countryRates) return null\n\n const stateRates = countryRates[stateCode]\n if (!stateRates) return null\n\n return stateRates[type] ?? null\n}\n\n/**\n * Helper function to check if shipping is available for a location.\n *\n * @param prices - The shipping price rates object\n * @param countryCode - ISO 3166-1 alpha-2 country code\n * @param stateCode - State/province code\n * @returns True if any shipping type is available for this location\n */\nexport function isShippingAvailable(\n prices: ShippingPriceRates,\n countryCode: string,\n stateCode: string\n): boolean {\n const countryRates = prices[countryCode]\n if (!countryRates) return false\n\n const stateRates = countryRates[stateCode]\n if (!stateRates) return false\n\n return stateRates.home !== null || stateRates.desk !== null || stateRates.pickup !== null\n}\n\n/**\n * Helper function to get all available shipping types for a location.\n *\n * @param prices - The shipping price rates object\n * @param countryCode - ISO 3166-1 alpha-2 country code\n * @param stateCode - State/province code\n * @returns Array of available shipping types with their prices\n */\nexport function getAvailableShippingTypes(\n prices: ShippingPriceRates,\n countryCode: string,\n stateCode: string\n): Array<{ type: ShippingPriceType; price: number }> {\n const countryRates = prices[countryCode]\n if (!countryRates) return []\n\n const stateRates = countryRates[stateCode]\n if (!stateRates) return []\n\n const available: Array<{ type: ShippingPriceType; price: number }> = []\n\n if (stateRates.home !== null) {\n available.push({ type: 'home', price: stateRates.home })\n }\n if (stateRates.desk !== null) {\n available.push({ type: 'desk', price: stateRates.desk })\n }\n if (stateRates.pickup !== null) {\n available.push({ type: 'pickup', price: stateRates.pickup })\n }\n\n return available\n}\n\n/**\n * Input data for creating a new shipping price\n */\nexport interface ShippingPriceCreateInput {\n name: string\n storeId: string\n logoUrl?: string\n prices: ShippingPriceRates\n status?: ShippingPriceStatus\n}\n\n/**\n * Input data for updating an existing shipping price\n */\nexport interface ShippingPriceUpdateInput {\n name?: string\n logoUrl?: string\n prices?: ShippingPriceRates\n status?: ShippingPriceStatus\n}\n","export type Listener<T extends NotifiableService> = (service: T) => void\n\nexport class NotifiableService {\n // Array of listeners (functions) to notify when changes occur\n private listeners: Set<Listener<typeof this>> = new Set()\n\n /**\n * Adds a listener that gets called when `notify` is triggered.\n * @param listener - The function to be called on notification.\n * @returns The same listener for potential chaining or removal.\n */\n addListener(listener: Listener<typeof this>): Listener<typeof this> {\n this.listeners.add(listener) // Using Set for uniqueness and faster removal\n return listener\n }\n\n /**\n * Removes a previously added listener.\n * @param listener - The function to be removed from the listeners list.\n */\n removeListener(listener: Listener<typeof this>): void {\n this.listeners.delete(listener) // Set deletion is O(1) for better performance\n }\n\n /**\n * Notifies all registered listeners, passing the service instance.\n * This allows listeners to react to changes.\n */\n notify(): void {\n // Iterating over the Set of listeners and invoking each one\n this.listeners.forEach((listener) => listener(this))\n }\n\n /**\n * Clears all listeners, removing any references to them.\n */\n clearListeners(): void {\n this.listeners.clear() // Clears the Set entirely\n }\n\n /**\n * Constructor for NotifiableService, initializes listeners as an empty Set.\n * The Set ensures unique listeners and better management.\n */\n constructor() {\n // Initialization can be skipped since listeners is already initialized as an empty Set\n }\n}\n","import { ShippingType } from '../../core/entities/order.js'\nimport { ProductEntity, ProductOffer } from '../../core/entities/product.js'\nimport {\n ShippingMethodEntity,\n ShippingMethodPolicy,\n ShippingMethodStatus,\n} from '../../core/entities/shipping_method.js'\nimport {\n ShippingPriceEntity,\n ShippingPriceType,\n getShippingPrice as getShippingPriceHelper,\n getAvailableShippingTypes as getAvailableShippingTypesHelper,\n} from '../../core/entities/shipping_price.js'\nimport { StoreEntity } from '../../core/entities/store.js'\nimport { NotifiableService } from './service.js'\n\n/**\n * Represents an item in the cart.\n */\nexport interface CartItem {\n product: ProductEntity\n offer?: ProductOffer\n quantity: number\n variantPath?: string\n addons?: Record<string, number>\n}\n\n/**\n * Cart shipping types.\n * - `pickup`: The user will pick up the order from the closest desk.\n * - `home`: The order will be delivered to the user's home.\n * - `store`: The order will be delivered to the store.\n */\n// export type CartShippingTypes = 'pickup' | 'home' | 'store'\n\n/**\n * Interface for a shipping address.\n */\nexport interface CartShippingAddress {\n name: string | null\n phone: string | null\n city: string | null\n state: string | null\n street: string | null\n country: 'dz' | string\n type: ShippingType\n}\n\n/**\n * Manages the shopping cart and its operations.\n */\nexport class CartService extends NotifiableService {\n private items: CartItem[] = [] // Array to support multiple items with same product but different variants\n private shippingMethod: ShippingMethodEntity | null = null\n private shippingPrice: ShippingPriceEntity | null = null // New shipping price system\n private store: StoreEntity | null = null // Store entity for accessing shippingPriceId\n private shippingAddress: CartShippingAddress = {\n name: null,\n phone: null,\n city: null,\n state: null,\n street: null,\n country: 'dz',\n type: ShippingType.pickup,\n }\n private cachedSubtotal: number | null = null // Cache for subtotal to avoid redundant calculations\n private currentItem: CartItem | null = null\n\n /**\n * Generates a unique key for a cart item based on product ID, variant path, offer code, and addons\n * @param item - The cart item to generate a key for\n * @returns A unique string key\n */\n private getItemKey(item: CartItem): string {\n const addonKeys = item.addons ? Object.keys(item.addons).sort().join('|') : ''\n return `${item.product.id}:${item.variantPath || ''}:${item.offer?.code || ''}:${addonKeys}`\n }\n\n /**\n * Finds an item in the cart that matches the given item's key\n * @param item - The item to find\n * @returns The matching cart item or undefined\n */\n private findItem(item: CartItem): CartItem | undefined {\n const targetKey = this.getItemKey(item)\n return this.items.find((cartItem) => this.getItemKey(cartItem) === targetKey)\n }\n\n /**\n * Finds the index of an item in the cart that matches the given item's key\n * @param item - The item to find\n * @returns The index of the matching cart item or -1 if not found\n */\n private findItemIndex(item: CartItem): number {\n const targetKey = this.getItemKey(item)\n return this.items.findIndex((cartItem) => this.getItemKey(cartItem) === targetKey)\n }\n\n /**\n * Sets the current item to be managed in the cart.\n * @param item - The item to be set as current.\n */\n setCurrentItem(item: CartItem, notify = true): void {\n this.currentItem = item\n\n const existingItemIndex = this.findItemIndex(this.currentItem)\n if (existingItemIndex !== -1) {\n this.items[existingItemIndex] = this.currentItem\n }\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Clamps the quantity to be within the offer's min/max range\n * @param offer - The offer containing quantity constraints\n * @param quantity - The quantity to clamp\n * @returns The clamped quantity value\n */\n private clampQuantityToOfferLimits(offer: ProductOffer, quantity: number): number {\n if (offer.minQuantity !== undefined) {\n quantity = Math.max(quantity, offer.minQuantity)\n }\n if (offer.maxQuantity !== undefined) {\n quantity = Math.min(quantity, offer.maxQuantity)\n }\n return quantity\n }\n\n /**\n * Update item by unique key (product ID + variant + offer + addons).\n * @param item - The item to identify the cart item to update.\n * @param updates - Partial item data to update.\n */\n updateItem(item: CartItem, updates: Partial<CartItem>, notify = true): void {\n const index = this.findItemIndex(item)\n\n if (index !== -1) {\n const currentItem = this.items[index]\n const newItem = { ...currentItem, ...updates }\n\n // Clamp quantity if there's an offer with constraints\n if (newItem.offer) {\n newItem.quantity = this.clampQuantityToOfferLimits(newItem.offer, newItem.quantity)\n }\n\n this.items[index] = newItem\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n }\n\n /**\n * Update current item.\n * @param updates - a partial item to update.\n */\n updateCurrentItem(updates: Partial<CartItem>, notify = true): void {\n if (!this.currentItem) return\n\n this.currentItem = { ...this.currentItem, ...updates }\n\n const existingItemIndex = this.findItemIndex(this.currentItem)\n if (existingItemIndex !== -1) {\n this.items[existingItemIndex] = this.currentItem\n }\n\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Update shipping address.\n * @param address - a partial address to update.\n */\n updateShippingAddress(address: Partial<CartShippingAddress>, notify = true): void {\n this.shippingAddress = { ...this.shippingAddress, ...address }\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Update shipping method.\n * @param method - a partial shipping method to update.\n */\n updateShippingMethod(method: Partial<ShippingMethodEntity>, notify = true): void {\n if (!this.shippingMethod) return\n\n this.shippingMethod = { ...this.shippingMethod, ...method }\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Retrieves the current item in the cart.\n * @returns The current cart item or null if not set.\n */\n getCurrentItem(): CartItem | null {\n return this.currentItem\n }\n\n /**\n * Checks if the current item is already in the cart.\n * @returns True if the current item is in the cart, false otherwise.\n */\n isCurrentItemInCart(): boolean {\n return this.currentItem ? this.findItem(this.currentItem) !== undefined : false\n }\n\n /**\n * Adds the current item to the cart if it's not already present.\n */\n addCurrentItemToCart(): void {\n if (!this.currentItem || this.isCurrentItemInCart()) return\n this.add(this.currentItem)\n this.cachedSubtotal = null\n }\n\n /**\n * Removes the current item from the cart if present.\n */\n removeCurrentItemFromCart(): void {\n if (this.currentItem) {\n this.remove(this.currentItem)\n }\n }\n\n /**\n * Toggles the current item's presence in the cart (add/remove).\n */\n toggleCurrentItemInCart(): void {\n this.isCurrentItemInCart() ? this.removeCurrentItemFromCart() : this.addCurrentItemToCart()\n }\n\n /**\n * Adds an item to the cart. If the item is already present, increments its quantity.\n * @param item - The cart item to add.\n */\n add(item: CartItem): void {\n const existingItem = this.findItem(item)\n\n if (existingItem) {\n existingItem.quantity += item.quantity\n } else {\n this.items.push({ ...item })\n }\n\n this.cachedSubtotal = null // Reset subtotal cache\n this.notifyIfChanged()\n }\n\n /**\n * Checks if an item exists in the cart by matching product ID and variant path.\n * @param productId - The product ID to check for.\n * @param variantPath - The variant path to check for.\n * @returns True if the item exists in the cart, false otherwise.\n */\n has(productId: string, variantPath?: string): boolean {\n return this.items.some((item) => {\n if (item.product.id !== productId) return false\n if (variantPath !== undefined && item.variantPath !== variantPath) return false\n return true\n })\n }\n\n /**\n * Checks if an item exists in the cart by matching the item's unique key.\n * @param item - The item to check for.\n * @returns True if the item exists in the cart, false otherwise.\n */\n hasItem(item: CartItem): boolean {\n return this.findItem(item) !== undefined\n }\n\n /**\n * Checks if any item with the given product ID exists in the cart.\n * @param productId - The product ID to check for.\n * @returns True if any item with the product ID exists, false otherwise.\n */\n hasProduct(productId: string): boolean {\n return this.items.some((item) => item.product.id === productId)\n }\n\n /**\n * Removes an item from the cart by matching the item's unique key.\n * @param item - The item to remove.\n */\n remove(item: CartItem): void {\n const index = this.findItemIndex(item)\n if (index !== -1) {\n this.items.splice(index, 1)\n this.cachedSubtotal = null\n this.notifyIfChanged()\n }\n }\n\n /**\n * Removes all items with the given product ID from the cart.\n * @param productId - The product ID to remove.\n */\n removeByProductId(productId: string, variantPath?: string): void {\n const initialLength = this.items.length\n this.items = this.items.filter((item) => {\n if (item.product.id !== productId) return true\n if (variantPath !== undefined && item.variantPath !== variantPath) return true\n return false\n })\n\n if (this.items.length !== initialLength) {\n this.cachedSubtotal = null\n this.notifyIfChanged()\n }\n }\n\n /**\n * Clears all items from the cart.\n */\n clear(notify = true): void {\n if (this.items.length > 0) {\n this.items = []\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n }\n\n /**\n * Retrieves the subtotal of the cart.\n * @param withCurrentItem - Whether to include the current item in the subtotal.\n * @returns The subtotal amount.\n */\n getSubtotal(withCurrentItem = true): number {\n if (this.cachedSubtotal === null) {\n this.cachedSubtotal = this.items.reduce((sum, item) => {\n return sum + this.getItemTotal(item)\n }, 0)\n }\n\n if (withCurrentItem && this.currentItem && !this.hasItem(this.currentItem)) {\n return this.cachedSubtotal + this.getItemTotal(this.currentItem)\n }\n\n return this.cachedSubtotal\n }\n\n /**\n * Calculates the total price for a cart item.\n * @param item - The cart item.\n * @returns The total price for the item.\n */\n getItemTotal(item: CartItem): number {\n const { product, variantPath, quantity, offer, addons } = item\n let price = product.price\n let discount = product.discount ?? 0\n\n // Handle variant pricing if a variant path exists\n if (variantPath) {\n const parts = variantPath.split('/')\n let currentVariant = product.variant\n\n for (const part of parts) {\n if (!currentVariant) break\n const option = currentVariant.options.find((o) => o.name === part)\n if (!option) break\n price = option.price ?? price\n discount = option.discount ?? discount\n currentVariant = option.child\n }\n }\n\n // Apply offer if present\n if (offer) {\n if (offer.price !== undefined) {\n // If offer has a fixed price, use it\n price = offer.price\n discount = 0 // Reset discount since we're using a fixed price\n }\n }\n\n // Calculate base product price with quantity\n let total = (price - discount) * quantity\n\n // Add pricing for addons if present\n if (addons && product.addons) {\n for (const [addonId, addonQuantity] of Object.entries(addons)) {\n // Find the addon in the product's addons array\n const addon = product.addons.find((a) => a.title === addonId)\n if (addon && addon.price) {\n // Add the addon price * quantity to the total\n total += addon.price * addonQuantity\n }\n }\n }\n\n return total\n }\n\n /**\n * Validates if an offer can be applied to the given quantity\n * @param offer - The offer to validate\n * @param quantity - The quantity to check\n * @returns boolean indicating if the offer is valid for the quantity\n */\n isOfferValidForQuantity(offer: ProductOffer, quantity: number): boolean {\n if (offer.minQuantity && quantity < offer.minQuantity) return false\n if (offer.maxQuantity && quantity > offer.maxQuantity) return false\n return true\n }\n\n /**\n * Updates the offer for a specific cart item\n * @param item - The item to update\n * @param offer - The offer to apply, or undefined to remove the offer\n */\n updateItemOffer(item: CartItem, offer?: ProductOffer): void {\n const existingItem = this.findItem(item)\n if (!existingItem) return\n\n const updatedItem = { ...existingItem, offer }\n // If applying an offer, ensure quantity is within limits\n if (offer) {\n updatedItem.quantity = this.clampQuantityToOfferLimits(offer, existingItem.quantity)\n }\n\n this.updateItem(item, updatedItem)\n this.cachedSubtotal = null\n this.notifyIfChanged()\n }\n\n /**\n * Updates the offer for the current item\n * @param offer - The offer to apply, or undefined to remove the offer\n */\n updateCurrentItemOffer(offer?: ProductOffer): void {\n if (!this.currentItem) return\n\n const updatedItem = { ...this.currentItem }\n updatedItem.offer = offer\n\n // If applying an offer, ensure quantity is within limits\n if (offer) {\n updatedItem.quantity = this.clampQuantityToOfferLimits(offer, this.currentItem.quantity)\n }\n\n this.updateCurrentItem(updatedItem)\n this.cachedSubtotal = null\n this.notifyIfChanged()\n }\n\n /**\n * Sets the shipping method.\n * @param method - Either a store or a shipping method.\n */\n setShippingMethod(method: ShippingMethodEntity | StoreEntity, notify = true): void {\n const store = (method as StoreEntity)?.defaultShippingRates ? (method as StoreEntity) : null\n const shippingMethod = (method as ShippingMethodEntity)?.rates\n ? (method as ShippingMethodEntity)\n : null\n\n if (store) {\n this.store = store\n this.shippingMethod = {\n id: store.id,\n name: store.name,\n description: store.description,\n logoUrl: store.logoUrl,\n ondarkLogoUrl: store.ondarkLogoUrl,\n price: 0,\n forks: 0,\n sourceId: store.id,\n storeId: store.id,\n rates: store.defaultShippingRates,\n status: ShippingMethodStatus.published,\n policy: ShippingMethodPolicy.public,\n verifiedAt: null,\n createdAt: null,\n updatedAt: null,\n orders: [],\n source: null,\n }\n if (notify) {\n this.notify()\n }\n } else if (shippingMethod) {\n this.shippingMethod = shippingMethod\n if (notify) {\n this.notify()\n }\n } else {\n throw new Error('Invalid shipping method')\n }\n }\n\n /**\n * Sets the shipping price (new system).\n * @param shippingPrice - The shipping price entity.\n * @param notify - Whether to notify listeners.\n */\n setShippingPrice(shippingPrice: ShippingPriceEntity | null, notify = true): void {\n this.shippingPrice = shippingPrice\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Sets the store entity.\n * @param store - The store entity.\n * @param notify - Whether to notify listeners.\n */\n setStore(store: StoreEntity | null, notify = true): void {\n this.store = store\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Maps ShippingType enum to ShippingPriceType string.\n * @param shippingType - The shipping type enum.\n * @returns The corresponding shipping price type.\n */\n private mapShippingTypeToPriceType(shippingType: ShippingType): ShippingPriceType {\n switch (shippingType) {\n case ShippingType.home:\n return 'home'\n case ShippingType.pickup:\n return 'pickup'\n case ShippingType.store:\n return 'desk'\n default:\n return 'home'\n }\n }\n\n /**\n * Resolves shipping price using the priority chain.\n * Priority: 1. Product shippingPriceId, 2. Store shippingPriceId, 3. Product shippingMethodId, 4. Store defaultShippingRates\n *\n * Note: Shipping prices must be loaded and set via setShippingPrice() for the new system to work.\n * If shipping prices are not loaded, the method falls back to the legacy system.\n *\n * @param countryCode - ISO 3166-1 alpha-2 country code (optional, required for new system)\n * @param stateCode - State/province code\n * @param shippingType - The shipping type\n * @returns The shipping price or null if not available\n */\n private resolveShippingPrice(\n countryCode: string | undefined,\n stateCode: string,\n shippingType: ShippingType\n ): number | null {\n if (!stateCode) return null\n\n const priceType = this.mapShippingTypeToPriceType(shippingType)\n\n // Collect all products (items + currentItem if not in items)\n const allProducts = [...this.items]\n if (this.currentItem && !this.hasItem(this.currentItem)) {\n allProducts.push(this.currentItem)\n }\n\n console.log('[resolveShippingPrice]', {\n countryCode,\n stateCode,\n shippingType,\n priceType,\n hasShippingPrice: !!this.shippingPrice,\n shippingPriceId: this.shippingPrice?.id,\n allProductsCount: allProducts.length,\n })\n\n // 1. Try product-specific ShippingPrice (new system) - HIGHEST PRIORITY\n // Check if all products have the same shippingPriceId\n if (countryCode && this.shippingPrice) {\n const productShippingPriceIds = allProducts\n .map((item) => item.product.shippingPriceId)\n .filter((id): id is string => id !== null)\n\n console.log('[resolveShippingPrice] Product shippingPriceIds:', productShippingPriceIds)\n\n if (productShippingPriceIds.length > 0) {\n // Check if all products have the same shippingPriceId\n const uniqueIds = new Set(productShippingPriceIds)\n if (uniqueIds.size === 1 && this.shippingPrice.id === productShippingPriceIds[0]) {\n console.log(\n '[resolveShippingPrice] Using product shippingPriceId:',\n productShippingPriceIds[0]\n )\n const price = getShippingPriceHelper(\n this.shippingPrice.prices,\n countryCode,\n stateCode,\n priceType\n )\n console.log('[resolveShippingPrice] Product price result:', price)\n if (price !== null) {\n return price\n }\n // If product has shippingPriceId but no rate for this location, fall through\n }\n }\n }\n\n // 2. Try store shippingPriceId (new system)\n if (\n countryCode &&\n this.store?.shippingPriceId &&\n this.shippingPrice &&\n this.shippingPrice.id === this.store.shippingPriceId\n ) {\n console.log('[resolveShippingPrice] Using store shippingPriceId:', this.store.shippingPriceId)\n const price = getShippingPriceHelper(\n this.shippingPrice.prices,\n countryCode,\n stateCode,\n priceType\n )\n console.log('[resolveShippingPrice] Store price result:', price)\n if (price !== null) {\n return price\n }\n // If store has shippingPriceId but no rate for this location, fall through\n }\n\n // 3. Try product-specific ShippingMethod (legacy)\n // Check if all products have the same shippingMethodId\n const productShippingMethodIds = allProducts\n .map((item) => item.product.shippingMethodId)\n .filter((id): id is string => id !== null)\n\n if (productShippingMethodIds.length > 0) {\n const uniqueIds = new Set(productShippingMethodIds)\n if (\n uniqueIds.size === 1 &&\n this.shippingMethod &&\n this.shippingMethod.id === productShippingMethodIds[0]\n ) {\n const legacyPrice = this.getShippingPriceForTypeLegacy(shippingType)\n if (legacyPrice !== null) {\n return legacyPrice\n }\n }\n }\n\n // 4. Fall back to store.defaultShippingRates (legacy)\n if (this.shippingMethod?.rates) {\n console.log('[resolveShippingPrice] Falling back to legacy system')\n const legacyPrice = this.getShippingPriceForTypeLegacy(shippingType)\n console.log('[resolveShippingPrice] Legacy price result:', legacyPrice)\n return legacyPrice\n }\n\n console.log('[resolveShippingPrice] No shipping price found, returning null')\n return null\n }\n\n /**\n * Gets shipping price using legacy system (array-based rates).\n * @param type - The shipping type\n * @returns The shipping price or null if not available\n */\n private getShippingPriceForTypeLegacy(type: ShippingType): number | null {\n if (!this.shippingMethod?.rates || !this.shippingAddress.state) return null\n\n const stateIndex = Number.parseInt(this.shippingAddress.state, 10) - 1\n const rates = this.shippingMethod.rates[stateIndex]\n\n if (!rates) return null\n\n switch (type) {\n case ShippingType.pickup:\n return rates[0]\n case ShippingType.home:\n return rates[1]\n case ShippingType.store:\n return rates[2]\n default:\n return null\n }\n }\n\n /**\n * Retrieves the available shipping types using the priority chain.\n * Priority: 1. Product shippingPriceId, 2. Store shippingPriceId, 3. Product shippingMethodId, 4. Store defaultShippingRates\n *\n * Note: Shipping prices must be loaded and set via setShippingPrice() for the new system to work.\n * If shipping prices are not loaded, the method falls back to the legacy system.\n *\n * @returns An array of available shipping types.\n */\n getAvailableShippingTypes(): ShippingType[] {\n if (!this.shippingAddress.state) return []\n\n // Get country code from shipping address first, then store config\n // If shippingAddress.country is 'dz' (lowercase), it means legacy system\n let countryCode: string | undefined\n if (this.shippingAddress.country && this.shippingAddress.country.toLowerCase() !== 'dz') {\n countryCode = this.shippingAddress.country.toUpperCase()\n } else if (this.store?.configs?.selectedCountry) {\n countryCode = this.store.configs.selectedCountry.toUpperCase()\n } else {\n // No country configured - use legacy system\n countryCode = undefined\n }\n\n // Collect all products (items + currentItem if not in items)\n const allProducts = [...this.items]\n if (this.currentItem && !this.hasItem(this.currentItem)) {\n allProducts.push(this.currentItem)\n }\n\n // 1. Try product-specific ShippingPrice (new system) - only if countryCode is available\n if (countryCode && this.shippingPrice) {\n const productShippingPriceIds = allProducts\n .map((item) => item.product.shippingPriceId)\n .filter((id): id is string => id !== null)\n\n if (productShippingPriceIds.length > 0) {\n const uniqueIds = new Set(productShippingPriceIds)\n if (uniqueIds.size === 1 && this.shippingPrice.id === productShippingPriceIds[0]) {\n const available = getAvailableShippingTypesHelper(\n this.shippingPrice.prices,\n countryCode,\n this.shippingAddress.state\n )\n if (available.length > 0) {\n return available.map((a) => {\n switch (a.type) {\n case 'home':\n return ShippingType.home\n case 'pickup':\n return ShippingType.pickup\n case 'desk':\n return ShippingType.store\n default:\n return ShippingType.home\n }\n })\n }\n // If product has shippingPriceId but no rate for this location, fall through\n }\n }\n }\n\n // 2. Try store shippingPriceId (new system) - only if countryCode is available\n if (\n countryCode &&\n this.store?.shippingPriceId &&\n this.shippingPrice &&\n this.shippingPrice.id === this.store.shippingPriceId\n ) {\n const available = getAvailableShippingTypesHelper(\n this.shippingPrice.prices,\n countryCode,\n this.shippingAddress.state\n )\n if (available.length > 0) {\n return available.map((a) => {\n switch (a.type) {\n case 'home':\n return ShippingType.home\n case 'pickup':\n return ShippingType.pickup\n case 'desk':\n return ShippingType.store\n default:\n return ShippingType.home\n }\n })\n }\n // If store has shippingPriceId but no rate for this location, fall through\n }\n\n // 3. Fall back to legacy system\n if (!this.shippingMethod?.rates) return []\n\n const state = Number.parseInt(this.shippingAddress.state, 10)\n const stateRates = this.shippingMethod.rates[state - 1]\n\n if (!stateRates) return []\n\n const availableTypes: ShippingType[] = []\n\n if (stateRates[0] !== null && stateRates[0] !== undefined)\n availableTypes.push(ShippingType.pickup)\n if (stateRates[1] !== null && stateRates[1] !== undefined)\n availableTypes.push(ShippingType.home)\n if (stateRates[2] !== null && stateRates[2] !== undefined)\n availableTypes.push(ShippingType.store)\n\n return availableTypes\n }\n\n /**\n * Retrieves the current shipping method.\n * @returns The shipping method or null.\n */\n getShippingMethod(): ShippingMethodEntity | null {\n return this.shippingMethod\n }\n\n /**\n * Sets the shipping address for the cart.\n * @param address - The shipping address.\n */\n setShippingAddress(address: CartShippingAddress, notify = true): void {\n if (\n this.shippingAddress.city !== address.city ||\n this.shippingAddress.state !== address.state ||\n this.shippingAddress.type !== address.type\n ) {\n this.shippingAddress = address\n if (notify) {\n this.notify()\n }\n }\n }\n\n /**\n * Retrieves the current shipping address.\n * @returns The shipping address.\n */\n getShippingAddress(): CartShippingAddress {\n return this.shippingAddress\n }\n\n /**\n * Calculates the shipping price based on the address and shipping method.\n * @returns The shipping price or 0 if not applicable.\n */\n getShippingPrice(): number {\n // Collect all items (items + currentItem if not in items)\n const allItems = [...this.items]\n if (this.currentItem && !this.hasItem(this.currentItem)) {\n allItems.push(this.currentItem)\n }\n\n // if at least one item have freeShipping offer return 0\n for (const item of allItems) {\n if (item.offer?.freeShipping) return 0\n }\n\n // if no shipping method is set, return 0\n if (!this.shippingMethod) return 0\n\n // if no shipping address is set, return the shipping method price\n if (!this.shippingAddress.state) return this.shippingMethod.price ?? 0\n\n // avalable shipping types\n const shippings = this.getAvailableShippingTypes()\n\n const currentOne = this.getShippingPriceForType(this.shippingAddress.type)\n if (currentOne !== null) {\n return currentOne\n }\n\n for (const type of shippings) {\n const price = this.getShippingPriceForType(type)\n if (price !== null) {\n return price\n }\n }\n\n return 0\n }\n\n /**\n * Gets the shipping price for a specific shipping type using the priority chain.\n * Priority: 1. Product shippingPriceId, 2. Store shippingPriceId, 3. Product shippingMethodId, 4. Store defaultShippingRates\n * @param type - The shipping type to check (pickup, home, store)\n * @returns The shipping price for the specified type, or null if not available\n */\n getShippingPriceForType(type: ShippingType): number | null {\n if (!this.shippingAddress.state) {\n console.log('[getShippingPriceForType] No state, returning null')\n return null\n }\n\n // Get country code from shipping address first, then store config, then default to 'DZ'\n // Convert to uppercase to match shipping price data format\n // If shippingAddress.country is 'dz' (lowercase), it means legacy system\n let countryCode: string | undefined\n if (this.shippingAddress.country && this.shippingAddress.country.toLowerCase() !== 'dz') {\n countryCode = this.shippingAddress.country.toUpperCase()\n } else if (this.store?.configs?.selectedCountry) {\n countryCode = this.store.configs.selectedCountry.toUpperCase()\n } else {\n // No country configured - use legacy system\n countryCode = undefined\n }\n\n console.log('[getShippingPriceForType]', {\n type,\n state: this.shippingAddress.state,\n country: this.shippingAddress.country,\n countryCode,\n storeSelectedCountry: this.store?.configs?.selectedCountry,\n hasShippingPrice: !!this.shippingPrice,\n shippingPriceId: this.shippingPrice?.id,\n })\n\n // Try new system first (requires countryCode)\n if (countryCode) {\n const newSystemPrice = this.resolveShippingPrice(\n countryCode,\n this.shippingAddress.state,\n type\n )\n if (newSystemPrice !== null) {\n console.log('[getShippingPriceForType] New system price:', newSystemPrice)\n return newSystemPrice\n }\n }\n\n // Fall back to legacy system\n console.log('[getShippingPriceForType] Falling back to legacy system')\n const legacyPrice = this.getShippingPriceForTypeLegacy(type)\n console.log('[getShippingPriceForType] Legacy price:', legacyPrice)\n return legacyPrice\n }\n\n /**\n * Calculates the total cost of the cart including shipping.\n * @param withCurrentItem - Whether to include the current item in the total.\n * @returns The total cost.\n */\n getTotal(withCurrentItem = true): number {\n const subTotal = this.getSubtotal(withCurrentItem)\n const shippingPrice = this.getShippingPrice() ?? 0\n const selectedOffer = this.currentItem?.offer\n if (selectedOffer && selectedOffer.freeShipping) {\n return subTotal // If the current item has free shipping, return subtotal only\n }\n return subTotal + shippingPrice\n }\n\n /**\n * Retrieves all items in the cart.\n * @returns An array of cart items.\n */\n getAll(): CartItem[] {\n return [...this.items] // Return a copy to prevent external modification\n }\n\n /**\n * Checks if the cart is empty.\n * @returns True if the cart is empty, otherwise false.\n */\n isEmpty(): boolean {\n return this.items.length === 0\n }\n\n /**\n * Notifies listeners if the cart state has meaningfully changed.\n */\n private notifyIfChanged(): void {\n // This method could be enhanced to track and notify only meaningful changes\n this.notify()\n }\n}\n","import { AxiosInstance } from 'axios'\n\n/**\n * Actions service for performing various actions on the Feeef API.\n * Similar to the Dart Actions class, this provides methods for file uploads,\n * integrations, and other action-based operations.\n */\nexport class ActionsService {\n private client: AxiosInstance\n\n constructor(client: AxiosInstance) {\n this.client = client\n }\n\n /**\n * Uploads a file or image for custom fields in orders.\n * Files are saved to u/{userId}/stores/{storeId}/customFields/{fieldId}/{filename}\n *\n * @param file - The file to upload (File or Blob)\n * @param storeId - The store ID\n * @param fieldId - The custom field ID\n * @param productId - The product ID\n * @returns Promise resolving to the uploaded file URL and metadata\n */\n async uploadCustomFieldFile({\n file,\n storeId,\n fieldId,\n productId,\n }: {\n file: File | Blob\n storeId: string\n fieldId: string\n productId: string\n }): Promise<{\n url: string\n filename: string\n fieldId: string\n storeId: string\n }> {\n const formData = new FormData()\n formData.append('file', file)\n formData.append('storeId', storeId)\n formData.append('fieldId', fieldId)\n formData.append('productId', productId)\n\n // Debug: log the baseURL and full URL that will be used\n if (\n typeof globalThis !== 'undefined' &&\n 'window' in globalThis &&\n process.env.NODE_ENV === 'development'\n ) {\n const baseURL = this.client.defaults.baseURL || ''\n const fullURL = baseURL\n ? `${baseURL}/actions/uploadCustomFieldFile`\n : '/actions/uploadCustomFieldFile'\n console.log('[ActionsService] Uploading to:', fullURL)\n console.log('[ActionsService] Client baseURL:', this.client.defaults.baseURL)\n }\n\n // Use the same pattern as other repositories - relative URL with baseURL from client defaults\n const response = await this.client.post('/actions/uploadCustomFieldFile', formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n })\n\n return {\n url: response.data.url,\n filename: response.data.filename,\n fieldId: response.data.fieldId,\n storeId: response.data.storeId,\n }\n }\n}\n","import type { AxiosInstance } from 'axios'\n\n/**\n * Options for sending a notification\n */\nexport interface SendNotificationOptions {\n /**\n * Notification title (required)\n * Max 100 characters (FCM recommendation)\n */\n title: string\n\n /**\n * Notification body/message (required)\n * Max 4000 characters (FCM recommendation)\n */\n body: string\n\n /**\n * Additional data payload (optional)\n * Key-value pairs sent with the notification\n */\n data?: Record<string, string>\n\n /**\n * Click URL (optional)\n * URL to open when notification is clicked\n */\n clickUrl?: string\n\n /**\n * Sound file name (optional)\n * Default: 'default'\n */\n sound?: string\n\n /**\n * Filterator JSON string for advanced user filtering (optional)\n * Supports complex filtering conditions - same format as users page\n */\n filterator?: string | object\n\n /**\n * Other standard user filter parameters\n */\n q?: string\n page?: number\n limit?: number\n}\n\n/**\n * Response from sending notifications\n */\nexport interface SendNotificationResponse {\n message: string\n stats: {\n usersProcessed: number\n tokensSent: number\n tokensFailed: number\n errors?: string[]\n }\n}\n\n/**\n * Service for managing notifications\n */\nexport class NotificationsService {\n private client: AxiosInstance\n\n constructor(client: AxiosInstance) {\n this.client = client\n }\n\n /**\n * Send notifications to filtered users\n * Admin only - uses filterator to filter users\n * @param options - Notification options including filterator\n * @returns Promise that resolves to send statistics\n */\n async send(options: SendNotificationOptions): Promise<SendNotificationResponse> {\n const payload: Record<string, any> = {\n title: options.title,\n body: options.body,\n }\n\n if (options.data) {\n payload.data = options.data\n }\n\n if (options.clickUrl) {\n payload.clickUrl = options.clickUrl\n }\n\n if (options.sound) {\n payload.sound = options.sound\n }\n\n // Handle filterator - convert to string if object\n if (options.filterator) {\n payload.filterator =\n typeof options.filterator === 'string'\n ? options.filterator\n : JSON.stringify(options.filterator)\n }\n\n if (options.q) {\n payload.q = options.q\n }\n\n if (options.page) {\n payload.page = options.page\n }\n\n if (options.limit) {\n payload.limit = options.limit\n }\n\n const res = await this.client.post('/notifications/send', payload)\n return res.data\n }\n}\n","import { AxiosInstance, AxiosProgressEvent, CancelToken } from 'axios'\n\n/**\n * Options for uploading a file\n */\nexport interface UploadOptions {\n /** The file to upload */\n file: File | Blob\n /** Optional folder path */\n folder?: string\n /** Progress callback */\n onProgress?: (progress: UploadProgress) => void\n /** Cancel token for aborting the upload */\n cancelToken?: CancelToken\n}\n\n/**\n * Upload progress information\n */\nexport interface UploadProgress {\n /** Bytes sent */\n loaded: number\n /** Total bytes */\n total: number\n /** Progress percentage (0-100) */\n percentage: number\n}\n\n/**\n * Upload result\n */\nexport interface UploadResult {\n /** URL of the uploaded file */\n url: string\n}\n\n/**\n * Options for uploading bytes\n */\nexport interface UploadBytesOptions {\n /** The bytes to upload */\n bytes: Uint8Array | ArrayBuffer\n /** The filename */\n filename: string\n /** Optional folder path */\n folder?: string\n /** Progress callback */\n onProgress?: (progress: UploadProgress) => void\n /** Cancel token for aborting the upload */\n cancelToken?: CancelToken\n}\n\n/**\n * Storage service for uploading files\n */\nexport class StorageService {\n private client: AxiosInstance\n\n constructor(client: AxiosInstance) {\n this.client = client\n }\n\n /**\n * Uploads a file\n * @param options - Upload options\n * @returns Promise resolving to the upload result\n */\n async upload(options: UploadOptions): Promise<UploadResult> {\n const formData = new FormData()\n formData.append('file', options.file)\n if (options.folder) {\n formData.append('folder', options.folder)\n }\n\n const response = await this.client.post('/services/storage/upload', formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n onUploadProgress: options.onProgress\n ? (progressEvent: AxiosProgressEvent) => {\n const total = progressEvent.total || 0\n const loaded = progressEvent.loaded || 0\n options.onProgress!({\n loaded,\n total,\n percentage: total > 0 ? Math.round((loaded / total) * 100) : 0,\n })\n }\n : undefined,\n cancelToken: options.cancelToken,\n })\n\n return {\n url: response.data.url,\n }\n }\n\n /**\n * Uploads bytes directly\n * @param options - Upload options\n * @returns Promise resolving to the upload result\n */\n async uploadBytes(options: UploadBytesOptions): Promise<UploadResult> {\n const blob = new Blob([options.bytes])\n const file = new File([blob], options.filename)\n\n return this.upload({\n file,\n folder: options.folder,\n onProgress: options.onProgress,\n cancelToken: options.cancelToken,\n })\n }\n\n /**\n * Uploads a file for a store\n * @param file - The file to upload\n * @param storeId - The store ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadStoreFile(\n file: File | Blob,\n storeId: string,\n options?: {\n subfolder?: string\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n const folder = options?.subfolder\n ? `stores/${storeId}/${options.subfolder}`\n : `stores/${storeId}`\n\n return this.upload({\n file,\n folder,\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a product image\n * @param file - The file to upload\n * @param storeId - The store ID\n * @param productId - The product ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadProductImage(\n file: File | Blob,\n storeId: string,\n productId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.uploadStoreFile(file, storeId, {\n subfolder: `products/${productId}`,\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a store logo\n * @param file - The file to upload\n * @param storeId - The store ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadStoreLogo(\n file: File | Blob,\n storeId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.uploadStoreFile(file, storeId, {\n subfolder: 'logo',\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a store icon\n * @param file - The file to upload\n * @param storeId - The store ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadStoreIcon(\n file: File | Blob,\n storeId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.uploadStoreFile(file, storeId, {\n subfolder: 'icon',\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a user avatar\n * @param file - The file to upload\n * @param userId - The user ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadUserAvatar(\n file: File | Blob,\n userId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.upload({\n file,\n folder: `users/${userId}/avatar`,\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a feedback attachment\n * @param file - The file to upload\n * @param feedbackId - The feedback ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadFeedbackAttachment(\n file: File | Blob,\n feedbackId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.upload({\n file,\n folder: `feedbacks/${feedbackId}`,\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n}\n","import { AxiosInstance } from 'axios'\n\n// ============================================================================\n// Common Types\n// ============================================================================\n\n/**\n * Delivery fees structure - Array of [home, desk] prices per state\n */\nexport type DeliveryFees = (number | null)[][]\n\n// ============================================================================\n// Ecotrack Integration\n// ============================================================================\n\n/**\n * Ecotrack delivery integration configuration\n */\nexport interface EcotrackDeliveryIntegration {\n baseUrl: string\n token: string\n active?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Ecotrack finance data\n */\nexport interface EcotrackFinanceData {\n success: boolean\n amountsNotEncaissed: number\n feesNotEncaissed: number\n notEncaissed: number\n amountsEncaissed: number\n feesEncaissed: number\n encaissed: number\n amountsPaymentReady: number\n feesPaymentReady: number\n paymentReady: number\n}\n\n/**\n * Ecotrack wilaya (state) statistics\n */\nexport interface EcotrackWilayaData {\n wilayaId: number\n total: number\n retours: number\n livred: number\n wilayaName: string\n}\n\n/**\n * Ecotrack today's activity\n */\nexport interface EcotrackTodayActivity {\n expedie: number\n delivered: number\n returned: number\n suspended: number\n}\n\n/**\n * Ecotrack global statistics\n */\nexport interface EcotrackGlobalStats {\n enTraitement: number\n livred: number\n retours: number\n total: number\n}\n\n/**\n * Ecotrack statistics data\n */\nexport interface EcotrackStatisticsData {\n topWilaya: EcotrackWilayaData[]\n todayActivity: EcotrackTodayActivity\n globalStats: EcotrackGlobalStats\n}\n\n/**\n * Ecotrack sync result\n */\nexport interface EcotrackSyncResult {\n success: boolean\n message: string\n syncId?: string\n totalFetched?: number\n totalUpdated?: number\n totalSkipped?: number\n syncedAt?: string\n errors?: string[]\n}\n\n/**\n * Ecotrack sync status\n */\nexport interface EcotrackSyncStatus {\n canSync: boolean\n lastSyncAt?: string\n nextSyncAvailableAt?: string\n minutesUntilNextSync?: number\n}\n\n/**\n * Ecotrack Delivery Integration API\n */\nexport class EcotrackDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: EcotrackDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: EcotrackDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Ecotrack\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecotrack/fees`, {\n params: {\n baseUrl: this.integration.baseUrl,\n token: this.integration.token,\n },\n })\n return res.data\n }\n\n /**\n * Gets financial data from Ecotrack\n */\n async getFinancialData(options?: {\n limit?: number\n search?: string\n telephone?: string\n }): Promise<EcotrackFinanceData> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecotrack/finance`, {\n params: {\n api_token: this.integration.token,\n ...options,\n },\n })\n return {\n success: res.data.success ?? false,\n amountsNotEncaissed: res.data.amounts_not_encaissed ?? 0,\n feesNotEncaissed: res.data.fees_not_encaissed ?? 0,\n notEncaissed: res.data.not_encaissed ?? 0,\n amountsEncaissed: res.data.amounts_encaissed ?? 0,\n feesEncaissed: res.data.fees_encaissed ?? 0,\n encaissed: res.data.encaissed ?? 0,\n amountsPaymentReady: res.data.amounts_payment_ready ?? 0,\n feesPaymentReady: res.data.fees_payment_ready ?? 0,\n paymentReady: res.data.payment_ready ?? 0,\n }\n }\n\n /**\n * Gets statistics data from Ecotrack\n */\n async getStatistics(): Promise<EcotrackStatisticsData> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecotrack/statistics`)\n return {\n topWilaya: (res.data.top_wilaya || []).map((w: any) => ({\n wilayaId: w.wilaya_id ?? 0,\n total: w.total ?? 0,\n retours: w.retours ?? 0,\n livred: w.livred ?? 0,\n wilayaName: w.wilaya_name ?? '',\n })),\n todayActivity: {\n expedie: res.data.today_act?.expedie ?? 0,\n delivered: res.data.today_act?.delivered ?? 0,\n returned: res.data.today_act?.returned ?? 0,\n suspended: res.data.today_act?.suspended ?? 0,\n },\n globalStats: {\n enTraitement: res.data.global?.enTraitement ?? 0,\n livred: res.data.global?.livred ?? 0,\n retours: res.data.global?.retours ?? 0,\n total: res.data.global?.total ?? 0,\n },\n }\n }\n\n /**\n * Gets the sync status for this store's Ecotrack integration\n */\n async getSyncStatus(): Promise<EcotrackSyncStatus> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecotrack/sync/status`)\n return res.data\n }\n\n /**\n * Triggers a sync of orders from Ecotrack\n */\n async triggerSync(options?: {\n startDate?: Date | string\n endDate?: Date | string\n }): Promise<EcotrackSyncResult> {\n const res = await this.client.post(`/stores/${this.storeId}/integrations/ecotrack/sync`, {\n startDate:\n options?.startDate instanceof Date ? options.startDate.toISOString() : options?.startDate,\n endDate: options?.endDate instanceof Date ? options.endDate.toISOString() : options?.endDate,\n })\n return res.data\n }\n}\n\n// ============================================================================\n// Yalidine Integration\n// ============================================================================\n\n/**\n * Yalidine agent type\n */\nexport enum YalidineAgent {\n yalidine = 'yalidine',\n guepex = 'guepex',\n}\n\n/**\n * Yalidine delivery integration configuration\n */\nexport interface YalidineDeliveryIntegration {\n id: string\n token: string\n agent?: YalidineAgent\n active?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Yalidine Delivery Integration API\n */\nexport class YalidineDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: YalidineDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: YalidineDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Yalidine\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/yalidine/fees`, {\n params: {\n id: this.integration.id,\n token: this.integration.token,\n },\n })\n return res.data\n }\n}\n\n// ============================================================================\n// Procolis Integration\n// ============================================================================\n\n/**\n * Procolis delivery integration configuration\n */\nexport interface ProcolisDeliveryIntegration {\n key: string\n token: string\n active?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Procolis Delivery Integration API\n */\nexport class ProcolisDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: ProcolisDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: ProcolisDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Procolis\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/procolis/fees`, {\n params: {\n key: this.integration.key,\n token: this.integration.token,\n },\n })\n return res.data\n }\n\n /**\n * Sends an order to Procolis\n */\n async send(orderId: string): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/procolis/send`, {\n key: this.integration.key,\n token: this.integration.token,\n orderId,\n })\n }\n}\n\n// ============================================================================\n// Noest Integration\n// ============================================================================\n\n/**\n * Noest delivery integration configuration\n */\nexport interface NoestDeliveryIntegration {\n guid: string\n token: string\n active?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Noest Delivery Integration API\n */\nexport class NoestDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: NoestDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: NoestDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Noest\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/noest/fees`, {\n params: {\n guid: this.integration.guid,\n token: this.integration.token,\n },\n })\n return res.data\n }\n\n /**\n * Sends an order to Noest\n */\n async send(orderId: string): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/noest/send`, {\n guid: this.integration.guid,\n token: this.integration.token,\n orderId,\n })\n }\n}\n\n// ============================================================================\n// Google Sheets Integration\n// ============================================================================\n\n/**\n * Google Sheets integration configuration for API calls\n * (Note: For store integrations, use GoogleSheetsIntegration from store.ts)\n */\nexport interface GoogleSheetsIntegrationConfig {\n id: string\n name: string\n active?: boolean\n oauth2?: Record<string, any>\n metadata?: Record<string, any>\n simple?: boolean\n columns?: Array<{\n field: string\n name: string\n enabled: boolean\n defaultValue?: any\n }>\n}\n\n/**\n * Google Sheets Integration API\n */\nexport class GoogleSheetIntegrationApi {\n private client: AxiosInstance\n private integration: GoogleSheetsIntegrationConfig\n private storeId: string\n\n constructor(client: AxiosInstance, integration: GoogleSheetsIntegrationConfig, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Appends a row to the Google Sheet\n */\n async appendRow(values: string[]): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/google-sheets/append-row`, {\n id: this.integration.id,\n name: this.integration.name,\n row: values,\n })\n }\n\n /**\n * Creates a new spreadsheet\n */\n async createSpreadsheet(name: string): Promise<void> {\n await this.client.post(\n `/stores/${this.storeId}/integrations/google-sheets/create-spreadsheet`,\n { name }\n )\n }\n}\n\n// ============================================================================\n// Zimou Integration\n// ============================================================================\n\n/**\n * Zimou delivery integration configuration\n */\nexport interface ZimouDeliveryIntegration {\n id: string\n apiKey: string\n active?: boolean\n silentMode?: boolean\n autoSend?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Zimou Delivery Integration API\n */\nexport class ZimouDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: ZimouDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: ZimouDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Zimou\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/zimou/fees`, {\n params: {\n apiKey: this.integration.apiKey,\n },\n })\n return res.data\n }\n\n /**\n * Sends an order to Zimou\n */\n async send(orderId: string): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/zimou/send`, {\n apiKey: this.integration.apiKey,\n orderId,\n })\n }\n}\n\n// ============================================================================\n// Ecomanager Integration\n// ============================================================================\n\n/**\n * Ecomanager delivery integration configuration\n */\nexport interface EcomanagerDeliveryIntegration {\n baseUrl: string\n token: string\n active?: boolean\n autoSend?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Ecomanager Delivery Integration API\n */\nexport class EcomanagerDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: EcomanagerDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: EcomanagerDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Ecomanager\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecomanager/fees`, {\n params: {\n baseUrl: this.integration.baseUrl,\n token: this.integration.token,\n },\n })\n return res.data\n }\n\n /**\n * Sends an order to Ecomanager\n */\n async send(orderId: string): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/ecomanager/send`, {\n baseUrl: this.integration.baseUrl,\n token: this.integration.token,\n orderId,\n })\n }\n}\n\n// ============================================================================\n// Integration Factory\n// ============================================================================\n\n/**\n * Factory for creating integration API instances\n */\nexport class IntegrationFactory {\n private client: AxiosInstance\n\n constructor(client: AxiosInstance) {\n this.client = client\n }\n\n /**\n * Creates an Ecotrack integration API\n */\n ecotrack(\n integration: EcotrackDeliveryIntegration,\n storeId: string\n ): EcotrackDeliveryIntegrationApi {\n return new EcotrackDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Yalidine integration API\n */\n yalidine(\n integration: YalidineDeliveryIntegration,\n storeId: string\n ): YalidineDeliveryIntegrationApi {\n return new YalidineDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Procolis integration API\n */\n procolis(\n integration: ProcolisDeliveryIntegration,\n storeId: string\n ): ProcolisDeliveryIntegrationApi {\n return new ProcolisDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Noest integration API\n */\n noest(integration: NoestDeliveryIntegration, storeId: string): NoestDeliveryIntegrationApi {\n return new NoestDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Google Sheets integration API\n */\n googleSheets(\n integration: GoogleSheetsIntegrationConfig,\n storeId: string\n ): GoogleSheetIntegrationApi {\n return new GoogleSheetIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Zimou integration API\n */\n zimou(integration: ZimouDeliveryIntegration, storeId: string): ZimouDeliveryIntegrationApi {\n return new ZimouDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates an Ecomanager integration API\n */\n ecomanager(\n integration: EcomanagerDeliveryIntegration,\n storeId: string\n ): EcomanagerDeliveryIntegrationApi {\n return new EcomanagerDeliveryIntegrationApi(this.client, integration, storeId)\n }\n}\n","import { EmbaddedAddress } from '../embadded/address.js'\nimport { EmbaddedCategory } from '../embadded/category.js'\nimport { EmbaddedContact } from '../embadded/contact.js'\nimport { OrderEntity, OrderStatus, DeliveryStatus, PaymentStatus } from './order.js'\nimport { MetaPixelEvent, TiktokPixelEvent } from './product.js'\n// import { OrderEntity } from \"./order.js\";\n// import { ShippingMethodEntity } from \"./shipping_method.js\";\nimport { UserEntity } from './user.js'\nimport { CategoryEntity } from './category.js'\nimport { DateTime } from 'luxon'\n\nexport interface StoreEntity {\n id: string\n slug: string\n banner: StoreBanner | null\n action: StoreAction | null\n domain: StoreDomain | null\n decoration: StoreDecoration | null\n name: string\n iconUrl: string | null\n logoUrl: string | null\n // deprecated\n ondarkLogoUrl: string | null\n userId: string\n categories: EmbaddedCategory[]\n categoriesRelation?: CategoryEntity[]\n title: string | null\n description: string | null\n addresses: EmbaddedAddress[]\n address: EmbaddedAddress | null\n metadata: Record<string, any>\n contacts: EmbaddedContact[]\n integrations?: StoreIntegrations | null\n publicIntegrations: PublicStoreIntegrations | null\n verifiedAt: any | null\n blockedAt: any | null\n createdAt: any\n updatedAt: any\n // products: ProductEntity[];\n user?: UserEntity\n // orders: OrderEntity[];\n // shippingMethods: ShippingMethodEntity[];\n defaultShippingRates: (number | null)[][] | null\n\n shippingPriceId?: string | null\n\n // subscription\n subscription?: any\n due?: number\n\n // StoreConfigs\n configs?: StoreConfigs\n\n // metaPixelIds\n metaPixelIds?: string[] | null\n\n // tiktokPixelIds\n tiktokPixelIds?: string[] | null\n\n // googleAnalyticsId\n googleAnalyticsId?: string | null\n\n // googleTagsId\n googleTagsId?: string | null\n\n // members\n members?: Record<string, StoreMember>\n}\n\n// function that generate public data from the integrations data\nexport const generatePublicStoreIntegrations = (\n integrations: StoreIntegrations | null | undefined\n): PublicStoreIntegrations | null => {\n if (!integrations) return null\n const {\n metaPixel,\n tiktokPixel,\n googleAnalytics,\n googleTags,\n orderdz,\n webhooks,\n ai,\n security,\n customFields,\n } = integrations\n return {\n metaPixel: generatePublicStoreIntegrationMetaPixel(metaPixel) || null,\n tiktokPixel: generatePublicStoreIntegrationTiktokPixel(tiktokPixel) || null,\n googleAnalytics: generatePublicStoreIntegrationGoogleAnalytics(googleAnalytics) || null,\n googleTags: generatePublicStoreIntegrationGoogleTags(googleTags) || null,\n googleSheet: null,\n ai: generatePublicStoreIntegrationAi(ai) || null,\n orderdz: generatePublicStoreIntegrationOrderdz(orderdz) || null,\n webhooks: generatePublicStoreIntegrationWebhooks(webhooks) || null,\n security: generatePublicStoreIntegrationSecurity(security) || null,\n customFields: generatePublicStoreIntegrationCustomFields(customFields) || null,\n }\n}\n\nexport const generatePublicStoreIntegrationCustomFields = (\n customFields: any | null | undefined\n): PublicCustomFieldsIntegration | null | undefined => {\n if (!customFields || !customFields.active) return null\n return {\n fields: (customFields.fields || []).map((field: any) => ({\n id: field.id,\n label: field.label,\n type: field.type,\n required: field.required,\n multiple: field.multiple,\n minCount: field.minCount,\n maxCount: field.maxCount,\n placeholder: field.placeholder,\n helpText: field.helpText,\n regexPattern: field.regexPattern,\n defaultValue: field.defaultValue,\n order: field.order,\n active: field.active,\n })),\n active: customFields.active,\n }\n}\n/**\n * Generates public Meta Pixel integration data from private integration data.\n * Only exposes non-sensitive information (pixel IDs, active status, objectives).\n * Sensitive data like oauth2 tokens, pixel API keys, and metadata are NOT exposed.\n */\nexport const generatePublicStoreIntegrationMetaPixel = (\n metaPixel: MetaPixelIntegration | null | undefined\n): PublicMetaPixelIntegration | null | undefined => {\n if (!metaPixel) return null\n // NOTE: oauth2, pixel.key, and metadata are intentionally excluded for security\n return {\n pixels: metaPixel.pixels.map((pixel) => ({\n id: pixel.id,\n })),\n active: metaPixel.active,\n objective: metaPixel.objective,\n draftObjective: metaPixel.draftObjective,\n }\n}\nexport const generatePublicStoreIntegrationTiktokPixel = (\n tiktokPixel: TiktokPixelIntegration | null | undefined\n): PublicTiktokPixelIntegration | null | undefined => {\n if (!tiktokPixel) return null\n return {\n pixels: tiktokPixel.pixels.map((pixel) => ({\n id: pixel.id,\n })),\n active: tiktokPixel.active,\n objective: tiktokPixel.objective,\n draftObjective: tiktokPixel.draftObjective,\n }\n}\nexport const generatePublicStoreIntegrationGoogleAnalytics = (\n googleAnalytics: GoogleAnalyticsIntegration | null | undefined\n): PublicGoogleAnalyticsIntegration | null | undefined => {\n if (!googleAnalytics) return null\n return {\n id: googleAnalytics.id,\n active: googleAnalytics.active,\n }\n}\nexport const generatePublicStoreIntegrationGoogleSheet = (\n googleSheet: GoogleSheetsIntegration | null | undefined\n): PublicGoogleSheetsIntegration | null | undefined => {\n if (!googleSheet) return null\n return null\n}\nexport const generatePublicStoreIntegrationGoogleTags = (\n googleTags: GoogleTagsIntegration | null | undefined\n): PublicGoogleTagsIntegration | null | undefined => {\n if (!googleTags) return null\n const { id, active } = googleTags\n return {\n id,\n active,\n }\n}\n\n/**\n * Generates public AI integration data from private integration data.\n * Only exposes non-sensitive information, keeping the API key private for security.\n */\nexport const generatePublicStoreIntegrationAi = (\n ai: AiIntegration | null | undefined\n): PublicAiIntegration | null | undefined => {\n if (!ai) return null\n return {\n active: ai.active,\n textModel: ai.textModel,\n imageModel: ai.imageModel,\n }\n}\n\n/**\n * Generates public OrderDZ integration data from private integration data.\n * Only exposes the URL and active status, keeping the token private for security.\n */\nexport const generatePublicStoreIntegrationOrderdz = (\n orderdz: OrderdzIntegration | null | undefined\n): PublicOrderdzIntegration | null | undefined => {\n if (!orderdz) return null\n return {\n url: orderdz.url,\n active: orderdz.active,\n }\n}\n\n/**\n * Generates public webhooks integration data from private integration data.\n * Only exposes non-sensitive information, keeping secrets private for security.\n */\nexport const generatePublicStoreIntegrationWebhooks = (\n webhooks: WebhooksIntegration | null | undefined\n): PublicWebhooksIntegration | null | undefined => {\n if (!webhooks) return null\n\n const activeWebhooks = webhooks.webhooks.filter((webhook) => webhook.active)\n\n return {\n webhookCount: webhooks.webhooks.length,\n activeWebhookCount: activeWebhooks.length,\n active: webhooks.active,\n webhookUrls: activeWebhooks.map((webhook) => webhook.url),\n }\n}\n/**\n * Generates public security integration data from private integration data.\n * Only exposes non-sensitive information, keeping backend protection details private for security.\n */\nexport const generatePublicStoreIntegrationSecurity = (\n security: SecurityIntegration | null | undefined\n): PublicSecurityIntegration | null | undefined => {\n if (!security) return null\n\n return {\n key: '[none]',\n orders: security.orders\n ? {\n frontend: security.orders.frontend,\n }\n : undefined,\n active: security.active,\n }\n}\n\n/**\n * Public interface for OrderDZ integration.\n * Contains only non-sensitive information that can be safely exposed to clients.\n */\nexport interface PublicOrderdzIntegration {\n url: string\n active: boolean\n}\n\n/**\n * Public interface for webhooks integration.\n * Contains only non-sensitive information that can be safely exposed to clients.\n */\nexport interface PublicWebhooksIntegration {\n /** Total number of configured webhooks */\n webhookCount: number\n /** Number of active webhooks */\n activeWebhookCount: number\n /** Whether the integration is active */\n active: boolean\n /** List of active webhook URLs (without secrets) */\n webhookUrls: string[]\n}\n\nexport interface PublicMetaPixelIntegration {\n pixels: { id: string }[]\n active: boolean\n objective?: MetaPixelEvent | null\n draftObjective?: MetaPixelEvent | null\n}\nexport interface PublicTiktokPixelIntegration {\n pixels: { id: string }[]\n active: boolean\n objective?: TiktokPixelEvent | null\n draftObjective?: TiktokPixelEvent | null\n}\nexport interface PublicGoogleAnalyticsIntegration {\n id: string\n active: boolean\n}\nexport interface PublicGoogleSheetsIntegration {\n id: string\n active: boolean\n}\nexport interface PublicGoogleTagsIntegration {\n id: string\n active: boolean\n}\n\nexport interface PublicAiIntegration {\n active: boolean\n textModel: string\n imageModel: string\n}\n\nexport interface PublicCustomField {\n id: string\n label: string\n type: string\n required?: boolean\n multiple?: boolean\n minCount?: number\n maxCount?: number\n placeholder?: string\n helpText?: string\n regexPattern?: string\n defaultValue?: any\n order?: number\n active?: boolean\n}\n\nexport interface PublicCustomFieldsIntegration {\n fields: PublicCustomField[]\n active: boolean\n}\n\nexport interface PublicStoreIntegrations {\n metaPixel: PublicMetaPixelIntegration | null\n tiktokPixel: PublicTiktokPixelIntegration | null\n googleAnalytics: PublicGoogleAnalyticsIntegration | null\n googleSheet: PublicGoogleSheetsIntegration | null\n googleTags: PublicGoogleTagsIntegration | null\n ai: PublicAiIntegration | null\n orderdz: PublicOrderdzIntegration | null\n webhooks: PublicWebhooksIntegration | null\n security: PublicSecurityIntegration | null\n customFields: PublicCustomFieldsIntegration | null\n}\n\nexport enum StoreMemberRole {\n editor = 'editor',\n viewer = 'viewer',\n confermer = 'confermer',\n}\n\nexport interface StoreMember {\n name: string\n userId: string\n role: StoreMemberRole\n acceptedAt: any | null\n expiredAt: any | null\n createdAt: any\n active: boolean\n metadata: Record<string, any>\n}\n\nexport interface StoreConfigs {\n currencies: StoreCurrencyConfig[]\n selectedCurrency: string\n languages?: StoreLanguageConfig[]\n defaultLanguage?: string\n countries?: StoreCountryConfig[]\n selectedCountry?: string\n customStatusMappings?: CustomStatusMapping[]\n /** Feature flag to enable custom statuses across the app */\n customStatusEnabled?: boolean\n}\n\nexport interface CustomStatusMapping {\n /** The custom status name (e.g., \"not_respond\", \"phone_closed_1\") */\n name: string\n /** Auto-generated code based on name if not provided (e.g., \"not_respond\" -> \"not_respond\") */\n code?: string\n /** Optional color for UI display (hex color as number) */\n color?: number\n /** Whether this custom status is enabled and should be shown in UI */\n enabled?: boolean\n /** Status to map to (null means no change) */\n status?: OrderStatus | null\n /** Delivery status to map to (null means no change) */\n deliveryStatus?: DeliveryStatus | null\n /** Payment status to map to (null means no change) */\n paymentStatus?: PaymentStatus | null\n}\n\nexport interface StoreCurrencyConfig {\n code: string\n symbol: string\n precision: number\n rate: number\n}\n\nexport interface StoreLanguageConfig {\n code: string\n name: string\n nativeName: string\n rtl?: boolean\n}\n\nexport interface StoreCountryConfig {\n code: string\n name: string\n nativeName: string\n}\n\nexport interface StoreDomain {\n name: string\n verifiedAt: any | null\n metadata: Record<string, any>\n}\nexport interface StoreBanner {\n title: string\n url?: string | null\n enabled: boolean\n metadata: Record<string, any>\n}\n\nexport interface StoreDecoration {\n // primary\n primary: number\n onPrimary?: number\n // on dark mode\n primaryDark?: number\n onPrimaryDark?: number\n // secondary\n secondary?: number\n onSecondary?: number\n // on dark mode\n secondaryDark?: number\n onSecondaryDark?: number\n\n useLogoDarkFilter?: boolean\n\n showStoreLogoInHeader?: boolean\n logoFullHeight?: boolean\n showStoreNameInHeader?: boolean\n metadata?: Record<string, any>\n [key: string]: any\n}\n\nexport interface StoreAction {\n label: string\n url: string\n type: StoreActionType\n}\n\nexport enum StoreActionType {\n link = 'link',\n whatsapp = 'whatsapp',\n telegram = 'telegram',\n phone = 'phone',\n}\nexport interface MetaPixel {\n name?: string\n id: string\n key?: string\n}\n\n/**\n * Facebook Marketing OAuth data\n * Used for accessing Facebook Marketing API (pixels, ads, etc.)\n */\nexport interface FacebookMarketingOAuth {\n accessToken: string\n tokenType?: string\n expiresIn?: number\n expiresAt?: string // ISO date string\n scopes?: string[]\n}\n\n// tiktok pixel\nexport interface TiktokPixel {\n name?: string\n id: string\n accessToken?: string\n}\n// meta pixel integration\nexport interface MetaPixelIntegration {\n id: string\n pixels: MetaPixel[]\n objective?: MetaPixelEvent | null\n draftObjective?: MetaPixelEvent | null\n active: boolean\n metadata: Record<string, any>\n /** Facebook Marketing OAuth data - for accessing pixels via API */\n oauth2?: FacebookMarketingOAuth | null\n}\n// tiktok pixel integration\nexport interface TiktokPixelIntegration {\n id: string\n pixels: TiktokPixel[]\n objective?: TiktokPixelEvent | null\n draftObjective?: TiktokPixelEvent | null\n active: boolean\n metadata: Record<string, any>\n}\n\nexport interface GoogleAnalyticsIntegration {\n id: string\n active: boolean\n metadata: Record<string, any>\n}\n\n// export enum GoogleSheetsColumnType {\n// string = 'string',\n// number = 'number',\n// boolean = 'boolean',\n// date = 'date',\n// }\n\nexport interface GoogleSheetsColumn<T> {\n // it can be path in json field for exmple metadata.customData\n field: keyof OrderEntity | string | 'skus' | 'quantities' | 'itemsNames'\n name: string\n enabled: boolean\n defaultValue?: T\n // type:\n}\nexport interface GoogleSheetsIntegration {\n id: string\n name: string\n active: boolean\n oauth2?: Record<string, any>\n metadata: Record<string, any>\n simple?: boolean\n columns?: GoogleSheetsColumn<any>[]\n}\nexport interface GoogleTagsIntegration {\n id: string\n active: boolean\n metadata: Record<string, any>\n}\n\n/**\n * AI integration configuration for Google AI Studio.\n */\nexport interface AiIntegration {\n active: boolean\n apiKey?: string\n textModel: string\n imageModel: string\n metadata: Record<string, any>\n}\n\n/**\n * OrderDZ integration configuration for order confirmation service.\n * This integration allows automatic order confirmation via OrderDZ API.\n */\nexport interface OrderdzIntegration {\n /** Unique identifier for this integration instance */\n id: string\n /** API endpoint URL for OrderDZ service (e.g., \"https://orderdz.com/api/v1/feeef/order\") */\n url: string\n /** Authentication token for OrderDZ API */\n token: string\n /** Whether this integration is currently active */\n active: boolean\n /** Whether to automatically send orders when they are marked as sent */\n autoSend?: boolean\n /** Additional metadata for the integration */\n metadata: Record<string, any>\n}\n\n/**\n * Ecomanager integration configuration for delivery management.\n * This integration allows order management and tracking via Ecomanager API.\n */\nexport interface EcomanagerIntegration {\n active: boolean\n baseUrl: string\n token: string\n autoSend?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Zimou Express integration configuration for delivery management.\n * This integration allows order management and tracking via Zimou Express API.\n */\nexport interface ZimouIntegration {\n /** Unique identifier for this integration instance */\n id: string\n /** API authentication key for Zimou Express */\n apiKey: string\n /** Whether this integration is currently active */\n active: boolean\n /** Whether to send orders directly without confirmation dialog */\n silentMode?: boolean\n /** Whether to automatically send orders when they are marked as sent */\n autoSend?: boolean\n /** Additional metadata for the integration */\n metadata?: Record<string, any>\n}\n\nexport interface SecurityIntegrationOrdersProtection {\n frontend: {\n active: boolean\n }\n backend: {\n active: boolean\n phoneTtl: number\n ipTtl: number\n blockDirectOrders: boolean\n adsOnlyMode: boolean\n }\n}\nexport interface PublicSecurityIntegrationOrdersProtection {\n frontend: {\n active: boolean\n }\n}\nexport interface SecurityIntegration {\n orders?: SecurityIntegrationOrdersProtection\n\n /** Whether this integration is currently active */\n active: boolean\n /** Additional metadata for the integration */\n metadata?: Record<string, any>\n}\nexport interface PublicSecurityIntegration {\n key?: string | null\n orders?: PublicSecurityIntegrationOrdersProtection\n\n /** Whether this integration is currently active */\n active: boolean\n /** Additional metadata for the integration */\n metadata?: Record<string, any>\n}\n\n/**\n * Webhook event types for order lifecycle\n */\nexport enum WebhookEvent {\n ORDER_CREATED = 'orderCreated',\n ORDER_UPDATED = 'orderUpdated',\n ORDER_DELETED = 'orderDeleted',\n}\n\n/**\n * Individual webhook configuration\n */\nexport interface WebhookConfig {\n /** Unique identifier for this webhook */\n id: string\n /** Human-readable name for this webhook */\n name: string\n /** Target URL where webhook events will be sent */\n url: string\n /** Events this webhook is subscribed to */\n events: WebhookEvent[]\n /** Optional secret key for HMAC signature verification */\n secret?: string\n /** Whether this webhook is currently active */\n active: boolean\n /** Additional HTTP headers to send with webhook requests */\n headers?: Record<string, string>\n /** Additional metadata for this webhook */\n metadata: Record<string, any>\n}\n\n/**\n * Webhooks integration configuration for real-time order notifications\n */\nexport interface WebhooksIntegration {\n /** List of configured webhooks */\n webhooks: WebhookConfig[]\n /** Whether the webhooks integration is active */\n active: boolean\n /** Additional metadata for the integration */\n metadata: Record<string, any>\n}\n\nexport interface StoreIntegrations {\n [key: string]: any\n metadata?: Record<string, any>\n\n // @Default('default') String id,\n // @Default([]) List<MetaPixel> pixels,\n // @Default(true) bool active,\n // @Default({}) Map<String, dynamic> metadata,\n metaPixel?: MetaPixelIntegration\n tiktokPixel?: TiktokPixelIntegration\n googleAnalytics?: GoogleAnalyticsIntegration\n googleSheet?: GoogleSheetsIntegration\n googleTags?: GoogleTagsIntegration\n ai?: AiIntegration\n orderdz?: OrderdzIntegration\n webhooks?: WebhooksIntegration\n\n sms?: any\n telegram?: any\n yalidine?: any\n maystroDelivery?: any\n echotrak?: any\n ecotrack?: any\n ecomanager?: EcomanagerIntegration\n procolis?: any\n noest?: any\n zimou?: ZimouIntegration\n\n security?: SecurityIntegration\n}\n\nexport enum StoreSubscriptionStatus {\n active = 'active',\n inactive = 'inactive',\n}\n\nexport enum StoreSubscriptionType {\n free = 'free',\n premium = 'premium',\n vip = 'vip',\n custom = 'custom',\n}\n\nexport interface StoreSubscription {\n type: StoreSubscriptionType\n name: string\n status: StoreSubscriptionStatus\n startedAt: DateTime\n expiresAt: DateTime | null\n quota: number\n consumed: number\n remaining: number\n metadata: Record<string, any>\n}\n\n/**\n * Input data for creating a new store\n */\nexport interface StoreCreateInput {\n name: string\n slug?: string\n title?: string\n description?: string\n iconUrl?: string\n logoUrl?: string\n ondarkLogoUrl?: string\n categories?: EmbaddedCategory[]\n addresses?: EmbaddedAddress[]\n contacts?: EmbaddedContact[]\n decoration?: StoreDecoration\n domain?: StoreDomain\n banner?: StoreBanner\n action?: StoreAction\n metadata?: Record<string, any>\n defaultShippingRates?: (number | null)[][] | null\n shippingPriceId?: string\n configs?: StoreConfigs\n metaPixelIds?: string[]\n tiktokPixelIds?: string[]\n googleAnalyticsId?: string\n googleTagsId?: string\n}\n\n/**\n * Input data for updating an existing store\n */\nexport interface StoreUpdateInput {\n name?: string\n slug?: string\n title?: string\n description?: string\n iconUrl?: string\n logoUrl?: string\n ondarkLogoUrl?: string\n categories?: EmbaddedCategory[]\n addresses?: EmbaddedAddress[]\n contacts?: EmbaddedContact[]\n decoration?: StoreDecoration\n domain?: StoreDomain\n banner?: StoreBanner\n action?: StoreAction\n metadata?: Record<string, any>\n defaultShippingRates?: (number | null)[][] | null\n shippingPriceId?: string\n configs?: StoreConfigs\n metaPixelIds?: string[]\n tiktokPixelIds?: string[]\n googleAnalyticsId?: string\n googleTagsId?: string\n integrations?: StoreIntegrations\n}\n\n/**\n * Store summary data\n */\nexport interface StoreSummary {\n ordersCount: number\n productsCount: number\n revenue: number\n topProducts?: Array<{ id: string; name: string; sold: number }>\n ordersByStatus?: Record<string, number>\n recentOrders?: any[]\n}\n\n/**\n * Input for adding a store member\n */\nexport interface AddStoreMemberInput {\n email: string\n role: StoreMemberRole\n name?: string\n metadata?: Record<string, any>\n}\n\n/**\n * Input for updating a store member\n */\nexport interface UpdateStoreMemberInput {\n role?: StoreMemberRole\n name?: string\n metadata?: Record<string, any>\n}\n","import { EmbaddedCategory } from '../embadded/category.js'\nimport { ShippingMethodEntity } from './shipping_method.js'\nimport { GoogleSheetsColumn, StoreEntity } from './store.js'\nimport { CategoryEntity } from './category.js'\n\nexport interface ProductEntity {\n id: string\n\n slug: string\n\n decoration: ProductDecoration | null\n\n name: string | null\n\n photoUrl: string | null\n\n media: string[]\n\n storeId: string\n\n shippingMethodId?: string | null\n\n shippingPriceId?: string | null\n\n categoryId?: string | null\n\n category?: EmbaddedCategory | null\n\n categoryRelation?: CategoryEntity | null\n\n title: string | null\n\n description: string | null\n\n body: string | null\n\n // sku\n sku: string | null\n\n price: number\n\n cost: number | null\n\n discount: number | null\n\n stock: number | null\n\n sold: number\n\n views: number\n\n likes: number\n\n dislikes: number\n\n variant?: ProductVariant | null\n\n offers?: ProductOffer[] | null\n\n metadata: Record<string, any>\n\n status: ProductStatus\n\n type: ProductType\n\n verifiedAt: any | null\n\n blockedAt: any | null\n\n createdAt: any\n\n updatedAt: any\n\n addons?: ProductAddon[] | null\n\n // integrations configs\n integrationsData?: IntegrationsData | null\n publicIntegrationsData?: IntegrationsData | null\n\n // relations\n store?: StoreEntity | null\n shippingMethod?: ShippingMethodEntity | null\n}\n\n// function that generate public data from the integrations data\nexport function generatePublicIntegrationsData(data: IntegrationsData | null | null): any {\n if (!data) return data\n const { metaPixelData, tiktokPixelData, googleAnalyticsData, googleTagsData } = data\n return {\n metaPixelData: generatePublicIntegrationsDataMetaPixel(metaPixelData),\n tiktokPixelData: generatePublicIntegrationsDataTiktokPixel(tiktokPixelData),\n googleAnalyticsData: generatePublicIntegrationsDataGoogleAnalytics(googleAnalyticsData),\n googleTagsData: generatePublicIntegrationsDataGoogleTag(googleTagsData),\n }\n}\n// function that generate public data from the meta pixel data\nexport function generatePublicIntegrationsDataMetaPixel(\n data: MetaPixelData | null | undefined\n): PublicMetaPixelData | null | undefined {\n if (!data) return data\n const { ids, objective, draftObjective } = data\n return {\n ids: ids,\n objective,\n draftObjective,\n }\n}\n// function that generate public data from the tiktok pixel data\nexport function generatePublicIntegrationsDataTiktokPixel(\n data: TiktokPixelData | null | undefined\n): PublicTiktokPixelData | null | undefined {\n if (!data) return data\n const { ids, objective, draftObjective } = data\n return {\n ids: ids,\n objective,\n draftObjective,\n }\n}\n// function that generate public data from the google analytics data\nexport function generatePublicIntegrationsDataGoogleAnalytics(\n data: GoogleAnalyticsData | null | undefined\n): PublicGoogleAnalyticsData | null | undefined {\n if (!data) return data\n return {}\n}\n// function that generate public data from the google tag data\nexport function generatePublicIntegrationsDataGoogleTag(\n data: GoogleTagData | null | undefined\n): PublicGoogleTagData | null | undefined {\n if (!data) return data\n return {}\n}\n// function that generate public data from the google sheets data\nexport function generatePublicIntegrationsDataGoogleSheets(\n data: GoogleSheetsData | null | undefined\n): PublicGoogleSheetsData | null | undefined {\n if (!data) return data\n return {}\n}\n\nexport interface IntegrationsData {\n metaPixelData?: MetaPixelData | null\n tiktokPixelData?: TiktokPixelData | null\n googleAnalyticsData?: GoogleAnalyticsData | null\n googleTagsData?: GoogleTagData | null\n googleSheetsData?: GoogleSheetsData | null\n}\n\nexport enum MetaPixelEvent {\n none = 'none',\n lead = 'Lead',\n purchase = 'Purchase',\n viewContent = 'ViewContent',\n addToCart = 'AddToCart',\n initiateCheckout = 'InitiateCheckout',\n}\nexport interface MetaPixelData {\n // active meta pixel ids\n ids: string[] | null\n // main objective\n objective: MetaPixelEvent | null\n // draft objective\n draftObjective: MetaPixelEvent | null\n}\n\nexport enum TiktokPixelEvent {\n none = 'none',\n viewContent = 'ViewContent',\n addToWishlist = 'AddToWishlist',\n search = 'Search',\n addPaymentInfo = 'AddPaymentInfo',\n addToCart = 'AddToCart',\n initiateCheckout = 'InitiateCheckout',\n placeAnOrder = 'PlaceAnOrder',\n completeRegistration = 'CompleteRegistration',\n purchase = 'Purchase',\n}\nexport interface TiktokPixelData {\n // active tiktok pixel ids\n ids: string[] | null\n // main objective\n objective: TiktokPixelEvent | null\n // draft objective\n draftObjective: TiktokPixelEvent | null\n}\nexport interface GoogleAnalyticsData {}\nexport interface GoogleTagData {}\nexport interface GoogleSheetsData {\n enabled: boolean\n // use cant use both sheetId and sheetName\n sheetId: string | null\n // if sheetId is null, use sheetName\n // if sheetName not exists in the spreadsheet, create it\n sheetName: string | null\n spreadsheetId: string | null\n // the next row to insert data\n nextRow: number | null\n // columns to insert data\n columns: GoogleSheetsColumn<any>[] | null\n}\n\n// public meta pixel data\nexport interface PublicMetaPixelData {\n ids: string[] | null\n objective: MetaPixelEvent | null\n draftObjective: MetaPixelEvent | null\n}\n// public tiktok pixel data\nexport interface PublicTiktokPixelData {\n ids: string[] | null\n objective: TiktokPixelEvent | null\n draftObjective: TiktokPixelEvent | null\n}\n// public google analytics data\nexport interface PublicGoogleAnalyticsData {}\n// public google tag data\nexport interface PublicGoogleTagData {}\n// public google sheets data\nexport interface PublicGoogleSheetsData {}\n\nexport interface ProductAddon {\n photoUrl?: string\n title: string\n subtitle?: string\n stock?: number\n price?: number\n min?: number\n max?: number\n}\n\nexport enum ProductStatus {\n draft = 'draft',\n published = 'published',\n archived = 'archived',\n deleted = 'deleted',\n}\n\nexport interface ProductDecoration {\n metadata: Record<string, any>\n}\n\nexport interface ProductVariant {\n name: string\n view?: ProductVariantView\n options: ProductVariantOption[]\n required?: boolean\n}\n\nexport enum ProductVariantView {\n list = 'list',\n chips = 'chips',\n dropdown = 'dropdown',\n}\n\nexport interface ProductVariantOption {\n name: string\n sku?: string | null\n price?: number | null\n discount?: number | null\n stock?: number | null\n sold?: number | null\n type?: VariantOptionType\n child?: ProductVariant | null\n mediaIndex?: number | null\n hint?: string | null\n value?: any\n mediaId?: string | null\n hidden?: boolean\n}\n\nexport enum VariantOptionType {\n color = 'color',\n image = 'image',\n text = 'text',\n}\n\nexport enum ProductType {\n physical = 'physical',\n digital = 'digital',\n service = 'service',\n}\n\nexport interface ProductOffer {\n code: string\n title: string\n subtitle?: string\n price?: number\n minQuantity?: number\n maxQuantity?: number\n freeShipping?: boolean\n}\n\n/**\n * Input data for creating a new product\n */\nexport interface ProductCreateInput {\n name: string\n storeId: string\n slug?: string\n photoUrl?: string\n media?: string[]\n shippingMethodId?: string\n shippingPriceId?: string\n categoryId?: string\n category?: EmbaddedCategory\n title?: string\n description?: string\n body?: string\n sku?: string\n price: number\n cost?: number\n discount?: number\n stock?: number\n variant?: ProductVariant\n offers?: ProductOffer[]\n addons?: ProductAddon[]\n metadata?: Record<string, any>\n status?: ProductStatus\n type?: ProductType\n decoration?: ProductDecoration\n integrationsData?: IntegrationsData\n}\n\n/**\n * Input data for updating an existing product\n */\nexport interface ProductUpdateInput {\n name?: string\n slug?: string\n photoUrl?: string\n media?: string[]\n shippingMethodId?: string\n shippingPriceId?: string\n categoryId?: string\n category?: EmbaddedCategory\n title?: string\n description?: string\n body?: string\n sku?: string\n price?: number\n cost?: number\n discount?: number\n stock?: number\n variant?: ProductVariant\n offers?: ProductOffer[]\n addons?: ProductAddon[]\n metadata?: Record<string, any>\n status?: ProductStatus\n type?: ProductType\n decoration?: ProductDecoration\n integrationsData?: IntegrationsData\n}\n\n/**\n * Product report/analytics data\n */\nexport interface ProductReport {\n views: number\n likes: number\n dislikes: number\n sold: number\n revenue: number\n conversionRate: number\n averageOrderValue: number\n topVariants?: Array<{ path: string; sold: number }>\n salesByDate?: Record<string, number>\n}\n","/**\n * Feedback status enum\n */\nexport enum FeedbackStatus {\n open = 'open',\n inProgress = 'in_progress',\n resolved = 'resolved',\n closed = 'closed',\n}\n\n/**\n * Feedback priority enum\n */\nexport enum FeedbackPriority {\n low = 'low',\n medium = 'medium',\n high = 'high',\n critical = 'critical',\n}\n\n/**\n * Feedback comment interface\n */\nexport interface FeedbackComment {\n id: string\n userId: string\n comment: string\n createdAt: any\n}\n\n/**\n * Feedback attachment interface\n */\nexport interface FeedbackAttachment {\n url: string\n name: string\n type: string\n size?: number\n}\n\n/**\n * Feedback entity interface\n */\nexport interface FeedbackEntity {\n id: string\n userId: string\n title: string\n details: string | null\n status: FeedbackStatus\n priority: FeedbackPriority\n tags: string[]\n attachments: FeedbackAttachment[]\n comments: FeedbackComment[]\n appVersion: string | null\n metadata: Record<string, any>\n resolvedAt: any | null\n createdAt: any\n updatedAt: any\n}\n\n/**\n * Input data for creating a new feedback\n */\nexport interface FeedbackCreateInput {\n title: string\n details?: string\n priority?: FeedbackPriority\n tags?: string[]\n attachments?: FeedbackAttachment[]\n appVersion?: string\n metadata?: Record<string, any>\n}\n\n/**\n * Input data for updating an existing feedback\n */\nexport interface FeedbackUpdateInput {\n title?: string\n details?: string\n status?: FeedbackStatus\n priority?: FeedbackPriority\n tags?: string[]\n attachments?: FeedbackAttachment[]\n appVersion?: string\n metadata?: Record<string, any>\n comment?: string\n}\n\n/**\n * Options for listing feedbacks\n */\nexport interface FeedbackListOptions {\n page?: number\n offset?: number\n limit?: number\n status?: FeedbackStatus[]\n priority?: FeedbackPriority[]\n tags?: string[]\n q?: string\n createdAfter?: Date | string\n createdBefore?: Date | string\n updatedAfter?: Date | string\n updatedBefore?: Date | string\n resolvedAfter?: Date | string\n resolvedBefore?: Date | string\n resolved?: boolean\n}\n","export enum EmbaddedContactType {\n phone = 'phone',\n email = 'email',\n facebook = 'facebook',\n twitter = 'twitter',\n instagram = 'instagram',\n linkedin = 'linkedin',\n website = 'website',\n whatsapp = 'whatsapp',\n telegram = 'telegram',\n signal = 'signal',\n viber = 'viber',\n skype = 'skype',\n zoom = 'zoom',\n other = 'other',\n}\n\n// EmbaddedContactType is not enum but can only be: \"phone\" | \"email\" | \"facebook\" | \"twitter\" | \"instagram\" | \"linkedin\" | \"website\" | \"whatsapp\" | \"telegram\" | \"signal\" | \"viber\" | \"skype\" | \"zoom\" | \"other\n\nexport interface EmbaddedContact {\n type: EmbaddedContactType\n value: string\n name?: string\n metadata?: Record<string, any>\n}\n","/**\n * Converts a Dart color (0xffXXXXXX) to a CSS-compatible number (0xXXXXXXFF).\n *\n * @param dartColor - The Dart color represented as a 32-bit integer (0xffXXXXXX).\n * @returns A number representing the color in CSS format (0xXXXXXXFF).\n */\nexport const convertDartColorToCssNumber = (dartColor: number): number => {\n const alpha = (dartColor >> 24) & 0xff // Extract alpha (high 8 bits)\n const rgb = dartColor & 0xffffff // Extract RGB (low 24 bits)\n\n // Return color as 0xXXXXXXFF (CSS format: RGB + alpha)\n return (rgb << 8) | alpha\n}\n\n/**\n * Converts a CSS color (0xXXXXXXFF) to HSL format.\n *\n * @param cssColor - The CSS color represented as a 32-bit integer (0xXXXXXXFF).\n * @returns An object with HSL values {h, s, l}.\n */\nexport const cssColorToHslString = (cssColor: number): string => {\n const r = ((cssColor >> 24) & 0xff) / 255 // Extract red channel\n const g = ((cssColor >> 16) & 0xff) / 255 // Extract green channel\n const b = ((cssColor >> 8) & 0xff) / 255 // Extract blue channel\n\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n let h = 0\n let s = 0\n let l = (max + min) / 2\n\n if (max !== min) {\n const d = max - min\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0)\n break\n case g:\n h = (b - r) / d + 2\n break\n case b:\n h = (r - g) / d + 4\n break\n }\n h /= 6\n }\n\n return `${Math.round(h * 360)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%`\n}\n\n/**\n * Trims and attempts to fix the phone number by:\n * - Removing all non-numeric characters\n * - Ensuring it starts with a '0'\n * @param phone - The input phone number string\n * @returns The cleaned phone number\n */\nexport function tryFixPhoneNumber(phone: string): string {\n phone = phone.trim() // Remove leading/trailing spaces\n // Remove all non-numeric characters\n phone = phone.replace(/\\D/g, '')\n // Ensure the phone number starts with '0'\n if (!phone.startsWith('0')) {\n phone = '0' + phone\n }\n return phone\n}\n\n/**\n * Validates the phone number based on specific rules:\n * - Cannot be empty or just \"0\"\n * - Must start with '05', '06', '07', or '02'\n * - Must be 10 digits for mobile numbers (05, 06, 07)\n * - Must be 9 digits for landline numbers (02)\n * @param phone - The input phone number string\n * @returns Error message if validation fails, otherwise null\n */\nexport function validatePhoneNumber(phone: string): string | null {\n // Helper function to handle length overflow/underflow messages\n const getLengthError = (requiredLength: number, actualLength: number): string => {\n const difference = actualLength - requiredLength\n if (difference > 0) {\n return `عدد الأرقام زائد عن ${requiredLength} رقماً بـ ${difference}`\n } else {\n const missingDigits = -difference\n if (missingDigits === 1) return 'ينقصك رقم واحد'\n if (missingDigits === 2) return 'ينقصك رقمان'\n return `ينقصك ${missingDigits} أرقام`\n }\n }\n\n if (phone === '0') {\n return 'اكمل رقم الهاتف'\n }\n\n // Check if phone number is empty\n if (!phone) {\n return 'رقم الهاتف لا يمكن أن يكون فارغاً.'\n }\n\n // Check if phone number contains only digits\n if (!/^\\d+$/.test(phone)) {\n return 'رقم الهاتف يجب أن يحتوي فقط على أرقام.'\n }\n\n // Ensure the phone starts with valid prefixes\n if (!/^(05|06|07|02)/.test(phone)) {\n return 'يجب أن يبدأ بـ 05, 06, 07, أو 02'\n }\n\n const length = phone.length\n\n // Validate mobile numbers (05, 06, 07 should be 10 digits)\n if (/^(05|06|07)/.test(phone)) {\n if (length !== 10) {\n return getLengthError(10, length)\n }\n }\n\n // Validate landline numbers (02 should be 9 digits)\n else if (phone.startsWith('02')) {\n if (length !== 9) {\n return getLengthError(9, length)\n }\n }\n\n // If all checks pass, return null (no errors)\n return null\n}\n"],"mappings":";AAAA,OAAO,WAA8B;;;ACQ9B,IAAe,kBAAf,MAAwC;AAAA,EAC7C;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAY,UAAkB,QAAuB;AACnD,SAAK,WAAW;AAChB,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,KAAK,SAAuC;AAChD,UAAM,EAAE,IAAI,IAAI,OAAO,IAAI;AAC3B,UAAM,MAAM,MAAM,KAAK,OAAO,IAAI,IAAI,KAAK,QAAQ,IAAI,EAAE,IAAI;AAAA,MAC3D,QAAQ;AAAA,QACN,IAAI,MAAM;AAAA,QACV,GAAG;AAAA,MACL;AAAA,IACF,CAAC;AACD,WAAO,IAAI;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,KAAK,SAAsD;AAC/D,UAAM,EAAE,MAAM,QAAQ,OAAO,OAAO,IAAI,WAAW,CAAC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aAAa;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI,UAAU,KAAK;AACjB,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,QAAQ,KAAK,KAAK,GAAG;AACxB,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,iBAAiB,KAAK,KAAK,GAAG;AACjC,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,MAAM;AAGrB,MAAI,cAAc,KAAK,KAAK,GAAG;AAC7B,QAAI,WAAW,IAAI;AACjB,aAAO,eAAe,IAAI,MAAM;AAAA,IAClC;AAAA,EACF,WAGS,MAAM,WAAW,IAAI,GAAG;AAC/B,QAAI,WAAW,GAAG;AAChB,aAAO,eAAe,GAAG,MAAM;AAAA,IACjC;AAAA,EACF;AAGA,SAAO;AACT;","names":["options","res","DeliveryServiceFilter","OrderStatus","PaymentStatus","DeliveryStatus","ShippingType","ShippingMethodStatus","ShippingMethodPolicy","ShippingPriceStatus","YalidineAgent","StoreMemberRole","StoreActionType","WebhookEvent","StoreSubscriptionStatus","StoreSubscriptionType","MetaPixelEvent","TiktokPixelEvent","ProductStatus","ProductVariantView","VariantOptionType","ProductType","FeedbackStatus","FeedbackPriority","EmbaddedContactType"]}
|
|
1
|
+
{"version":3,"sources":["../src/feeef/feeef.ts","../src/feeef/repositories/repository.ts","../src/feeef/repositories/orders.ts","../src/feeef/repositories/products.ts","../src/feeef/repositories/stores.ts","../src/feeef/repositories/users.ts","../src/feeef/repositories/deposits.ts","../src/feeef/repositories/transfers.ts","../src/feeef/repositories/categories.ts","../src/feeef/repositories/countries.ts","../src/feeef/repositories/states.ts","../src/feeef/repositories/cities.ts","../src/feeef/repositories/currencies.ts","../src/feeef/repositories/shipping_prices.ts","../src/feeef/repositories/shipping_methods.ts","../src/feeef/repositories/feedbacks.ts","../src/core/entities/order.ts","../src/core/entities/shipping_method.ts","../src/core/entities/shipping_price.ts","../src/feeef/services/service.ts","../src/feeef/services/cart.ts","../src/feeef/services/actions.ts","../src/feeef/services/notifications.ts","../src/feeef/services/storage.ts","../src/feeef/services/integrations.ts","../src/core/entities/store.ts","../src/core/entities/product.ts","../src/core/entities/feedback.ts","../src/core/embadded/contact.ts","../src/utils.ts"],"sourcesContent":["import axios, { AxiosInstance } from 'axios'\n// Repositories\nimport { OrderRepository } from './repositories/orders.js'\nimport { ProductRepository } from './repositories/products.js'\nimport { StoreRepository } from './repositories/stores.js'\nimport { UserRepository } from './repositories/users.js'\nimport { DepositRepository } from './repositories/deposits.js'\nimport { TransferRepository } from './repositories/transfers.js'\nimport { CategoryRepository } from './repositories/categories.js'\nimport { CountryRepository } from './repositories/countries.js'\nimport { StateRepository } from './repositories/states.js'\nimport { CityRepository } from './repositories/cities.js'\nimport { CurrencyRepository } from './repositories/currencies.js'\nimport { ShippingPriceRepository } from './repositories/shipping_prices.js'\nimport { ShippingMethodRepository } from './repositories/shipping_methods.js'\nimport { FeedbackRepository } from './repositories/feedbacks.js'\n// Services\nimport { CartService } from './services/cart.js'\nimport { ActionsService } from './services/actions.js'\nimport { NotificationsService } from './services/notifications.js'\nimport { StorageService } from './services/storage.js'\nimport { IntegrationFactory } from './services/integrations.js'\n\n/**\n * Configuration options for the FeeeF module.\n */\nexport interface FeeeFConfig {\n /**\n * The API key to be used for authentication.\n */\n apiKey: string\n\n /**\n * An optional Axios instance to be used for making HTTP requests.\n */\n client?: AxiosInstance\n\n /**\n * Specifies whether caching should be enabled or disabled.\n * If set to a number, it represents the maximum number of seconds to cache the responses.\n * If set to `false`, caching will be disabled (5s).\n * cannot be less than 5 seconds\n */\n cache?: false | number\n\n /**\n * The base URL for the API.\n */\n baseURL?: string\n}\n\n/**\n * Represents the FeeeF class.\n */\nexport class FeeeF {\n /**\n * The API key used for authentication.\n */\n apiKey: string\n\n /**\n * The Axios instance used for making HTTP requests.\n */\n client: AxiosInstance\n\n /**\n * The repository for managing stores.\n */\n stores: StoreRepository\n\n /**\n * The repository for managing products.\n */\n products: ProductRepository\n\n /**\n * The repository for managing users.\n */\n users: UserRepository\n\n /**\n * The repository for managing orders.\n */\n orders: OrderRepository\n\n /**\n * The repository for managing deposits.\n */\n deposits: DepositRepository\n\n /**\n * The repository for managing transfers.\n */\n transfers: TransferRepository\n\n /**\n * The repository for managing categories.\n */\n categories: CategoryRepository\n\n /**\n * The repository for managing countries.\n */\n countries: CountryRepository\n\n /**\n * The repository for managing states.\n */\n states: StateRepository\n\n /**\n * The repository for managing cities.\n */\n cities: CityRepository\n\n /**\n * The repository for managing currencies.\n */\n currencies: CurrencyRepository\n\n /**\n * The repository for managing shipping prices.\n */\n shippingPrices: ShippingPriceRepository\n\n /**\n * The repository for managing shipping methods.\n */\n shippingMethods: ShippingMethodRepository\n\n /**\n * The repository for managing feedbacks.\n */\n feedbacks: FeedbackRepository\n\n /**\n * The cart service for managing the cart.\n */\n cart: CartService\n\n /**\n * The actions service for performing various actions (file uploads, etc.)\n */\n actions: ActionsService\n\n /**\n * The notifications service for sending push notifications\n */\n notifications: NotificationsService\n\n /**\n * The storage service for uploading files\n */\n storage: StorageService\n\n /**\n * The integration factory for creating integration API instances\n */\n integrations: IntegrationFactory\n\n /**\n * Constructs a new instance of the FeeeF class.\n * @param {FeeeFConfig} config - The configuration object.\n * @param {string} config.apiKey - The API key used for authentication.\n * @param {AxiosInstance} config.client - The Axios instance used for making HTTP requests.\n * @param {boolean | number} config.cache - The caching configuration. Set to `false` to disable caching, or provide a number to set the cache TTL in milliseconds.\n */\n constructor({ apiKey, client, cache, baseURL = 'http://localhost:3333/api/v1' }: FeeeFConfig) {\n console.log('feeef super cache', cache)\n this.apiKey = apiKey\n\n this.client = client || axios\n // set the api key\n this.client.defaults.headers.common['Authorization'] = `Bearer ${this.apiKey}`\n // set base url\n this.client.defaults.baseURL = baseURL\n // set accept header\n this.client.defaults.headers.common['Accept'] = 'application/json'\n this.client.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'\n\n // Initialize repositories\n this.stores = new StoreRepository(this.client)\n this.products = new ProductRepository(this.client)\n this.users = new UserRepository(this.client)\n this.orders = new OrderRepository(this.client)\n this.deposits = new DepositRepository(this.client)\n this.transfers = new TransferRepository(this.client)\n this.categories = new CategoryRepository(this.client)\n this.countries = new CountryRepository(this.client)\n this.states = new StateRepository(this.client)\n this.cities = new CityRepository(this.client)\n this.currencies = new CurrencyRepository(this.client)\n this.shippingPrices = new ShippingPriceRepository(this.client)\n this.shippingMethods = new ShippingMethodRepository(this.client)\n this.feedbacks = new FeedbackRepository(this.client)\n\n // Initialize services\n this.cart = new CartService()\n this.actions = new ActionsService(this.client)\n this.notifications = new NotificationsService(this.client)\n this.storage = new StorageService(this.client)\n this.integrations = new IntegrationFactory(this.client)\n }\n\n /**\n * Sets a header for all requests\n * @param {string} key - The header key.\n * @param {string} value - The header value.\n */\n setHeader(key: string, value: string) {\n this.client.defaults.headers.common[key] = value\n }\n\n /**\n * Removes a header from the default headers.\n * @param {string} key - The key of the header to remove.\n */\n removeHeader(key: string) {\n delete this.client.defaults.headers.common[key]\n }\n}\n","import { AxiosInstance } from 'axios'\n\n/**\n * Represents a generic model repository.\n * @template T - The type of the model.\n * @template C - The type of the create options.\n * @template U - The type of the update options.\n */\nexport abstract class ModelRepository<T, C, U> {\n resource: string\n // client\n client: AxiosInstance\n\n /**\n * Constructs a new instance of the ModelRepository class.\n * @param resource - The resource name.\n * @param client - The Axios instance used for making HTTP requests.\n */\n constructor(resource: string, client: AxiosInstance) {\n this.resource = resource\n this.client = client\n }\n\n /**\n * Finds a model by its ID or other criteria.\n * @param options - The options for finding the model.\n * @returns A promise that resolves to the found model.\n */\n async find(options: ModelFindOptions): Promise<T> {\n const { id, by, params } = options\n const res = await this.client.get(`/${this.resource}/${id}`, {\n params: {\n by: by || 'id',\n ...params,\n },\n })\n return res.data\n }\n\n /**\n * Lists models with optional pagination and filtering.\n * @param options - The options for listing the models.\n * @returns A promise that resolves to a list of models.\n */\n async list(options?: ModelListOptions): Promise<ListResponse<T>> {\n const { page, offset, limit, params } = options || {}\n const res = await this.client.get(`/${this.resource}`, {\n params: { page, offset, limit, ...params },\n })\n // if res.data is an array then create ListResponse\n if (Array.isArray(res.data)) {\n return {\n data: res.data,\n }\n } else {\n return {\n data: res.data.data,\n total: res.data.meta.total,\n page: res.data.meta.currentPage,\n limit: res.data.meta.perPage,\n }\n }\n }\n\n /**\n * Creates a new model.\n * Supports two call patterns:\n * 1. `create(data, params?)` - Pass data directly with optional params\n * 2. `create({ data, params })` - Pass options object\n * @param dataOrOptions - The data to create or options object containing data and params\n * @param params - Optional query parameters (only used when data is passed directly)\n * @returns A promise that resolves to the created model.\n */\n async create(dataOrOptions: C | ModelCreateOptions<C>, params?: Record<string, any>): Promise<T> {\n // If dataOrOptions is already wrapped in ModelCreateOptions, use it directly\n if (dataOrOptions && typeof dataOrOptions === 'object' && 'data' in dataOrOptions) {\n const options = dataOrOptions as ModelCreateOptions<C>\n const { data, params: optionsParams } = options\n const requestParams = optionsParams || params\n const res = await this.client.post(`/${this.resource}`, data, {\n params: requestParams,\n })\n return res.data\n }\n // Otherwise, wrap the data in ModelCreateOptions\n const options: ModelCreateOptions<C> = {\n data: dataOrOptions as C,\n }\n if (params) {\n options.params = params\n }\n const res = await this.client.post(`/${this.resource}`, options.data, {\n params: options.params,\n })\n return res.data\n }\n\n /**\n * Updates an existing model.\n * @param options - The options for updating the model.\n * @returns A promise that resolves to the updated model.\n */\n async update(options: ModelUpdateOptions<U>): Promise<T> {\n const { id, data, params } = options\n const res = await this.client.put(`/${this.resource}/${id}`, data, {\n params,\n })\n return res.data\n }\n\n /**\n * Deletes a model by its ID or other criteria.\n * @param options - The options for deleting the model.\n * @returns A promise that resolves when the model is deleted.\n */\n async delete(options: ModelFindOptions): Promise<void> {\n const { id, by, params } = options\n await this.client.delete(`/${this.resource}/${id}`, {\n params: {\n by: by || 'id',\n ...params,\n },\n })\n }\n}\n\n/**\n * Represents a list response containing an array of data of type T.\n */\nexport interface ListResponse<T> {\n data: T[]\n total?: number\n page?: number\n limit?: number\n}\n\n/**\n * Represents the options for making a request.\n */\ninterface RequestOptions {\n params?: Record<string, any>\n}\n\nexport interface ModelFindOptions extends RequestOptions {\n /**\n * The ID of the model to find or the value to find by.\n */\n id: string\n /**\n * The field to find by.\n * @default \"id\" - The ID field.\n */\n by?: string\n}\n\n/**\n * Options for listing models.\n */\nexport interface ModelListOptions extends RequestOptions {\n /**\n * The page number to retrieve.\n */\n page?: number\n\n /**\n * The offset from the beginning of the list.\n */\n offset?: number\n\n /**\n * The maximum number of models to retrieve per page.\n */\n limit?: number\n}\n\n/**\n * Represents the options for creating a model.\n * @template T - The type of data being created.\n */\nexport interface ModelCreateOptions<T> extends RequestOptions {\n data: T\n}\n\n/**\n * Represents the options for updating a model.\n * @template T - The type of the data being updated.\n */\nexport interface ModelUpdateOptions<T> extends RequestOptions {\n /**\n * The ID of the model to update.\n */\n id: string\n /**\n * The data to update the model with.\n */\n data: T\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n OrderEntity,\n OrderTrackEntity,\n OrderStatus,\n DeliveryStatus,\n PaymentStatus,\n ShippingType,\n OrderCreateInput,\n OrderUpdateInput,\n OrderPricing,\n CalculateOrderPricingOptions,\n} from '../../core/entities/order.js'\n\n/**\n * Represents the options for tracking an order.\n */\nexport interface OrderModelTrackOptions {\n id: string\n params?: Record<string, any>\n}\n\n/**\n * Schema for sending an order from an anonymous user\n */\nexport interface SendOrderSchema {\n id?: string\n customerName?: string\n customerNote?: string\n customerPhone: string\n customerEmail?: string\n source?: string\n shippingAddress?: string\n shippingCity?: string\n shippingState?: string\n shippingCountry?: string\n shippingType: ShippingType\n shippingMethodId?: string\n shippingNote?: string\n paymentMethodId?: string\n items: GuestOrderItemSchema[]\n coupon?: string\n status: 'pending' | 'draft'\n storeId: string\n customFields?: Record<string, any>\n metadata?: any\n}\n\n/**\n * Schema for guest order items\n */\nexport interface GuestOrderItemSchema {\n productId: string\n offerCode?: string\n variantPath?: string\n quantity: number\n addons?: Record<string, number>\n}\n\n/**\n * Schema for assigning a single order to a member\n */\nexport interface AssignOrderSchema {\n orderId: string\n memberId: string\n storeId: string\n}\n\n/**\n * Schema for assigning multiple orders to a member\n */\nexport interface AssignManyOrdersSchema {\n orderIds: string[]\n memberId: string\n storeId: string\n}\n\n/**\n * Delivery service filter enum\n */\nexport enum DeliveryServiceFilter {\n yalidine = 'yalidine',\n ecotrack = 'ecotrack',\n procolis = 'procolis',\n noest = 'noest',\n zimou = 'zimou',\n maystro = 'maystro',\n ecomanager = 'ecomanager',\n}\n\n/**\n * Options for listing orders\n */\nexport interface OrderListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n status?: OrderStatus | OrderStatus[]\n deliveryStatus?: DeliveryStatus\n paymentStatus?: PaymentStatus\n customStatus?: string | string[]\n source?: string | string[]\n tags?: string[]\n createdBefore?: Date | string\n createdAfter?: Date | string\n q?: string\n confirmer?: string\n products?: string[]\n shippingState?: string\n shippingCity?: string\n deliveryService?: DeliveryServiceFilter\n params?: Record<string, any>\n}\n\n/**\n * Represents a repository for managing orders.\n */\nexport class OrderRepository extends ModelRepository<\n OrderEntity,\n OrderCreateInput,\n OrderUpdateInput\n> {\n /**\n * Constructs a new OrderRepository instance.\n * @param client - The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('orders', client)\n }\n\n /**\n * Lists orders with optional filtering.\n * @param options - The options for listing orders.\n * @returns A Promise that resolves to a list of Order entities.\n */\n async list(options?: OrderListOptions): Promise<ListResponse<OrderEntity>> {\n const params: Record<string, any> = { ...options?.params }\n\n if (options) {\n if (options.page) params.page = options.page\n if (options.offset) params.offset = options.offset\n if (options.limit) params.limit = options.limit\n if (options.storeId) params.store_id = options.storeId\n if (options.status) {\n params.status = Array.isArray(options.status) ? options.status : [options.status]\n }\n if (options.deliveryStatus) params.deliveryStatus = options.deliveryStatus\n if (options.paymentStatus) params.paymentStatus = options.paymentStatus\n if (options.customStatus) params.customStatus = options.customStatus\n if (options.source) params.source = options.source\n if (options.tags) params.tags = options.tags\n if (options.createdBefore) {\n params.created_before =\n options.createdBefore instanceof Date\n ? options.createdBefore.toISOString()\n : options.createdBefore\n }\n if (options.createdAfter) {\n params.created_after =\n options.createdAfter instanceof Date\n ? options.createdAfter.toISOString()\n : options.createdAfter\n }\n if (options.q) params.q = options.q\n if (options.confirmer) params.confirmer = options.confirmer\n if (options.products) params.products = options.products\n if (options.shippingState) params.shippingState = options.shippingState\n if (options.shippingCity) params.shippingCity = options.shippingCity\n if (options.deliveryService) params.deliveryService = options.deliveryService\n }\n\n return super.list({ params })\n }\n\n /**\n * Sends an order from an anonymous user.\n * @param data - The data representing the order to be sent.\n * @returns A Promise that resolves to the sent OrderEntity.\n */\n async send(data: SendOrderSchema): Promise<OrderEntity> {\n const res = await this.client.post(`/${this.resource}/send`, data)\n return res.data\n }\n\n /**\n * Tracks the order by the order ID.\n * Returns the order status and history.\n * @param options - The options for tracking the order.\n * @returns A promise that resolves to the order track entity.\n */\n async track(options: OrderModelTrackOptions): Promise<OrderTrackEntity> {\n const { id, params } = options\n const res = await this.client.get(`/${this.resource}/${id}/track`, {\n params,\n })\n return res.data\n }\n\n /**\n * Calculates order pricing based on items, shipping details, etc.\n * @param options - The calculation options.\n * @returns A Promise that resolves to the calculated pricing.\n */\n async calculate(options: CalculateOrderPricingOptions): Promise<OrderPricing> {\n const res = await this.client.post(`/${this.resource}/calculate`, {\n storeId: options.storeId,\n items: options.items.map((item) => ({\n productId: item.productId,\n quantity: item.quantity,\n variantPath: item.variantPath,\n offerCode: item.offerCode,\n addons: item.addons,\n price: item.price,\n discount: item.discount,\n })),\n shippingState: options.shippingState,\n shippingCountry: options.shippingCountry,\n shippingType: options.shippingType,\n shippingAddress: options.shippingAddress,\n })\n\n return {\n subtotal: res.data.pricing.subtotal,\n shippingPrice: res.data.pricing.shippingPrice,\n calculatedTotal: res.data.pricing.calculatedTotal,\n }\n }\n\n /**\n * Assigns a single order to a member (as confirmer).\n * @param data - The data containing orderId, memberId, and storeId.\n * @returns A Promise that resolves to the updated OrderEntity.\n */\n async assign(data: AssignOrderSchema): Promise<OrderEntity> {\n const res = await this.client.post(`/${this.resource}/assign`, data)\n return res.data\n }\n\n /**\n * Assigns multiple orders to a member (as confirmer).\n * @param data - The data containing orderIds, memberId, and storeId.\n * @returns A Promise that resolves to a success message.\n */\n async assignMany(data: AssignManyOrdersSchema): Promise<{ message: string }> {\n const res = await this.client.post(`/${this.resource}/assignMany`, data)\n return res.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n ProductEntity,\n ProductCreateInput,\n ProductUpdateInput,\n ProductReport,\n ProductStatus,\n} from '../../core/entities/product.js'\n\n/**\n * Options for listing products\n */\nexport interface ProductListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n categoryId?: string\n status?: ProductStatus | ProductStatus[]\n q?: string\n minPrice?: number\n maxPrice?: number\n inStock?: boolean\n sortBy?: 'price' | 'createdAt' | 'sold' | 'views'\n sortOrder?: 'asc' | 'desc'\n params?: Record<string, any>\n}\n\n/**\n * Represents a repository for managing products.\n */\nexport class ProductRepository extends ModelRepository<\n ProductEntity,\n ProductCreateInput,\n ProductUpdateInput\n> {\n /**\n * Creates a new instance of the ProductRepository class.\n * @param client - The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('products', client)\n }\n\n /**\n * Lists products with optional filtering.\n * @param options - The options for listing products.\n * @returns A Promise that resolves to a list of Product entities.\n */\n async list(options?: ProductListOptions): Promise<ListResponse<ProductEntity>> {\n const {\n storeId,\n categoryId,\n status,\n q,\n minPrice,\n maxPrice,\n inStock,\n sortBy,\n sortOrder,\n ...listOptions\n } = options || {}\n\n const params: Record<string, any> = {\n ...listOptions.params,\n }\n\n if (storeId) params.store_id = storeId\n if (categoryId) params.category_id = categoryId\n if (status) params.status = Array.isArray(status) ? status : [status]\n if (q) params.q = q\n if (minPrice !== undefined) params.min_price = minPrice\n if (maxPrice !== undefined) params.max_price = maxPrice\n if (inStock !== undefined) params.in_stock = inStock\n if (sortBy) params.sort_by = sortBy\n if (sortOrder) params.sort_order = sortOrder\n\n return super.list({\n ...listOptions,\n params,\n })\n }\n\n /**\n * Retrieves random products from the repository.\n * @param limit - The number of random products to retrieve. Default is 12.\n * @returns A promise that resolves to an array of random ProductEntity objects.\n */\n async random(limit = 12): Promise<ProductEntity[]> {\n const response = await this.client.get<ProductEntity[]>(`/products/random`, {\n params: { limit },\n })\n return response.data\n }\n\n /**\n * Gets the sells chart for a product (last 7 days).\n * @param productId - The product ID.\n * @param storeId - The store ID.\n * @returns A Promise that resolves to a map of date to number of sells.\n */\n async sells(productId: string, storeId: string): Promise<Map<Date, number>> {\n const res = await this.client.get(`/stores/${storeId}/${this.resource}/${productId}/sells`)\n const sellsData = new Map<Date, number>()\n\n if (res.data) {\n for (const [key, value] of Object.entries(res.data)) {\n sellsData.set(new Date(key), Number(value) || 0)\n }\n }\n\n return sellsData\n }\n\n /**\n * Gets the analytics/report for a product.\n * @param productId - The product ID.\n * @param storeId - The store ID.\n * @returns A Promise that resolves to the product report.\n */\n async report(productId: string, storeId: string): Promise<ProductReport> {\n const res = await this.client.get(`/stores/${storeId}/${this.resource}/${productId}/report`)\n return res.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n StoreEntity,\n StoreSummary,\n StoreMember,\n StoreSubscriptionType,\n AddStoreMemberInput,\n UpdateStoreMemberInput,\n StoreCreateInput,\n StoreUpdateInput,\n} from '../../core/entities/store.js'\n\n/**\n * Options for listing stores\n */\nexport interface StoreListOptions {\n page?: number\n offset?: number\n limit?: number\n userId?: string\n params?: Record<string, any>\n}\n\n/**\n * Options for getting store summary\n */\nexport interface StoreSummaryOptions {\n id: string\n from?: Date | string\n to?: Date | string\n}\n\n/**\n * Result from paying store due\n */\nexport interface PayDueResult {\n success: boolean\n paidAmount: number\n remainingDue: number\n cost: number\n}\n\n/**\n * Repository for managing Store entities.\n */\nexport class StoreRepository extends ModelRepository<\n StoreEntity,\n StoreCreateInput,\n StoreUpdateInput\n> {\n /**\n * Constructs a new StoreRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('stores', client)\n }\n\n /**\n * Lists stores with optional filtering.\n * @param options - The options for listing stores.\n * @returns A Promise that resolves to a list of Store entities.\n */\n async list(options?: StoreListOptions): Promise<ListResponse<StoreEntity>> {\n const { userId, ...listOptions } = options || {}\n return super.list({\n ...listOptions,\n params: {\n ...listOptions.params,\n ...(userId && { user_id: userId }),\n },\n })\n }\n\n /**\n * Gets the summary for a store.\n * @param options - The summary options including store ID and date range.\n * @returns A Promise that resolves to the store summary.\n */\n async summary(options: StoreSummaryOptions): Promise<StoreSummary> {\n const { id, from, to } = options\n const params: Record<string, string> = {}\n if (from) params.from = from instanceof Date ? from.toISOString() : from\n if (to) params.to = to instanceof Date ? to.toISOString() : to\n\n const res = await this.client.get(`/${this.resource}/${id}/summary`, { params })\n return res.data\n }\n\n /**\n * Gets the orders chart data for a store.\n * @param id - The store ID.\n * @returns A Promise that resolves to a map of date to order count.\n */\n async chart(id: string): Promise<Map<Date, number>> {\n const res = await this.client.get(`/${this.resource}/${id}/chart`)\n const chartData = new Map<Date, number>()\n\n if (res.data.orders) {\n for (const [key, value] of Object.entries(res.data.orders)) {\n chartData.set(new Date(key), Number(value))\n }\n }\n\n return chartData\n }\n\n /**\n * Adds a member to the store.\n * @param storeId - The store ID.\n * @param data - The member data.\n * @returns A Promise that resolves to the added member.\n */\n async addMember(storeId: string, data: AddStoreMemberInput): Promise<StoreMember> {\n const res = await this.client.post(`/${this.resource}/${storeId}/members`, {\n email: data.email,\n role: data.role,\n name: data.name,\n metadata: data.metadata,\n })\n return res.data\n }\n\n /**\n * Edits a store member.\n * @param storeId - The store ID.\n * @param memberId - The member ID.\n * @param data - The update data.\n * @returns A Promise that resolves to the updated member.\n */\n async editMember(\n storeId: string,\n memberId: string,\n data: UpdateStoreMemberInput\n ): Promise<StoreMember> {\n const res = await this.client.put(`/${this.resource}/${storeId}/members/${memberId}`, {\n role: data.role,\n name: data.name,\n metadata: data.metadata,\n })\n return res.data\n }\n\n /**\n * Removes a member from the store.\n * @param storeId - The store ID.\n * @param memberId - The member ID.\n * @returns A Promise that resolves when the member is removed.\n */\n async removeMember(storeId: string, memberId: string): Promise<void> {\n await this.client.delete(`/${this.resource}/${storeId}/members/${memberId}`)\n }\n\n /**\n * Upgrades or renews a store's subscription plan.\n * @param id - The store ID.\n * @param plan - The plan type to upgrade to.\n * @param months - The number of months (1-12).\n * @returns A Promise that resolves when the upgrade is complete.\n */\n async upgrade(id: string, plan: StoreSubscriptionType, months: number): Promise<void> {\n await this.client.post(`/${this.resource}/${id}/subscription/upgrade`, {\n plan,\n months,\n })\n }\n\n /**\n * Purchases additional points for a store's subscription.\n * @param id - The store ID.\n * @param points - The number of points to purchase.\n * @returns A Promise that resolves when the charge is complete.\n */\n async charge(id: string, points: number): Promise<void> {\n await this.client.post(`/${this.resource}/${id}/subscription/charge`, {\n points,\n })\n }\n\n /**\n * Pays store due amount.\n * @param storeId - The store ID.\n * @param amount - The amount of due to pay (in points).\n * @returns A Promise that resolves to the payment result.\n */\n async payDue(storeId: string, amount: number): Promise<PayDueResult> {\n const res = await this.client.post(`/${this.resource}/${storeId}/subscription/payDue`, {\n amount,\n })\n return res.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository } from './repository.js'\nimport {\n AccessToken,\n AuthToken,\n CreateUserOptions,\n FinishPasskeyAuthenticationOptions,\n FinishPasskeyRegistrationOptions,\n LinkSocialAccountOptions,\n Passkey,\n SigninCredentials,\n SigninWithSocialOptions,\n SignupCredentials,\n TransferMoneyOptions,\n TransferMoneyResponse,\n UpdateUserOptions,\n UserEntity,\n UserUpdate,\n StartPasskeyAuthenticationOptions,\n StartPasskeyRegistrationOptions,\n} from '../../core/entities/user.js'\n\n/**\n * Represents the response returned by the authentication process.\n */\nexport interface AuthResponse {\n token: AuthToken\n user: UserEntity\n}\n\n/**\n * Represents a repository for managing user data and authentication.\n * Extends the ModelRepository class with authentication capabilities.\n */\nexport class UserRepository extends ModelRepository<\n UserEntity,\n CreateUserOptions,\n UpdateUserOptions\n> {\n /**\n * Represents the current authentication response.\n * Set automatically after signin, signup, or signinWithToken.\n */\n private _auth: AuthResponse | null = null\n\n /**\n * Gets the current authentication response.\n */\n get auth(): AuthResponse | null {\n return this._auth\n }\n\n /**\n * Sets the authentication response and updates the Authorization header.\n */\n private set auth(value: AuthResponse | null) {\n this._auth = value\n if (value?.token?.token) {\n this.client.defaults.headers.common['Authorization'] = `Bearer ${value.token.token}`\n } else {\n delete this.client.defaults.headers.common['Authorization']\n }\n }\n\n /**\n * Constructs a new UserRepository instance.\n * @param client - The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('users', client)\n }\n\n /**\n * Signs in a user with the provided credentials.\n * @param credentials - The user credentials (email, password, optional fcmToken).\n * @returns A promise that resolves to the authentication response.\n */\n async signin(credentials: SigninCredentials): Promise<AuthResponse> {\n const res = await this.client.post(`/${this.resource}/auth/signin`, credentials)\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Signs up a new user with the provided credentials.\n * @param credentials - The user signup credentials.\n * @returns A promise that resolves to the authentication response.\n */\n async signup(credentials: SignupCredentials): Promise<AuthResponse> {\n const res = await this.client.post(`/${this.resource}/auth/signup`, credentials)\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Signs in a user with an existing token.\n * Useful for restoring authentication state from localStorage.\n * @param token - The authentication token.\n * @param fcmToken - Optional FCM token for push notifications.\n * @returns A promise that resolves to the authentication response.\n */\n async signinWithToken(token: string, fcmToken?: string | null): Promise<AuthResponse> {\n // Set the token in headers first\n this.client.defaults.headers.common['Authorization'] = `Bearer ${token}`\n\n // Call the me endpoint to get user data\n const res = await this.client.get(`/${this.resource}/auth`)\n\n // Update FCM token if provided\n if (fcmToken) {\n try {\n await this.client.post(`/${this.resource}/auth/fcm-token`, { fcmToken })\n } catch (e) {\n // Ignore FCM token update errors\n console.warn('Failed to update FCM token:', e)\n }\n }\n\n this.auth = {\n user: res.data.user,\n token: { ...res.data.token, token },\n }\n\n return this.auth!\n }\n\n /**\n * Signs out the currently authenticated user.\n * Deletes the token on the server and clears local auth state.\n * @returns A promise that resolves when the user is signed out.\n */\n async signout(): Promise<void> {\n if (this.auth) {\n try {\n await this.client.post(`/${this.resource}/auth/signout`)\n } catch (e) {\n // Even if the request fails, clear local auth state\n console.warn('Signout request failed:', e)\n }\n }\n this.auth = null\n }\n\n /**\n * Gets the currently authenticated user.\n * @returns A promise that resolves to the authentication response with current user.\n */\n async me(): Promise<AuthResponse> {\n const res = await this.client.get(`/${this.resource}/auth`)\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Updates the authenticated user's profile.\n * @param data - The updated user data.\n * @returns A promise that resolves to the updated user entity.\n */\n async updateMe(data: UserUpdate): Promise<UserEntity> {\n const res = await this.client.put(`/${this.resource}/auth`, data)\n // Update local auth state if user was updated\n if (this.auth) {\n this.auth = {\n ...this.auth,\n user: res.data,\n }\n }\n return res.data\n }\n\n /**\n * Sends a password reset email to the user.\n * @param email - The user's email address.\n * @returns A promise that resolves when the email is sent.\n */\n async sendResetPasswordEmail(email: string): Promise<void> {\n await this.client.post(`/${this.resource}/auth/reset-password`, null, {\n params: { email },\n })\n }\n\n /**\n * Resets the password using a token from the reset email.\n * @param uid - The user ID.\n * @param token - The reset token from the email.\n * @returns A promise that resolves when the password is reset.\n */\n async resetPasswordWithToken(uid: string, token: string): Promise<void> {\n await this.client.get(`/${this.resource}/auth/reset-password`, {\n params: { uid, token },\n })\n }\n\n /**\n * Gets all access tokens for the authenticated user.\n * @returns A promise that resolves to an array of access tokens.\n */\n async tokens(): Promise<AccessToken[]> {\n const res = await this.client.get(`/${this.resource}/auth/tokens`)\n return res.data\n }\n\n /**\n * Signs in with Google OAuth.\n * @param options - The OAuth code and optional FCM token.\n * @returns A promise that resolves to the authentication response.\n */\n async signinWithGoogle(options: SigninWithSocialOptions): Promise<AuthResponse> {\n const res = await this.client.post('/social/google/callback', {\n code: options.code,\n fcmToken: options.fcmToken,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Signs in with GitHub OAuth.\n * @param options - The OAuth code and optional FCM token.\n * @returns A promise that resolves to the authentication response.\n */\n async signinWithGitHub(options: SigninWithSocialOptions): Promise<AuthResponse> {\n const res = await this.client.post('/social/github/callback', {\n code: options.code,\n fcmToken: options.fcmToken,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Signs in with Apple OAuth.\n * @param options - The OAuth code and optional FCM token.\n * @returns A promise that resolves to the authentication response.\n */\n async signinWithApple(options: SigninWithSocialOptions): Promise<AuthResponse> {\n const res = await this.client.post('/social/apple/callback', {\n code: options.code,\n fcmToken: options.fcmToken,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Links a social account to the current user.\n * @param options - The provider and OAuth code.\n * @returns A promise that resolves to the updated user entity.\n */\n async linkSocialAccount(options: LinkSocialAccountOptions): Promise<UserEntity> {\n const res = await this.client.post(`/social/${options.provider}/link/callback`, {\n code: options.code,\n })\n // Update local auth state if it's the current user\n if (this.auth && this.auth.user.id === res.data.user.id) {\n this.auth = {\n ...this.auth,\n user: res.data.user,\n }\n }\n return res.data.user\n }\n\n /**\n * Unlinks a social account from the current user.\n * @param provider - The social provider to unlink.\n * @returns A promise that resolves to the updated user entity.\n */\n async unlinkSocialAccount(provider: 'google' | 'github' | 'apple'): Promise<UserEntity> {\n const res = await this.client.post('/social/unlink', { provider })\n // Update local auth state if it's the current user\n if (this.auth && this.auth.user.id === res.data.user.id) {\n this.auth = {\n ...this.auth,\n user: res.data.user,\n }\n }\n return res.data.user\n }\n\n /**\n * Transfers money from the authenticated user to another user.\n * @param options - Transfer options including recipient and amount.\n * @returns A promise that resolves to the transfer response with updated users.\n */\n async transferMoney(options: TransferMoneyOptions): Promise<TransferMoneyResponse> {\n const res = await this.client.post(`/${this.resource}/auth/transfer`, options)\n // Update local auth state if sender is the current user\n if (this.auth && this.auth.user.id === res.data.sender.id) {\n this.auth = {\n ...this.auth,\n user: res.data.sender,\n }\n }\n return res.data\n }\n\n /**\n * Starts passkey registration.\n * @param options - Optional device name for the passkey.\n * @returns A promise that resolves to the registration challenge data.\n */\n async startPasskeyRegistration(\n options?: StartPasskeyRegistrationOptions\n ): Promise<Record<string, any>> {\n const res = await this.client.post('/passkeys/register/start', {\n deviceName: options?.deviceName,\n })\n return res.data\n }\n\n /**\n * Finishes passkey registration.\n * @param options - The registration response from the authenticator.\n * @returns A promise that resolves to the authentication response.\n */\n async finishPasskeyRegistration(\n options: FinishPasskeyRegistrationOptions\n ): Promise<AuthResponse> {\n const res = await this.client.post('/passkeys/register/finish', {\n response: options.registrationResponse,\n deviceName: options.deviceName,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Starts passkey authentication.\n * @param options - Optional email to identify the user.\n * @returns A promise that resolves to the authentication challenge data.\n */\n async startPasskeyAuthentication(\n options?: StartPasskeyAuthenticationOptions\n ): Promise<Record<string, any>> {\n const res = await this.client.post('/passkeys/authenticate/start', {\n email: options?.email,\n })\n return res.data\n }\n\n /**\n * Finishes passkey authentication.\n * @param options - The authentication response from the authenticator.\n * @returns A promise that resolves to the authentication response.\n */\n async finishPasskeyAuthentication(\n options: FinishPasskeyAuthenticationOptions\n ): Promise<AuthResponse> {\n const res = await this.client.post('/passkeys/authenticate/finish', {\n response: options.authenticationResponse,\n })\n this.auth = res.data\n return this.auth!\n }\n\n /**\n * Lists all passkeys for the authenticated user.\n * @returns A promise that resolves to an array of passkeys.\n */\n async listPasskeys(): Promise<Passkey[]> {\n const res = await this.client.get('/passkeys')\n return res.data.passkeys || []\n }\n\n /**\n * Deletes a passkey.\n * @param passkeyId - The ID of the passkey to delete.\n * @returns A promise that resolves when the passkey is deleted.\n */\n async deletePasskey(passkeyId: string): Promise<void> {\n await this.client.delete(`/passkeys/${passkeyId}`)\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\n\n/**\n * Deposit status enum\n */\nexport type DepositStatus = 'pending' | 'completed' | 'failed' | 'cancelled'\n\n/**\n * Represents a deposit entity for wallet transactions\n */\nexport interface DepositEntity {\n id: string\n externalId?: string | null\n userId: string\n amount: number\n currency: string\n paymentMethod?: string | null\n attachment?: string | null\n status: DepositStatus\n note?: string | null\n metadata: Record<string, any>\n history: Array<{\n status: string\n timestamp: string\n note?: string\n }>\n createdAt: any\n updatedAt: any\n}\n\n/**\n * Input data for creating a new deposit\n */\nexport interface DepositCreateInput {\n id?: string\n externalId?: string\n userId?: string\n amount: number\n currency?: string\n paymentMethod?: string\n attachment?: string\n status?: DepositStatus\n note?: string\n metadata?: Record<string, any>\n}\n\n/**\n * Input data for updating an existing deposit\n */\nexport interface DepositUpdateInput {\n externalId?: string\n amount?: number\n currency?: string\n paymentMethod?: string\n attachment?: string\n status?: DepositStatus\n note?: string\n metadata?: Record<string, any>\n}\n\n/**\n * Options for listing deposits\n */\nexport interface DepositListOptions {\n page?: number\n offset?: number\n limit?: number\n userId?: string\n status?: DepositStatus | DepositStatus[]\n paymentMethod?: string\n createdAfter?: Date | string\n createdBefore?: Date | string\n minAmount?: number\n maxAmount?: number\n q?: string\n params?: Record<string, any>\n}\n\n/**\n * PayPal order creation response\n */\nexport interface PayPalOrderResponse {\n id: string\n status: string\n approvalUrl?: string\n links: Array<{\n href: string\n rel: string\n method: string\n }>\n}\n\n/**\n * PayPal order capture response\n */\nexport interface PayPalCaptureResponse {\n id: string\n status: string\n captureId?: string\n amount?: number\n currency?: string\n}\n\n/**\n * Repository for managing deposit data and PayPal integration\n */\nexport class DepositRepository extends ModelRepository<\n DepositEntity,\n DepositCreateInput,\n DepositUpdateInput\n> {\n /**\n * Constructs a new DepositRepository instance\n * @param client - The AxiosInstance used for making HTTP requests\n */\n constructor(client: AxiosInstance) {\n super('deposits', client)\n }\n\n /**\n * Lists deposits with optional filtering.\n * @param options - The options for listing deposits.\n * @returns A Promise that resolves to a list of Deposit entities.\n */\n async list(options?: DepositListOptions): Promise<ListResponse<DepositEntity>> {\n const params: Record<string, any> = { ...options?.params }\n\n if (options) {\n if (options.page) params.page = options.page\n if (options.offset) params.offset = options.offset\n if (options.limit) params.limit = options.limit\n if (options.userId) params.user_id = options.userId\n if (options.status) {\n params.status = Array.isArray(options.status) ? options.status : [options.status]\n }\n if (options.paymentMethod) params.payment_method = options.paymentMethod\n if (options.createdAfter) {\n params.created_after =\n options.createdAfter instanceof Date\n ? options.createdAfter.toISOString()\n : options.createdAfter\n }\n if (options.createdBefore) {\n params.created_before =\n options.createdBefore instanceof Date\n ? options.createdBefore.toISOString()\n : options.createdBefore\n }\n if (options.minAmount !== undefined) params.min_amount = options.minAmount\n if (options.maxAmount !== undefined) params.max_amount = options.maxAmount\n if (options.q) params.q = options.q\n }\n\n return super.list({ params })\n }\n\n /**\n * Create a new deposit request (for anonymous/guest users)\n * @param data - The deposit data\n * @returns Promise that resolves to the created deposit\n */\n async send(data: DepositCreateInput): Promise<DepositEntity> {\n const res = await this.client.post(`/${this.resource}/send`, data)\n return res.data\n }\n\n /**\n * Create a PayPal order for deposit\n * @param params - PayPal order parameters\n * @returns Promise that resolves to PayPal order details\n */\n async createPayPalOrder(params: {\n amount: number\n currency?: string\n depositId?: string\n returnUrl: string\n cancelUrl: string\n }): Promise<PayPalOrderResponse> {\n const orderData = {\n amount: params.amount,\n currency: params.currency || 'USD',\n depositId: params.depositId,\n returnUrl: params.returnUrl,\n cancelUrl: params.cancelUrl,\n }\n\n const res = await this.client.post(`/${this.resource}/paypal/create-order`, orderData)\n\n // Extract approval URL from links\n const approvalLink = res.data.links?.find((link: any) => link.rel === 'approve')\n\n return {\n id: res.data.id,\n status: res.data.status,\n approvalUrl: approvalLink?.href,\n links: res.data.links || [],\n }\n }\n\n /**\n * Capture a PayPal order after user approval\n * @param orderId - PayPal order ID\n * @returns Promise that resolves to capture details\n */\n async capturePayPalOrder(orderId: string): Promise<PayPalCaptureResponse> {\n const res = await this.client.post(`/${this.resource}/paypal/capture-order`, {\n orderId,\n })\n return res.data\n }\n\n /**\n * Get PayPal order status\n * @param orderId - PayPal order ID\n * @returns Promise that resolves to order details\n */\n async getPayPalOrderStatus(orderId: string): Promise<{\n id: string\n status: string\n amount?: number\n currency?: string\n }> {\n const res = await this.client.get(`/${this.resource}/paypal/order/${orderId}`)\n return res.data\n }\n\n /**\n * Accept a pending deposit (admin only)\n * @param depositId - The deposit ID to accept\n * @param note - Optional note for the status change\n * @returns Promise that resolves to the updated deposit\n */\n async accept(depositId: string, note?: string): Promise<DepositEntity> {\n return this.update({\n id: depositId,\n data: {\n status: 'completed',\n note,\n },\n })\n }\n\n /**\n * Reject a pending deposit (admin only)\n * @param depositId - The deposit ID to reject\n * @param note - Optional note for the rejection reason\n * @returns Promise that resolves to the updated deposit\n */\n async reject(depositId: string, note?: string): Promise<DepositEntity> {\n return this.update({\n id: depositId,\n data: {\n status: 'failed',\n note,\n },\n })\n }\n\n /**\n * Cancel a pending deposit\n * @param depositId - The deposit ID to cancel\n * @param note - Optional note for the cancellation reason\n * @returns Promise that resolves to the updated deposit\n */\n async cancel(depositId: string, note?: string): Promise<DepositEntity> {\n return this.update({\n id: depositId,\n data: {\n status: 'cancelled',\n note,\n },\n })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\n\n/**\n * Transfer type enum\n */\nexport type TransferType =\n | 'deposit'\n | 'subscription'\n | 'points'\n | 'store_due'\n | 'user_transfer'\n | 'ai_generation'\n | 'refund'\n | 'adjustment'\n\n/**\n * Represents a transfer entity for double-entry accounting transactions\n */\nexport interface TransferEntity {\n id: string\n debitAccountId: string\n creditAccountId: string\n amount: number\n type: TransferType\n referenceId?: string | null\n description?: string | null\n metadata: Record<string, any>\n createdAt: any\n}\n\n/**\n * Input data for creating a new transfer\n */\nexport interface TransferCreateInput {\n debitAccountId: string\n creditAccountId: string\n amount: number\n type: TransferType\n referenceId?: string | null\n description?: string | null\n metadata?: Record<string, any>\n}\n\n/**\n * Input data for updating an existing transfer\n * Note: Transfers are typically immutable, but metadata/description may be updatable\n */\nexport interface TransferUpdateInput {\n description?: string | null\n metadata?: Record<string, any>\n}\n\n/**\n * Options for listing transfers\n */\nexport interface TransferListOptions {\n page?: number\n offset?: number\n limit?: number\n debitAccountId?: string\n creditAccountId?: string\n accountId?: string // Either debit or credit\n type?: TransferType | TransferType[]\n referenceId?: string\n createdAfter?: Date | string\n createdBefore?: Date | string\n minAmount?: number\n maxAmount?: number\n params?: Record<string, any>\n}\n\n/**\n * Repository for managing transfer data\n */\nexport class TransferRepository extends ModelRepository<\n TransferEntity,\n TransferCreateInput,\n TransferUpdateInput\n> {\n /**\n * Constructs a new TransferRepository instance\n * @param client - The AxiosInstance used for making HTTP requests\n */\n constructor(client: AxiosInstance) {\n super('transfers', client)\n }\n\n /**\n * Lists transfers with optional filtering.\n * @param options - The options for listing transfers.\n * @returns A Promise that resolves to a list of Transfer entities.\n */\n async list(options?: TransferListOptions): Promise<ListResponse<TransferEntity>> {\n const params: Record<string, any> = { ...options?.params }\n\n if (options) {\n if (options.page) params.page = options.page\n if (options.offset) params.offset = options.offset\n if (options.limit) params.limit = options.limit\n if (options.debitAccountId) params.debit_account_id = options.debitAccountId\n if (options.creditAccountId) params.credit_account_id = options.creditAccountId\n if (options.accountId) params.account_id = options.accountId\n if (options.type) {\n params.type = Array.isArray(options.type) ? options.type : [options.type]\n }\n if (options.referenceId) params.reference_id = options.referenceId\n if (options.createdAfter) {\n params.created_after =\n options.createdAfter instanceof Date\n ? options.createdAfter.toISOString()\n : options.createdAfter\n }\n if (options.createdBefore) {\n params.created_before =\n options.createdBefore instanceof Date\n ? options.createdBefore.toISOString()\n : options.createdBefore\n }\n if (options.minAmount !== undefined) params.min_amount = options.minAmount\n if (options.maxAmount !== undefined) params.max_amount = options.maxAmount\n }\n\n return super.list({ params })\n }\n\n /**\n * Lists transfers for a specific account (either as debit or credit).\n * @param accountId - The account ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of Transfer entities.\n */\n async listByAccount(\n accountId: string,\n options?: Omit<TransferListOptions, 'accountId'>\n ): Promise<ListResponse<TransferEntity>> {\n return this.list({ ...options, accountId })\n }\n\n /**\n * Lists transfers by type.\n * @param type - The transfer type(s).\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of Transfer entities.\n */\n async listByType(\n type: TransferType | TransferType[],\n options?: Omit<TransferListOptions, 'type'>\n ): Promise<ListResponse<TransferEntity>> {\n return this.list({ ...options, type })\n }\n\n /**\n * Lists transfers by reference ID.\n * @param referenceId - The reference ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of Transfer entities.\n */\n async listByReferenceId(\n referenceId: string,\n options?: Omit<TransferListOptions, 'referenceId'>\n ): Promise<ListResponse<TransferEntity>> {\n return this.list({ ...options, referenceId })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n CategoryEntity,\n CategoryCreateInput,\n CategoryUpdateInput,\n} from '../../core/entities/category.js'\n\n/**\n * Options for listing categories\n */\nexport interface CategoryListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n parentId?: string | null\n q?: string\n params?: Record<string, any>\n}\n\n/**\n * Represents a repository for managing categories.\n */\nexport class CategoryRepository extends ModelRepository<\n CategoryEntity,\n CategoryCreateInput,\n CategoryUpdateInput\n> {\n /**\n * Creates a new instance of the CategoryRepository class.\n * @param client - The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('categories', client)\n }\n\n /**\n * Lists categories with optional filtering.\n * @param options - The options for listing categories.\n * @returns A Promise that resolves to a list of Category entities.\n */\n async list(options?: CategoryListOptions): Promise<ListResponse<CategoryEntity>> {\n const { storeId, parentId, q, ...listOptions } = options || {}\n\n const params: Record<string, any> = {\n ...listOptions.params,\n }\n\n if (storeId) params.store_id = storeId\n if (parentId !== undefined) params.parent_id = parentId\n if (q) params.q = q\n\n return super.list({\n ...listOptions,\n params,\n })\n }\n\n /**\n * Lists categories for a specific store.\n * @param storeId - The store ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of Category entities.\n */\n async listByStore(\n storeId: string,\n options?: Omit<CategoryListOptions, 'storeId'>\n ): Promise<ListResponse<CategoryEntity>> {\n return this.list({ ...options, storeId })\n }\n\n /**\n * Lists root categories (no parent) for a store.\n * @param storeId - The store ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of root Category entities.\n */\n async listRootCategories(\n storeId: string,\n options?: Omit<CategoryListOptions, 'storeId' | 'parentId'>\n ): Promise<ListResponse<CategoryEntity>> {\n return this.list({ ...options, storeId, parentId: null })\n }\n\n /**\n * Lists child categories for a parent category.\n * @param storeId - The store ID.\n * @param parentId - The parent category ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of child Category entities.\n */\n async listChildren(\n storeId: string,\n parentId: string,\n options?: Omit<CategoryListOptions, 'storeId' | 'parentId'>\n ): Promise<ListResponse<CategoryEntity>> {\n return this.list({ ...options, storeId, parentId })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository } from './repository.js'\nimport { CountryEntity } from '../../core/entities/country.js'\n\n/**\n * Repository for managing Country entities.\n */\nexport class CountryRepository extends ModelRepository<CountryEntity, any, any> {\n /**\n * Constructs a new CountryRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('countries', client)\n }\n\n /**\n * Finds a country by its code (ID is the country code).\n * @param code - The country code (ISO 3166-1 alpha-2).\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the found Country entity.\n */\n async findByCode(code: string, params?: Record<string, any>): Promise<CountryEntity> {\n return this.find({ id: code.toUpperCase(), params })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ModelListOptions } from './repository.js'\nimport { StateEntity } from '../../core/entities/state.js'\n\n/**\n * Repository for managing State entities.\n * States have composite keys (countryCode + code) and can be nested under countries.\n */\nexport class StateRepository extends ModelRepository<StateEntity, any, any> {\n /**\n * Constructs a new StateRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('states', client)\n }\n\n /**\n * Lists states, optionally filtered by country code.\n * @param options - The options for listing states, including countryCode filter.\n * @returns A Promise that resolves to a list of State entities.\n */\n async list(options?: ModelListOptions & { countryCode?: string }): Promise<any> {\n const { countryCode, ...listOptions } = options || {}\n const params = {\n ...listOptions.params,\n ...(countryCode && { country_code: countryCode }),\n }\n return super.list({ ...listOptions, params })\n }\n\n /**\n * Lists states for a specific country (nested route).\n * @param countryCode - The country code.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of State entities.\n */\n async listByCountry(countryCode: string, options?: ModelListOptions): Promise<any> {\n const res = await this.client.get(`/countries/${countryCode}/states`, {\n params: {\n page: options?.page,\n offset: options?.offset,\n limit: options?.limit,\n ...options?.params,\n },\n })\n if (Array.isArray(res.data)) {\n return { data: res.data }\n } else {\n return {\n data: res.data.data,\n total: res.data.meta.total,\n page: res.data.meta.currentPage,\n limit: res.data.meta.perPage,\n }\n }\n }\n\n /**\n * Finds a state by country code and state code.\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the found State entity.\n */\n async findByCode(\n countryCode: string,\n stateCode: string,\n params?: Record<string, any>\n ): Promise<StateEntity> {\n const res = await this.client.get(`/countries/${countryCode}/states/${stateCode}`, { params })\n return res.data\n }\n\n /**\n * Creates a new state (nested under country).\n * @param countryCode - The country code.\n * @param data - The state data.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the created State entity.\n */\n async createByCountry(\n countryCode: string,\n data: any,\n params?: Record<string, any>\n ): Promise<StateEntity> {\n const res = await this.client.post(`/countries/${countryCode}/states`, data, { params })\n return res.data\n }\n\n /**\n * Updates a state (nested under country).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param data - The update data.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the updated State entity.\n */\n async updateByCountry(\n countryCode: string,\n stateCode: string,\n data: any,\n params?: Record<string, any>\n ): Promise<StateEntity> {\n const res = await this.client.put(`/countries/${countryCode}/states/${stateCode}`, data, {\n params,\n })\n return res.data\n }\n\n /**\n * Deletes a state (nested under country).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves when the state is deleted.\n */\n async deleteByCountry(\n countryCode: string,\n stateCode: string,\n params?: Record<string, any>\n ): Promise<void> {\n await this.client.delete(`/countries/${countryCode}/states/${stateCode}`, { params })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ModelListOptions } from './repository.js'\nimport { CityEntity } from '../../core/entities/city.js'\n\n/**\n * Repository for managing City entities.\n * Cities have composite keys (countryCode + stateCode + name) and are nested under states.\n */\nexport class CityRepository extends ModelRepository<CityEntity, any, any> {\n /**\n * Constructs a new CityRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('cities', client)\n }\n\n /**\n * Lists cities, optionally filtered by country code and/or state code.\n * @param options - The options for listing cities, including filters.\n * @returns A Promise that resolves to a list of City entities.\n */\n async list(\n options?: ModelListOptions & { countryCode?: string; stateCode?: string }\n ): Promise<any> {\n const { countryCode, stateCode, ...listOptions } = options || {}\n const params = {\n ...listOptions.params,\n ...(countryCode && { country_code: countryCode }),\n ...(stateCode && { state_code: stateCode }),\n }\n return super.list({ ...listOptions, params })\n }\n\n /**\n * Lists cities for a specific country and state (nested route).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of City entities.\n */\n async listByState(\n countryCode: string,\n stateCode: string,\n options?: ModelListOptions\n ): Promise<any> {\n const res = await this.client.get(`/countries/${countryCode}/states/${stateCode}/cities`, {\n params: {\n page: options?.page,\n offset: options?.offset,\n limit: options?.limit,\n ...options?.params,\n },\n })\n if (Array.isArray(res.data)) {\n return { data: res.data }\n } else {\n return {\n data: res.data.data,\n total: res.data.meta.total,\n page: res.data.meta.currentPage,\n limit: res.data.meta.perPage,\n }\n }\n }\n\n /**\n * Finds a city by country code, state code, and city name.\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param cityName - The city name.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the found City entity.\n */\n async findByName(\n countryCode: string,\n stateCode: string,\n cityName: string,\n params?: Record<string, any>\n ): Promise<CityEntity> {\n const res = await this.client.get(\n `/countries/${countryCode}/states/${stateCode}/cities/${cityName}`,\n { params }\n )\n return res.data\n }\n\n /**\n * Creates a new city (nested under country/state).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param data - The city data.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the created City entity.\n */\n async createByState(\n countryCode: string,\n stateCode: string,\n data: any,\n params?: Record<string, any>\n ): Promise<CityEntity> {\n const res = await this.client.post(\n `/countries/${countryCode}/states/${stateCode}/cities`,\n data,\n { params }\n )\n return res.data\n }\n\n /**\n * Updates a city (nested under country/state).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param cityName - The city name.\n * @param data - The update data.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the updated City entity.\n */\n async updateByState(\n countryCode: string,\n stateCode: string,\n cityName: string,\n data: any,\n params?: Record<string, any>\n ): Promise<CityEntity> {\n const res = await this.client.put(\n `/countries/${countryCode}/states/${stateCode}/cities/${cityName}`,\n data,\n { params }\n )\n return res.data\n }\n\n /**\n * Deletes a city (nested under country/state).\n * @param countryCode - The country code.\n * @param stateCode - The state code.\n * @param cityName - The city name.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves when the city is deleted.\n */\n async deleteByState(\n countryCode: string,\n stateCode: string,\n cityName: string,\n params?: Record<string, any>\n ): Promise<void> {\n await this.client.delete(`/countries/${countryCode}/states/${stateCode}/cities/${cityName}`, {\n params,\n })\n }\n\n /**\n * Searches cities by name (autocomplete).\n * @param query - The search query.\n * @param options - Optional filters (countryCode, stateCode).\n * @returns A Promise that resolves to a list of matching City entities.\n */\n async search(\n query: string,\n options?: { countryCode?: string; stateCode?: string }\n ): Promise<CityEntity[]> {\n const params: Record<string, any> = { q: query }\n if (options?.countryCode) params.country_code = options.countryCode\n if (options?.stateCode) params.state_code = options.stateCode\n\n const res = await this.client.get('/cities/search', { params })\n return res.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository } from './repository.js'\nimport { CurrencyEntity } from '../../core/entities/currency.js'\n\n/**\n * Repository for managing Currency entities.\n */\nexport class CurrencyRepository extends ModelRepository<CurrencyEntity, any, any> {\n /**\n * Constructs a new CurrencyRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('currencies', client)\n }\n\n /**\n * Finds a currency by its code (ID is the currency code).\n * @param code - The currency code (ISO 4217, e.g., USD, EUR).\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the found Currency entity.\n */\n async findByCode(code: string, params?: Record<string, any>): Promise<CurrencyEntity> {\n return this.find({ id: code.toUpperCase(), params })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n ShippingPriceEntity,\n ShippingPriceCreateInput,\n ShippingPriceUpdateInput,\n ShippingPriceStatus,\n} from '../../core/entities/shipping_price.js'\n\n/**\n * Options for listing shipping prices\n */\nexport interface ShippingPriceListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n status?: ShippingPriceStatus | ShippingPriceStatus[]\n params?: Record<string, any>\n}\n\n/**\n * Repository for managing ShippingPrice entities.\n *\n * ShippingPrice is the new geo-based shipping system that replaces\n * the legacy array-based ShippingMethod rates.\n */\nexport class ShippingPriceRepository extends ModelRepository<\n ShippingPriceEntity,\n ShippingPriceCreateInput,\n ShippingPriceUpdateInput\n> {\n /**\n * Constructs a new ShippingPriceRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('shipping_prices', client)\n }\n\n /**\n * Lists shipping prices with optional filtering.\n * @param options - The options for listing shipping prices.\n * @returns A Promise that resolves to a list of ShippingPrice entities.\n */\n async list(options?: ShippingPriceListOptions): Promise<ListResponse<ShippingPriceEntity>> {\n const { storeId, status, ...listOptions } = options || {}\n\n const params: Record<string, any> = {\n ...listOptions.params,\n }\n\n if (storeId) params.store_id = storeId\n if (status) params.status = Array.isArray(status) ? status : [status]\n\n return super.list({\n ...listOptions,\n params,\n })\n }\n\n /**\n * Lists shipping prices for a specific store.\n * @param storeId The store ID to search for.\n * @returns A Promise that resolves to the ShippingPrice entities for the store.\n */\n async listByStore(storeId: string): Promise<ShippingPriceEntity[]> {\n const response = await this.list({ storeId })\n return response.data\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n ShippingMethodEntity,\n ShippingMethodCreateInput,\n ShippingMethodUpdateInput,\n ShippingMethodStatus,\n ShippingMethodPolicy,\n} from '../../core/entities/shipping_method.js'\n\n/**\n * Options for listing shipping methods\n */\nexport interface ShippingMethodListOptions {\n page?: number\n offset?: number\n limit?: number\n storeId?: string\n status?: ShippingMethodStatus | ShippingMethodStatus[]\n policy?: ShippingMethodPolicy\n params?: Record<string, any>\n}\n\n/**\n * Repository for managing ShippingMethod entities.\n */\nexport class ShippingMethodRepository extends ModelRepository<\n ShippingMethodEntity,\n ShippingMethodCreateInput,\n ShippingMethodUpdateInput\n> {\n /**\n * Constructs a new ShippingMethodRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('shipping_methods', client)\n }\n\n /**\n * Lists shipping methods with optional filtering.\n * @param options - The options for listing shipping methods.\n * @returns A Promise that resolves to a list of ShippingMethod entities.\n */\n async list(options?: ShippingMethodListOptions): Promise<ListResponse<ShippingMethodEntity>> {\n const { storeId, status, policy, ...listOptions } = options || {}\n\n const params: Record<string, any> = {\n ...listOptions.params,\n }\n\n if (storeId) params.store_id = storeId\n if (status) params.status = Array.isArray(status) ? status : [status]\n if (policy) params.policy = policy\n\n return super.list({\n ...listOptions,\n params,\n })\n }\n\n /**\n * Lists shipping methods for a specific store.\n * @param storeId - The store ID.\n * @param options - Optional list options.\n * @returns A Promise that resolves to a list of ShippingMethod entities.\n */\n async listByStore(\n storeId: string,\n options?: Omit<ShippingMethodListOptions, 'storeId'>\n ): Promise<ListResponse<ShippingMethodEntity>> {\n return this.list({ ...options, storeId })\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { ModelRepository, ListResponse } from './repository.js'\nimport {\n FeedbackEntity,\n FeedbackCreateInput,\n FeedbackUpdateInput,\n FeedbackListOptions,\n} from '../../core/entities/feedback.js'\n\n/**\n * Repository for managing Feedback entities.\n */\nexport class FeedbackRepository extends ModelRepository<\n FeedbackEntity,\n FeedbackCreateInput,\n FeedbackUpdateInput\n> {\n /**\n * Constructs a new FeedbackRepository instance.\n * @param client The AxiosInstance used for making HTTP requests.\n */\n constructor(client: AxiosInstance) {\n super('feedbacks', client)\n }\n\n /**\n * Lists feedbacks with optional filtering.\n * @param options - The options for listing feedbacks.\n * @returns A Promise that resolves to a list of Feedback entities.\n */\n async list(options?: FeedbackListOptions): Promise<ListResponse<FeedbackEntity>> {\n const params: Record<string, any> = {}\n\n if (options) {\n if (options.page) params.page = options.page\n if (options.offset) params.offset = options.offset\n if (options.limit) params.limit = options.limit\n if (options.status) params.status = options.status\n if (options.priority) params.priority = options.priority\n if (options.tags) params.tags = options.tags\n if (options.q) params.q = options.q\n if (options.createdAfter) {\n params.created_after =\n options.createdAfter instanceof Date\n ? options.createdAfter.toISOString()\n : options.createdAfter\n }\n if (options.createdBefore) {\n params.created_before =\n options.createdBefore instanceof Date\n ? options.createdBefore.toISOString()\n : options.createdBefore\n }\n if (options.updatedAfter) {\n params.updated_after =\n options.updatedAfter instanceof Date\n ? options.updatedAfter.toISOString()\n : options.updatedAfter\n }\n if (options.updatedBefore) {\n params.updated_before =\n options.updatedBefore instanceof Date\n ? options.updatedBefore.toISOString()\n : options.updatedBefore\n }\n if (options.resolvedAfter) {\n params.resolved_after =\n options.resolvedAfter instanceof Date\n ? options.resolvedAfter.toISOString()\n : options.resolvedAfter\n }\n if (options.resolvedBefore) {\n params.resolved_before =\n options.resolvedBefore instanceof Date\n ? options.resolvedBefore.toISOString()\n : options.resolvedBefore\n }\n if (options.resolved !== undefined) params.resolved = options.resolved\n }\n\n return super.list({ params })\n }\n\n /**\n * Adds a comment to existing feedback.\n * @param id - The feedback ID.\n * @param comment - The comment to add.\n * @returns A Promise that resolves to the updated Feedback entity.\n */\n async addComment(id: string, comment: string): Promise<FeedbackEntity> {\n const res = await this.client.post(`/${this.resource}/${id}/comments`, { comment })\n return res.data\n }\n\n /**\n * Creates feedback with file attachments.\n * @param data - The feedback data.\n * @param files - Optional array of files to attach.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the created Feedback entity.\n */\n async createWithFiles(\n data: FeedbackCreateInput,\n files?: File[],\n params?: Record<string, any>\n ): Promise<FeedbackEntity> {\n const formData = new FormData()\n\n // Add feedback data\n formData.append('title', data.title)\n if (data.details) formData.append('details', data.details)\n if (data.priority) formData.append('priority', data.priority)\n if (data.appVersion) formData.append('appVersion', data.appVersion)\n if (data.tags) formData.append('tags', JSON.stringify(data.tags))\n if (data.attachments) formData.append('attachments', JSON.stringify(data.attachments))\n if (data.metadata) formData.append('metadata', JSON.stringify(data.metadata))\n\n // Add files\n if (files) {\n for (const file of files) {\n formData.append('files', file)\n }\n }\n\n // Add additional params\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n formData.append(key, String(value))\n }\n }\n\n const res = await this.client.post(`/${this.resource}`, formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n })\n\n return res.data\n }\n\n /**\n * Updates feedback with additional files.\n * @param id - The feedback ID.\n * @param data - The update data.\n * @param files - Optional array of files to attach.\n * @param params - Optional query parameters.\n * @returns A Promise that resolves to the updated Feedback entity.\n */\n async updateWithFiles(\n id: string,\n data: FeedbackUpdateInput,\n files?: File[],\n params?: Record<string, any>\n ): Promise<FeedbackEntity> {\n const formData = new FormData()\n\n // Add update data\n if (data.title) formData.append('title', data.title)\n if (data.details) formData.append('details', data.details)\n if (data.status) formData.append('status', data.status)\n if (data.priority) formData.append('priority', data.priority)\n if (data.appVersion) formData.append('appVersion', data.appVersion)\n if (data.tags) formData.append('tags', JSON.stringify(data.tags))\n if (data.attachments) formData.append('attachments', JSON.stringify(data.attachments))\n if (data.metadata) formData.append('metadata', JSON.stringify(data.metadata))\n if (data.comment) formData.append('comment', data.comment)\n\n // Add files\n if (files) {\n for (const file of files) {\n formData.append('files', file)\n }\n }\n\n // Add additional params\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n formData.append(key, String(value))\n }\n }\n\n const res = await this.client.put(`/${this.resource}/${id}`, formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n })\n\n return res.data\n }\n}\n","export enum OrderStatus {\n draft = 'draft',\n pending = 'pending',\n review = 'review',\n accepted = 'accepted',\n processing = 'processing',\n completed = 'completed',\n cancelled = 'cancelled',\n}\n\n// PaymentStatus\nexport enum PaymentStatus {\n unpaid = 'unpaid',\n paid = 'paid',\n received = 'received',\n}\nexport enum DeliveryStatus {\n pending = 'pending',\n delivering = 'delivering',\n delivered = 'delivered',\n returned = 'returned',\n}\n\nexport enum ShippingType {\n // delivery to customer home\n home = 'home',\n // the customer picks up the order from the local shipping center\n pickup = 'pickup',\n // the customer picks up the order from the store\n store = 'store',\n}\n\nexport interface OrderEntity {\n id: string\n customerName?: string | null\n customerPhone: string\n customerEmail?: string | null\n customerNote?: string | null\n customerIp?: string | null\n shippingAddress?: string | null\n shippingCity?: string | null\n shippingState?: string | null\n shippingCountry?: string | null\n shippingMethodId?: string | null\n shippingType: ShippingType\n trackingCode: string | null\n paymentMethodId?: string | null\n items: OrderItem[]\n subtotal: number\n shippingPrice: number\n total: number\n discount: number\n // @Deprecated\n coupon?: string | null\n couponId?: string | null\n couponCode?: string | null\n couponDiscount?: string | null\n storeId: string\n source: string | null\n confirmerId: string | null\n customFields?: Record<string, any> | null\n metadata: OrderMetadata\n claims?: Record<string, any> | null // System-only, secure data storage (read-only for users)\n status: OrderStatus\n paymentStatus: PaymentStatus\n deliveryStatus: DeliveryStatus\n customStatus?: string | null\n tags: string[] | null\n createdAt: any\n updatedAt: any\n}\nexport interface OrderItem {\n productId: string\n productName: string\n productPhotoUrl?: string | null\n variantPath?: string\n sku?: string | null\n discount?: number | null\n quantity: number\n price: number\n offerCode?: string | null\n offerName?: string | null\n addons?: Record<string, number>\n}\n\n// order track entity\nexport interface OrderTrackEntity {\n id: string\n customerName?: string | null\n items: OrderItem[]\n total: number\n createdAt: any\n storeId: string\n status: OrderStatus\n history: OrderTrackHistory[]\n}\n\n// order track history\nexport interface OrderTrackHistory {\n status: OrderStatus\n deliveryStatus: string\n paymentStatus: string\n createdAt: string\n}\n\n// order metadata history\ninterface OrderMetadataHistory {\n status: OrderStatus\n deliveryStatus: string\n paymentStatus: string\n createdAt: string\n message: string\n code: string\n userId: string\n}\n\n// order metadata\ninterface OrderMetadata {\n note?: string\n history?: OrderMetadataHistory[]\n metaPixel?: any\n customOrderTagHistories?: any[]\n [key: string]: any\n}\n\n// utils\n// order entity to order track entity\nexport const convertOrderEntityToOrderTrackEntity = (order: OrderEntity): OrderTrackEntity => {\n return {\n id: order.id,\n customerName: order.customerName,\n items: order.items,\n total: order.total,\n createdAt: order.createdAt,\n storeId: order.storeId,\n status: order.status,\n history:\n order.metadata.history?.map((history) => ({\n status: history.status,\n deliveryStatus: history.deliveryStatus,\n paymentStatus: history.paymentStatus,\n createdAt: history.createdAt,\n })) || [],\n }\n}\n\n/**\n * Input for creating a new order (admin/merchant)\n */\nexport interface OrderCreateInput {\n id?: string\n customerName?: string\n customerPhone: string\n customerEmail?: string\n customerNote?: string\n shippingAddress?: string\n shippingCity?: string\n shippingState?: string\n shippingCountry?: string\n shippingType: ShippingType\n shippingMethodId?: string\n paymentMethodId?: string\n items: OrderItemInput[]\n coupon?: string\n couponId?: string\n source?: string\n status?: OrderStatus\n paymentStatus?: PaymentStatus\n deliveryStatus?: DeliveryStatus\n customStatus?: string\n customFields?: Record<string, any>\n metadata?: Record<string, any>\n storeId: string\n tags?: string[]\n}\n\n/**\n * Input for order items when creating/updating an order\n */\nexport interface OrderItemInput {\n productId: string\n quantity: number\n variantPath?: string\n offerCode?: string\n addons?: Record<string, number>\n price?: number\n discount?: number\n}\n\n/**\n * Input data for updating an existing order\n */\nexport interface OrderUpdateInput {\n customerName?: string\n customerPhone?: string\n customerEmail?: string\n customerNote?: string\n shippingAddress?: string\n shippingCity?: string\n shippingState?: string\n shippingCountry?: string\n shippingType?: ShippingType\n shippingMethodId?: string\n trackingCode?: string\n paymentMethodId?: string\n items?: OrderItemInput[]\n subtotal?: number\n shippingPrice?: number\n total?: number\n discount?: number\n coupon?: string\n couponId?: string\n source?: string\n confirmerId?: string\n status?: OrderStatus\n paymentStatus?: PaymentStatus\n deliveryStatus?: DeliveryStatus\n customStatus?: string\n customFields?: Record<string, any>\n metadata?: Record<string, any>\n tags?: string[]\n}\n\n/**\n * Order pricing calculation result\n */\nexport interface OrderPricing {\n subtotal: number\n shippingPrice: number | null\n calculatedTotal: number\n}\n\n/**\n * Options for calculating order pricing\n */\nexport interface CalculateOrderPricingOptions {\n storeId: string\n items: OrderItemInput[]\n shippingState?: string\n shippingCountry?: string\n shippingType?: ShippingType\n shippingAddress?: string\n}\n","import { OrderEntity } from './order.js'\n\nexport interface ShippingMethodEntity {\n id: string\n name: string\n description: string | null\n logoUrl: string | null\n ondarkLogoUrl: string | null\n price: number\n forks: number\n sourceId: string\n storeId: string\n rates: (number | null)[][] | null\n status: ShippingMethodStatus\n policy: ShippingMethodPolicy\n verifiedAt: any\n createdAt: any\n updatedAt: any\n orders: OrderEntity[]\n source: ShippingMethodEntity | null\n}\n\nexport enum ShippingMethodStatus {\n draft = 'draft',\n published = 'published',\n archived = 'archived',\n}\n\nexport enum ShippingMethodPolicy {\n private = 'private',\n public = 'public',\n}\n\n/**\n * Input data for creating a new shipping method\n */\nexport interface ShippingMethodCreateInput {\n name: string\n storeId: string\n description?: string\n logoUrl?: string\n ondarkLogoUrl?: string\n price?: number\n rates?: (number | null)[][] | null\n status?: ShippingMethodStatus\n policy?: ShippingMethodPolicy\n sourceId?: string\n}\n\n/**\n * Input data for updating an existing shipping method\n */\nexport interface ShippingMethodUpdateInput {\n name?: string\n description?: string\n logoUrl?: string\n ondarkLogoUrl?: string\n price?: number\n rates?: (number | null)[][] | null\n status?: ShippingMethodStatus\n policy?: ShippingMethodPolicy\n}\n","/**\n * Shipping Price Entity\n *\n * A simplified, country-aware shipping pricing system that replaces\n * the legacy array-based shipping rates with a structured approach.\n *\n * Key features:\n * - Country codes as keys (ISO 3166-1 alpha-2)\n * - State codes as keys (no fragile array indexes)\n * - Named price types for extensibility\n * - Gradual migration path from legacy system\n *\n * @example\n * ```typescript\n * const prices: ShippingPriceRates = {\n * \"DZ\": {\n * \"01\": { home: 800, desk: 400, pickup: 0 },\n * \"16\": { home: 600, desk: 300, pickup: 0 }\n * },\n * \"IQ\": {\n * \"01\": { home: 15000, desk: 10000, pickup: 5000 }\n * }\n * }\n * ```\n */\n\n/**\n * Individual state shipping rates with named price types.\n * Using named properties instead of array indexes for clarity and extensibility.\n */\nexport interface ShippingStateRates {\n /** Price for home delivery (nullable if unavailable) */\n home: number | null\n /** Price for desk/office pickup (nullable if unavailable) */\n desk: number | null\n /** Price for store pickup (nullable if unavailable) */\n pickup: number | null\n}\n\n/**\n * Shipping rates organized by country code and state code.\n * Structure: { [countryCode]: { [stateCode]: ShippingStateRates } }\n */\nexport type ShippingPriceRates = Record<string, Record<string, ShippingStateRates>>\n\n/**\n * Status of the shipping price configuration.\n */\nexport enum ShippingPriceStatus {\n /** Not yet published, only visible to store owner */\n draft = 'draft',\n /** Active and used for shipping calculations */\n published = 'published',\n}\n\n/**\n * Shipping Price Entity\n *\n * Represents a shipping pricing configuration for a store.\n * Supports multi-country operations with state-level pricing.\n */\nexport interface ShippingPriceEntity {\n /** Unique identifier (24-char string) */\n id: string\n\n /** Display name for this pricing configuration */\n name: string\n\n /** Optional logo URL for branding */\n logoUrl: string | null\n\n /** Store this pricing belongs to */\n storeId: string\n\n /**\n * Pricing data structured by country and state codes.\n * @see ShippingPriceRates\n */\n prices: ShippingPriceRates\n\n /** Publication status */\n status: ShippingPriceStatus\n\n /** Creation timestamp */\n createdAt: any\n\n /** Last update timestamp */\n updatedAt: any\n}\n\n/**\n * Shipping type enumeration for order shipping type.\n * Maps to the pricing structure keys.\n */\nexport type ShippingPriceType = keyof ShippingStateRates\n\n/**\n * Helper function to get shipping price from rates.\n *\n * @param prices - The shipping price rates object\n * @param countryCode - ISO 3166-1 alpha-2 country code\n * @param stateCode - State/province code\n * @param type - Shipping type (home, desk, pickup)\n * @returns The price or null if not available\n *\n * @example\n * ```typescript\n * const price = getShippingPrice(shippingPrice.prices, 'DZ', '16', 'home')\n * // Returns 600 or null\n * ```\n */\nexport function getShippingPrice(\n prices: ShippingPriceRates,\n countryCode: string,\n stateCode: string,\n type: ShippingPriceType\n): number | null {\n const countryRates = prices[countryCode]\n if (!countryRates) return null\n\n const stateRates = countryRates[stateCode]\n if (!stateRates) return null\n\n return stateRates[type] ?? null\n}\n\n/**\n * Helper function to check if shipping is available for a location.\n *\n * @param prices - The shipping price rates object\n * @param countryCode - ISO 3166-1 alpha-2 country code\n * @param stateCode - State/province code\n * @returns True if any shipping type is available for this location\n */\nexport function isShippingAvailable(\n prices: ShippingPriceRates,\n countryCode: string,\n stateCode: string\n): boolean {\n const countryRates = prices[countryCode]\n if (!countryRates) return false\n\n const stateRates = countryRates[stateCode]\n if (!stateRates) return false\n\n return stateRates.home !== null || stateRates.desk !== null || stateRates.pickup !== null\n}\n\n/**\n * Helper function to get all available shipping types for a location.\n *\n * @param prices - The shipping price rates object\n * @param countryCode - ISO 3166-1 alpha-2 country code\n * @param stateCode - State/province code\n * @returns Array of available shipping types with their prices\n */\nexport function getAvailableShippingTypes(\n prices: ShippingPriceRates,\n countryCode: string,\n stateCode: string\n): Array<{ type: ShippingPriceType; price: number }> {\n const countryRates = prices[countryCode]\n if (!countryRates) return []\n\n const stateRates = countryRates[stateCode]\n if (!stateRates) return []\n\n const available: Array<{ type: ShippingPriceType; price: number }> = []\n\n if (stateRates.home !== null) {\n available.push({ type: 'home', price: stateRates.home })\n }\n if (stateRates.desk !== null) {\n available.push({ type: 'desk', price: stateRates.desk })\n }\n if (stateRates.pickup !== null) {\n available.push({ type: 'pickup', price: stateRates.pickup })\n }\n\n return available\n}\n\n/**\n * Input data for creating a new shipping price\n */\nexport interface ShippingPriceCreateInput {\n name: string\n storeId: string\n logoUrl?: string\n prices: ShippingPriceRates\n status?: ShippingPriceStatus\n}\n\n/**\n * Input data for updating an existing shipping price\n */\nexport interface ShippingPriceUpdateInput {\n name?: string\n logoUrl?: string\n prices?: ShippingPriceRates\n status?: ShippingPriceStatus\n}\n","export type Listener<T extends NotifiableService> = (service: T) => void\n\nexport class NotifiableService {\n // Array of listeners (functions) to notify when changes occur\n private listeners: Set<Listener<typeof this>> = new Set()\n\n /**\n * Adds a listener that gets called when `notify` is triggered.\n * @param listener - The function to be called on notification.\n * @returns The same listener for potential chaining or removal.\n */\n addListener(listener: Listener<typeof this>): Listener<typeof this> {\n this.listeners.add(listener) // Using Set for uniqueness and faster removal\n return listener\n }\n\n /**\n * Removes a previously added listener.\n * @param listener - The function to be removed from the listeners list.\n */\n removeListener(listener: Listener<typeof this>): void {\n this.listeners.delete(listener) // Set deletion is O(1) for better performance\n }\n\n /**\n * Notifies all registered listeners, passing the service instance.\n * This allows listeners to react to changes.\n */\n notify(): void {\n // Iterating over the Set of listeners and invoking each one\n this.listeners.forEach((listener) => listener(this))\n }\n\n /**\n * Clears all listeners, removing any references to them.\n */\n clearListeners(): void {\n this.listeners.clear() // Clears the Set entirely\n }\n\n /**\n * Constructor for NotifiableService, initializes listeners as an empty Set.\n * The Set ensures unique listeners and better management.\n */\n constructor() {\n // Initialization can be skipped since listeners is already initialized as an empty Set\n }\n}\n","import { ShippingType } from '../../core/entities/order.js'\nimport { ProductEntity, ProductOffer } from '../../core/entities/product.js'\nimport {\n ShippingMethodEntity,\n ShippingMethodPolicy,\n ShippingMethodStatus,\n} from '../../core/entities/shipping_method.js'\nimport {\n ShippingPriceEntity,\n ShippingPriceType,\n getShippingPrice as getShippingPriceHelper,\n getAvailableShippingTypes as getAvailableShippingTypesHelper,\n} from '../../core/entities/shipping_price.js'\nimport { StoreEntity } from '../../core/entities/store.js'\nimport { NotifiableService } from './service.js'\n\n/**\n * Represents an item in the cart.\n */\nexport interface CartItem {\n product: ProductEntity\n offer?: ProductOffer\n quantity: number\n variantPath?: string\n addons?: Record<string, number>\n}\n\n/**\n * Cart shipping types.\n * - `pickup`: The user will pick up the order from the closest desk.\n * - `home`: The order will be delivered to the user's home.\n * - `store`: The order will be delivered to the store.\n */\n// export type CartShippingTypes = 'pickup' | 'home' | 'store'\n\n/**\n * Interface for a shipping address.\n */\nexport interface CartShippingAddress {\n name: string | null\n phone: string | null\n city: string | null\n state: string | null\n street: string | null\n country: 'dz' | string\n type: ShippingType\n}\n\n/**\n * Manages the shopping cart and its operations.\n */\nexport class CartService extends NotifiableService {\n private items: CartItem[] = [] // Array to support multiple items with same product but different variants\n private shippingMethod: ShippingMethodEntity | null = null\n private shippingPrice: ShippingPriceEntity | null = null // New shipping price system\n private store: StoreEntity | null = null // Store entity for accessing shippingPriceId\n private shippingAddress: CartShippingAddress = {\n name: null,\n phone: null,\n city: null,\n state: null,\n street: null,\n country: 'dz',\n type: ShippingType.pickup,\n }\n private cachedSubtotal: number | null = null // Cache for subtotal to avoid redundant calculations\n private currentItem: CartItem | null = null\n\n /**\n * Generates a unique key for a cart item based on product ID, variant path, offer code, and addons\n * @param item - The cart item to generate a key for\n * @returns A unique string key\n */\n private getItemKey(item: CartItem): string {\n const addonKeys = item.addons ? Object.keys(item.addons).sort().join('|') : ''\n return `${item.product.id}:${item.variantPath || ''}:${item.offer?.code || ''}:${addonKeys}`\n }\n\n /**\n * Finds an item in the cart that matches the given item's key\n * @param item - The item to find\n * @returns The matching cart item or undefined\n */\n private findItem(item: CartItem): CartItem | undefined {\n const targetKey = this.getItemKey(item)\n return this.items.find((cartItem) => this.getItemKey(cartItem) === targetKey)\n }\n\n /**\n * Finds the index of an item in the cart that matches the given item's key\n * @param item - The item to find\n * @returns The index of the matching cart item or -1 if not found\n */\n private findItemIndex(item: CartItem): number {\n const targetKey = this.getItemKey(item)\n return this.items.findIndex((cartItem) => this.getItemKey(cartItem) === targetKey)\n }\n\n /**\n * Sets the current item to be managed in the cart.\n * @param item - The item to be set as current.\n */\n setCurrentItem(item: CartItem, notify = true): void {\n this.currentItem = item\n\n const existingItemIndex = this.findItemIndex(this.currentItem)\n if (existingItemIndex !== -1) {\n this.items[existingItemIndex] = this.currentItem\n }\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Clamps the quantity to be within the offer's min/max range\n * @param offer - The offer containing quantity constraints\n * @param quantity - The quantity to clamp\n * @returns The clamped quantity value\n */\n private clampQuantityToOfferLimits(offer: ProductOffer, quantity: number): number {\n if (offer.minQuantity !== undefined) {\n quantity = Math.max(quantity, offer.minQuantity)\n }\n if (offer.maxQuantity !== undefined) {\n quantity = Math.min(quantity, offer.maxQuantity)\n }\n return quantity\n }\n\n /**\n * Update item by unique key (product ID + variant + offer + addons).\n * @param item - The item to identify the cart item to update.\n * @param updates - Partial item data to update.\n */\n updateItem(item: CartItem, updates: Partial<CartItem>, notify = true): void {\n const index = this.findItemIndex(item)\n\n if (index !== -1) {\n const currentItem = this.items[index]\n const newItem = { ...currentItem, ...updates }\n\n // Clamp quantity if there's an offer with constraints\n if (newItem.offer) {\n newItem.quantity = this.clampQuantityToOfferLimits(newItem.offer, newItem.quantity)\n }\n\n this.items[index] = newItem\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n }\n\n /**\n * Update current item.\n * @param updates - a partial item to update.\n */\n updateCurrentItem(updates: Partial<CartItem>, notify = true): void {\n if (!this.currentItem) return\n\n this.currentItem = { ...this.currentItem, ...updates }\n\n const existingItemIndex = this.findItemIndex(this.currentItem)\n if (existingItemIndex !== -1) {\n this.items[existingItemIndex] = this.currentItem\n }\n\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Update shipping address.\n * @param address - a partial address to update.\n */\n updateShippingAddress(address: Partial<CartShippingAddress>, notify = true): void {\n this.shippingAddress = { ...this.shippingAddress, ...address }\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Update shipping method.\n * @param method - a partial shipping method to update.\n */\n updateShippingMethod(method: Partial<ShippingMethodEntity>, notify = true): void {\n if (!this.shippingMethod) return\n\n this.shippingMethod = { ...this.shippingMethod, ...method }\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Retrieves the current item in the cart.\n * @returns The current cart item or null if not set.\n */\n getCurrentItem(): CartItem | null {\n return this.currentItem\n }\n\n /**\n * Checks if the current item is already in the cart.\n * @returns True if the current item is in the cart, false otherwise.\n */\n isCurrentItemInCart(): boolean {\n return this.currentItem ? this.findItem(this.currentItem) !== undefined : false\n }\n\n /**\n * Adds the current item to the cart if it's not already present.\n */\n addCurrentItemToCart(): void {\n if (!this.currentItem || this.isCurrentItemInCart()) return\n this.add(this.currentItem)\n this.cachedSubtotal = null\n }\n\n /**\n * Removes the current item from the cart if present.\n */\n removeCurrentItemFromCart(): void {\n if (this.currentItem) {\n this.remove(this.currentItem)\n }\n }\n\n /**\n * Toggles the current item's presence in the cart (add/remove).\n */\n toggleCurrentItemInCart(): void {\n this.isCurrentItemInCart() ? this.removeCurrentItemFromCart() : this.addCurrentItemToCart()\n }\n\n /**\n * Adds an item to the cart. If the item is already present, increments its quantity.\n * @param item - The cart item to add.\n */\n add(item: CartItem): void {\n const existingItem = this.findItem(item)\n\n if (existingItem) {\n existingItem.quantity += item.quantity\n } else {\n this.items.push({ ...item })\n }\n\n this.cachedSubtotal = null // Reset subtotal cache\n this.notifyIfChanged()\n }\n\n /**\n * Checks if an item exists in the cart by matching product ID and variant path.\n * @param productId - The product ID to check for.\n * @param variantPath - The variant path to check for.\n * @returns True if the item exists in the cart, false otherwise.\n */\n has(productId: string, variantPath?: string): boolean {\n return this.items.some((item) => {\n if (item.product.id !== productId) return false\n if (variantPath !== undefined && item.variantPath !== variantPath) return false\n return true\n })\n }\n\n /**\n * Checks if an item exists in the cart by matching the item's unique key.\n * @param item - The item to check for.\n * @returns True if the item exists in the cart, false otherwise.\n */\n hasItem(item: CartItem): boolean {\n return this.findItem(item) !== undefined\n }\n\n /**\n * Checks if any item with the given product ID exists in the cart.\n * @param productId - The product ID to check for.\n * @returns True if any item with the product ID exists, false otherwise.\n */\n hasProduct(productId: string): boolean {\n return this.items.some((item) => item.product.id === productId)\n }\n\n /**\n * Removes an item from the cart by matching the item's unique key.\n * @param item - The item to remove.\n */\n remove(item: CartItem): void {\n const index = this.findItemIndex(item)\n if (index !== -1) {\n this.items.splice(index, 1)\n this.cachedSubtotal = null\n this.notifyIfChanged()\n }\n }\n\n /**\n * Removes all items with the given product ID from the cart.\n * @param productId - The product ID to remove.\n */\n removeByProductId(productId: string, variantPath?: string): void {\n const initialLength = this.items.length\n this.items = this.items.filter((item) => {\n if (item.product.id !== productId) return true\n if (variantPath !== undefined && item.variantPath !== variantPath) return true\n return false\n })\n\n if (this.items.length !== initialLength) {\n this.cachedSubtotal = null\n this.notifyIfChanged()\n }\n }\n\n /**\n * Clears all items from the cart.\n */\n clear(notify = true): void {\n if (this.items.length > 0) {\n this.items = []\n this.cachedSubtotal = null\n if (notify) {\n this.notify()\n }\n }\n }\n\n /**\n * Retrieves the subtotal of the cart.\n * @param withCurrentItem - Whether to include the current item in the subtotal.\n * @returns The subtotal amount.\n */\n getSubtotal(withCurrentItem = true): number {\n if (this.cachedSubtotal === null) {\n this.cachedSubtotal = this.items.reduce((sum, item) => {\n return sum + this.getItemTotal(item)\n }, 0)\n }\n\n if (withCurrentItem && this.currentItem && !this.hasItem(this.currentItem)) {\n return this.cachedSubtotal + this.getItemTotal(this.currentItem)\n }\n\n return this.cachedSubtotal\n }\n\n /**\n * Calculates the total price for a cart item.\n * @param item - The cart item.\n * @returns The total price for the item.\n */\n getItemTotal(item: CartItem): number {\n const { product, variantPath, quantity, offer, addons } = item\n let price = product.price\n let discount = product.discount ?? 0\n\n // Handle variant pricing if a variant path exists\n if (variantPath) {\n const parts = variantPath.split('/')\n let currentVariant = product.variant\n\n for (const part of parts) {\n if (!currentVariant) break\n const option = currentVariant.options.find((o) => o.name === part)\n if (!option) break\n price = option.price ?? price\n discount = option.discount ?? discount\n currentVariant = option.child\n }\n }\n\n // Apply offer if present\n if (offer) {\n if (offer.price !== undefined) {\n // If offer has a fixed price, use it\n price = offer.price\n discount = 0 // Reset discount since we're using a fixed price\n }\n }\n\n // Calculate base product price with quantity\n let total = (price - discount) * quantity\n\n // Add pricing for addons if present\n if (addons && product.addons) {\n for (const [addonId, addonQuantity] of Object.entries(addons)) {\n // Find the addon in the product's addons array\n const addon = product.addons.find((a) => a.title === addonId)\n if (addon && addon.price) {\n // Add the addon price * quantity to the total\n total += addon.price * addonQuantity\n }\n }\n }\n\n return total\n }\n\n /**\n * Validates if an offer can be applied to the given quantity\n * @param offer - The offer to validate\n * @param quantity - The quantity to check\n * @returns boolean indicating if the offer is valid for the quantity\n */\n isOfferValidForQuantity(offer: ProductOffer, quantity: number): boolean {\n if (offer.minQuantity && quantity < offer.minQuantity) return false\n if (offer.maxQuantity && quantity > offer.maxQuantity) return false\n return true\n }\n\n /**\n * Updates the offer for a specific cart item\n * @param item - The item to update\n * @param offer - The offer to apply, or undefined to remove the offer\n */\n updateItemOffer(item: CartItem, offer?: ProductOffer): void {\n const existingItem = this.findItem(item)\n if (!existingItem) return\n\n const updatedItem = { ...existingItem, offer }\n // If applying an offer, ensure quantity is within limits\n if (offer) {\n updatedItem.quantity = this.clampQuantityToOfferLimits(offer, existingItem.quantity)\n }\n\n this.updateItem(item, updatedItem)\n this.cachedSubtotal = null\n this.notifyIfChanged()\n }\n\n /**\n * Updates the offer for the current item\n * @param offer - The offer to apply, or undefined to remove the offer\n */\n updateCurrentItemOffer(offer?: ProductOffer): void {\n if (!this.currentItem) return\n\n const updatedItem = { ...this.currentItem }\n updatedItem.offer = offer\n\n // If applying an offer, ensure quantity is within limits\n if (offer) {\n updatedItem.quantity = this.clampQuantityToOfferLimits(offer, this.currentItem.quantity)\n }\n\n this.updateCurrentItem(updatedItem)\n this.cachedSubtotal = null\n this.notifyIfChanged()\n }\n\n /**\n * Sets the shipping method.\n * @param method - Either a store or a shipping method.\n */\n setShippingMethod(method: ShippingMethodEntity | StoreEntity, notify = true): void {\n const store = (method as StoreEntity)?.defaultShippingRates ? (method as StoreEntity) : null\n const shippingMethod = (method as ShippingMethodEntity)?.rates\n ? (method as ShippingMethodEntity)\n : null\n\n if (store) {\n this.store = store\n this.shippingMethod = {\n id: store.id,\n name: store.name,\n description: store.description,\n logoUrl: store.logoUrl,\n ondarkLogoUrl: store.ondarkLogoUrl,\n price: 0,\n forks: 0,\n sourceId: store.id,\n storeId: store.id,\n rates: store.defaultShippingRates,\n status: ShippingMethodStatus.published,\n policy: ShippingMethodPolicy.public,\n verifiedAt: null,\n createdAt: null,\n updatedAt: null,\n orders: [],\n source: null,\n }\n if (notify) {\n this.notify()\n }\n } else if (shippingMethod) {\n this.shippingMethod = shippingMethod\n if (notify) {\n this.notify()\n }\n } else {\n throw new Error('Invalid shipping method')\n }\n }\n\n /**\n * Sets the shipping price (new system).\n * @param shippingPrice - The shipping price entity.\n * @param notify - Whether to notify listeners.\n */\n setShippingPrice(shippingPrice: ShippingPriceEntity | null, notify = true): void {\n this.shippingPrice = shippingPrice\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Sets the store entity.\n * @param store - The store entity.\n * @param notify - Whether to notify listeners.\n */\n setStore(store: StoreEntity | null, notify = true): void {\n this.store = store\n if (notify) {\n this.notify()\n }\n }\n\n /**\n * Maps ShippingType enum to ShippingPriceType string.\n * @param shippingType - The shipping type enum.\n * @returns The corresponding shipping price type.\n */\n private mapShippingTypeToPriceType(shippingType: ShippingType): ShippingPriceType {\n switch (shippingType) {\n case ShippingType.home:\n return 'home'\n case ShippingType.pickup:\n return 'pickup'\n case ShippingType.store:\n return 'desk'\n default:\n return 'home'\n }\n }\n\n /**\n * Resolves shipping price using the priority chain.\n * Priority: 1. Product shippingPriceId, 2. Store shippingPriceId, 3. Product shippingMethodId, 4. Store defaultShippingRates\n *\n * Note: Shipping prices must be loaded and set via setShippingPrice() for the new system to work.\n * If shipping prices are not loaded, the method falls back to the legacy system.\n *\n * @param countryCode - ISO 3166-1 alpha-2 country code (optional, required for new system)\n * @param stateCode - State/province code\n * @param shippingType - The shipping type\n * @returns The shipping price or null if not available\n */\n private resolveShippingPrice(\n countryCode: string | undefined,\n stateCode: string,\n shippingType: ShippingType\n ): number | null {\n if (!stateCode) return null\n\n const priceType = this.mapShippingTypeToPriceType(shippingType)\n\n // Collect all products (items + currentItem if not in items)\n const allProducts = [...this.items]\n if (this.currentItem && !this.hasItem(this.currentItem)) {\n allProducts.push(this.currentItem)\n }\n\n console.log('[resolveShippingPrice]', {\n countryCode,\n stateCode,\n shippingType,\n priceType,\n hasShippingPrice: !!this.shippingPrice,\n shippingPriceId: this.shippingPrice?.id,\n allProductsCount: allProducts.length,\n })\n\n // 1. Try product-specific ShippingPrice (new system) - HIGHEST PRIORITY\n // Check if all products have the same shippingPriceId\n if (countryCode && this.shippingPrice) {\n const productShippingPriceIds = allProducts\n .map((item) => item.product.shippingPriceId)\n .filter((id): id is string => id !== null)\n\n console.log('[resolveShippingPrice] Product shippingPriceIds:', productShippingPriceIds)\n\n if (productShippingPriceIds.length > 0) {\n // Check if all products have the same shippingPriceId\n const uniqueIds = new Set(productShippingPriceIds)\n if (uniqueIds.size === 1 && this.shippingPrice.id === productShippingPriceIds[0]) {\n console.log(\n '[resolveShippingPrice] Using product shippingPriceId:',\n productShippingPriceIds[0]\n )\n const price = getShippingPriceHelper(\n this.shippingPrice.prices,\n countryCode,\n stateCode,\n priceType\n )\n console.log('[resolveShippingPrice] Product price result:', price)\n if (price !== null) {\n return price\n }\n // If product has shippingPriceId but no rate for this location, fall through\n }\n }\n }\n\n // 2. Try store shippingPriceId (new system)\n if (\n countryCode &&\n this.store?.shippingPriceId &&\n this.shippingPrice &&\n this.shippingPrice.id === this.store.shippingPriceId\n ) {\n console.log('[resolveShippingPrice] Using store shippingPriceId:', this.store.shippingPriceId)\n const price = getShippingPriceHelper(\n this.shippingPrice.prices,\n countryCode,\n stateCode,\n priceType\n )\n console.log('[resolveShippingPrice] Store price result:', price)\n if (price !== null) {\n return price\n }\n // If store has shippingPriceId but no rate for this location, fall through\n }\n\n // 3. Try product-specific ShippingMethod (legacy)\n // Check if all products have the same shippingMethodId\n const productShippingMethodIds = allProducts\n .map((item) => item.product.shippingMethodId)\n .filter((id): id is string => id !== null)\n\n if (productShippingMethodIds.length > 0) {\n const uniqueIds = new Set(productShippingMethodIds)\n if (\n uniqueIds.size === 1 &&\n this.shippingMethod &&\n this.shippingMethod.id === productShippingMethodIds[0]\n ) {\n const legacyPrice = this.getShippingPriceForTypeLegacy(shippingType)\n if (legacyPrice !== null) {\n return legacyPrice\n }\n }\n }\n\n // 4. Fall back to store.defaultShippingRates (legacy)\n if (this.shippingMethod?.rates) {\n console.log('[resolveShippingPrice] Falling back to legacy system')\n const legacyPrice = this.getShippingPriceForTypeLegacy(shippingType)\n console.log('[resolveShippingPrice] Legacy price result:', legacyPrice)\n return legacyPrice\n }\n\n console.log('[resolveShippingPrice] No shipping price found, returning null')\n return null\n }\n\n /**\n * Gets shipping price using legacy system (array-based rates).\n * @param type - The shipping type\n * @returns The shipping price or null if not available\n */\n private getShippingPriceForTypeLegacy(type: ShippingType): number | null {\n if (!this.shippingMethod?.rates || !this.shippingAddress.state) return null\n\n const stateIndex = Number.parseInt(this.shippingAddress.state, 10) - 1\n const rates = this.shippingMethod.rates[stateIndex]\n\n if (!rates) return null\n\n switch (type) {\n case ShippingType.pickup:\n return rates[0]\n case ShippingType.home:\n return rates[1]\n case ShippingType.store:\n return rates[2]\n default:\n return null\n }\n }\n\n /**\n * Retrieves the available shipping types using the priority chain.\n * Priority: 1. Product shippingPriceId, 2. Store shippingPriceId, 3. Product shippingMethodId, 4. Store defaultShippingRates\n *\n * Note: Shipping prices must be loaded and set via setShippingPrice() for the new system to work.\n * If shipping prices are not loaded, the method falls back to the legacy system.\n *\n * @returns An array of available shipping types.\n */\n getAvailableShippingTypes(): ShippingType[] {\n if (!this.shippingAddress.state) return []\n\n // Get country code from shipping address first, then store config\n // If shippingAddress.country is 'dz' (lowercase), it means legacy system\n let countryCode: string | undefined\n if (this.shippingAddress.country && this.shippingAddress.country.toLowerCase() !== 'dz') {\n countryCode = this.shippingAddress.country.toUpperCase()\n } else if (this.store?.configs?.selectedCountry) {\n countryCode = this.store.configs.selectedCountry.toUpperCase()\n } else {\n // No country configured - use legacy system\n countryCode = undefined\n }\n\n // Collect all products (items + currentItem if not in items)\n const allProducts = [...this.items]\n if (this.currentItem && !this.hasItem(this.currentItem)) {\n allProducts.push(this.currentItem)\n }\n\n // 1. Try product-specific ShippingPrice (new system) - only if countryCode is available\n if (countryCode && this.shippingPrice) {\n const productShippingPriceIds = allProducts\n .map((item) => item.product.shippingPriceId)\n .filter((id): id is string => id !== null)\n\n if (productShippingPriceIds.length > 0) {\n const uniqueIds = new Set(productShippingPriceIds)\n if (uniqueIds.size === 1 && this.shippingPrice.id === productShippingPriceIds[0]) {\n const available = getAvailableShippingTypesHelper(\n this.shippingPrice.prices,\n countryCode,\n this.shippingAddress.state\n )\n if (available.length > 0) {\n return available.map((a) => {\n switch (a.type) {\n case 'home':\n return ShippingType.home\n case 'pickup':\n return ShippingType.pickup\n case 'desk':\n return ShippingType.store\n default:\n return ShippingType.home\n }\n })\n }\n // If product has shippingPriceId but no rate for this location, fall through\n }\n }\n }\n\n // 2. Try store shippingPriceId (new system) - only if countryCode is available\n if (\n countryCode &&\n this.store?.shippingPriceId &&\n this.shippingPrice &&\n this.shippingPrice.id === this.store.shippingPriceId\n ) {\n const available = getAvailableShippingTypesHelper(\n this.shippingPrice.prices,\n countryCode,\n this.shippingAddress.state\n )\n if (available.length > 0) {\n return available.map((a) => {\n switch (a.type) {\n case 'home':\n return ShippingType.home\n case 'pickup':\n return ShippingType.pickup\n case 'desk':\n return ShippingType.store\n default:\n return ShippingType.home\n }\n })\n }\n // If store has shippingPriceId but no rate for this location, fall through\n }\n\n // 3. Fall back to legacy system\n if (!this.shippingMethod?.rates) return []\n\n const state = Number.parseInt(this.shippingAddress.state, 10)\n const stateRates = this.shippingMethod.rates[state - 1]\n\n if (!stateRates) return []\n\n const availableTypes: ShippingType[] = []\n\n if (stateRates[0] !== null && stateRates[0] !== undefined)\n availableTypes.push(ShippingType.pickup)\n if (stateRates[1] !== null && stateRates[1] !== undefined)\n availableTypes.push(ShippingType.home)\n if (stateRates[2] !== null && stateRates[2] !== undefined)\n availableTypes.push(ShippingType.store)\n\n return availableTypes\n }\n\n /**\n * Retrieves the current shipping method.\n * @returns The shipping method or null.\n */\n getShippingMethod(): ShippingMethodEntity | null {\n return this.shippingMethod\n }\n\n /**\n * Sets the shipping address for the cart.\n * @param address - The shipping address.\n */\n setShippingAddress(address: CartShippingAddress, notify = true): void {\n if (\n this.shippingAddress.city !== address.city ||\n this.shippingAddress.state !== address.state ||\n this.shippingAddress.type !== address.type\n ) {\n this.shippingAddress = address\n if (notify) {\n this.notify()\n }\n }\n }\n\n /**\n * Retrieves the current shipping address.\n * @returns The shipping address.\n */\n getShippingAddress(): CartShippingAddress {\n return this.shippingAddress\n }\n\n /**\n * Calculates the shipping price based on the address and shipping method.\n * @returns The shipping price or 0 if not applicable.\n */\n getShippingPrice(): number {\n // Collect all items (items + currentItem if not in items)\n const allItems = [...this.items]\n if (this.currentItem && !this.hasItem(this.currentItem)) {\n allItems.push(this.currentItem)\n }\n\n // if at least one item have freeShipping offer return 0\n for (const item of allItems) {\n if (item.offer?.freeShipping) return 0\n }\n\n // if no shipping method is set, return 0\n if (!this.shippingMethod) return 0\n\n // if no shipping address is set, return the shipping method price\n if (!this.shippingAddress.state) return this.shippingMethod.price ?? 0\n\n // avalable shipping types\n const shippings = this.getAvailableShippingTypes()\n\n const currentOne = this.getShippingPriceForType(this.shippingAddress.type)\n if (currentOne !== null) {\n return currentOne\n }\n\n for (const type of shippings) {\n const price = this.getShippingPriceForType(type)\n if (price !== null) {\n return price\n }\n }\n\n return 0\n }\n\n /**\n * Gets the shipping price for a specific shipping type using the priority chain.\n * Priority: 1. Product shippingPriceId, 2. Store shippingPriceId, 3. Product shippingMethodId, 4. Store defaultShippingRates\n * @param type - The shipping type to check (pickup, home, store)\n * @returns The shipping price for the specified type, or null if not available\n */\n getShippingPriceForType(type: ShippingType): number | null {\n if (!this.shippingAddress.state) {\n console.log('[getShippingPriceForType] No state, returning null')\n return null\n }\n\n // Get country code from shipping address first, then store config, then default to 'DZ'\n // Convert to uppercase to match shipping price data format\n // If shippingAddress.country is 'dz' (lowercase), it means legacy system\n let countryCode: string | undefined\n if (this.shippingAddress.country && this.shippingAddress.country.toLowerCase() !== 'dz') {\n countryCode = this.shippingAddress.country.toUpperCase()\n } else if (this.store?.configs?.selectedCountry) {\n countryCode = this.store.configs.selectedCountry.toUpperCase()\n } else {\n // No country configured - use legacy system\n countryCode = undefined\n }\n\n console.log('[getShippingPriceForType]', {\n type,\n state: this.shippingAddress.state,\n country: this.shippingAddress.country,\n countryCode,\n storeSelectedCountry: this.store?.configs?.selectedCountry,\n hasShippingPrice: !!this.shippingPrice,\n shippingPriceId: this.shippingPrice?.id,\n })\n\n // Try new system first (requires countryCode)\n if (countryCode) {\n const newSystemPrice = this.resolveShippingPrice(\n countryCode,\n this.shippingAddress.state,\n type\n )\n if (newSystemPrice !== null) {\n console.log('[getShippingPriceForType] New system price:', newSystemPrice)\n return newSystemPrice\n }\n }\n\n // Fall back to legacy system\n console.log('[getShippingPriceForType] Falling back to legacy system')\n const legacyPrice = this.getShippingPriceForTypeLegacy(type)\n console.log('[getShippingPriceForType] Legacy price:', legacyPrice)\n return legacyPrice\n }\n\n /**\n * Calculates the total cost of the cart including shipping.\n * @param withCurrentItem - Whether to include the current item in the total.\n * @returns The total cost.\n */\n getTotal(withCurrentItem = true): number {\n const subTotal = this.getSubtotal(withCurrentItem)\n const shippingPrice = this.getShippingPrice() ?? 0\n const selectedOffer = this.currentItem?.offer\n if (selectedOffer && selectedOffer.freeShipping) {\n return subTotal // If the current item has free shipping, return subtotal only\n }\n return subTotal + shippingPrice\n }\n\n /**\n * Retrieves all items in the cart.\n * @returns An array of cart items.\n */\n getAll(): CartItem[] {\n return [...this.items] // Return a copy to prevent external modification\n }\n\n /**\n * Checks if the cart is empty.\n * @returns True if the cart is empty, otherwise false.\n */\n isEmpty(): boolean {\n return this.items.length === 0\n }\n\n /**\n * Notifies listeners if the cart state has meaningfully changed.\n */\n private notifyIfChanged(): void {\n // This method could be enhanced to track and notify only meaningful changes\n this.notify()\n }\n}\n","import { AxiosInstance } from 'axios'\n\n/**\n * Actions service for performing various actions on the Feeef API.\n * Similar to the Dart Actions class, this provides methods for file uploads,\n * integrations, and other action-based operations.\n */\nexport class ActionsService {\n private client: AxiosInstance\n\n constructor(client: AxiosInstance) {\n this.client = client\n }\n\n /**\n * Uploads a file or image for custom fields in orders.\n * Files are saved to u/{userId}/stores/{storeId}/customFields/{fieldId}/{filename}\n *\n * @param file - The file to upload (File or Blob)\n * @param storeId - The store ID\n * @param fieldId - The custom field ID\n * @param productId - The product ID\n * @returns Promise resolving to the uploaded file URL and metadata\n */\n async uploadCustomFieldFile({\n file,\n storeId,\n fieldId,\n productId,\n }: {\n file: File | Blob\n storeId: string\n fieldId: string\n productId: string\n }): Promise<{\n url: string\n filename: string\n fieldId: string\n storeId: string\n }> {\n const formData = new FormData()\n formData.append('file', file)\n formData.append('storeId', storeId)\n formData.append('fieldId', fieldId)\n formData.append('productId', productId)\n\n // Debug: log the baseURL and full URL that will be used\n if (\n typeof globalThis !== 'undefined' &&\n 'window' in globalThis &&\n process.env.NODE_ENV === 'development'\n ) {\n const baseURL = this.client.defaults.baseURL || ''\n const fullURL = baseURL\n ? `${baseURL}/actions/uploadCustomFieldFile`\n : '/actions/uploadCustomFieldFile'\n console.log('[ActionsService] Uploading to:', fullURL)\n console.log('[ActionsService] Client baseURL:', this.client.defaults.baseURL)\n }\n\n // Use the same pattern as other repositories - relative URL with baseURL from client defaults\n const response = await this.client.post('/actions/uploadCustomFieldFile', formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n })\n\n return {\n url: response.data.url,\n filename: response.data.filename,\n fieldId: response.data.fieldId,\n storeId: response.data.storeId,\n }\n }\n}\n","import type { AxiosInstance } from 'axios'\n\n/**\n * Options for sending a notification\n */\nexport interface SendNotificationOptions {\n /**\n * Notification title (required)\n * Max 100 characters (FCM recommendation)\n */\n title: string\n\n /**\n * Notification body/message (required)\n * Max 4000 characters (FCM recommendation)\n */\n body: string\n\n /**\n * Additional data payload (optional)\n * Key-value pairs sent with the notification\n */\n data?: Record<string, string>\n\n /**\n * Click URL (optional)\n * URL to open when notification is clicked\n */\n clickUrl?: string\n\n /**\n * Sound file name (optional)\n * Default: 'default'\n */\n sound?: string\n\n /**\n * Filterator JSON string for advanced user filtering (optional)\n * Supports complex filtering conditions - same format as users page\n */\n filterator?: string | object\n\n /**\n * Other standard user filter parameters\n */\n q?: string\n page?: number\n limit?: number\n}\n\n/**\n * Response from sending notifications\n */\nexport interface SendNotificationResponse {\n message: string\n stats: {\n usersProcessed: number\n tokensSent: number\n tokensFailed: number\n errors?: string[]\n }\n}\n\n/**\n * Service for managing notifications\n */\nexport class NotificationsService {\n private client: AxiosInstance\n\n constructor(client: AxiosInstance) {\n this.client = client\n }\n\n /**\n * Send notifications to filtered users\n * Admin only - uses filterator to filter users\n * @param options - Notification options including filterator\n * @returns Promise that resolves to send statistics\n */\n async send(options: SendNotificationOptions): Promise<SendNotificationResponse> {\n const payload: Record<string, any> = {\n title: options.title,\n body: options.body,\n }\n\n if (options.data) {\n payload.data = options.data\n }\n\n if (options.clickUrl) {\n payload.clickUrl = options.clickUrl\n }\n\n if (options.sound) {\n payload.sound = options.sound\n }\n\n // Handle filterator - convert to string if object\n if (options.filterator) {\n payload.filterator =\n typeof options.filterator === 'string'\n ? options.filterator\n : JSON.stringify(options.filterator)\n }\n\n if (options.q) {\n payload.q = options.q\n }\n\n if (options.page) {\n payload.page = options.page\n }\n\n if (options.limit) {\n payload.limit = options.limit\n }\n\n const res = await this.client.post('/notifications/send', payload)\n return res.data\n }\n}\n","import { AxiosInstance, AxiosProgressEvent, CancelToken } from 'axios'\n\n/**\n * Options for uploading a file\n */\nexport interface UploadOptions {\n /** The file to upload */\n file: File | Blob\n /** Optional folder path */\n folder?: string\n /** Progress callback */\n onProgress?: (progress: UploadProgress) => void\n /** Cancel token for aborting the upload */\n cancelToken?: CancelToken\n}\n\n/**\n * Upload progress information\n */\nexport interface UploadProgress {\n /** Bytes sent */\n loaded: number\n /** Total bytes */\n total: number\n /** Progress percentage (0-100) */\n percentage: number\n}\n\n/**\n * Upload result\n */\nexport interface UploadResult {\n /** URL of the uploaded file */\n url: string\n}\n\n/**\n * Options for uploading bytes\n */\nexport interface UploadBytesOptions {\n /** The bytes to upload */\n bytes: Uint8Array | ArrayBuffer\n /** The filename */\n filename: string\n /** Optional folder path */\n folder?: string\n /** Progress callback */\n onProgress?: (progress: UploadProgress) => void\n /** Cancel token for aborting the upload */\n cancelToken?: CancelToken\n}\n\n/**\n * Storage service for uploading files\n */\nexport class StorageService {\n private client: AxiosInstance\n\n constructor(client: AxiosInstance) {\n this.client = client\n }\n\n /**\n * Uploads a file\n * @param options - Upload options\n * @returns Promise resolving to the upload result\n */\n async upload(options: UploadOptions): Promise<UploadResult> {\n const formData = new FormData()\n formData.append('file', options.file)\n if (options.folder) {\n formData.append('folder', options.folder)\n }\n\n const response = await this.client.post('/services/storage/upload', formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n onUploadProgress: options.onProgress\n ? (progressEvent: AxiosProgressEvent) => {\n const total = progressEvent.total || 0\n const loaded = progressEvent.loaded || 0\n options.onProgress!({\n loaded,\n total,\n percentage: total > 0 ? Math.round((loaded / total) * 100) : 0,\n })\n }\n : undefined,\n cancelToken: options.cancelToken,\n })\n\n return {\n url: response.data.url,\n }\n }\n\n /**\n * Uploads bytes directly\n * @param options - Upload options\n * @returns Promise resolving to the upload result\n */\n async uploadBytes(options: UploadBytesOptions): Promise<UploadResult> {\n const blob = new Blob([options.bytes])\n const file = new File([blob], options.filename)\n\n return this.upload({\n file,\n folder: options.folder,\n onProgress: options.onProgress,\n cancelToken: options.cancelToken,\n })\n }\n\n /**\n * Uploads a file for a store\n * @param file - The file to upload\n * @param storeId - The store ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadStoreFile(\n file: File | Blob,\n storeId: string,\n options?: {\n subfolder?: string\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n const folder = options?.subfolder\n ? `stores/${storeId}/${options.subfolder}`\n : `stores/${storeId}`\n\n return this.upload({\n file,\n folder,\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a product image\n * @param file - The file to upload\n * @param storeId - The store ID\n * @param productId - The product ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadProductImage(\n file: File | Blob,\n storeId: string,\n productId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.uploadStoreFile(file, storeId, {\n subfolder: `products/${productId}`,\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a store logo\n * @param file - The file to upload\n * @param storeId - The store ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadStoreLogo(\n file: File | Blob,\n storeId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.uploadStoreFile(file, storeId, {\n subfolder: 'logo',\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a store icon\n * @param file - The file to upload\n * @param storeId - The store ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadStoreIcon(\n file: File | Blob,\n storeId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.uploadStoreFile(file, storeId, {\n subfolder: 'icon',\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a user avatar\n * @param file - The file to upload\n * @param userId - The user ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadUserAvatar(\n file: File | Blob,\n userId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.upload({\n file,\n folder: `users/${userId}/avatar`,\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n\n /**\n * Uploads a feedback attachment\n * @param file - The file to upload\n * @param feedbackId - The feedback ID\n * @param options - Additional options\n * @returns Promise resolving to the upload result\n */\n async uploadFeedbackAttachment(\n file: File | Blob,\n feedbackId: string,\n options?: {\n onProgress?: (progress: UploadProgress) => void\n cancelToken?: CancelToken\n }\n ): Promise<UploadResult> {\n return this.upload({\n file,\n folder: `feedbacks/${feedbackId}`,\n onProgress: options?.onProgress,\n cancelToken: options?.cancelToken,\n })\n }\n}\n","import { AxiosInstance } from 'axios'\n\n// ============================================================================\n// Common Types\n// ============================================================================\n\n/**\n * Delivery fees structure - Array of [home, desk] prices per state\n */\nexport type DeliveryFees = (number | null)[][]\n\n// ============================================================================\n// Ecotrack Integration\n// ============================================================================\n\n/**\n * Ecotrack delivery integration configuration\n */\nexport interface EcotrackDeliveryIntegration {\n baseUrl: string\n token: string\n active?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Ecotrack finance data\n */\nexport interface EcotrackFinanceData {\n success: boolean\n amountsNotEncaissed: number\n feesNotEncaissed: number\n notEncaissed: number\n amountsEncaissed: number\n feesEncaissed: number\n encaissed: number\n amountsPaymentReady: number\n feesPaymentReady: number\n paymentReady: number\n}\n\n/**\n * Ecotrack wilaya (state) statistics\n */\nexport interface EcotrackWilayaData {\n wilayaId: number\n total: number\n retours: number\n livred: number\n wilayaName: string\n}\n\n/**\n * Ecotrack today's activity\n */\nexport interface EcotrackTodayActivity {\n expedie: number\n delivered: number\n returned: number\n suspended: number\n}\n\n/**\n * Ecotrack global statistics\n */\nexport interface EcotrackGlobalStats {\n enTraitement: number\n livred: number\n retours: number\n total: number\n}\n\n/**\n * Ecotrack statistics data\n */\nexport interface EcotrackStatisticsData {\n topWilaya: EcotrackWilayaData[]\n todayActivity: EcotrackTodayActivity\n globalStats: EcotrackGlobalStats\n}\n\n/**\n * Ecotrack sync result\n */\nexport interface EcotrackSyncResult {\n success: boolean\n message: string\n syncId?: string\n totalFetched?: number\n totalUpdated?: number\n totalSkipped?: number\n syncedAt?: string\n errors?: string[]\n}\n\n/**\n * Ecotrack sync status\n */\nexport interface EcotrackSyncStatus {\n canSync: boolean\n lastSyncAt?: string\n nextSyncAvailableAt?: string\n minutesUntilNextSync?: number\n}\n\n/**\n * Ecotrack Delivery Integration API\n */\nexport class EcotrackDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: EcotrackDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: EcotrackDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Ecotrack\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecotrack/fees`, {\n params: {\n baseUrl: this.integration.baseUrl,\n token: this.integration.token,\n },\n })\n return res.data\n }\n\n /**\n * Gets financial data from Ecotrack\n */\n async getFinancialData(options?: {\n limit?: number\n search?: string\n telephone?: string\n }): Promise<EcotrackFinanceData> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecotrack/finance`, {\n params: {\n api_token: this.integration.token,\n ...options,\n },\n })\n return {\n success: res.data.success ?? false,\n amountsNotEncaissed: res.data.amounts_not_encaissed ?? 0,\n feesNotEncaissed: res.data.fees_not_encaissed ?? 0,\n notEncaissed: res.data.not_encaissed ?? 0,\n amountsEncaissed: res.data.amounts_encaissed ?? 0,\n feesEncaissed: res.data.fees_encaissed ?? 0,\n encaissed: res.data.encaissed ?? 0,\n amountsPaymentReady: res.data.amounts_payment_ready ?? 0,\n feesPaymentReady: res.data.fees_payment_ready ?? 0,\n paymentReady: res.data.payment_ready ?? 0,\n }\n }\n\n /**\n * Gets statistics data from Ecotrack\n */\n async getStatistics(): Promise<EcotrackStatisticsData> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecotrack/statistics`)\n return {\n topWilaya: (res.data.top_wilaya || []).map((w: any) => ({\n wilayaId: w.wilaya_id ?? 0,\n total: w.total ?? 0,\n retours: w.retours ?? 0,\n livred: w.livred ?? 0,\n wilayaName: w.wilaya_name ?? '',\n })),\n todayActivity: {\n expedie: res.data.today_act?.expedie ?? 0,\n delivered: res.data.today_act?.delivered ?? 0,\n returned: res.data.today_act?.returned ?? 0,\n suspended: res.data.today_act?.suspended ?? 0,\n },\n globalStats: {\n enTraitement: res.data.global?.enTraitement ?? 0,\n livred: res.data.global?.livred ?? 0,\n retours: res.data.global?.retours ?? 0,\n total: res.data.global?.total ?? 0,\n },\n }\n }\n\n /**\n * Gets the sync status for this store's Ecotrack integration\n */\n async getSyncStatus(): Promise<EcotrackSyncStatus> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecotrack/sync/status`)\n return res.data\n }\n\n /**\n * Triggers a sync of orders from Ecotrack\n */\n async triggerSync(options?: {\n startDate?: Date | string\n endDate?: Date | string\n }): Promise<EcotrackSyncResult> {\n const res = await this.client.post(`/stores/${this.storeId}/integrations/ecotrack/sync`, {\n startDate:\n options?.startDate instanceof Date ? options.startDate.toISOString() : options?.startDate,\n endDate: options?.endDate instanceof Date ? options.endDate.toISOString() : options?.endDate,\n })\n return res.data\n }\n}\n\n// ============================================================================\n// Yalidine Integration\n// ============================================================================\n\n/**\n * Yalidine agent type\n */\nexport enum YalidineAgent {\n yalidine = 'yalidine',\n guepex = 'guepex',\n}\n\n/**\n * Yalidine delivery integration configuration\n */\nexport interface YalidineDeliveryIntegration {\n id: string\n token: string\n agent?: YalidineAgent\n active?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Yalidine Delivery Integration API\n */\nexport class YalidineDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: YalidineDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: YalidineDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Yalidine\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/yalidine/fees`, {\n params: {\n id: this.integration.id,\n token: this.integration.token,\n },\n })\n return res.data\n }\n}\n\n// ============================================================================\n// Procolis Integration\n// ============================================================================\n\n/**\n * Procolis delivery integration configuration\n */\nexport interface ProcolisDeliveryIntegration {\n key: string\n token: string\n active?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Procolis Delivery Integration API\n */\nexport class ProcolisDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: ProcolisDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: ProcolisDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Procolis\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/procolis/fees`, {\n params: {\n key: this.integration.key,\n token: this.integration.token,\n },\n })\n return res.data\n }\n\n /**\n * Sends an order to Procolis\n */\n async send(orderId: string): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/procolis/send`, {\n key: this.integration.key,\n token: this.integration.token,\n orderId,\n })\n }\n}\n\n// ============================================================================\n// Noest Integration\n// ============================================================================\n\n/**\n * Noest delivery integration configuration\n */\nexport interface NoestDeliveryIntegration {\n guid: string\n token: string\n active?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Noest Delivery Integration API\n */\nexport class NoestDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: NoestDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: NoestDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Noest\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/noest/fees`, {\n params: {\n guid: this.integration.guid,\n token: this.integration.token,\n },\n })\n return res.data\n }\n\n /**\n * Sends an order to Noest\n */\n async send(orderId: string): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/noest/send`, {\n guid: this.integration.guid,\n token: this.integration.token,\n orderId,\n })\n }\n}\n\n// ============================================================================\n// Google Sheets Integration\n// ============================================================================\n\n/**\n * Google Sheets integration configuration for API calls\n * (Note: For store integrations, use GoogleSheetsIntegration from store.ts)\n */\nexport interface GoogleSheetsIntegrationConfig {\n id: string\n name: string\n active?: boolean\n oauth2?: Record<string, any>\n metadata?: Record<string, any>\n simple?: boolean\n columns?: Array<{\n field: string\n name: string\n enabled: boolean\n defaultValue?: any\n }>\n}\n\n/**\n * Google Sheets Integration API\n */\nexport class GoogleSheetIntegrationApi {\n private client: AxiosInstance\n private integration: GoogleSheetsIntegrationConfig\n private storeId: string\n\n constructor(client: AxiosInstance, integration: GoogleSheetsIntegrationConfig, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Appends a row to the Google Sheet\n */\n async appendRow(values: string[]): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/google-sheets/append-row`, {\n id: this.integration.id,\n name: this.integration.name,\n row: values,\n })\n }\n\n /**\n * Creates a new spreadsheet\n */\n async createSpreadsheet(name: string): Promise<void> {\n await this.client.post(\n `/stores/${this.storeId}/integrations/google-sheets/create-spreadsheet`,\n { name }\n )\n }\n}\n\n// ============================================================================\n// Zimou Integration\n// ============================================================================\n\n/**\n * Zimou delivery integration configuration\n */\nexport interface ZimouDeliveryIntegration {\n id: string\n apiKey: string\n active?: boolean\n silentMode?: boolean\n autoSend?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Zimou Delivery Integration API\n */\nexport class ZimouDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: ZimouDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: ZimouDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Zimou\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/zimou/fees`, {\n params: {\n apiKey: this.integration.apiKey,\n },\n })\n return res.data\n }\n\n /**\n * Sends an order to Zimou\n */\n async send(orderId: string): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/zimou/send`, {\n apiKey: this.integration.apiKey,\n orderId,\n })\n }\n}\n\n// ============================================================================\n// Ecomanager Integration\n// ============================================================================\n\n/**\n * Ecomanager delivery integration configuration\n */\nexport interface EcomanagerDeliveryIntegration {\n baseUrl: string\n token: string\n active?: boolean\n autoSend?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Ecomanager Delivery Integration API\n */\nexport class EcomanagerDeliveryIntegrationApi {\n private client: AxiosInstance\n private integration: EcomanagerDeliveryIntegration\n private storeId: string\n\n constructor(client: AxiosInstance, integration: EcomanagerDeliveryIntegration, storeId: string) {\n this.client = client\n this.integration = integration\n this.storeId = storeId\n }\n\n /**\n * Gets delivery fees from Ecomanager\n */\n async getDeliveryFees(): Promise<DeliveryFees> {\n const res = await this.client.get(`/stores/${this.storeId}/integrations/ecomanager/fees`, {\n params: {\n baseUrl: this.integration.baseUrl,\n token: this.integration.token,\n },\n })\n return res.data\n }\n\n /**\n * Sends an order to Ecomanager\n */\n async send(orderId: string): Promise<void> {\n await this.client.post(`/stores/${this.storeId}/integrations/ecomanager/send`, {\n baseUrl: this.integration.baseUrl,\n token: this.integration.token,\n orderId,\n })\n }\n}\n\n// ============================================================================\n// Integration Factory\n// ============================================================================\n\n/**\n * Factory for creating integration API instances\n */\nexport class IntegrationFactory {\n private client: AxiosInstance\n\n constructor(client: AxiosInstance) {\n this.client = client\n }\n\n /**\n * Creates an Ecotrack integration API\n */\n ecotrack(\n integration: EcotrackDeliveryIntegration,\n storeId: string\n ): EcotrackDeliveryIntegrationApi {\n return new EcotrackDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Yalidine integration API\n */\n yalidine(\n integration: YalidineDeliveryIntegration,\n storeId: string\n ): YalidineDeliveryIntegrationApi {\n return new YalidineDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Procolis integration API\n */\n procolis(\n integration: ProcolisDeliveryIntegration,\n storeId: string\n ): ProcolisDeliveryIntegrationApi {\n return new ProcolisDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Noest integration API\n */\n noest(integration: NoestDeliveryIntegration, storeId: string): NoestDeliveryIntegrationApi {\n return new NoestDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Google Sheets integration API\n */\n googleSheets(\n integration: GoogleSheetsIntegrationConfig,\n storeId: string\n ): GoogleSheetIntegrationApi {\n return new GoogleSheetIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates a Zimou integration API\n */\n zimou(integration: ZimouDeliveryIntegration, storeId: string): ZimouDeliveryIntegrationApi {\n return new ZimouDeliveryIntegrationApi(this.client, integration, storeId)\n }\n\n /**\n * Creates an Ecomanager integration API\n */\n ecomanager(\n integration: EcomanagerDeliveryIntegration,\n storeId: string\n ): EcomanagerDeliveryIntegrationApi {\n return new EcomanagerDeliveryIntegrationApi(this.client, integration, storeId)\n }\n}\n","import { EmbaddedAddress } from '../embadded/address.js'\nimport { EmbaddedCategory } from '../embadded/category.js'\nimport { EmbaddedContact } from '../embadded/contact.js'\nimport { OrderEntity, OrderStatus, DeliveryStatus, PaymentStatus } from './order.js'\nimport { MetaPixelEvent, TiktokPixelEvent } from './product.js'\n// import { OrderEntity } from \"./order.js\";\n// import { ShippingMethodEntity } from \"./shipping_method.js\";\nimport { UserEntity } from './user.js'\nimport { CategoryEntity } from './category.js'\nimport { DateTime } from 'luxon'\n\nexport interface StoreEntity {\n id: string\n slug: string\n banner: StoreBanner | null\n action: StoreAction | null\n domain: StoreDomain | null\n decoration: StoreDecoration | null\n name: string\n iconUrl: string | null\n logoUrl: string | null\n // deprecated\n ondarkLogoUrl: string | null\n userId: string\n categories: EmbaddedCategory[]\n categoriesRelation?: CategoryEntity[]\n title: string | null\n description: string | null\n addresses: EmbaddedAddress[]\n address: EmbaddedAddress | null\n metadata: Record<string, any>\n contacts: EmbaddedContact[]\n integrations?: StoreIntegrations | null\n publicIntegrations: PublicStoreIntegrations | null\n verifiedAt: any | null\n blockedAt: any | null\n createdAt: any\n updatedAt: any\n // products: ProductEntity[];\n user?: UserEntity\n // orders: OrderEntity[];\n // shippingMethods: ShippingMethodEntity[];\n defaultShippingRates: (number | null)[][] | null\n\n shippingPriceId?: string | null\n\n // subscription\n subscription?: any\n due?: number\n\n // StoreConfigs\n configs?: StoreConfigs\n\n // metaPixelIds\n metaPixelIds?: string[] | null\n\n // tiktokPixelIds\n tiktokPixelIds?: string[] | null\n\n // googleAnalyticsId\n googleAnalyticsId?: string | null\n\n // googleTagsId\n googleTagsId?: string | null\n\n // members\n members?: Record<string, StoreMember>\n}\n\n// function that generate public data from the integrations data\nexport const generatePublicStoreIntegrations = (\n integrations: StoreIntegrations | null | undefined\n): PublicStoreIntegrations | null => {\n if (!integrations) return null\n const {\n metaPixel,\n tiktokPixel,\n googleAnalytics,\n googleTags,\n orderdz,\n webhooks,\n ai,\n security,\n customFields,\n payment,\n } = integrations\n return {\n metaPixel: generatePublicStoreIntegrationMetaPixel(metaPixel) || null,\n tiktokPixel: generatePublicStoreIntegrationTiktokPixel(tiktokPixel) || null,\n googleAnalytics: generatePublicStoreIntegrationGoogleAnalytics(googleAnalytics) || null,\n googleTags: generatePublicStoreIntegrationGoogleTags(googleTags) || null,\n googleSheet: null,\n ai: generatePublicStoreIntegrationAi(ai) || null,\n orderdz: generatePublicStoreIntegrationOrderdz(orderdz) || null,\n webhooks: generatePublicStoreIntegrationWebhooks(webhooks) || null,\n security: generatePublicStoreIntegrationSecurity(security) || null,\n customFields: generatePublicStoreIntegrationCustomFields(customFields) || null,\n payment: generatePublicStoreIntegrationPayment(payment) || null,\n }\n}\n\nexport const generatePublicStoreIntegrationCustomFields = (\n customFields: any | null | undefined\n): PublicCustomFieldsIntegration | null | undefined => {\n if (!customFields || !customFields.active) return null\n return {\n fields: (customFields.fields || []).map((field: any) => ({\n id: field.id,\n label: field.label,\n type: field.type,\n required: field.required,\n multiple: field.multiple,\n minCount: field.minCount,\n maxCount: field.maxCount,\n placeholder: field.placeholder,\n helpText: field.helpText,\n regexPattern: field.regexPattern,\n defaultValue: field.defaultValue,\n order: field.order,\n active: field.active,\n })),\n active: customFields.active,\n }\n}\n/**\n * Generates public Meta Pixel integration data from private integration data.\n * Only exposes non-sensitive information (pixel IDs, active status, objectives).\n * Sensitive data like oauth2 tokens, pixel API keys, and metadata are NOT exposed.\n */\nexport const generatePublicStoreIntegrationMetaPixel = (\n metaPixel: MetaPixelIntegration | null | undefined\n): PublicMetaPixelIntegration | null | undefined => {\n if (!metaPixel) return null\n // NOTE: oauth2, pixel.key, and metadata are intentionally excluded for security\n return {\n pixels: metaPixel.pixels.map((pixel) => ({\n id: pixel.id,\n })),\n active: metaPixel.active,\n objective: metaPixel.objective,\n draftObjective: metaPixel.draftObjective,\n }\n}\nexport const generatePublicStoreIntegrationTiktokPixel = (\n tiktokPixel: TiktokPixelIntegration | null | undefined\n): PublicTiktokPixelIntegration | null | undefined => {\n if (!tiktokPixel) return null\n return {\n pixels: tiktokPixel.pixels.map((pixel) => ({\n id: pixel.id,\n })),\n active: tiktokPixel.active,\n objective: tiktokPixel.objective,\n draftObjective: tiktokPixel.draftObjective,\n }\n}\nexport const generatePublicStoreIntegrationGoogleAnalytics = (\n googleAnalytics: GoogleAnalyticsIntegration | null | undefined\n): PublicGoogleAnalyticsIntegration | null | undefined => {\n if (!googleAnalytics) return null\n return {\n id: googleAnalytics.id,\n active: googleAnalytics.active,\n }\n}\nexport const generatePublicStoreIntegrationGoogleSheet = (\n googleSheet: GoogleSheetsIntegration | null | undefined\n): PublicGoogleSheetsIntegration | null | undefined => {\n if (!googleSheet) return null\n return null\n}\nexport const generatePublicStoreIntegrationGoogleTags = (\n googleTags: GoogleTagsIntegration | null | undefined\n): PublicGoogleTagsIntegration | null | undefined => {\n if (!googleTags) return null\n const { id, active } = googleTags\n return {\n id,\n active,\n }\n}\n\n/**\n * Generates public AI integration data from private integration data.\n * Only exposes non-sensitive information, keeping the API key private for security.\n */\nexport const generatePublicStoreIntegrationAi = (\n ai: AiIntegration | null | undefined\n): PublicAiIntegration | null | undefined => {\n if (!ai) return null\n return {\n active: ai.active,\n textModel: ai.textModel,\n imageModel: ai.imageModel,\n }\n}\n\n/**\n * Generates public OrderDZ integration data from private integration data.\n * Only exposes the URL and active status, keeping the token private for security.\n */\nexport const generatePublicStoreIntegrationOrderdz = (\n orderdz: OrderdzIntegration | null | undefined\n): PublicOrderdzIntegration | null | undefined => {\n if (!orderdz) return null\n return {\n url: orderdz.url,\n active: orderdz.active,\n }\n}\n\n/**\n * Generates public webhooks integration data from private integration data.\n * Only exposes non-sensitive information, keeping secrets private for security.\n */\nexport const generatePublicStoreIntegrationWebhooks = (\n webhooks: WebhooksIntegration | null | undefined\n): PublicWebhooksIntegration | null | undefined => {\n if (!webhooks) return null\n\n const activeWebhooks = webhooks.webhooks.filter((webhook) => webhook.active)\n\n return {\n webhookCount: webhooks.webhooks.length,\n activeWebhookCount: activeWebhooks.length,\n active: webhooks.active,\n webhookUrls: activeWebhooks.map((webhook) => webhook.url),\n }\n}\n/**\n * Generates public security integration data from private integration data.\n * Only exposes non-sensitive information, keeping backend protection details private for security.\n */\nexport const generatePublicStoreIntegrationSecurity = (\n security: SecurityIntegration | null | undefined\n): PublicSecurityIntegration | null | undefined => {\n if (!security) return null\n\n return {\n key: '[none]',\n orders: security.orders\n ? {\n frontend: security.orders.frontend,\n }\n : undefined,\n active: security.active,\n }\n}\n\n/**\n * Generates public payment integration data from private integration data.\n * Only exposes non-sensitive information (method IDs, names, active status).\n * Sensitive data like API keys, client secrets are NOT exposed.\n */\nexport const generatePublicStoreIntegrationPayment = (\n payment: PaymentIntegration | null | undefined\n): PublicPaymentIntegration | null | undefined => {\n if (!payment) return null\n\n return {\n active: payment.active,\n methods: payment.methods.map((method) => ({\n id: method.id,\n name: method.name,\n active: method.active,\n // API keys, client secrets, etc. are intentionally excluded\n })),\n defaultMethod: payment.defaultMethod,\n }\n}\n\n/**\n * Public interface for OrderDZ integration.\n * Contains only non-sensitive information that can be safely exposed to clients.\n */\nexport interface PublicOrderdzIntegration {\n url: string\n active: boolean\n}\n\n/**\n * Public interface for webhooks integration.\n * Contains only non-sensitive information that can be safely exposed to clients.\n */\nexport interface PublicWebhooksIntegration {\n /** Total number of configured webhooks */\n webhookCount: number\n /** Number of active webhooks */\n activeWebhookCount: number\n /** Whether the integration is active */\n active: boolean\n /** List of active webhook URLs (without secrets) */\n webhookUrls: string[]\n}\n\nexport interface PublicMetaPixelIntegration {\n pixels: { id: string }[]\n active: boolean\n objective?: MetaPixelEvent | null\n draftObjective?: MetaPixelEvent | null\n}\nexport interface PublicTiktokPixelIntegration {\n pixels: { id: string }[]\n active: boolean\n objective?: TiktokPixelEvent | null\n draftObjective?: TiktokPixelEvent | null\n}\nexport interface PublicGoogleAnalyticsIntegration {\n id: string\n active: boolean\n}\nexport interface PublicGoogleSheetsIntegration {\n id: string\n active: boolean\n}\nexport interface PublicGoogleTagsIntegration {\n id: string\n active: boolean\n}\n\nexport interface PublicAiIntegration {\n active: boolean\n textModel: string\n imageModel: string\n}\n\nexport interface PublicCustomField {\n id: string\n label: string\n type: string\n required?: boolean\n multiple?: boolean\n minCount?: number\n maxCount?: number\n placeholder?: string\n helpText?: string\n regexPattern?: string\n defaultValue?: any\n order?: number\n active?: boolean\n}\n\nexport interface PublicCustomFieldsIntegration {\n fields: PublicCustomField[]\n active: boolean\n}\n\n/**\n * Public payment method (no sensitive data like API keys)\n */\nexport interface PublicPaymentMethod {\n id: string // Slug identifier (e.g., 'chargily', 'paypal')\n name: string // Display name (e.g., 'Chargily Pay', 'PayPal')\n active: boolean\n}\n\n/**\n * Public payment integration (exposes only non-sensitive information)\n */\nexport interface PublicPaymentIntegration {\n active: boolean\n methods: PublicPaymentMethod[]\n defaultMethod?: string // Method ID to use by default\n}\n\nexport interface PublicStoreIntegrations {\n metaPixel: PublicMetaPixelIntegration | null\n tiktokPixel: PublicTiktokPixelIntegration | null\n googleAnalytics: PublicGoogleAnalyticsIntegration | null\n googleSheet: PublicGoogleSheetsIntegration | null\n googleTags: PublicGoogleTagsIntegration | null\n ai: PublicAiIntegration | null\n orderdz: PublicOrderdzIntegration | null\n webhooks: PublicWebhooksIntegration | null\n security: PublicSecurityIntegration | null\n customFields: PublicCustomFieldsIntegration | null\n payment: PublicPaymentIntegration | null\n}\n\nexport enum StoreMemberRole {\n editor = 'editor',\n viewer = 'viewer',\n confermer = 'confermer',\n}\n\nexport interface StoreMember {\n name: string\n userId: string\n role: StoreMemberRole\n acceptedAt: any | null\n expiredAt: any | null\n createdAt: any\n active: boolean\n metadata: Record<string, any>\n}\n\nexport interface StoreConfigs {\n currencies: StoreCurrencyConfig[]\n selectedCurrency: string\n languages?: StoreLanguageConfig[]\n defaultLanguage?: string\n countries?: StoreCountryConfig[]\n selectedCountry?: string\n customStatusMappings?: CustomStatusMapping[]\n /** Feature flag to enable custom statuses across the app */\n customStatusEnabled?: boolean\n}\n\nexport interface CustomStatusMapping {\n /** The custom status name (e.g., \"not_respond\", \"phone_closed_1\") */\n name: string\n /** Auto-generated code based on name if not provided (e.g., \"not_respond\" -> \"not_respond\") */\n code?: string\n /** Optional color for UI display (hex color as number) */\n color?: number\n /** Whether this custom status is enabled and should be shown in UI */\n enabled?: boolean\n /** Status to map to (null means no change) */\n status?: OrderStatus | null\n /** Delivery status to map to (null means no change) */\n deliveryStatus?: DeliveryStatus | null\n /** Payment status to map to (null means no change) */\n paymentStatus?: PaymentStatus | null\n}\n\nexport interface StoreCurrencyConfig {\n code: string\n symbol: string\n precision: number\n rate: number\n}\n\nexport interface StoreLanguageConfig {\n code: string\n name: string\n nativeName: string\n rtl?: boolean\n}\n\nexport interface StoreCountryConfig {\n code: string\n name: string\n nativeName: string\n}\n\nexport interface StoreDomain {\n name: string\n verifiedAt: any | null\n metadata: Record<string, any>\n}\nexport interface StoreBanner {\n title: string\n url?: string | null\n enabled: boolean\n metadata: Record<string, any>\n}\n\nexport interface StoreDecoration {\n // primary\n primary: number\n onPrimary?: number\n // on dark mode\n primaryDark?: number\n onPrimaryDark?: number\n // secondary\n secondary?: number\n onSecondary?: number\n // on dark mode\n secondaryDark?: number\n onSecondaryDark?: number\n\n useLogoDarkFilter?: boolean\n\n showStoreLogoInHeader?: boolean\n logoFullHeight?: boolean\n showStoreNameInHeader?: boolean\n metadata?: Record<string, any>\n [key: string]: any\n}\n\nexport interface StoreAction {\n label: string\n url: string\n type: StoreActionType\n}\n\nexport enum StoreActionType {\n link = 'link',\n whatsapp = 'whatsapp',\n telegram = 'telegram',\n phone = 'phone',\n}\nexport interface MetaPixel {\n name?: string\n id: string\n key?: string\n}\n\n/**\n * Facebook Marketing OAuth data\n * Used for accessing Facebook Marketing API (pixels, ads, etc.)\n */\nexport interface FacebookMarketingOAuth {\n accessToken: string\n tokenType?: string\n expiresIn?: number\n expiresAt?: string // ISO date string\n scopes?: string[]\n}\n\n// tiktok pixel\nexport interface TiktokPixel {\n name?: string\n id: string\n accessToken?: string\n}\n// meta pixel integration\nexport interface MetaPixelIntegration {\n id: string\n pixels: MetaPixel[]\n objective?: MetaPixelEvent | null\n draftObjective?: MetaPixelEvent | null\n active: boolean\n metadata: Record<string, any>\n /** Facebook Marketing OAuth data - for accessing pixels via API */\n oauth2?: FacebookMarketingOAuth | null\n}\n// tiktok pixel integration\nexport interface TiktokPixelIntegration {\n id: string\n pixels: TiktokPixel[]\n objective?: TiktokPixelEvent | null\n draftObjective?: TiktokPixelEvent | null\n active: boolean\n metadata: Record<string, any>\n}\n\nexport interface GoogleAnalyticsIntegration {\n id: string\n active: boolean\n metadata: Record<string, any>\n}\n\n// export enum GoogleSheetsColumnType {\n// string = 'string',\n// number = 'number',\n// boolean = 'boolean',\n// date = 'date',\n// }\n\nexport interface GoogleSheetsColumn<T> {\n // it can be path in json field for exmple metadata.customData\n field: keyof OrderEntity | string | 'skus' | 'quantities' | 'itemsNames'\n name: string\n enabled: boolean\n defaultValue?: T\n // type:\n}\nexport interface GoogleSheetsIntegration {\n id: string\n name: string\n active: boolean\n oauth2?: Record<string, any>\n metadata: Record<string, any>\n simple?: boolean\n columns?: GoogleSheetsColumn<any>[]\n}\nexport interface GoogleTagsIntegration {\n id: string\n active: boolean\n metadata: Record<string, any>\n}\n\n/**\n * AI integration configuration for Google AI Studio.\n */\nexport interface AiIntegration {\n active: boolean\n apiKey?: string\n textModel: string\n imageModel: string\n metadata: Record<string, any>\n}\n\n/**\n * OrderDZ integration configuration for order confirmation service.\n * This integration allows automatic order confirmation via OrderDZ API.\n */\nexport interface OrderdzIntegration {\n /** Unique identifier for this integration instance */\n id: string\n /** API endpoint URL for OrderDZ service (e.g., \"https://orderdz.com/api/v1/feeef/order\") */\n url: string\n /** Authentication token for OrderDZ API */\n token: string\n /** Whether this integration is currently active */\n active: boolean\n /** Whether to automatically send orders when they are marked as sent */\n autoSend?: boolean\n /** Additional metadata for the integration */\n metadata: Record<string, any>\n}\n\n/**\n * Ecomanager integration configuration for delivery management.\n * This integration allows order management and tracking via Ecomanager API.\n */\nexport interface EcomanagerIntegration {\n active: boolean\n baseUrl: string\n token: string\n autoSend?: boolean\n metadata?: Record<string, any>\n}\n\n/**\n * Zimou Express integration configuration for delivery management.\n * This integration allows order management and tracking via Zimou Express API.\n */\nexport interface ZimouIntegration {\n /** Unique identifier for this integration instance */\n id: string\n /** API authentication key for Zimou Express */\n apiKey: string\n /** Whether this integration is currently active */\n active: boolean\n /** Whether to send orders directly without confirmation dialog */\n silentMode?: boolean\n /** Whether to automatically send orders when they are marked as sent */\n autoSend?: boolean\n /** Additional metadata for the integration */\n metadata?: Record<string, any>\n}\n\n/**\n * ZR Express integration configuration for delivery management.\n * This integration allows order management and tracking via ZR Express API.\n * Uses header-based authentication (x-api-key, x-tenant).\n */\nexport interface ZrexpressIntegration {\n /** Unique identifier for this integration instance */\n id: string\n /** API key for ZR Express (x-api-key header) */\n apiKey: string\n /** Tenant UUID for ZR Express (x-tenant header) */\n tenantId: string\n /** Whether this integration is currently active */\n active: boolean\n /** Whether to send orders directly without confirmation dialog */\n silentMode?: boolean\n /** Whether to automatically send orders when they are marked as sent */\n autoSend?: boolean\n /** Additional metadata for the integration */\n metadata?: Record<string, any>\n}\n\nexport interface SecurityIntegrationOrdersProtection {\n frontend: {\n active: boolean\n }\n backend: {\n active: boolean\n phoneTtl: number\n ipTtl: number\n blockDirectOrders: boolean\n adsOnlyMode: boolean\n }\n}\nexport interface PublicSecurityIntegrationOrdersProtection {\n frontend: {\n active: boolean\n }\n}\nexport interface SecurityIntegration {\n orders?: SecurityIntegrationOrdersProtection\n\n /** Whether this integration is currently active */\n active: boolean\n /** Additional metadata for the integration */\n metadata?: Record<string, any>\n}\nexport interface PublicSecurityIntegration {\n key?: string | null\n orders?: PublicSecurityIntegrationOrdersProtection\n\n /** Whether this integration is currently active */\n active: boolean\n /** Additional metadata for the integration */\n metadata?: Record<string, any>\n}\n\n/**\n * Webhook event types for order lifecycle\n */\nexport enum WebhookEvent {\n ORDER_CREATED = 'orderCreated',\n ORDER_UPDATED = 'orderUpdated',\n ORDER_DELETED = 'orderDeleted',\n}\n\n/**\n * Individual webhook configuration\n */\nexport interface WebhookConfig {\n /** Unique identifier for this webhook */\n id: string\n /** Human-readable name for this webhook */\n name: string\n /** Target URL where webhook events will be sent */\n url: string\n /** Events this webhook is subscribed to */\n events: WebhookEvent[]\n /** Optional secret key for HMAC signature verification */\n secret?: string\n /** Whether this webhook is currently active */\n active: boolean\n /** Additional HTTP headers to send with webhook requests */\n headers?: Record<string, string>\n /** Additional metadata for this webhook */\n metadata: Record<string, any>\n}\n\n/**\n * Webhooks integration configuration for real-time order notifications\n */\nexport interface WebhooksIntegration {\n /** List of configured webhooks */\n webhooks: WebhookConfig[]\n /** Whether the webhooks integration is active */\n active: boolean\n /** Additional metadata for the integration */\n metadata: Record<string, any>\n}\n\n/**\n * Payment method configuration (includes sensitive data like API keys)\n */\nexport interface PaymentMethodConfig {\n id: string // Slug identifier (e.g., 'chargily', 'paypal')\n name: string // Display name (e.g., 'Chargily Pay', 'PayPal')\n active: boolean\n // Method-specific configuration\n apiKey?: string // For Chargily\n clientId?: string // For PayPal, Stripe, etc.\n clientSecret?: string // For PayPal, Stripe, etc.\n [key: string]: any // Allow other method-specific fields\n}\n\n/**\n * Payment integration configuration\n */\nexport interface PaymentIntegration {\n active: boolean\n methods: PaymentMethodConfig[]\n defaultMethod?: string // Method ID to use by default\n metadata?: Record<string, any>\n}\n\nexport interface StoreIntegrations {\n [key: string]: any\n metadata?: Record<string, any>\n\n // @Default('default') String id,\n // @Default([]) List<MetaPixel> pixels,\n // @Default(true) bool active,\n // @Default({}) Map<String, dynamic> metadata,\n metaPixel?: MetaPixelIntegration\n tiktokPixel?: TiktokPixelIntegration\n googleAnalytics?: GoogleAnalyticsIntegration\n googleSheet?: GoogleSheetsIntegration\n googleTags?: GoogleTagsIntegration\n ai?: AiIntegration\n orderdz?: OrderdzIntegration\n webhooks?: WebhooksIntegration\n payment?: PaymentIntegration\n\n sms?: any\n telegram?: any\n yalidine?: any\n maystroDelivery?: any\n echotrak?: any\n ecotrack?: any\n ecomanager?: EcomanagerIntegration\n procolis?: any\n noest?: any\n zimou?: ZimouIntegration\n zrexpress?: ZrexpressIntegration\n\n security?: SecurityIntegration\n}\n\nexport enum StoreSubscriptionStatus {\n active = 'active',\n inactive = 'inactive',\n}\n\nexport enum StoreSubscriptionType {\n free = 'free',\n premium = 'premium',\n vip = 'vip',\n custom = 'custom',\n}\n\nexport interface StoreSubscription {\n type: StoreSubscriptionType\n name: string\n status: StoreSubscriptionStatus\n startedAt: DateTime\n expiresAt: DateTime | null\n quota: number\n consumed: number\n remaining: number\n metadata: Record<string, any>\n}\n\n/**\n * Input data for creating a new store\n */\nexport interface StoreCreateInput {\n name: string\n slug?: string\n title?: string\n description?: string\n iconUrl?: string\n logoUrl?: string\n ondarkLogoUrl?: string\n categories?: EmbaddedCategory[]\n addresses?: EmbaddedAddress[]\n contacts?: EmbaddedContact[]\n decoration?: StoreDecoration\n domain?: StoreDomain\n banner?: StoreBanner\n action?: StoreAction\n metadata?: Record<string, any>\n defaultShippingRates?: (number | null)[][] | null\n shippingPriceId?: string\n configs?: StoreConfigs\n metaPixelIds?: string[]\n tiktokPixelIds?: string[]\n googleAnalyticsId?: string\n googleTagsId?: string\n}\n\n/**\n * Input data for updating an existing store\n */\nexport interface StoreUpdateInput {\n name?: string\n slug?: string\n title?: string\n description?: string\n iconUrl?: string\n logoUrl?: string\n ondarkLogoUrl?: string\n categories?: EmbaddedCategory[]\n addresses?: EmbaddedAddress[]\n contacts?: EmbaddedContact[]\n decoration?: StoreDecoration\n domain?: StoreDomain\n banner?: StoreBanner\n action?: StoreAction\n metadata?: Record<string, any>\n defaultShippingRates?: (number | null)[][] | null\n shippingPriceId?: string\n configs?: StoreConfigs\n metaPixelIds?: string[]\n tiktokPixelIds?: string[]\n googleAnalyticsId?: string\n googleTagsId?: string\n integrations?: StoreIntegrations\n}\n\n/**\n * Store summary data\n */\nexport interface StoreSummary {\n ordersCount: number\n productsCount: number\n revenue: number\n topProducts?: Array<{ id: string; name: string; sold: number }>\n ordersByStatus?: Record<string, number>\n recentOrders?: any[]\n}\n\n/**\n * Input for adding a store member\n */\nexport interface AddStoreMemberInput {\n email: string\n role: StoreMemberRole\n name?: string\n metadata?: Record<string, any>\n}\n\n/**\n * Input for updating a store member\n */\nexport interface UpdateStoreMemberInput {\n role?: StoreMemberRole\n name?: string\n metadata?: Record<string, any>\n}\n","import { EmbaddedCategory } from '../embadded/category.js'\nimport { ShippingMethodEntity } from './shipping_method.js'\nimport { GoogleSheetsColumn, StoreEntity } from './store.js'\nimport { CategoryEntity } from './category.js'\n\nexport interface ProductEntity {\n id: string\n\n slug: string\n\n decoration: ProductDecoration | null\n\n name: string | null\n\n photoUrl: string | null\n\n media: string[]\n\n storeId: string\n\n shippingMethodId?: string | null\n\n shippingPriceId?: string | null\n\n categoryId?: string | null\n\n category?: EmbaddedCategory | null\n\n categoryRelation?: CategoryEntity | null\n\n title: string | null\n\n description: string | null\n\n body: string | null\n\n // sku\n sku: string | null\n\n price: number\n\n cost: number | null\n\n discount: number | null\n\n stock: number | null\n\n sold: number\n\n views: number\n\n likes: number\n\n dislikes: number\n\n variant?: ProductVariant | null\n\n offers?: ProductOffer[] | null\n\n metadata: Record<string, any>\n\n status: ProductStatus\n\n type: ProductType\n\n verifiedAt: any | null\n\n blockedAt: any | null\n\n createdAt: any\n\n updatedAt: any\n\n addons?: ProductAddon[] | null\n\n // integrations configs\n integrationsData?: IntegrationsData | null\n publicIntegrationsData?: IntegrationsData | null\n\n // relations\n store?: StoreEntity | null\n shippingMethod?: ShippingMethodEntity | null\n}\n\n// function that generate public data from the integrations data\nexport function generatePublicIntegrationsData(data: IntegrationsData | null | null): any {\n if (!data) return data\n const { metaPixelData, tiktokPixelData, googleAnalyticsData, googleTagsData, paymentMethodData } =\n data\n return {\n metaPixelData: generatePublicIntegrationsDataMetaPixel(metaPixelData),\n tiktokPixelData: generatePublicIntegrationsDataTiktokPixel(tiktokPixelData),\n googleAnalyticsData: generatePublicIntegrationsDataGoogleAnalytics(googleAnalyticsData),\n googleTagsData: generatePublicIntegrationsDataGoogleTag(googleTagsData),\n paymentMethodData: generatePublicIntegrationsDataPaymentMethod(paymentMethodData),\n }\n}\n// function that generate public data from the meta pixel data\nexport function generatePublicIntegrationsDataMetaPixel(\n data: MetaPixelData | null | undefined\n): PublicMetaPixelData | null | undefined {\n if (!data) return data\n const { ids, objective, draftObjective } = data\n return {\n ids: ids,\n objective,\n draftObjective,\n }\n}\n// function that generate public data from the tiktok pixel data\nexport function generatePublicIntegrationsDataTiktokPixel(\n data: TiktokPixelData | null | undefined\n): PublicTiktokPixelData | null | undefined {\n if (!data) return data\n const { ids, objective, draftObjective } = data\n return {\n ids: ids,\n objective,\n draftObjective,\n }\n}\n// function that generate public data from the google analytics data\nexport function generatePublicIntegrationsDataGoogleAnalytics(\n data: GoogleAnalyticsData | null | undefined\n): PublicGoogleAnalyticsData | null | undefined {\n if (!data) return data\n return {}\n}\n// function that generate public data from the google tag data\nexport function generatePublicIntegrationsDataGoogleTag(\n data: GoogleTagData | null | undefined\n): PublicGoogleTagData | null | undefined {\n if (!data) return data\n return {}\n}\n// function that generate public data from the google sheets data\nexport function generatePublicIntegrationsDataGoogleSheets(\n data: GoogleSheetsData | null | undefined\n): PublicGoogleSheetsData | null | undefined {\n if (!data) return data\n return {}\n}\n\nexport interface IntegrationsData {\n metaPixelData?: MetaPixelData | null\n tiktokPixelData?: TiktokPixelData | null\n googleAnalyticsData?: GoogleAnalyticsData | null\n googleTagsData?: GoogleTagData | null\n googleSheetsData?: GoogleSheetsData | null\n paymentMethodData?: PaymentMethodData | null\n}\n\nexport enum MetaPixelEvent {\n none = 'none',\n lead = 'Lead',\n purchase = 'Purchase',\n viewContent = 'ViewContent',\n addToCart = 'AddToCart',\n initiateCheckout = 'InitiateCheckout',\n}\nexport interface MetaPixelData {\n // active meta pixel ids\n ids: string[] | null\n // main objective\n objective: MetaPixelEvent | null\n // draft objective\n draftObjective: MetaPixelEvent | null\n}\n\nexport enum TiktokPixelEvent {\n none = 'none',\n viewContent = 'ViewContent',\n addToWishlist = 'AddToWishlist',\n search = 'Search',\n addPaymentInfo = 'AddPaymentInfo',\n addToCart = 'AddToCart',\n initiateCheckout = 'InitiateCheckout',\n placeAnOrder = 'PlaceAnOrder',\n completeRegistration = 'CompleteRegistration',\n purchase = 'Purchase',\n}\nexport interface TiktokPixelData {\n // active tiktok pixel ids\n ids: string[] | null\n // main objective\n objective: TiktokPixelEvent | null\n // draft objective\n draftObjective: TiktokPixelEvent | null\n}\nexport interface GoogleAnalyticsData {}\nexport interface GoogleTagData {}\nexport interface GoogleSheetsData {\n enabled: boolean\n // use cant use both sheetId and sheetName\n sheetId: string | null\n // if sheetId is null, use sheetName\n // if sheetName not exists in the spreadsheet, create it\n sheetName: string | null\n spreadsheetId: string | null\n // the next row to insert data\n nextRow: number | null\n // columns to insert data\n columns: GoogleSheetsColumn<any>[] | null\n}\n\n// public meta pixel data\nexport interface PublicMetaPixelData {\n ids: string[] | null\n objective: MetaPixelEvent | null\n draftObjective: MetaPixelEvent | null\n}\n// public tiktok pixel data\nexport interface PublicTiktokPixelData {\n ids: string[] | null\n objective: TiktokPixelEvent | null\n draftObjective: TiktokPixelEvent | null\n}\n// public google analytics data\nexport interface PublicGoogleAnalyticsData {}\n// public google tag data\nexport interface PublicGoogleTagData {}\n// public google sheets data\nexport interface PublicGoogleSheetsData {}\n\n/**\n * Payment method data for product-level override\n */\nexport interface PaymentMethodData {\n methodId?: string // Which payment method ID to use (optional, falls back to store default)\n enabled: boolean\n}\n\n/**\n * Public payment method data (same structure, no sensitive data)\n */\nexport interface PublicPaymentMethodData {\n methodId?: string\n enabled: boolean\n}\n\n// function that generate public data from the payment method data\nexport function generatePublicIntegrationsDataPaymentMethod(\n data: PaymentMethodData | null | undefined\n): PublicPaymentMethodData | null | undefined {\n if (!data) return data\n return {\n methodId: data.methodId,\n enabled: data.enabled,\n }\n}\n\nexport interface ProductAddon {\n photoUrl?: string\n title: string\n subtitle?: string\n stock?: number\n price?: number\n min?: number\n max?: number\n}\n\nexport enum ProductStatus {\n draft = 'draft',\n published = 'published',\n archived = 'archived',\n deleted = 'deleted',\n}\n\nexport interface ProductDecoration {\n metadata: Record<string, any>\n}\n\nexport interface ProductVariant {\n name: string\n view?: ProductVariantView\n options: ProductVariantOption[]\n required?: boolean\n}\n\nexport enum ProductVariantView {\n list = 'list',\n chips = 'chips',\n dropdown = 'dropdown',\n}\n\nexport interface ProductVariantOption {\n name: string\n sku?: string | null\n price?: number | null\n discount?: number | null\n stock?: number | null\n sold?: number | null\n type?: VariantOptionType\n child?: ProductVariant | null\n mediaIndex?: number | null\n hint?: string | null\n value?: any\n mediaId?: string | null\n hidden?: boolean\n}\n\nexport enum VariantOptionType {\n color = 'color',\n image = 'image',\n text = 'text',\n}\n\nexport enum ProductType {\n physical = 'physical',\n digital = 'digital',\n service = 'service',\n}\n\nexport interface ProductOffer {\n code: string\n title: string\n subtitle?: string\n price?: number\n minQuantity?: number\n maxQuantity?: number\n freeShipping?: boolean\n}\n\n/**\n * Input data for creating a new product\n */\nexport interface ProductCreateInput {\n name: string\n storeId: string\n slug?: string\n photoUrl?: string\n media?: string[]\n shippingMethodId?: string\n shippingPriceId?: string\n categoryId?: string\n category?: EmbaddedCategory\n title?: string\n description?: string\n body?: string\n sku?: string\n price: number\n cost?: number\n discount?: number\n stock?: number\n variant?: ProductVariant\n offers?: ProductOffer[]\n addons?: ProductAddon[]\n metadata?: Record<string, any>\n status?: ProductStatus\n type?: ProductType\n decoration?: ProductDecoration\n integrationsData?: IntegrationsData\n}\n\n/**\n * Input data for updating an existing product\n */\nexport interface ProductUpdateInput {\n name?: string\n slug?: string\n photoUrl?: string\n media?: string[]\n shippingMethodId?: string\n shippingPriceId?: string\n categoryId?: string\n category?: EmbaddedCategory\n title?: string\n description?: string\n body?: string\n sku?: string\n price?: number\n cost?: number\n discount?: number\n stock?: number\n variant?: ProductVariant\n offers?: ProductOffer[]\n addons?: ProductAddon[]\n metadata?: Record<string, any>\n status?: ProductStatus\n type?: ProductType\n decoration?: ProductDecoration\n integrationsData?: IntegrationsData\n}\n\n/**\n * Product report/analytics data\n */\nexport interface ProductReport {\n views: number\n likes: number\n dislikes: number\n sold: number\n revenue: number\n conversionRate: number\n averageOrderValue: number\n topVariants?: Array<{ path: string; sold: number }>\n salesByDate?: Record<string, number>\n}\n","/**\n * Feedback status enum\n */\nexport enum FeedbackStatus {\n open = 'open',\n inProgress = 'in_progress',\n resolved = 'resolved',\n closed = 'closed',\n}\n\n/**\n * Feedback priority enum\n */\nexport enum FeedbackPriority {\n low = 'low',\n medium = 'medium',\n high = 'high',\n critical = 'critical',\n}\n\n/**\n * Feedback comment interface\n */\nexport interface FeedbackComment {\n id: string\n userId: string\n comment: string\n createdAt: any\n}\n\n/**\n * Feedback attachment interface\n */\nexport interface FeedbackAttachment {\n url: string\n name: string\n type: string\n size?: number\n}\n\n/**\n * Feedback entity interface\n */\nexport interface FeedbackEntity {\n id: string\n userId: string\n title: string\n details: string | null\n status: FeedbackStatus\n priority: FeedbackPriority\n tags: string[]\n attachments: FeedbackAttachment[]\n comments: FeedbackComment[]\n appVersion: string | null\n metadata: Record<string, any>\n resolvedAt: any | null\n createdAt: any\n updatedAt: any\n}\n\n/**\n * Input data for creating a new feedback\n */\nexport interface FeedbackCreateInput {\n title: string\n details?: string\n priority?: FeedbackPriority\n tags?: string[]\n attachments?: FeedbackAttachment[]\n appVersion?: string\n metadata?: Record<string, any>\n}\n\n/**\n * Input data for updating an existing feedback\n */\nexport interface FeedbackUpdateInput {\n title?: string\n details?: string\n status?: FeedbackStatus\n priority?: FeedbackPriority\n tags?: string[]\n attachments?: FeedbackAttachment[]\n appVersion?: string\n metadata?: Record<string, any>\n comment?: string\n}\n\n/**\n * Options for listing feedbacks\n */\nexport interface FeedbackListOptions {\n page?: number\n offset?: number\n limit?: number\n status?: FeedbackStatus[]\n priority?: FeedbackPriority[]\n tags?: string[]\n q?: string\n createdAfter?: Date | string\n createdBefore?: Date | string\n updatedAfter?: Date | string\n updatedBefore?: Date | string\n resolvedAfter?: Date | string\n resolvedBefore?: Date | string\n resolved?: boolean\n}\n","export enum EmbaddedContactType {\n phone = 'phone',\n email = 'email',\n facebook = 'facebook',\n twitter = 'twitter',\n instagram = 'instagram',\n linkedin = 'linkedin',\n website = 'website',\n whatsapp = 'whatsapp',\n telegram = 'telegram',\n signal = 'signal',\n viber = 'viber',\n skype = 'skype',\n zoom = 'zoom',\n other = 'other',\n}\n\n// EmbaddedContactType is not enum but can only be: \"phone\" | \"email\" | \"facebook\" | \"twitter\" | \"instagram\" | \"linkedin\" | \"website\" | \"whatsapp\" | \"telegram\" | \"signal\" | \"viber\" | \"skype\" | \"zoom\" | \"other\n\nexport interface EmbaddedContact {\n type: EmbaddedContactType\n value: string\n name?: string\n metadata?: Record<string, any>\n}\n","/**\n * Converts a Dart color (0xffXXXXXX) to a CSS-compatible number (0xXXXXXXFF).\n *\n * @param dartColor - The Dart color represented as a 32-bit integer (0xffXXXXXX).\n * @returns A number representing the color in CSS format (0xXXXXXXFF).\n */\nexport const convertDartColorToCssNumber = (dartColor: number): number => {\n const alpha = (dartColor >> 24) & 0xff // Extract alpha (high 8 bits)\n const rgb = dartColor & 0xffffff // Extract RGB (low 24 bits)\n\n // Return color as 0xXXXXXXFF (CSS format: RGB + alpha)\n return (rgb << 8) | alpha\n}\n\n/**\n * Converts a CSS color (0xXXXXXXFF) to HSL format.\n *\n * @param cssColor - The CSS color represented as a 32-bit integer (0xXXXXXXFF).\n * @returns An object with HSL values {h, s, l}.\n */\nexport const cssColorToHslString = (cssColor: number): string => {\n const r = ((cssColor >> 24) & 0xff) / 255 // Extract red channel\n const g = ((cssColor >> 16) & 0xff) / 255 // Extract green channel\n const b = ((cssColor >> 8) & 0xff) / 255 // Extract blue channel\n\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n let h = 0\n let s = 0\n let l = (max + min) / 2\n\n if (max !== min) {\n const d = max - min\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0)\n break\n case g:\n h = (b - r) / d + 2\n break\n case b:\n h = (r - g) / d + 4\n break\n }\n h /= 6\n }\n\n return `${Math.round(h * 360)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%`\n}\n\n/**\n * Trims and attempts to fix the phone number by:\n * - Removing all non-numeric characters\n * - Ensuring it starts with a '0'\n * @param phone - The input phone number string\n * @returns The cleaned phone number\n */\nexport function tryFixPhoneNumber(phone: string): string {\n phone = phone.trim() // Remove leading/trailing spaces\n // Remove all non-numeric characters\n phone = phone.replace(/\\D/g, '')\n // Ensure the phone number starts with '0'\n if (!phone.startsWith('0')) {\n phone = '0' + phone\n }\n return phone\n}\n\n/**\n * Validates the phone number based on specific rules:\n * - Cannot be empty or just \"0\"\n * - Must start with '05', '06', '07', or '02'\n * - Must be 10 digits for mobile numbers (05, 06, 07)\n * - Must be 9 digits for landline numbers (02)\n * @param phone - The input phone number string\n * @returns Error message if validation fails, otherwise null\n */\nexport function validatePhoneNumber(phone: string): string | null {\n // Helper function to handle length overflow/underflow messages\n const getLengthError = (requiredLength: number, actualLength: number): string => {\n const difference = actualLength - requiredLength\n if (difference > 0) {\n return `عدد الأرقام زائد عن ${requiredLength} رقماً بـ ${difference}`\n } else {\n const missingDigits = -difference\n if (missingDigits === 1) return 'ينقصك رقم واحد'\n if (missingDigits === 2) return 'ينقصك رقمان'\n return `ينقصك ${missingDigits} أرقام`\n }\n }\n\n if (phone === '0') {\n return 'اكمل رقم الهاتف'\n }\n\n // Check if phone number is empty\n if (!phone) {\n return 'رقم الهاتف لا يمكن أن يكون فارغاً.'\n }\n\n // Check if phone number contains only digits\n if (!/^\\d+$/.test(phone)) {\n return 'رقم الهاتف يجب أن يحتوي فقط على أرقام.'\n }\n\n // Ensure the phone starts with valid prefixes\n if (!/^(05|06|07|02)/.test(phone)) {\n return 'يجب أن يبدأ بـ 05, 06, 07, أو 02'\n }\n\n const length = phone.length\n\n // Validate mobile numbers (05, 06, 07 should be 10 digits)\n if (/^(05|06|07)/.test(phone)) {\n if (length !== 10) {\n return getLengthError(10, length)\n }\n }\n\n // Validate landline numbers (02 should be 9 digits)\n else if (phone.startsWith('02')) {\n if (length !== 9) {\n return getLengthError(9, length)\n }\n }\n\n // If all checks pass, return null (no errors)\n return null\n}\n"],"mappings":";AAAA,OAAO,WAA8B;;;ACQ9B,IAAe,kBAAf,MAAwC;AAAA,EAC7C;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAY,UAAkB,QAAuB;AACnD,SAAK,WAAW;AAChB,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,KAAK,SAAuC;AAChD,UAAM,EAAE,IAAI,IAAI,OAAO,IAAI;AAC3B,UAAM,MAAM,MAAM,KAAK,OAAO,IAAI,IAAI,KAAK,QAAQ,IAAI,EAAE,IAAI;AAAA,MAC3D,QAAQ;AAAA,QACN,IAAI,MAAM;AAAA,QACV,GAAG;AAAA,MACL;AAAA,IACF,CAAC;AACD,WAAO,IAAI;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,KAAK,SAAsD;AAC/D,UAAM,EAAE,MAAM,QAAQ,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K,KAAK,MAAM,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,IAAI,GAAG,CAAC;AAChF;AASO,SAAS,kBAAkB,OAAuB;AACvD,UAAQ,MAAM,KAAK;AAEnB,UAAQ,MAAM,QAAQ,OAAO,EAAE;AAE/B,MAAI,CAAC,MAAM,WAAW,GAAG,GAAG;AAC1B,YAAQ,MAAM;AAAA,EAChB;AACA,SAAO;AACT;AAWO,SAAS,oBAAoB,OAA8B;AAEhE,QAAM,iBAAiB,CAAC,gBAAwB,iBAAiC;AAC/E,UAAM,aAAa,eAAe;AAClC,QAAI,aAAa,GAAG;AAClB,aAAO,uGAAuB,cAAc,gDAAa,UAAU;AAAA,IACrE,OAAO;AACL,YAAM,gBAAgB,CAAC;AACvB,UAAI,kBAAkB,EAAG,QAAO;AAChC,UAAI,kBAAkB,EAAG,QAAO;AAChC,aAAO,kCAAS,aAAa;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI,UAAU,KAAK;AACjB,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,QAAQ,KAAK,KAAK,GAAG;AACxB,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,iBAAiB,KAAK,KAAK,GAAG;AACjC,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,MAAM;AAGrB,MAAI,cAAc,KAAK,KAAK,GAAG;AAC7B,QAAI,WAAW,IAAI;AACjB,aAAO,eAAe,IAAI,MAAM;AAAA,IAClC;AAAA,EACF,WAGS,MAAM,WAAW,IAAI,GAAG;AAC/B,QAAI,WAAW,GAAG;AAChB,aAAO,eAAe,GAAG,MAAM;AAAA,IACjC;AAAA,EACF;AAGA,SAAO;AACT;","names":["options","res","DeliveryServiceFilter","OrderStatus","PaymentStatus","DeliveryStatus","ShippingType","ShippingMethodStatus","ShippingMethodPolicy","ShippingPriceStatus","YalidineAgent","StoreMemberRole","StoreActionType","WebhookEvent","StoreSubscriptionStatus","StoreSubscriptionType","MetaPixelEvent","TiktokPixelEvent","ProductStatus","ProductVariantView","VariantOptionType","ProductType","FeedbackStatus","FeedbackPriority","EmbaddedContactType"]}
|