@autologix-engineering/shared 1.2.404 → 1.2.406

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 (53) hide show
  1. package/package.json +1 -1
  2. package/src/lib/data-transfer-objects/src/add.client.persona.billing.methods.dto.d.ts +1 -0
  3. package/src/lib/data-transfer-objects/src/add.client.persona.billing.methods.dto.js +5 -0
  4. package/src/lib/data-transfer-objects/src/add.client.persona.billing.methods.dto.js.map +1 -1
  5. package/src/lib/data-transfer-objects/src/command/add.client.group.dto.d.ts +1 -1
  6. package/src/lib/data-transfer-objects/src/command/add.client.group.dto.js +9 -2
  7. package/src/lib/data-transfer-objects/src/command/add.client.group.dto.js.map +1 -1
  8. package/src/lib/data-transfer-objects/src/command/update.client.group.dto.js +9 -1
  9. package/src/lib/data-transfer-objects/src/command/update.client.group.dto.js.map +1 -1
  10. package/src/lib/data-transfer-objects/src/driver.persona.custom.dto.d.ts +2 -0
  11. package/src/lib/data-transfer-objects/src/driver.persona.custom.dto.js +6 -0
  12. package/src/lib/data-transfer-objects/src/driver.persona.custom.dto.js.map +1 -1
  13. package/src/lib/data-transfer-objects/src/get.active.contract.dto.d.ts +2 -0
  14. package/src/lib/data-transfer-objects/src/get.active.contract.dto.js +8 -1
  15. package/src/lib/data-transfer-objects/src/get.active.contract.dto.js.map +1 -1
  16. package/src/lib/data-transfer-objects/src/vehicle.custom.query.dto.d.ts +2 -0
  17. package/src/lib/data-transfer-objects/src/vehicle.custom.query.dto.js +7 -0
  18. package/src/lib/data-transfer-objects/src/vehicle.custom.query.dto.js.map +1 -1
  19. package/src/lib/enums/src/country.currency.d.ts +20 -0
  20. package/src/lib/enums/src/country.currency.js +28 -0
  21. package/src/lib/enums/src/country.currency.js.map +1 -0
  22. package/src/lib/enums/src/index.d.ts +1 -0
  23. package/src/lib/enums/src/index.js +1 -0
  24. package/src/lib/enums/src/index.js.map +1 -1
  25. package/src/lib/enums/src/internal.alert.type.variable.map.js +13 -4
  26. package/src/lib/enums/src/internal.alert.type.variable.map.js.map +1 -1
  27. package/src/lib/enums/src/vehicle.default.fields.json.js +1 -1
  28. package/src/lib/enums/src/vehicle.default.fields.json.js.map +1 -1
  29. package/src/lib/models/src/business.context.owner.model.d.ts +7 -0
  30. package/src/lib/models/src/business.context.owner.model.js +6 -0
  31. package/src/lib/models/src/business.context.owner.model.js.map +1 -1
  32. package/src/lib/models/src/client.persona.model.d.ts +2 -0
  33. package/src/lib/models/src/client.persona.model.js +3 -0
  34. package/src/lib/models/src/client.persona.model.js.map +1 -1
  35. package/src/lib/utilities/src/amount.in.words.d.ts +1 -0
  36. package/src/lib/utilities/src/amount.in.words.js +26 -0
  37. package/src/lib/utilities/src/amount.in.words.js.map +1 -1
  38. package/src/lib/utilities/src/get.shortened.link.d.ts +11 -0
  39. package/src/lib/utilities/src/get.shortened.link.js +42 -15
  40. package/src/lib/utilities/src/get.shortened.link.js.map +1 -1
  41. package/src/lib/utilities/src/index.d.ts +3 -0
  42. package/src/lib/utilities/src/index.js +3 -0
  43. package/src/lib/utilities/src/index.js.map +1 -1
  44. package/src/lib/utilities/src/money.d.ts +82 -0
  45. package/src/lib/utilities/src/money.js +123 -0
  46. package/src/lib/utilities/src/money.js.map +1 -0
  47. package/src/lib/utilities/src/show.cust.usage.dtls.d.ts +15 -0
  48. package/src/lib/utilities/src/show.cust.usage.dtls.js +16 -0
  49. package/src/lib/utilities/src/show.cust.usage.dtls.js.map +1 -0
  50. package/src/lib/utilities/src/singapore.phone.number.d.ts +56 -0
  51. package/src/lib/utilities/src/singapore.phone.number.js +90 -0
  52. package/src/lib/utilities/src/singapore.phone.number.js.map +1 -0
  53. package/src/lib/view-models/src/view.models.d.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"amount.in.words.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/amount.in.words.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG;IACZ,MAAM;IACN,KAAK;IAC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,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,aAAa,GAAG,GAAG,oBAAoB,CAAC,MAAM,CAAC,eAAe,oBAAoB,CACvF,KAAK,CACL,cAAc,CAAC,WAAW,EAAE,CAAC;IAC9B,OAAO,GAAG,MAAM,GAAG,aAAa,EAAE,CAAC;AACpC,CAAC,CAAC"}
