@react-pakistan/util-functions 1.25.35 → 1.25.37

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.
@@ -21,6 +21,10 @@ export declare enum QUOTE_STATUS {
21
21
  ACCEPTED = "ACCEPTED",
22
22
  DECLINED = "DECLINED"
23
23
  }
24
+ export declare enum QUOTE_INVOICE_MODE {
25
+ CUSTOMER = "CUSTOMER",
26
+ COMPANY = "COMPANY"
27
+ }
24
28
  export declare enum PAYMENT_TYPE {
25
29
  FULL_AMOUNT = "FULL_AMOUNT",
26
30
  PARTIAL_AMOUNT = "PARTIAL_AMOUNT"
@@ -3,7 +3,7 @@
3
3
  // ENUMS
4
4
  // ============================================================================
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LS_KEYS = exports.LEAD_STATUS = exports.LEAD_TYPE = exports.LEAD_SOURCE = exports.PAYMENT_TYPE = exports.QUOTE_STATUS = exports.INVOICE_STATUS = exports.DISCOUNT_UNIT = exports.QUOTE_INVOICE_CATEGORY = exports.GENDER = void 0;
6
+ exports.LS_KEYS = exports.LEAD_STATUS = exports.LEAD_TYPE = exports.LEAD_SOURCE = exports.PAYMENT_TYPE = exports.QUOTE_INVOICE_MODE = exports.QUOTE_STATUS = exports.INVOICE_STATUS = exports.DISCOUNT_UNIT = exports.QUOTE_INVOICE_CATEGORY = exports.GENDER = void 0;
7
7
  var GENDER;
8
8
  (function (GENDER) {
9
9
  GENDER["MALE"] = "MALE";
@@ -32,6 +32,11 @@ var QUOTE_STATUS;
32
32
  QUOTE_STATUS["ACCEPTED"] = "ACCEPTED";
33
33
  QUOTE_STATUS["DECLINED"] = "DECLINED";
34
34
  })(QUOTE_STATUS || (exports.QUOTE_STATUS = QUOTE_STATUS = {}));
35
+ var QUOTE_INVOICE_MODE;
36
+ (function (QUOTE_INVOICE_MODE) {
37
+ QUOTE_INVOICE_MODE["CUSTOMER"] = "CUSTOMER";
38
+ QUOTE_INVOICE_MODE["COMPANY"] = "COMPANY";
39
+ })(QUOTE_INVOICE_MODE || (exports.QUOTE_INVOICE_MODE = QUOTE_INVOICE_MODE = {}));
35
40
  var PAYMENT_TYPE;
36
41
  (function (PAYMENT_TYPE) {
37
42
  PAYMENT_TYPE["FULL_AMOUNT"] = "FULL_AMOUNT";
@@ -42,7 +42,6 @@ var __importStar = (this && this.__importStar) || (function () {
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.createGenericModulePage = exports.GenericDrawer = exports.GenericTable = exports.DRAWER_TYPES = void 0;
44
44
  var react_1 = __importStar(require("react"));
45
- var next_intl_1 = require("next-intl");
46
45
  var general_1 = require("../general");
47
46
  var use_rtl_1 = require("../hooks/use-rtl");
48
47
  var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
@@ -61,7 +60,18 @@ exports.DRAWER_TYPES = {
61
60
  };
62
61
  var GenericTable = function (_a) {
63
62
  var config = _a.config, context = _a.context, tableBodyCols = _a.tableBodyCols, headerActions = _a.headerActions, rowActions = _a.rowActions;
64
- var t = (0, next_intl_1.useTranslations)(config.moduleName);
63
+ var maybeUseTranslations = (function () {
64
+ try {
65
+ // Use runtime require so bundlers don't statically include next-intl when unused
66
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
67
+ return require('next-intl').useTranslations;
68
+ }
69
+ catch (_a) {
70
+ // Fallback: identity translator
71
+ return function (_ns) { return function (key) { return key; }; };
72
+ }
73
+ })();
74
+ var t = maybeUseTranslations(config.moduleName);
65
75
  var isRTL = (0, use_rtl_1.useRTL)();
66
76
  var tableHeadItems = (0, react_1.useMemo)(function () {
67
77
  return config.tableColumns.map(function (col) { return ({
@@ -81,7 +91,16 @@ exports.GenericTable = GenericTable;
81
91
  var GenericDrawer = function (_a) {
82
92
  var _b, _c, _d, _e, _f, _g;
83
93
  var config = _a.config, context = _a.context, formContent = _a.formContent, viewContent = _a.viewContent, filterContent = _a.filterContent, moreActionsContent = _a.moreActionsContent;
84
- var t = (0, next_intl_1.useTranslations)(config.moduleName);
94
+ var maybeUseTranslations = (function () {
95
+ try {
96
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
97
+ return require('next-intl').useTranslations;
98
+ }
99
+ catch (_a) {
100
+ return function (_ns) { return function (key) { return key; }; };
101
+ }
102
+ })();
103
+ var t = maybeUseTranslations(config.moduleName);
85
104
  var isRTL = (0, use_rtl_1.useRTL)();
86
105
  var closeDrawer = context.closeDrawer || context.handleCloseDrawer;
87
106
  var _h = context.state, disableSaveButton = _h.disableSaveButton, drawer = _h.drawer;
@@ -2,7 +2,7 @@
2
2
  * Hook to detect RTL (Right-to-Left) layout based on current locale
3
3
  * @returns {boolean} true if current locale requires RTL layout (Urdu), false otherwise
4
4
  */
5
- export declare const useRTL: () => boolean;
5
+ export declare const useRTL: (forcedLocale?: string) => boolean;
6
6
  /**
7
7
  * Hook to get RTL-aware CSS classes
8
8
  *
package/hooks/use-rtl.js CHANGED
@@ -1,14 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useRTLClasses = exports.useRTL = void 0;
4
- var next_intl_1 = require("next-intl");
5
4
  /**
6
5
  * Hook to detect RTL (Right-to-Left) layout based on current locale
7
6
  * @returns {boolean} true if current locale requires RTL layout (Urdu), false otherwise
8
7
  */
9
- var useRTL = function () {
10
- var locale = (0, next_intl_1.useLocale)();
11
- return locale === 'ur';
8
+ var useRTL = function (forcedLocale) {
9
+ if (forcedLocale)
10
+ return forcedLocale === 'ur';
11
+ try {
12
+ // Require at runtime so bundlers don't statically include next-intl unless used
13
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
14
+ var useLocale = require('next-intl').useLocale;
15
+ var locale = useLocale();
16
+ return locale === 'ur';
17
+ }
18
+ catch (_a) {
19
+ return false;
20
+ }
12
21
  };
13
22
  exports.useRTL = useRTL;
14
23
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.25.35",
3
+ "version": "1.25.37",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {