feeef 0.6.0 → 0.6.2

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.
@@ -0,0 +1,330 @@
1
+ import { AxiosInstance } from 'axios';
2
+ /**
3
+ * Delivery fees structure - Array of [home, desk] prices per state
4
+ */
5
+ export type DeliveryFees = (number | null)[][];
6
+ /**
7
+ * Ecotrack delivery integration configuration
8
+ */
9
+ export interface EcotrackDeliveryIntegration {
10
+ baseUrl: string;
11
+ token: string;
12
+ active?: boolean;
13
+ metadata?: Record<string, any>;
14
+ }
15
+ /**
16
+ * Ecotrack finance data
17
+ */
18
+ export interface EcotrackFinanceData {
19
+ success: boolean;
20
+ amountsNotEncaissed: number;
21
+ feesNotEncaissed: number;
22
+ notEncaissed: number;
23
+ amountsEncaissed: number;
24
+ feesEncaissed: number;
25
+ encaissed: number;
26
+ amountsPaymentReady: number;
27
+ feesPaymentReady: number;
28
+ paymentReady: number;
29
+ }
30
+ /**
31
+ * Ecotrack wilaya (state) statistics
32
+ */
33
+ export interface EcotrackWilayaData {
34
+ wilayaId: number;
35
+ total: number;
36
+ retours: number;
37
+ livred: number;
38
+ wilayaName: string;
39
+ }
40
+ /**
41
+ * Ecotrack today's activity
42
+ */
43
+ export interface EcotrackTodayActivity {
44
+ expedie: number;
45
+ delivered: number;
46
+ returned: number;
47
+ suspended: number;
48
+ }
49
+ /**
50
+ * Ecotrack global statistics
51
+ */
52
+ export interface EcotrackGlobalStats {
53
+ enTraitement: number;
54
+ livred: number;
55
+ retours: number;
56
+ total: number;
57
+ }
58
+ /**
59
+ * Ecotrack statistics data
60
+ */
61
+ export interface EcotrackStatisticsData {
62
+ topWilaya: EcotrackWilayaData[];
63
+ todayActivity: EcotrackTodayActivity;
64
+ globalStats: EcotrackGlobalStats;
65
+ }
66
+ /**
67
+ * Ecotrack sync result
68
+ */
69
+ export interface EcotrackSyncResult {
70
+ success: boolean;
71
+ message: string;
72
+ syncId?: string;
73
+ totalFetched?: number;
74
+ totalUpdated?: number;
75
+ totalSkipped?: number;
76
+ syncedAt?: string;
77
+ errors?: string[];
78
+ }
79
+ /**
80
+ * Ecotrack sync status
81
+ */
82
+ export interface EcotrackSyncStatus {
83
+ canSync: boolean;
84
+ lastSyncAt?: string;
85
+ nextSyncAvailableAt?: string;
86
+ minutesUntilNextSync?: number;
87
+ }
88
+ /**
89
+ * Ecotrack Delivery Integration API
90
+ */
91
+ export declare class EcotrackDeliveryIntegrationApi {
92
+ private client;
93
+ private integration;
94
+ private storeId;
95
+ constructor(client: AxiosInstance, integration: EcotrackDeliveryIntegration, storeId: string);
96
+ /**
97
+ * Gets delivery fees from Ecotrack
98
+ */
99
+ getDeliveryFees(): Promise<DeliveryFees>;
100
+ /**
101
+ * Gets financial data from Ecotrack
102
+ */
103
+ getFinancialData(options?: {
104
+ limit?: number;
105
+ search?: string;
106
+ telephone?: string;
107
+ }): Promise<EcotrackFinanceData>;
108
+ /**
109
+ * Gets statistics data from Ecotrack
110
+ */
111
+ getStatistics(): Promise<EcotrackStatisticsData>;
112
+ /**
113
+ * Gets the sync status for this store's Ecotrack integration
114
+ */
115
+ getSyncStatus(): Promise<EcotrackSyncStatus>;
116
+ /**
117
+ * Triggers a sync of orders from Ecotrack
118
+ */
119
+ triggerSync(options?: {
120
+ startDate?: Date | string;
121
+ endDate?: Date | string;
122
+ }): Promise<EcotrackSyncResult>;
123
+ }
124
+ /**
125
+ * Yalidine agent type
126
+ */
127
+ export declare enum YalidineAgent {
128
+ yalidine = "yalidine",
129
+ guepex = "guepex"
130
+ }
131
+ /**
132
+ * Yalidine delivery integration configuration
133
+ */
134
+ export interface YalidineDeliveryIntegration {
135
+ id: string;
136
+ token: string;
137
+ agent?: YalidineAgent;
138
+ active?: boolean;
139
+ metadata?: Record<string, any>;
140
+ }
141
+ /**
142
+ * Yalidine Delivery Integration API
143
+ */
144
+ export declare class YalidineDeliveryIntegrationApi {
145
+ private client;
146
+ private integration;
147
+ private storeId;
148
+ constructor(client: AxiosInstance, integration: YalidineDeliveryIntegration, storeId: string);
149
+ /**
150
+ * Gets delivery fees from Yalidine
151
+ */
152
+ getDeliveryFees(): Promise<DeliveryFees>;
153
+ }
154
+ /**
155
+ * Procolis delivery integration configuration
156
+ */
157
+ export interface ProcolisDeliveryIntegration {
158
+ key: string;
159
+ token: string;
160
+ active?: boolean;
161
+ metadata?: Record<string, any>;
162
+ }
163
+ /**
164
+ * Procolis Delivery Integration API
165
+ */
166
+ export declare class ProcolisDeliveryIntegrationApi {
167
+ private client;
168
+ private integration;
169
+ private storeId;
170
+ constructor(client: AxiosInstance, integration: ProcolisDeliveryIntegration, storeId: string);
171
+ /**
172
+ * Gets delivery fees from Procolis
173
+ */
174
+ getDeliveryFees(): Promise<DeliveryFees>;
175
+ /**
176
+ * Sends an order to Procolis
177
+ */
178
+ send(orderId: string): Promise<void>;
179
+ }
180
+ /**
181
+ * Noest delivery integration configuration
182
+ */
183
+ export interface NoestDeliveryIntegration {
184
+ guid: string;
185
+ token: string;
186
+ active?: boolean;
187
+ metadata?: Record<string, any>;
188
+ }
189
+ /**
190
+ * Noest Delivery Integration API
191
+ */
192
+ export declare class NoestDeliveryIntegrationApi {
193
+ private client;
194
+ private integration;
195
+ private storeId;
196
+ constructor(client: AxiosInstance, integration: NoestDeliveryIntegration, storeId: string);
197
+ /**
198
+ * Gets delivery fees from Noest
199
+ */
200
+ getDeliveryFees(): Promise<DeliveryFees>;
201
+ /**
202
+ * Sends an order to Noest
203
+ */
204
+ send(orderId: string): Promise<void>;
205
+ }
206
+ /**
207
+ * Google Sheets integration configuration for API calls
208
+ * (Note: For store integrations, use GoogleSheetsIntegration from store.ts)
209
+ */
210
+ export interface GoogleSheetsIntegrationConfig {
211
+ id: string;
212
+ name: string;
213
+ active?: boolean;
214
+ oauth2?: Record<string, any>;
215
+ metadata?: Record<string, any>;
216
+ simple?: boolean;
217
+ columns?: Array<{
218
+ field: string;
219
+ name: string;
220
+ enabled: boolean;
221
+ defaultValue?: any;
222
+ }>;
223
+ }
224
+ /**
225
+ * Google Sheets Integration API
226
+ */
227
+ export declare class GoogleSheetIntegrationApi {
228
+ private client;
229
+ private integration;
230
+ private storeId;
231
+ constructor(client: AxiosInstance, integration: GoogleSheetsIntegrationConfig, storeId: string);
232
+ /**
233
+ * Appends a row to the Google Sheet
234
+ */
235
+ appendRow(values: string[]): Promise<void>;
236
+ /**
237
+ * Creates a new spreadsheet
238
+ */
239
+ createSpreadsheet(name: string): Promise<void>;
240
+ }
241
+ /**
242
+ * Zimou delivery integration configuration
243
+ */
244
+ export interface ZimouDeliveryIntegration {
245
+ id: string;
246
+ apiKey: string;
247
+ active?: boolean;
248
+ silentMode?: boolean;
249
+ autoSend?: boolean;
250
+ metadata?: Record<string, any>;
251
+ }
252
+ /**
253
+ * Zimou Delivery Integration API
254
+ */
255
+ export declare class ZimouDeliveryIntegrationApi {
256
+ private client;
257
+ private integration;
258
+ private storeId;
259
+ constructor(client: AxiosInstance, integration: ZimouDeliveryIntegration, storeId: string);
260
+ /**
261
+ * Gets delivery fees from Zimou
262
+ */
263
+ getDeliveryFees(): Promise<DeliveryFees>;
264
+ /**
265
+ * Sends an order to Zimou
266
+ */
267
+ send(orderId: string): Promise<void>;
268
+ }
269
+ /**
270
+ * Ecomanager delivery integration configuration
271
+ */
272
+ export interface EcomanagerDeliveryIntegration {
273
+ baseUrl: string;
274
+ token: string;
275
+ active?: boolean;
276
+ autoSend?: boolean;
277
+ metadata?: Record<string, any>;
278
+ }
279
+ /**
280
+ * Ecomanager Delivery Integration API
281
+ */
282
+ export declare class EcomanagerDeliveryIntegrationApi {
283
+ private client;
284
+ private integration;
285
+ private storeId;
286
+ constructor(client: AxiosInstance, integration: EcomanagerDeliveryIntegration, storeId: string);
287
+ /**
288
+ * Gets delivery fees from Ecomanager
289
+ */
290
+ getDeliveryFees(): Promise<DeliveryFees>;
291
+ /**
292
+ * Sends an order to Ecomanager
293
+ */
294
+ send(orderId: string): Promise<void>;
295
+ }
296
+ /**
297
+ * Factory for creating integration API instances
298
+ */
299
+ export declare class IntegrationFactory {
300
+ private client;
301
+ constructor(client: AxiosInstance);
302
+ /**
303
+ * Creates an Ecotrack integration API
304
+ */
305
+ ecotrack(integration: EcotrackDeliveryIntegration, storeId: string): EcotrackDeliveryIntegrationApi;
306
+ /**
307
+ * Creates a Yalidine integration API
308
+ */
309
+ yalidine(integration: YalidineDeliveryIntegration, storeId: string): YalidineDeliveryIntegrationApi;
310
+ /**
311
+ * Creates a Procolis integration API
312
+ */
313
+ procolis(integration: ProcolisDeliveryIntegration, storeId: string): ProcolisDeliveryIntegrationApi;
314
+ /**
315
+ * Creates a Noest integration API
316
+ */
317
+ noest(integration: NoestDeliveryIntegration, storeId: string): NoestDeliveryIntegrationApi;
318
+ /**
319
+ * Creates a Google Sheets integration API
320
+ */
321
+ googleSheets(integration: GoogleSheetsIntegrationConfig, storeId: string): GoogleSheetIntegrationApi;
322
+ /**
323
+ * Creates a Zimou integration API
324
+ */
325
+ zimou(integration: ZimouDeliveryIntegration, storeId: string): ZimouDeliveryIntegrationApi;
326
+ /**
327
+ * Creates an Ecomanager integration API
328
+ */
329
+ ecomanager(integration: EcomanagerDeliveryIntegration, storeId: string): EcomanagerDeliveryIntegrationApi;
330
+ }
@@ -0,0 +1,68 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ /**
3
+ * Options for sending a notification
4
+ */
5
+ export interface SendNotificationOptions {
6
+ /**
7
+ * Notification title (required)
8
+ * Max 100 characters (FCM recommendation)
9
+ */
10
+ title: string;
11
+ /**
12
+ * Notification body/message (required)
13
+ * Max 4000 characters (FCM recommendation)
14
+ */
15
+ body: string;
16
+ /**
17
+ * Additional data payload (optional)
18
+ * Key-value pairs sent with the notification
19
+ */
20
+ data?: Record<string, string>;
21
+ /**
22
+ * Click URL (optional)
23
+ * URL to open when notification is clicked
24
+ */
25
+ clickUrl?: string;
26
+ /**
27
+ * Sound file name (optional)
28
+ * Default: 'default'
29
+ */
30
+ sound?: string;
31
+ /**
32
+ * Filterator JSON string for advanced user filtering (optional)
33
+ * Supports complex filtering conditions - same format as users page
34
+ */
35
+ filterator?: string | object;
36
+ /**
37
+ * Other standard user filter parameters
38
+ */
39
+ q?: string;
40
+ page?: number;
41
+ limit?: number;
42
+ }
43
+ /**
44
+ * Response from sending notifications
45
+ */
46
+ export interface SendNotificationResponse {
47
+ message: string;
48
+ stats: {
49
+ usersProcessed: number;
50
+ tokensSent: number;
51
+ tokensFailed: number;
52
+ errors?: string[];
53
+ };
54
+ }
55
+ /**
56
+ * Service for managing notifications
57
+ */
58
+ export declare class NotificationsService {
59
+ private client;
60
+ constructor(client: AxiosInstance);
61
+ /**
62
+ * Send notifications to filtered users
63
+ * Admin only - uses filterator to filter users
64
+ * @param options - Notification options including filterator
65
+ * @returns Promise that resolves to send statistics
66
+ */
67
+ send(options: SendNotificationOptions): Promise<SendNotificationResponse>;
68
+ }
@@ -0,0 +1,134 @@
1
+ import { AxiosInstance, CancelToken } from 'axios';
2
+ /**
3
+ * Options for uploading a file
4
+ */
5
+ export interface UploadOptions {
6
+ /** The file to upload */
7
+ file: File | Blob;
8
+ /** Optional folder path */
9
+ folder?: string;
10
+ /** Progress callback */
11
+ onProgress?: (progress: UploadProgress) => void;
12
+ /** Cancel token for aborting the upload */
13
+ cancelToken?: CancelToken;
14
+ }
15
+ /**
16
+ * Upload progress information
17
+ */
18
+ export interface UploadProgress {
19
+ /** Bytes sent */
20
+ loaded: number;
21
+ /** Total bytes */
22
+ total: number;
23
+ /** Progress percentage (0-100) */
24
+ percentage: number;
25
+ }
26
+ /**
27
+ * Upload result
28
+ */
29
+ export interface UploadResult {
30
+ /** URL of the uploaded file */
31
+ url: string;
32
+ }
33
+ /**
34
+ * Options for uploading bytes
35
+ */
36
+ export interface UploadBytesOptions {
37
+ /** The bytes to upload */
38
+ bytes: Uint8Array | ArrayBuffer;
39
+ /** The filename */
40
+ filename: string;
41
+ /** Optional folder path */
42
+ folder?: string;
43
+ /** Progress callback */
44
+ onProgress?: (progress: UploadProgress) => void;
45
+ /** Cancel token for aborting the upload */
46
+ cancelToken?: CancelToken;
47
+ }
48
+ /**
49
+ * Storage service for uploading files
50
+ */
51
+ export declare class StorageService {
52
+ private client;
53
+ constructor(client: AxiosInstance);
54
+ /**
55
+ * Uploads a file
56
+ * @param options - Upload options
57
+ * @returns Promise resolving to the upload result
58
+ */
59
+ upload(options: UploadOptions): Promise<UploadResult>;
60
+ /**
61
+ * Uploads bytes directly
62
+ * @param options - Upload options
63
+ * @returns Promise resolving to the upload result
64
+ */
65
+ uploadBytes(options: UploadBytesOptions): Promise<UploadResult>;
66
+ /**
67
+ * Uploads a file for a store
68
+ * @param file - The file to upload
69
+ * @param storeId - The store ID
70
+ * @param options - Additional options
71
+ * @returns Promise resolving to the upload result
72
+ */
73
+ uploadStoreFile(file: File | Blob, storeId: string, options?: {
74
+ subfolder?: string;
75
+ onProgress?: (progress: UploadProgress) => void;
76
+ cancelToken?: CancelToken;
77
+ }): Promise<UploadResult>;
78
+ /**
79
+ * Uploads a product image
80
+ * @param file - The file to upload
81
+ * @param storeId - The store ID
82
+ * @param productId - The product ID
83
+ * @param options - Additional options
84
+ * @returns Promise resolving to the upload result
85
+ */
86
+ uploadProductImage(file: File | Blob, storeId: string, productId: string, options?: {
87
+ onProgress?: (progress: UploadProgress) => void;
88
+ cancelToken?: CancelToken;
89
+ }): Promise<UploadResult>;
90
+ /**
91
+ * Uploads a store logo
92
+ * @param file - The file to upload
93
+ * @param storeId - The store ID
94
+ * @param options - Additional options
95
+ * @returns Promise resolving to the upload result
96
+ */
97
+ uploadStoreLogo(file: File | Blob, storeId: string, options?: {
98
+ onProgress?: (progress: UploadProgress) => void;
99
+ cancelToken?: CancelToken;
100
+ }): Promise<UploadResult>;
101
+ /**
102
+ * Uploads a store icon
103
+ * @param file - The file to upload
104
+ * @param storeId - The store ID
105
+ * @param options - Additional options
106
+ * @returns Promise resolving to the upload result
107
+ */
108
+ uploadStoreIcon(file: File | Blob, storeId: string, options?: {
109
+ onProgress?: (progress: UploadProgress) => void;
110
+ cancelToken?: CancelToken;
111
+ }): Promise<UploadResult>;
112
+ /**
113
+ * Uploads a user avatar
114
+ * @param file - The file to upload
115
+ * @param userId - The user ID
116
+ * @param options - Additional options
117
+ * @returns Promise resolving to the upload result
118
+ */
119
+ uploadUserAvatar(file: File | Blob, userId: string, options?: {
120
+ onProgress?: (progress: UploadProgress) => void;
121
+ cancelToken?: CancelToken;
122
+ }): Promise<UploadResult>;
123
+ /**
124
+ * Uploads a feedback attachment
125
+ * @param file - The file to upload
126
+ * @param feedbackId - The feedback ID
127
+ * @param options - Additional options
128
+ * @returns Promise resolving to the upload result
129
+ */
130
+ uploadFeedbackAttachment(file: File | Blob, feedbackId: string, options?: {
131
+ onProgress?: (progress: UploadProgress) => void;
132
+ cancelToken?: CancelToken;
133
+ }): Promise<UploadResult>;
134
+ }
@@ -10,16 +10,31 @@ export * from './core/entities/country.js';
10
10
  export * from './core/entities/state.js';
