@appcorp/stellar-solutions-modules 0.1.56 → 0.1.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/global-modules/bank/constants.d.ts +2 -2
  2. package/global-modules/bank/constants.js +11 -11
  3. package/global-modules/bank/drawer.js +1 -1
  4. package/global-modules/bank/types.d.ts +2 -22
  5. package/global-modules/branch/constants.d.ts +2 -2
  6. package/global-modules/branch/constants.js +11 -11
  7. package/global-modules/branch/types.d.ts +9 -106
  8. package/global-modules/currency/actions.d.ts +203 -0
  9. package/global-modules/currency/actions.js +153 -0
  10. package/global-modules/currency/constants.d.ts +33 -0
  11. package/global-modules/currency/constants.js +71 -0
  12. package/global-modules/currency/context.d.ts +41 -0
  13. package/global-modules/currency/context.js +422 -0
  14. package/global-modules/currency/currency.d.ts +8 -0
  15. package/global-modules/currency/currency.js +57 -0
  16. package/global-modules/currency/drawer.d.ts +27 -0
  17. package/global-modules/currency/drawer.js +76 -0
  18. package/global-modules/currency/form.d.ts +19 -0
  19. package/global-modules/currency/form.js +52 -0
  20. package/global-modules/currency/reducer.d.ts +25 -0
  21. package/global-modules/currency/reducer.js +153 -0
  22. package/global-modules/currency/types.d.ts +163 -0
  23. package/global-modules/currency/types.js +44 -0
  24. package/global-modules/currency/validate.d.ts +9 -0
  25. package/global-modules/currency/validate.js +18 -0
  26. package/global-modules/payment-mode/constants.d.ts +2 -2
  27. package/global-modules/payment-mode/constants.js +7 -7
  28. package/global-modules/payment-mode/types.d.ts +12 -223
  29. package/global-modules/payment-mode/types.js +1 -9
  30. package/global-modules/preferences/context.js +27 -27
  31. package/global-modules/preferences/preferences.js +2 -3
  32. package/global-modules/preferences/types.d.ts +14 -240
  33. package/global-modules/preferences/types.js +3 -6
  34. package/global-modules/tax/constants.d.ts +2 -2
  35. package/global-modules/tax/constants.js +9 -9
  36. package/global-modules/tax/context.js +3 -2
  37. package/global-modules/tax/types.d.ts +9 -254
  38. package/global-modules/tax/types.js +1 -9
  39. package/i18n/routing.d.ts +1 -1
  40. package/package.json +2 -2
@@ -25,6 +25,7 @@
25
25
  import { Dispatch } from "react";
26
26
  import { RowAction, HeaderAction } from "@appcorp/shadcn/components/enhanced-table";
27
27
  import { PaymentModeActions } from "./actions";
28
+ import { BankBE as BankTypeBE, BranchBE as BranchTypeBE, CurrencyBE as CurrencyTypeBE, MenuOrderBE as MenuOrderTypeBE, PaymentBE as PaymentTypeBE, PaymentModeBE as PaymentModeTypeBE, PreferenceBE as PreferenceTypeBE, TaxBE as TaxTypeBE } from "@react-pakistan/util-functions/api/stellar-solutions/type";
28
29
  /**
29
30
  * Payment Mode Context Interface
30
31
  *
@@ -58,56 +59,19 @@ export interface PaymentModeContextType {
58
59
  * Represents the complete payment mode data structure as received from the API.
59
60
  * Includes all payment mode-specific fields and relationships.
60
61
  */
61
- export interface PaymentModeTypeBE {
62
- createdAt: string;
63
- enabled: boolean;
64
- id: string;
65
- isDefault: boolean;
66
- label: string;
67
- payments?: PaymentTypeBE[];
68
- preference?: PreferenceTypeBE;
69
- preferenceId: string;
70
- updatedAt: string;
71
- }
62
+ export type { PaymentModeTypeBE };
72
63
  /**
73
64
  * Payment Backend Entity
74
65
  *
75
66
  * Represents payment data structure with payment mode relationship.
76
67
  */
77
- export interface PaymentTypeBE {
78
- amount: string;
79
- attachment?: string;
80
- balance: string;
81
- createdAt: string;
82
- currency: string;
83
- date: string;
84
- description?: string;
85
- id: string;
86
- paymentMode?: PaymentModeTypeBE;
87
- paymentModeId: string;
88
- paymentType: PAYMENT_TYPE;
89
- quoteInvoice?: undefined;
90
- quoteInvoiceId: string;
91
- ref: string;
92
- updatedAt: string;
93
- }
68
+ export type { PaymentTypeBE };
94
69
  /**
95
70
  * Preference Backend Entity
96
71
  *
97
72
  * Represents preference data structure containing payment modes.
98
73
  */
99
- export interface PreferenceTypeBE {
100
- bankingDetails: BankingDetailTypeBE[];
101
- branches: BranchTypeBE[];
102
- createdAt: string;
103
- currencies: CurrencyTypeBE[];
104
- id: string;
105
- menuOrder: MenuOrderTypeBE[];
106
- onboarding: boolean;
107
- paymentModes: PaymentModeTypeBE[];
108
- taxes: TaxTypeBE[];
109
- updatedAt: string;
110
- }
74
+ export type { PreferenceTypeBE };
111
75
  /**
112
76
  * Payment Mode Component State
113
77
  *
@@ -261,206 +225,31 @@ export declare const getPaymentModeDisplayLabel: (paymentMode: PaymentModeTypeBE
261
225
  /**
262
226
  * Check if payment mode has payments associated
263
227
  */
264
- export declare const hasPayments: (paymentMode: PaymentModeTypeBE) => boolean;
228
+ export declare const hasPayments: (paymentMode: PaymentModeTypeBE & {
229
+ payments?: PaymentTypeBE[];
230
+ }) => boolean;
265
231
  /**
266
232
  * Legacy Banking Detail Type
267
233
  * TODO: Move to banking-details module
268
234
  */
269
- export interface BankingDetailTypeBE {
270
- accountNumber: string;
271
- accountTitle: string;
272
- bankAddress?: string;
273
- bankName: string;
274
- createdAt: string;
275
- enabled: boolean;
276
- iban?: string;
277
- id: string;
278
- isDefault: boolean;
279
- preference: PreferenceTypeBE;
280
- preferenceId: string;
281
- swiftCode?: string;
282
- updatedAt: string;
283
- }
235
+ export type { BankTypeBE };
284
236
  /**
285
237
  * Legacy Branch Type
286
238
  * TODO: Move to branches module
287
239
  */
288
- export interface BranchTypeBE {
289
- branchAddress: string;
290
- branchName: string;
291
- createdAt: string;
292
- enabled: boolean;
293
- id: string;
294
- isDefault: boolean;
295
- personEmail: string;
296
- personName: string;
297
- personPhone: string;
298
- preference: PreferenceTypeBE;
299
- preferenceId: string;
300
- updatedAt: string;
301
- }
240
+ export type { BranchTypeBE };
302
241
  /**
303
242
  * Legacy Currency Type
304
243
  * TODO: Move to currencies module
305
244
  */
306
- export interface CurrencyTypeBE {
307
- code: string;
308
- createdAt: string;
309
- enabled: boolean;
310
- id: string;
311
- isDefault: boolean;
312
- label: string;
313
- preference?: PreferenceTypeBE;
314
- preferenceId: string;
315
- updatedAt: string;
316
- }
245
+ export type { CurrencyTypeBE };
317
246
  /**
318
247
  * Legacy Menu Order Type
319
248
  * TODO: Move to preferences module
320
249
  */
321
- export interface MenuOrderTypeBE {
322
- createdAt: string;
323
- id: string;
324
- label: string;
325
- order: number;
326
- preference: PreferenceTypeBE;
327
- preferenceId: string;
328
- updatedAt: string;
329
- }
250
+ export type { MenuOrderTypeBE };
330
251
  /**
331
252
  * Legacy Tax Type
332
253
  * TODO: Move to taxes module
333
254
  */