1
+ {"version":3,"file":"amount.in.words.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/amount.in.words.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG;IACZ,MAAM;IACN,KAAK;IACL,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;IACL,OAAO;IACP,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,WAAW;IACX,UAAU;IACV,UAAU;CACV,CAAC;AAEF,MAAM,IAAI,GAAG;IACZ,EAAE;IACF,EAAE;IACF,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACT,QAAQ;IACR,QAAQ;CACR,CAAC;AAEF,qDAAqD;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAU,EAAE;IAC9D,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9D,OAAO,MAAM,CAAC;IACf,CAAC;IACD,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,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AAG,CAAC,WAAmB,EAAU,EAAE;IACtE,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7E,OAAO,oCAAoC,CAAC;IAC7C,CAAC;IACD,MAAM,UAAU,GAAG,WAAW,GAAG,CAAC,CAAC;IACnC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,aAAa,GAAG,GAAG,oBAAoB,CAAC,MAAM,CAAC,eAAe,oBAAoB,CACvF,KAAK,CACL,cAAc,CAAC,WAAW,EAAE,CAAC;IAC9B,OAAO,GAAG,MAAM,GAAG,aAAa,EAAE,CAAC;AACpC,CAAC,CAAC"}
@@ -1 +1,12 @@
1
+ /**
2
+ * Returns the shortener's response if it is a short link on t.autologix.io,
3
+ * otherwise ''. The shortener has answered 200 with its own PHP source when
4
+ * PHP stopped executing on that box, and that text went out verbatim in trip
5
+ * emails, SMS and WhatsApp -- anything that isn't a short link must not.
6
+ */
7
+ export declare const toValidShortUrl: (data: unknown) => string;
8
+ /**
9
+ * Short link for `url`, or '' if one can't be had for any reason.
10
+ * Needs SHORTENER_API_KEY (a Shlink API key) in the service's env.
11
+ */
1
12
  export declare const getShortUrl: (url: string) => Promise<string>;
@@ -1,18 +1,45 @@
1
1
  import axios from 'axios';
