sahab-utils 1.9.2 → 1.9.3

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.
@@ -1,5 +1,6 @@
1
1
  import { DocumentReference, GeoPoint, Timestamp } from 'firebase/firestore';
2
2
  import type { PushTransport } from '../ts/push';
3
+ import type { TapLicenseType } from '../ts/tap';
3
4
  export type GeoPointType = GeoPoint;
4
5
  export type TimestampType = Timestamp;
5
6
  export type DistenceDueration = {
@@ -493,7 +494,6 @@ export declare const INTEGRATION_KEYS: {
493
494
  export type IntegrationKey = (typeof INTEGRATION_KEYS)[keyof typeof INTEGRATION_KEYS];
494
495
  export type TapKycStatus = 'draft' | 'documents_uploaded' | 'lead_created' | 'account_created' | 'payout_enabled' | 'rejected';
495
496
  export type TapDocumentPurpose = 'commercial_registration' | 'national_id' | 'bank_statement' | 'iban_certificate';
496
- export type TapLicenseType = 'LLC' | 'SOLE_PROPRIETORSHIP' | 'JOINT_STOCK' | 'PARTNERSHIP' | 'OTHER';
497
497
  export type TapApplicationFile = {
498
498
  purpose: TapDocumentPurpose;
499
499
  fileId: string;
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './ts/loyalty';
10
10
  export * from './ts/offerings';
11
11
  export * from './ts/orderActivity';
12
12
  export * from './ts/payLink';
13
+ export * from './ts/tap';
13
14
  export * from './ts/push';
14
15
  export * from './ts/utils';
15
16
  export * from './ts/wheel';
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ __exportStar(require("./ts/loyalty"), exports);
26
26
  __exportStar(require("./ts/offerings"), exports);
27
27
  __exportStar(require("./ts/orderActivity"), exports);
28
28
  __exportStar(require("./ts/payLink"), exports);
29
+ __exportStar(require("./ts/tap"), exports);
29
30
  __exportStar(require("./ts/push"), exports);
30
31
  __exportStar(require("./ts/utils"), exports);
31
32
  __exportStar(require("./ts/wheel"), exports);
@@ -0,0 +1,6 @@
1
+ /** The only `entity.license.type` values Tap's Create Lead API accepts, spelled exactly as Tap lists them. */
2
+ export declare const TAP_LICENSE_TYPES: readonly ["Establishment", "Trust", "Partnership", "LLC", "JSC", "Foreign JSC Branch", "Mix LLC", "Foreign LLC", "GCC Partnership", "GCC LLC", "GCC JSC", "Foreign LLC Branch", "Profession LLC", "Freelancer"];
3
+ export type TapLicenseType = (typeof TAP_LICENSE_TYPES)[number];
4
+ export declare const isTapLicenseType: (value: unknown) => value is TapLicenseType;
5
+ /** A stored or submitted license type as one Tap accepts, or undefined when it maps to none. */
6
+ export declare function normalizeTapLicenseType(value: unknown): TapLicenseType | undefined;
package/dist/ts/tap.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTapLicenseType = exports.TAP_LICENSE_TYPES = void 0;
4
+ exports.normalizeTapLicenseType = normalizeTapLicenseType;
5
+ /** The only `entity.license.type` values Tap's Create Lead API accepts, spelled exactly as Tap lists them. */
6
+ exports.TAP_LICENSE_TYPES = [
7
+ 'Establishment',
8
+ 'Trust',
9
+ 'Partnership',
10
+ 'LLC',
11
+ 'JSC',
12
+ 'Foreign JSC Branch',
13
+ 'Mix LLC',
14
+ 'Foreign LLC',
15
+ 'GCC Partnership',
16
+ 'GCC LLC',
17
+ 'GCC JSC',
18
+ 'Foreign LLC Branch',
19
+ 'Profession LLC',
20
+ 'Freelancer',
21
+ ];
22
+ const isTapLicenseType = (value) => exports.TAP_LICENSE_TYPES.includes(value);
23
+ exports.isTapLicenseType = isTapLicenseType;
24
+ // Applications saved before the list was corrected hold the dashboard's old names. There is no Tap value for
25
+ // "other", so that one stays unresolved and the form must ask again.
26
+ const LEGACY_LICENSE_TYPES = {
27
+ SOLE_PROPRIETORSHIP: 'Establishment',
28
+ JOINT_STOCK: 'JSC',
29
+ PARTNERSHIP: 'Partnership',
30
+ };
31
+ /** A stored or submitted license type as one Tap accepts, or undefined when it maps to none. */
32
+ function normalizeTapLicenseType(value) {
33
+ if ((0, exports.isTapLicenseType)(value))
34
+ return value;
35
+ return typeof value === 'string' ? LEGACY_LICENSE_TYPES[value] : undefined;
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sahab-utils",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "This package contains types and utils functions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "build": "tsc",
9
9
  "prepublishOnly": "npm run build",
10
10
  "deploy": "npm run build && npm publish",
11
- "test": "npm run build && node tests/loyalty.test.js && node tests/gifts.test.js && node tests/cashback.test.js && node tests/utils.test.js && node tests/wheel.test.js && node tests/calcs.test.js && node tests/orderActivity.test.js && node tests/push.test.js && node tests/broadcast.test.js && node tests/iban.test.js && node tests/cash.test.js && node tests/workingHours.test.js && node tests/payLink.test.js && node tests/offerings.test.js && node tests/capacity.test.js"
11
+ "test": "npm run build && node tests/loyalty.test.js && node tests/gifts.test.js && node tests/cashback.test.js && node tests/utils.test.js && node tests/wheel.test.js && node tests/calcs.test.js && node tests/orderActivity.test.js && node tests/push.test.js && node tests/broadcast.test.js && node tests/iban.test.js && node tests/cash.test.js && node tests/workingHours.test.js && node tests/payLink.test.js && node tests/offerings.test.js && node tests/capacity.test.js && node tests/tap.test.js"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",