11
11
  export * from './core/entities/city.js';
12
12
  export * from './core/entities/currency.js';
13
+ export * from './core/entities/feedback.js';
14
+ export * from './feeef/repositories/repository.js';
13
15
  export * from './feeef/repositories/deposits.js';
14
16
  export * from './feeef/repositories/transfers.js';
15
17
  export * from './feeef/repositories/shipping_prices.js';
18
+ export * from './feeef/repositories/shipping_methods.js';
16
19
  export * from './feeef/repositories/users.js';
17
- export type { TransferEntity, TransferCreateInput } from './feeef/repositories/transfers.js';
18
- export type { DepositEntity, DepositCreateInput } from './feeef/repositories/deposits.js';
20
+ export * from './feeef/repositories/stores.js';
21
+ export * from './feeef/repositories/products.js';
22
+ export * from './feeef/repositories/orders.js';
23
+ export * from './feeef/repositories/categories.js';
24
+ export * from './feeef/repositories/feedbacks.js';
25
+ export * from './feeef/repositories/countries.js';
26
+ export * from './feeef/repositories/states.js';
27
+ export * from './feeef/repositories/cities.js';
28
+ export * from './feeef/repositories/currencies.js';
29
+ export type { TransferEntity, TransferCreateInput, TransferUpdateInput, TransferType, TransferListOptions, } from './feeef/repositories/transfers.js';
30
+ export type { DepositEntity, DepositCreateInput, DepositUpdateInput, DepositStatus, DepositListOptions, PayPalOrderResponse, PayPalCaptureResponse, } from './feeef/repositories/deposits.js';
19
31
  export * from './core/embadded/address.js';
20
32
  export * from './core/embadded/category.js';
21
33
  export * from './core/embadded/contact.js';
22
34
  export * from './feeef/services/cart.js';
23
35
  export * from './feeef/services/actions.js';
36
+ export * from './feeef/services/notifications.js';
37
+ export * from './feeef/services/storage.js';
38
+ export * from './feeef/services/integrations.js';
24
39
  export * from './utils.js';
25
40
  export type { StoreIntegrations } from './core/entities/store.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "feeef",
3
3
  "description": "feeef sdk for javascript",
4
- "version": "0.6.0",
4
+ "version": "0.6.2",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
7
7
  "files": [