2
- export const getShortUrl = (url) => {
3
- // eslint-disable-next-line no-async-promise-executor
4
- return new Promise(async (resolve, reject) => {
5
- try {
6
- const _shortUrl = await axios.post('https://t.autologix.io/api/v2/action/shorten', {
7
- key: 'b243355c7b9e8d20dc888b8d6cdc03',
8
- url: url,
9
- });
10
- resolve(_shortUrl?.data?.replace('t.autologix.io/', 't.autologix.io/AUTLGX/'));
11
- }
12
- catch (error) {
13
- console.error(error);
14
- reject(error);
15
- }
16
- });
2
+ // A single short link on our host, e.g. https://t.autologix.io/a1B2c
3
+ const SHORT_URL_PATTERN = /^https?:\/\/t\.autologix\.io\/[A-Za-z0-9_-]{1,64}$/;
4
+ // t.autologix.io runs Shlink (Polr's /api/v2/action/shorten is gone).
5
+ const SHLINK_SHORTEN_URL = 'https://t.autologix.io/rest/v3/short-urls';
6
+ /**
7
+ * Returns the shortener's response if it is a short link on t.autologix.io,
8
+ * otherwise ''. The shortener has answered 200 with its own PHP source when
9
+ * PHP stopped executing on that box, and that text went out verbatim in trip
10
+ * emails, SMS and WhatsApp -- anything that isn't a short link must not.
11
+ */
12
+ export const toValidShortUrl = (data) => {
13
+ const candidate = typeof data === 'string' ? data.trim() : '';
14
+ if (SHORT_URL_PATTERN.test(candidate)) {
15
+ return candidate;
16
+ }
17
+ console.error(`Shortener returned an invalid short url: ${JSON.stringify(data)?.slice(0, 80)}`);
18
+ return '';
19
+ };
20
+ /**
21
+ * Short link for `url`, or '' if one can't be had for any reason.
22
+ * Needs SHORTENER_API_KEY (a Shlink API key) in the service's env.
23
+ */
24
+ export const getShortUrl = async (url) => {
25
+ const apiKey = typeof process !== 'undefined'
26
+ ? process.env?.['SHORTENER_API_KEY']
27
+ : undefined;
28
+ if (!apiKey) {
29
+ console.error('Short URL request skipped: SHORTENER_API_KEY is not set');
30
+ return '';
31
+ }
32
+ try {
33
+ const _shortUrl = await axios.post(SHLINK_SHORTEN_URL, { longUrl: url }, {
34
+ headers: { 'X-Api-Key': apiKey, Accept: 'application/json' },
35
+ timeout: 10000,
36
+ });
37
+ return toValidShortUrl(_shortUrl?.data?.shortUrl);
38
+ }
39
+ catch (error) {
40
+ // Message only: the axios error also carries the request headers (the API key).
41
+ console.error(`Short URL request failed: ${error instanceof Error ? error.message : String(error)}`);
42
+ return '';
43
+ }
17
44
  };
18
45
  //# sourceMappingURL=get.shortened.link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get.shortened.link.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/get.shortened.link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAmB,EAAE;IAC3D,qDAAqD;IACrD,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QAC5C,IAAI,CAAC;YACJ,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,IAAI,CACjC,8CAA8C,EAC9C;gBACC,GAAG,EAAE,gCAAgC;gBACrC,GAAG,EAAE,GAAG;aACR,CACD,CAAC;YACF,OAAO,CACN,SAAS,EAAE,IAAI,EAAE,OAAO,CACvB,iBAAiB,EACjB,wBAAwB,CACxB,CACD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,MAAM,CAAC,KAAK,CAAC,CAAC;QACf,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"get.shortened.link.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/get.shortened.link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,oDAAoD,CAAC;AAC/E,sEAAsE;AACtE,MAAM,kBAAkB,GAAG,2CAA2C,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAa,EAAU,EAAE;IACxD,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAA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* from './format.cleartax.b2c.error';
23
23
  export * from './build.cleartax.pay.dtls';
24
24
  export * from './resolve.cleartax.driver.sac.hsn';
25
25
  export * from './normalize.phone.number';
26
+ export * from './singapore.phone.number';
26
27
  export * from './resolve.passenger.display.name';
27
28
  export * from './remove.null.filter';
28
29
  export * from './calculate.deducted.sharing.amount';
@@ -33,6 +34,7 @@ export * from './line.item.helpers';
33
34
  export * from './tax.invoice.helpers';
34
35
  export * from './build.include.revenue.client.id.set';
35
36
  export * from './amount.in.words';
37
+ export * from './money';
36
38
  export * from './calculate.ba.payout.working.days';
37
39
  export * from './garage.start.from.pickup';
38
40
  export * from './parse.display.date';
@@ -58,3 +60,4 @@ export * from './ba.contract.rm.refund';
58
60
  export * from './trip.allocation';
59
61
  export * from './gps.odometer.km';
60
62
  export * from './ltr.invoice.in.force';
63
+ export * from './show.cust.usage.dtls';
@@ -23,6 +23,7 @@ export * from './format.cleartax.b2c.error';
23
23
  export * from './build.cleartax.pay.dtls';
24
24
  export * from './resolve.cleartax.driver.sac.hsn';
25
25
  export * from './normalize.phone.number';
26
+ export * from './singapore.phone.number';
26
27
  export * from './resolve.passenger.display.name';
27
28
  export * from './remove.null.filter';
28
29
  export * from './calculate.deducted.sharing.amount';
@@ -33,6 +34,7 @@ export * from './line.item.helpers';
33
34
  export * from './tax.invoice.helpers';
34
35
  export * from './build.include.revenue.client.id.set';
35
36
  export * from './amount.in.words';
37
+ export * from './money';
36
38
  export * from './calculate.ba.payout.working.days';
37
39
  export * from './garage.start.from.pickup';
38
40
  export * from './parse.display.date';
@@ -58,4 +60,5 @@ export * from './ba.contract.rm.refund';
58
60
  export * from './trip.allocation';
59
61
  export * from './gps.odometer.km';
60
62
  export * from './ltr.invoice.in.force';
63
+ export * from './show.cust.usage.dtls';
61
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/index.ts"],"names":[],"mappings":"AAAA,c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8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,YAAY,CAAC;AAC3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,OAAO,CAAC;AACtB,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { BusinessContextOwnerField, IBusinessContextOwner } from '@autologix/shared/models';
2
+ /** How a currency is written on documents and screens. */
3
+ export interface CurrencyMeta {
4
+ /** ISO 4217 code, e.g. 'INR'. */
5
+ code: string;
6
+ /** Symbol before an amount, e.g. '₹'. */
7
+ symbol: string;
8
+ /** Short text prefix used where the symbol is spelled out, e.g. 'Rs.'. */
9
+ abbrev: string;
10
+ /** Locale for digit grouping, e.g. 'en-IN' (lakh/crore). */
11
+ locale: string;
12
+ /** Major and minor unit names for amount in words. */
13
+ major: string;
14
+ minor: string;
15
+ /**
16
+ * How amount in words groups digits: 'indian' (lakh / crore, the existing
17
+ * convertToRupeesAndPaisa text) or 'international' (million / billion).
18
+ */
19
+ numbering: 'indian' | 'international';
20
+ }
21
+ /**
22
+ * The currencies companies can bill in. INR matches what India-only code
23
+ * printed before currencies existed, so Indian output is unchanged.
24
+ */
25
+ export declare const CURRENCY_META: Record<string, CurrencyMeta>;
26
+ /** True for a currency code this platform can bill in. */
27
+ export declare const isSupportedCurrency: (code?: string | null) => boolean;
28
+ /** `code`'s formatting rules; INR's for a missing or unsupported code. */
29
+ export declare const currencyMeta: (code?: string | null) => CurrencyMeta;
30
+ /**
31
+ * A company's currency from its row, INR when missing or unsupported (rows
32
+ * read before the column existed, or a partial select without it).
33
+ */
34
+ export declare const companyCurrency: (company?: Pick<IBusinessContextOwner, BusinessContextOwnerField.Currency> | null) => string;
35
+ /** The symbol written before amounts in `code`, e.g. '₹' or 'S$'. */
36
+ export declare const currencySymbol: (code?: string | null) => string;
37
+ /**
38
+ * `amount` with `code`'s digit grouping and a fixed number of decimals, no
39
+ * symbol: 123456.5 is '1,23,456.50' in INR and '123,456.50' in SGD.
40
+ */
41
+ export declare const formatAmount: (amount: number, code?: string | null, decimals?: number) => string;
42
+ /**
43
+ * `amount` with its symbol and `code`'s grouping, no space: 123456.5 is
44
+ * '₹1,23,456.50' in INR and 'S$123,456.50' in SGD (the alert emails' form).
45
+ */
46
+ export declare const formatMoney: (amount: number, code?: string | null, decimals?: number) => string;
47
+ /**
48
+ * `amount` in words for a document, upper case. INR is exactly
49
+ * convertToRupeesAndPaisa ('Rs. ONE HUNDRED RUPEES AND ZERO PAISE ONLY.');
50
+ * other currencies use international numbering
51
+ * ('S$ ONE HUNDRED SINGAPORE DOLLARS AND FIFTY CENTS ONLY.').
52
+ */
53
+ export declare const amountInWords: (amount: number, code?: string | null) => string;
54
+ /**
55
+ * The only currency the payment, e-invoicing and ERP integrations handle
56
+ * today: CCAvenue and Razorpay are called with INR, Cleartax files Indian GST
57
+ * e-invoices (IRN), QUp is told the fare is INR and the D365 imports carry
58
+ * CURRENCYCODE INR. A company billing in anything else must not reach them,
59
+ * or its amounts would be charged or booked as rupees.
60
+ */
61
+ export declare const INR_ONLY_CURRENCY = "INR";
62
+ /**
63
+ * True when a company bills in INR. A missing or unsupported code counts as
64
+ * INR, as companyCurrency() reads it, so every company from before currencies
65
+ * existed behaves exactly as it did.
66
+ */
67
+ export declare const isInrCompany: (currency?: string | null) => boolean;
68
+ /** Names of INR-only features, for inrOnlyMessage / assertInrCompany. */
69
+ export declare const InrOnlyFeature: {
70
+ readonly OnlinePayments: "Online payments";
71
+ readonly StandingInstructions: "Standing instructions";
72
+ readonly GstEInvoices: "GST e-invoices (IRN)";
73
+ readonly QupFareUpdates: "QUp fare updates";
74
+ readonly ErpImports: "D365 import sheets";
75
+ };
76
+ /**
77
+ * Why `feature` is refused for a non-INR company, e.g. "Online payments are
78
+ * not available for SGD companies yet."
79
+ */
80
+ export declare const inrOnlyMessage: (currency: string | null | undefined, feature: string) => string;
81
+ /** Throws inrOnlyMessage(currency, feature) unless the company bills in INR. */
82
+ export declare const assertInrCompany: (currency: string | null | undefined, feature: string) => void;
@@ -0,0 +1,123 @@
1
+ import { BusinessContextOwnerField, } from '@autologix/shared/models';
2
+ import { DEFAULT_CURRENCY } from '@autologix/shared/enums';
3
+ import { convertNumberToWordsInternational, convertToRupeesAndPaisa, } from './amount.in.words';
4
+ /**
5
+ * The currencies companies can bill in. INR matches what India-only code
6
+ * printed before currencies existed, so Indian output is unchanged.
7
+ */
8
+ export const CURRENCY_META = {
9
+ INR: {
10
+ code: 'INR',
11
+ symbol: '₹',
12
+ abbrev: 'Rs.',
13
+ locale: 'en-IN',
14
+ major: 'rupees',
15
+ minor: 'paise',
16
+ numbering: 'indian',
17
+ },
18
+ SGD: {
19
+ code: 'SGD',
20
+ symbol: 'S$',
21
+ abbrev: 'S$',
22
+ locale: 'en-SG',
23
+ major: 'Singapore dollars',
24
+ minor: 'cents',
25
+ numbering: 'international',
26
+ },
27
+ };
28
+ /** True for a currency code this platform can bill in. */
29
+ export const isSupportedCurrency = (code) => !!code && Object.prototype.hasOwnProperty.call(CURRENCY_META, code);
30
+ /** `code`'s formatting rules; INR's for a missing or unsupported code. */
31
+ export const currencyMeta = (code) => CURRENCY_META[isSupportedCurrency(code) ? code : DEFAULT_CURRENCY];
32
+ /**
33
+ * A company's currency from its row, INR when missing or unsupported (rows
34
+ * read before the column existed, or a partial select without it).
35
+ */
36
+ export const companyCurrency = (company) => {
37
+ const code = company?.[BusinessContextOwnerField.Currency];
38
+ return isSupportedCurrency(code) ? code : DEFAULT_CURRENCY;
39
+ };
40
+ /** The symbol written before amounts in `code`, e.g. '₹' or 'S$'. */
41
+ export const currencySymbol = (code) => currencyMeta(code).symbol;
42
+ /**
43
+ * `amount` with `code`'s digit grouping and a fixed number of decimals, no
44
+ * symbol: 123456.5 is '1,23,456.50' in INR and '123,456.50' in SGD.
45
+ */
46
+ export const formatAmount = (amount, code, decimals = 2) => new Intl.NumberFormat(currencyMeta(code).locale, {
47
+ minimumFractionDigits: decimals,
48
+ maximumFractionDigits: decimals,
49
+ }).format(amount);
50
+ /**
51
+ * `amount` with its symbol and `code`'s grouping, no space: 123456.5 is
52
+ * '₹1,23,456.50' in INR and 'S$123,456.50' in SGD (the alert emails' form).
53
+ */
54
+ export const formatMoney = (amount, code, decimals = 2) => {
55
+ const meta = currencyMeta(code);
56
+ return `${meta.symbol}${amount.toLocaleString(meta.locale, {
57
+ minimumFractionDigits: decimals,
58
+ maximumFractionDigits: decimals,
59
+ })}`;
60
+ };
61
+ /**
62
+ * `amount` in words for a document, upper case. INR is exactly
63
+ * convertToRupeesAndPaisa ('Rs. ONE HUNDRED RUPEES AND ZERO PAISE ONLY.');
64
+ * other currencies use international numbering
65
+ * ('S$ ONE HUNDRED SINGAPORE DOLLARS AND FIFTY CENTS ONLY.').
66
+ */
67
+ export const amountInWords = (amount, code) => {
68
+ const meta = currencyMeta(code);
69
+ if (meta.numbering === 'indian')
70
+ return convertToRupeesAndPaisa(amount);
71
+ if (amount === null || amount === undefined || !Number.isFinite(amount)) {
72
+ return `${meta.abbrev} ZERO ${meta.major} AND ZERO ${meta.minor} ONLY.`.toUpperCase();
73
+ }
74
+ const absolute = Math.abs(amount);
75
+ let major = Math.floor(absolute);
76
+ let minor = Math.round((absolute - major) * 100);
77
+ // 1.999 rounds to 100 cents: carry it rather than print "100 cents".
78
+ if (minor === 100) {
79
+ major += 1;
80
+ minor = 0;
81
+ }
82
+ // Signed after rounding: -0.001 is zero, not "(-) ZERO ... ZERO CENTS".
83
+ const prefix = amount < 0 && (major > 0 || minor > 0)
84
+ ? `(-)${meta.abbrev} `
85
+ : `${meta.abbrev} `;
86
+ const words = `${convertNumberToWordsInternational(major)} ${meta.major} and ${convertNumberToWordsInternational(minor)} ${meta.minor} only.`;
87
+ return `${prefix}${words.toUpperCase()}`;
88
+ };
89
+ /**
90
+ * The only currency the payment, e-invoicing and ERP integrations handle
91
+ * today: CCAvenue and Razorpay are called with INR, Cleartax files Indian GST
92
+ * e-invoices (IRN), QUp is told the fare is INR and the D365 imports carry
93
+ * CURRENCYCODE INR. A company billing in anything else must not reach them,
94
+ * or its amounts would be charged or booked as rupees.
95
+ */
96
+ export const INR_ONLY_CURRENCY = 'INR';
97
+ /**
98
+ * True when a company bills in INR. A missing or unsupported code counts as
99
+ * INR, as companyCurrency() reads it, so every company from before currencies
100
+ * existed behaves exactly as it did.
101
+ */
102
+ export const isInrCompany = (currency) => (isSupportedCurrency(currency) ? currency : DEFAULT_CURRENCY) ===
103
+ INR_ONLY_CURRENCY;
104
+ /** Names of INR-only features, for inrOnlyMessage / assertInrCompany. */
105
+ export const InrOnlyFeature = {
106
+ OnlinePayments: 'Online payments',
107
+ StandingInstructions: 'Standing instructions',
108
+ GstEInvoices: 'GST e-invoices (IRN)',
109
+ QupFareUpdates: 'QUp fare updates',
110
+ ErpImports: 'D365 import sheets',
111
+ };
112
+ /**
113
+ * Why `feature` is refused for a non-INR company, e.g. "Online payments are
114
+ * not available for SGD companies yet."
115
+ */
116
+ export const inrOnlyMessage = (currency, feature) => `${feature} are not available for ${currency} companies yet.`;
117
+ /** Throws inrOnlyMessage(currency, feature) unless the company bills in INR. */
118
+ export const assertInrCompany = (currency, feature) => {
119
+ if (!isInrCompany(currency)) {
120
+ throw new Error(inrOnlyMessage(currency, feature));
121
+ }
122
+ };
123
+ //# sourceMappingURL=money.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"money.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/money.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,GAEzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACN,iCAAiC,EACjC,uBAAuB,GACvB,MAAM,mBAAmB,CAAC;AAsB3B;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC;IAC1D,GAAG,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,QAAQ;KACnB;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,mBAAmB;QAC1B,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,eAAe;KAC1B;CACD,CAAC;AAEF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAoB,EAAW,EAAE,CACpE,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CA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AG,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;AAC1C,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAwB,EAAW,EAAE,CACjE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAC7D,iBAAiB,CAAC;AAEnB,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,cAAc,EAAE,iBAAiB;IACjC,oBAAoB,EAAE,uBAAuB;IAC7C,YAAY,EAAE,sBAAsB;IACpC,cAAc,EAAE,kBAAkB;IAClC,UAAU,EAAE,oBAAoB;CACvB,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,QAAmC,EACnC,OAAe,EACN,EAAE,CAAC,GAAG,OAAO,0BAA0B,QAAQ,iBAAiB,CAAC;AAE3E,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,QAAmC,EACnC,OAAe,EACR,EAAE;IACT,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,CAAC;AACF,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { IBillingMethods } from '@autologix/shared/models';
2
+ /**
3
+ * ZD-72175: whether a client's duty slips show the customer usage details
4
+ * (pickup/drop-off KMs and times, G2P/P2D/D2G KMs).
5
+ *
6
+ * Stored as `ClientPersona.billMthd.showCustUsageDtls`. Avis turns it off for
7
+ * selected customers; every existing client never had the key, so a missing or
8
+ * null value means Yes. Only an explicit `false` hides the section.
9
+ */
10
+ export declare const showsCustUsageDtls: (billMthd?: Partial<IBillingMethods> | null) => boolean;
11
+ /**
12
+ * The value sent to MMI as `ShowCustUsageDtls` on the booking push and the
13
+ * agreement-detail pull. Same Y/N convention as `RouteDetlReq`.
14
+ */
15
+ export declare const showCustUsageDtlsFlag: (billMthd?: Partial<IBillingMethods> | null) => "Y" | "N";
@@ -0,0 +1,16 @@
1
+ import { ClientPersonaField } from '@autologix/shared/models';
2
+ /**
3
+ * ZD-72175: whether a client's duty slips show the customer usage details
4
+ * (pickup/drop-off KMs and times, G2P/P2D/D2G KMs).
5
+ *
6
+ * Stored as `ClientPersona.billMthd.showCustUsageDtls`. Avis turns it off for
7
+ * selected customers; every existing client never had the key, so a missing or
8
+ * null value means Yes. Only an explicit `false` hides the section.
9
+ */
10
+ export const showsCustUsageDtls = (billMthd) => billMthd?.[ClientPersonaField.ShowCustUsageDtls] !== false;
11
+ /**
12
+ * The value sent to MMI as `ShowCustUsageDtls` on the booking push and the
13
+ * agreement-detail pull. Same Y/N convention as `RouteDetlReq`.
14
+ */
15
+ export const showCustUsageDtlsFlag = (billMthd) => (showsCustUsageDtls(billMthd) ? 'Y' : 'N');
16
+ //# sourceMappingURL=show.cust.usage.dtls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.cust.usage.dtls.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/show.cust.usage.dtls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,0BAA0B,CAAC;AAE/E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,QAA0C,EAChC,EAAE,CAAC,QAAQ,EAAE,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,KAAK,KAAK,CAAC;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACpC,QAA0C,EAC9B,EAAE,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Singapore (+65) phone numbers, accepted alongside the Indian (+91) ones the
3
+ * platform was built around.
4
+ *
5
+ * A Singapore number is `+65` and eight digits: mobiles start 8 or 9,
6
+ * landlines 6, VoIP 3. It is stored the same way an Indian one is, in E.164
7
+ * (`+6591234567`), so nothing that reads a stored number has to learn a new
8
+ * shape.
9
+ *
10
+ * Only a number that SAYS it is Singaporean is treated as one: a leading `+65`
11
+ * (or the `0065` international trunk spelling). A bare `6591234567` is ten
12
+ * digits and a perfectly valid Indian mobile, and a bare `91234567` is eight
13
+ * digits that every India-first rule in the codebase would mangle or reject —
14
+ * guessing either way would move a number to the wrong person. Callers that
15
+ * know the company is Singaporean compose the `+65` themselves.
16
+ *
17
+ * Every helper here returns null / false for anything that is not a Singapore
18
+ * number, so `toSingaporePhoneNumber(x) ?? <existing India rule>(x)` leaves the
19
+ * India behaviour exactly as it was.
20
+ */
21
+ export declare const INDIA_DIAL_CODE = "+91";
22
+ export declare const SINGAPORE_DIAL_CODE = "+65";
23
+ /**
24
+ * True when `phone` is a Singapore number already in stored (E.164) form,
25
+ * e.g. `+6591234567`. Decorated spellings (`+65 9123 4567`) are not — use
26
+ * {@link toSingaporePhoneNumber} to normalise those first.
27
+ */
28
+ export declare function isSingaporePhoneNumber(phone: unknown): boolean;
29
+ /**
30
+ * The E.164 form of a value that explicitly carries the Singapore country code
31
+ * (`+65 9123 4567`, `+65-91234567`, `(+65) 9123-4567`, `0065 91234567`), or
32
+ * null for anything else — including bare digits, which are left to the
33
+ * existing India rules.
34
+ */
35
+ export declare function toSingaporePhoneNumber(phone: string | number | null | undefined): string | null;
36
+ /**
37
+ * Whether a phone may be used to sign in or reset a password. India's rule is
38
+ * unchanged — anything starting `+91` passes here, as it did — and a Singapore
39
+ * number in E.164 is accepted alongside it.
40
+ */
41
+ export declare function isAcceptedLoginPhone(phone: string | null | undefined): boolean;
42
+ /**
43
+ * A driver mobile as the driver create / modify / bulk paths store it: a
44
+ * Singapore number in E.164; otherwise their rule from before +65, unchanged —
45
+ * a 13-character value (`+91` and ten digits) as is, anything else with `+91`
46
+ * in front. (Without the Singapore check, `+6591234567` is 11 characters and
47
+ * became `+91+6591234567`.)
48
+ */
49
+ export declare function toStoredDriverMobile(mobile: string): string;
50
+ /**
51
+ * `+91` in front of a value the caller holds as a bare Indian number — unless
52
+ * the value is already a Singapore number, which is returned normalised
53
+ * instead of becoming `+91+6591234567` (which a WhatsApp send strips to the
54
+ * Indian `916591234567`: somebody else's phone).
55
+ */
56
+ export declare function withIndianDialCode(phone: string): string;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Singapore (+65) phone numbers, accepted alongside the Indian (+91) ones the
3
+ * platform was built around.
4
+ *
5
+ * A Singapore number is `+65` and eight digits: mobiles start 8 or 9,
6
+ * landlines 6, VoIP 3. It is stored the same way an Indian one is, in E.164
7
+ * (`+6591234567`), so nothing that reads a stored number has to learn a new
8
+ * shape.
9
+ *
10
+ * Only a number that SAYS it is Singaporean is treated as one: a leading `+65`
11
+ * (or the `0065` international trunk spelling). A bare `6591234567` is ten
12
+ * digits and a perfectly valid Indian mobile, and a bare `91234567` is eight
13
+ * digits that every India-first rule in the codebase would mangle or reject —
14
+ * guessing either way would move a number to the wrong person. Callers that
15
+ * know the company is Singaporean compose the `+65` themselves.
16
+ *
17
+ * Every helper here returns null / false for anything that is not a Singapore
18
+ * number, so `toSingaporePhoneNumber(x) ?? <existing India rule>(x)` leaves the
19
+ * India behaviour exactly as it was.
20
+ */
21
+ export const INDIA_DIAL_CODE = '+91';
22
+ export const SINGAPORE_DIAL_CODE = '+65';
23
+ /** Eight digits, starting 3 (VoIP), 6 (landline), 8 or 9 (mobile). */
24
+ const SINGAPORE_SUBSCRIBER = /^[3689]\d{7}$/;
25
+ /** Already-normalised E.164 Singapore number. */
26
+ const SINGAPORE_E164 = /^\+65[3689]\d{7}$/;
27
+ /**
28
+ * True when `phone` is a Singapore number already in stored (E.164) form,
29
+ * e.g. `+6591234567`. Decorated spellings (`+65 9123 4567`) are not — use
30
+ * {@link toSingaporePhoneNumber} to normalise those first.
31
+ */
32
+ export function isSingaporePhoneNumber(phone) {
33
+ return typeof phone === 'string' && SINGAPORE_E164.test(phone);
34
+ }
35
+ /**
36
+ * The E.164 form of a value that explicitly carries the Singapore country code
37
+ * (`+65 9123 4567`, `+65-91234567`, `(+65) 9123-4567`, `0065 91234567`), or
38
+ * null for anything else — including bare digits, which are left to the
39
+ * existing India rules.
40
+ */
41
+ export function toSingaporePhoneNumber(phone) {
42
+ if (phone === null || phone === undefined)
43
+ return null;
44
+ // Brackets, spaces, dots and hyphens are decoration; the `+` is not.
45
+ const marker = String(phone)
46
+ .trim()
47
+ .replace(/[^\d+]/g, '');
48
+ let subscriber;
49
+ if (marker.startsWith('+65'))
50
+ subscriber = marker.slice(3);
51
+ else if (marker.startsWith('0065'))
52
+ subscriber = marker.slice(4);
53
+ else
54
+ return null;
55
+ return SINGAPORE_SUBSCRIBER.test(subscriber)
56
+ ? `${SINGAPORE_DIAL_CODE}${subscriber}`
57
+ : null;
58
+ }
59
+ /**
60
+ * Whether a phone may be used to sign in or reset a password. India's rule is
61
+ * unchanged — anything starting `+91` passes here, as it did — and a Singapore
62
+ * number in E.164 is accepted alongside it.
63
+ */
64
+ export function isAcceptedLoginPhone(phone) {
65
+ if (typeof phone !== 'string')
66
+ return false;
67
+ return (phone.substring(0, 3) === INDIA_DIAL_CODE ||
68
+ isSingaporePhoneNumber(phone));
69
+ }
70
+ /**
71
+ * A driver mobile as the driver create / modify / bulk paths store it: a
72
+ * Singapore number in E.164; otherwise their rule from before +65, unchanged —
73
+ * a 13-character value (`+91` and ten digits) as is, anything else with `+91`
74
+ * in front. (Without the Singapore check, `+6591234567` is 11 characters and
75
+ * became `+91+6591234567`.)
76
+ */
77
+ export function toStoredDriverMobile(mobile) {
78
+ return (toSingaporePhoneNumber(mobile) ??
79
+ (mobile.length === 13 ? mobile : INDIA_DIAL_CODE + mobile));
80
+ }
81
+ /**
82
+ * `+91` in front of a value the caller holds as a bare Indian number — unless
83
+ * the value is already a Singapore number, which is returned normalised
84
+ * instead of becoming `+91+6591234567` (which a WhatsApp send strips to the
85
+ * Indian `916591234567`: somebody else's phone).
86
+ */
87
+ export function withIndianDialCode(phone) {
88
+ return toSingaporePhoneNumber(phone) ?? INDIA_DIAL_CODE + phone;
89
+ }
90
+ //# sourceMappingURL=singapore.phone.number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singapore.phone.number.js","sourceRoot":"","sources":["../../../../../../../libs/shared/src/lib/utilities/src/singapore.phone.number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AACrC,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAEzC,sEAAsE;AACtE,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAE7C,iDAAiD;AACjD,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACrC,KAAyC;IAEzC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvD,qEAAqE;IACrE,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;SAC1B,IAAI,EAAE;SACN,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACzB,IAAI,UAAkB,CAAC;IACvB,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACtD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;;QAC5D,OAAO,IAAI,CAAC;IACjB,OAAO,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC;QAC3C,CAAC,CAAC,GAAG,mBAAmB,GAAG,UAAU,EAAE;QACvC,CAAC,CAAC,IAAI,CAAC;AACT,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CACnC,KAAgC;IAEhC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,CACN,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,eAAe;QACzC,sBAAsB,CAAC,KAAK,CAAC,CAC7B,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IAClD,OAAO,CACN,sBAAsB,CAAC,MAAM,CAAC;QAC9B,CAAC,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,GAAG,MAAM,CAAC,CAC1D,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC/C,OAAO,sBAAsB,CAAC,KAAK,CAAC,IAAI,eAAe,GAAG,KAAK,CAAC;AACjE,CAAC"}
@@ -85,6 +85,8 @@ export interface ContextListItem {
85
85
  dbAuditLogsEnabled?: boolean;
86
86
  /** IANA timezone of the company (BusinessContextOwner.timezone), e.g. 'Asia/Singapore'. */
87
87
  timezone?: string;
88
+ /** ISO 4217 currency of the company (BusinessContextOwner.currency), e.g. 'SGD'. */
89
+ currency?: string;
88
90
  }
89
91
  export interface IDriverDashBoardData {
90
92
  distance: number;