334
- export interface TaxTypeBE {
335
- createdAt: string;
336
- description?: string;
337
- enabled: boolean;
338
- id: string;
339
- isDefault: boolean;
340
- preference: PreferenceTypeBE;
341
- preferenceId: string;
342
- taxName: string;
343
- taxRate: string;
344
- updatedAt: string;
345
- }
346
- /**
347
- * Legacy Tax Interface
348
- * TODO: Move to taxes module
349
- */
350
- export interface Tax {
351
- taxName: string;
352
- taxValue: string;
353
- id: string;
354
- description: string;
355
- preferenceId: string;
356
- enabled: boolean;
357
- errors: {
358
- [key: string]: string;
359
- };
360
- createdAt?: string;
361
- updatedAt?: string;
362
- loading: boolean;
363
- isDefault: boolean;
364
- btnDisableTax: boolean;
365
- }
366
- /**
367
- * Legacy Menu Item Interface
368
- * TODO: Move to preferences module
369
- */
370
- export interface MenuItem {
371
- preferenceId: string;
372
- label: string;
373
- order: number;
374
- id: string;
375
- }
376
- /**
377
- * Legacy Currency Args
378
- * TODO: Move to currencies module
379
- */
380
- export type CurrencyArgs = {
381
- id: string;
382
- label: string;
383
- enabled: boolean;
384
- code: string;
385
- isDefault: boolean;
386
- preferenceId: string;
387
- };
388
- /**
389
- * Legacy Create Bank Detail Args
390
- * TODO: Move to banking-details module
391
- */
392
- export interface CreateBankDetailArg {
393
- id: string;
394
- accountNumber: string;
395
- accountTitle: string;
396
- bankAddress: string;
397
- bankName: string;
398
- enabled: boolean;
399
- iban: string;
400
- swiftCode: string;
401
- preferenceId: string;
402
- errors: {
403
- [key: string]: string;
404
- };
405
- loading: boolean;
406
- isDefault: boolean;
407
- }
408
- /**
409
- * Legacy Create Branches Args
410
- * TODO: Move to branches module
411
- */
412
- export interface createBranchesArgs {
413
- personName: string;
414
- personEmail: string;
415
- id: string;
416
- personPhone: string;
417
- branchAddress: string;
418
- branchName: string;
419
- preferenceId: string;
420
- enabled: boolean;
421
- errors: {
422
- [key: string]: string;
423
- };
424
- createdAt?: string;
425
- updatedAt?: string;
426
- loading: boolean;
427
- isDefault: boolean;
428
- }
429
- /**
430
- * Legacy Create Taxes Args
431
- * TODO: Move to taxes module
432
- */
433
- export interface createTaxesArgs {
434
- taxName: string;
435
- taxValue: string;
436
- id: string;
437
- description: string;
438
- preferenceId: string;
439
- enabled: boolean;
440
- errors: {
441
- [key: string]: string;
442
- };
443
- createdAt?: string;
444
- updatedAt?: string;
445
- loading: boolean;
446
- isDefault: boolean;
447
- }
448
- /**
449
- * Legacy Update Currency Args
450
- * TODO: Move to currencies module
451
- */
452
- export interface updateCurrencyArgs {
453
- id: string;
454
- label: string;
455
- enabled: boolean;
456
- code: string;
457
- isDefault: boolean;
458
- preferenceId: string;
459
- }
460
- /**
461
- * Legacy Branch Modal Enum
462
- * TODO: Move to branches module
463
- */
464
- export declare enum BRANCH_MODAL {
465
- DUMMY = "DUMMY"
466
- }
255
+ export type { TaxTypeBE };
@@ -24,7 +24,7 @@
24
24
  * - Types: PascalCase following interface conventions
25
25
  */
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.BRANCH_MODAL = exports.hasPayments = exports.getPaymentModeDisplayLabel = exports.isPaymentModeDefault = exports.isPaymentModeEnabled = exports.isFetchPaymentModesArgs = exports.isPaymentType = exports.isPaymentModeDrawer = exports.isPaymentModeTypeBE = exports.PAYMENT_TYPE = exports.PAYMENT_MODE_DRAWER = void 0;
27
+ exports.hasPayments = exports.getPaymentModeDisplayLabel = exports.isPaymentModeDefault = exports.isPaymentModeEnabled = exports.isFetchPaymentModesArgs = exports.isPaymentType = exports.isPaymentModeDrawer = exports.isPaymentModeTypeBE = exports.PAYMENT_TYPE = exports.PAYMENT_MODE_DRAWER = void 0;
28
28
  // ============================================================================
29
29
  // UI ENUMS (Component State Definitions)
30
30
  // ============================================================================
@@ -117,14 +117,6 @@ var hasPayments = function (paymentMode) {
117
117
  return Boolean(paymentMode.payments && paymentMode.payments.length > 0);
118
118
  };
119
119
  exports.hasPayments = hasPayments;
120
- /**
121
- * Legacy Branch Modal Enum
122
- * TODO: Move to branches module
123
- */
124
- var BRANCH_MODAL;
125
- (function (BRANCH_MODAL) {
126
- BRANCH_MODAL["DUMMY"] = "DUMMY";
127
- })(BRANCH_MODAL || (exports.BRANCH_MODAL = BRANCH_MODAL = {}));
128
120
  // ============================================================================
129
121
  // OPTIMIZATION SUMMARY
130
122
  // ============================================================================
@@ -48,12 +48,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.usePreferenceStateContext = exports.PreferenceStateContextProvider = exports.PreferenceStateContext = void 0;
49
49
  var react_1 = __importStar(require("react"));
50
50
  var util_functions_1 = require("@react-pakistan/util-functions");
51
- var vista_notification_type_1 = require("@appcorp/app-corp-vista/type/vista-notification-type");
52
51
  var next_intl_1 = require("next-intl");
53
52
  var actions_1 = require("./actions");
54
53
  var constants_1 = require("./constants");
55
54
  var reducer_1 = require("./reducer");
56
- var generate_toast_1 = require("@appcorp/app-corp-vista/utils/generate-toast");
55
+ var toast_utils_1 = require("@appcorp/shadcn/lib/toast-utils");
57
56
  var usePreferenceState = function () {
58
57
  var _a = (0, react_1.useReducer)(reducer_1.preferenceReducer, reducer_1.initialPreferenceState), state = _a[0], dispatch = _a[1];
59
58
  var t = (0, next_intl_1.useTranslations)("preferences");
@@ -65,8 +64,8 @@ var usePreferenceState = function () {
65
64
  var listCallback = function (_a) {
66
65
  var data = _a.data, error = _a.error;
67
66
  if (error) {
68
- (0, generate_toast_1.generateToast)({
69
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
67
+ (0, toast_utils_1.generateThemeToast)({
68
+ variant: toast_utils_1.TOAST_VARIANT.ERROR,
70
69
  description: tCommon("messagesNetworkError"),
71
70
  });
72
71
  }
@@ -82,9 +81,10 @@ var usePreferenceState = function () {
82
81
  }
83
82
  };
84
83
  var updateParams = (0, react_1.useMemo)(function () { return ({
85
- currencies: [],
84
+ banks: [],
86
85
  bankingDetails: [],
87
86
  branches: [],
87
+ currencies: [],
88
88
  id: "",
89
89
  menuOrder: [],
90
90
  onboarding: false,
@@ -94,15 +94,15 @@ var usePreferenceState = function () {
94
94
  var updateCallback = function (_a) {
95
95
  var data = _a.data, error = _a.error;
96
96
  if (error) {
97
- (0, generate_toast_1.generateToast)({
97
+ (0, toast_utils_1.generateThemeToast)({
98
98
  description: tCommon("messagesNetworkError"),
99
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
99
+ variant: toast_utils_1.TOAST_VARIANT.ERROR,
100
100
  });
101
101
  }
102
102
  if (data) {
103
- (0, generate_toast_1.generateToast)({
103
+ (0, toast_utils_1.generateThemeToast)({
104
104
  description: t("messagesPreferenceUpdated"),
105
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS,
105
+ variant: toast_utils_1.TOAST_VARIANT.SUCCESS,
106
106
  });
107
107
  dispatch({
108
108
  type: actions_1.PREFERENCE_ACTION_TYPES.RESET_FORM,
@@ -123,9 +123,9 @@ var usePreferenceState = function () {
123
123
  var byIdCallback = function (_a) {
124
124
  var data = _a.data, error = _a.error;
125
125
  if (error) {
126
- (0, generate_toast_1.generateToast)({
126
+ (0, toast_utils_1.generateThemeToast)({
127
127
  description: tCommon("messagesNetworkError"),
128
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
128
+ variant: toast_utils_1.TOAST_VARIANT.ERROR,
129
129
  });
130
130
  }
131
131
  if (data) {
@@ -145,15 +145,15 @@ var usePreferenceState = function () {
145
145
  var deleteCallback = function (_a) {
146
146
  var data = _a.data, error = _a.error;
147
147
  if (error) {
148
- (0, generate_toast_1.generateToast)({
148
+ (0, toast_utils_1.generateThemeToast)({
149
149
  description: tCommon("messagesNetworkError"),
150
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
150
+ variant: toast_utils_1.TOAST_VARIANT.ERROR,
151
151
  });
152
152
  }
153
153
  if (data) {
154
- (0, generate_toast_1.generateToast)({
154
+ (0, toast_utils_1.generateThemeToast)({
155
155
  description: t("messagesPreferenceDeleted"),
156
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS,
156
+ variant: toast_utils_1.TOAST_VARIANT.SUCCESS,
157
157
  });
158
158
  dispatch({
159
159
  type: actions_1.PREFERENCE_ACTION_TYPES.RESET_FORM,
@@ -186,8 +186,8 @@ var usePreferenceState = function () {
186
186
  var currencyListCallback = function (_a) {
187
187
  var data = _a.data, error = _a.error;
188
188
  if (error) {
189
- (0, generate_toast_1.generateToast)({
190
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
189
+ (0, toast_utils_1.generateThemeToast)({
190
+ variant: toast_utils_1.TOAST_VARIANT.ERROR,
191
191
  description: tCommon("messagesNetworkError"),
192
192
  });
193
193
  }
@@ -213,15 +213,15 @@ var usePreferenceState = function () {
213
213
  var currencyUpdateCallback = function (_a) {
214
214
  var data = _a.data, error = _a.error;
215
215
  if (error) {
216
- (0, generate_toast_1.generateToast)({
216
+ (0, toast_utils_1.generateThemeToast)({
217
217
  description: tCommon("messagesNetworkError"),
218
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
218
+ variant: toast_utils_1.TOAST_VARIANT.ERROR,
219
219
  });
220
220
  }
221
221
  if (data) {
222
- (0, generate_toast_1.generateToast)({
222
+ (0, toast_utils_1.generateThemeToast)({
223
223
  description: t("messagesPreferenceUpdated"),
224
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS,
224
+ variant: toast_utils_1.TOAST_VARIANT.SUCCESS,
225
225
  });
226
226
  dispatch({
227
227
  type: actions_1.PREFERENCE_ACTION_TYPES.SET_CURRENCY_UPDATE_ID,
@@ -239,9 +239,9 @@ var usePreferenceState = function () {
239
239
  var currencyByIdCallback = function (_a) {
240
240
  var data = _a.data, error = _a.error;
241
241
  if (error) {
242
- (0, generate_toast_1.generateToast)({
242
+ (0, toast_utils_1.generateThemeToast)({
243
243
  description: tCommon("messagesNetworkError"),
244
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
244
+ variant: toast_utils_1.TOAST_VARIANT.ERROR,
245
245
  });
246
246
  }
247
247
  if (data) {
@@ -261,15 +261,15 @@ var usePreferenceState = function () {
261
261
  var currencyDeleteCallback = function (_a) {
262
262
  var data = _a.data, error = _a.error;
263
263
  if (error) {
264
- (0, generate_toast_1.generateToast)({
264
+ (0, toast_utils_1.generateThemeToast)({
265
265
  description: tCommon("messagesNetworkError"),
266
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR,
266
+ variant: toast_utils_1.TOAST_VARIANT.ERROR,
267
267
  });
268
268
  }
269
269
  if (data) {
270
- (0, generate_toast_1.generateToast)({
270
+ (0, toast_utils_1.generateThemeToast)({
271
271
  description: t("messagesPreferenceDeleted"),
272
- variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS,
272
+ variant: toast_utils_1.TOAST_VARIANT.SUCCESS,
273
273
  });
274
274
  dispatch({
275
275
  type: actions_1.PREFERENCE_ACTION_TYPES.RESET_FORM,
@@ -6,11 +6,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.PreferencesPage = void 0;
8
8
  var react_1 = __importDefault(require("react"));
9
- // import { usePreferenceStateContext } from "./context";
10
- var generate_toast_1 = require("@appcorp/app-corp-vista/utils/generate-toast");
9
+ var sonner_1 = require("@appcorp/shadcn/components/sonner");
11
10
  var PreferencesPage = function () {
12
11
  // const { headerTabs, activeTab } = usePreferenceStateContext();
13
12
  return (react_1.default.createElement(react_1.default.Fragment, null,
14
- react_1.default.createElement(generate_toast_1.VistaToaster, null)));
13
+ react_1.default.createElement(sonner_1.Toaster, null)));
15
14
  };
16
15
  exports.PreferencesPage = PreferencesPage;