@africanies/angular-web-sdk 0.1.5 → 0.1.7
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.
- package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +140 -52
- package/.nx/cache/13466509747676776487/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
- package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/package.json +3 -3
- package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +14 -11
- package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +539 -232
- package/.nx/cache/14995846848874973576/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/package.json +5 -5
- package/.nx/cache/{5741611231803799383 → 14995846848874973576}/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +111 -28
- package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +16 -0
- package/.nx/cache/6673686859704879504/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/{14153928176747262656 → 6673686859704879504}/dist/libs/africanies-theme/package.json +3 -3
- package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/tailwind-preset.cjs +31 -14
- package/.nx/cache/{14153928176747262656 → 6673686859704879504}/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +18 -1
- package/.nx/cache/run.json +18 -18
- package/.nx/cache/terminalOutputs/{4011892767661954819 → 13466509747676776487} +1 -1
- package/.nx/cache/terminalOutputs/1446890025183346611 +32 -0
- package/.nx/cache/terminalOutputs/{3064561615116090625 → 14995846848874973576} +7 -7
- package/.nx/cache/terminalOutputs/6337357866566791975 +6 -0
- package/.nx/cache/terminalOutputs/{1275815545780424169 → 6673686859704879504} +1 -1
- package/.nx/cache/terminalOutputs/{12148417737220755248 → 8032148447904822353} +182 -174
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
- package/.nx/workspace-data/d/daemon.log +2461 -0
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +2747 -2747
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/project-graph.json +2 -2
- package/apps/playground/src/app/pages/button-page.ts +5 -3
- package/apps/playground/src/app/pages/feedback-page.ts +1 -1
- package/apps/playground/src/app/pages/home-page.ts +1 -1
- package/apps/playground/src/app/pages/icons-page.ts +3 -3
- package/apps/playground/src/app/pages/lecture-page.ts +3 -3
- package/apps/playground/src/app/pages/models-page.ts +1 -1
- package/apps/playground/src/app/pages/overlay-demos.ts +1 -1
- package/apps/playground/src/app/pages/tokens-page.ts +17 -3
- package/apps/playground/src/app/pages/usecases/onboarding-login.page.ts +1 -1
- package/apps/playground/src/app/pages/usecases/onboarding-reset-password.page.ts +1 -1
- package/apps/playground/src/app/pages/usecases/shipment-detail.page.ts +1 -1
- package/apps/playground/src/app/pages/viewport-preview.component.ts +1 -1
- package/apps/playground/src/app/snippets/button.snippets.ts +4 -3
- package/apps/playground/src/index.html +6 -0
- package/apps/playground/src/styles.css +4 -5
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +131 -8
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
- package/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +8 -6
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +12 -2
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -1
- package/dist/libs/africanies-theme/tailwind-preset.cjs +16 -7
- package/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +11 -3
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +83 -63
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
- package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +11 -8
- package/libs/africanies-core/src/index.ts +1 -0
- package/libs/africanies-core/src/lib/notification/index.ts +1 -1
- package/libs/africanies-core/src/lib/notification/notification-link.spec.ts +40 -7
- package/libs/africanies-core/src/lib/notification/notification-link.ts +143 -7
- package/libs/africanies-theme/src/lib/mode-color.safelist.ts +8 -2
- package/libs/africanies-theme/src/lib/mode-color.service.ts +16 -0
- package/libs/africanies-theme/tailwind-preset.cjs +16 -7
- package/libs/africanies-ui/src/lib/button/button.component.ts +5 -1
- package/libs/africanies-ui/src/lib/feedback/empty-state.component.ts +1 -1
- package/libs/africanies-ui/src/lib/feedback/error-state.component.ts +1 -1
- package/libs/africanies-ui/src/lib/forms/file-upload/file-preview.dialog.ts +1 -1
- package/libs/africanies-ui/src/lib/forms/file-upload/file-upload.component.ts +4 -4
- package/libs/africanies-ui/src/lib/forms/form-field.classes.ts +2 -2
- package/libs/africanies-ui/src/lib/forms/select/select.component.ts +1 -1
- package/libs/africanies-ui/src/lib/layout/app-shell-header.component.ts +1 -1
- package/libs/africanies-ui/src/lib/layout/app-shell.component.ts +2 -2
- package/libs/africanies-ui/src/lib/navigation/shipping-mode-switch/shipping-mode-switch.component.ts +2 -2
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.html +2 -2
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.ts +10 -6
- package/libs/africanies-ui/src/lib/notifications/notification-drawer.panel.ts +21 -8
- package/libs/africanies-ui/src/lib/overlay/drawer.service.ts +1 -1
- package/libs/africanies-ui/src/lib/overlay/modal.service.ts +1 -1
- package/libs/africanies-ui/src/lib/pagination/pagination.component.ts +3 -3
- package/libs/africanies-ui/src/lib/table/table.component.ts +5 -5
- package/libs/africanies-ui/src/lib/toast/toast-host.component.ts +4 -4
- package/libs/africanies-ui/src/lib/toast/toast-item.component.ts +1 -1
- package/package.json +1 -1
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/package.json +0 -36
- package/.nx/cache/1275815545780424169/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +0 -157
- package/.nx/cache/13524438527920092277/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/README.md +0 -46
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +0 -215
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/14153928176747262656/dist/libs/africanies-theme/tailwind-preset.cjs +0 -245
- package/.nx/cache/18132311043100376919/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/18132311043100376919/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +0 -5410
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/README.md +0 -69
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/assets/icons.sprite.svg +0 -1844
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +0 -832
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +0 -1
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/package.json +0 -31
- package/.nx/cache/2782605790118376385/dist/libs/africanies-icons/types/africanies-africanies-icons.d.ts +0 -108
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/README.md +0 -31
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs +0 -243
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs.map +0 -1
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/package.json +0 -27
- package/.nx/cache/3064561615116090625/dist/libs/africanies-storage/types/africanies-africanies-storage.d.ts +0 -210
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/README.md +0 -85
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +0 -4546
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/package.json +0 -32
- package/.nx/cache/4011892767661954819/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +0 -2740
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/README.md +0 -68
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -5
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -7
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +0 -19088
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/5741611231803799383/dist/libs/africanies-ui/package.json +0 -36
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/README.md +0 -60
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs +0 -599
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs.map +0 -1
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/package.json +0 -24
- package/.nx/cache/6372470950255467653/dist/libs/africanies-models/types/africanies-africanies-models.d.ts +0 -1452
- package/.nx/cache/terminalOutputs/11768036696192889608 +0 -8
- package/.nx/cache/terminalOutputs/1227201614544602906 +0 -23
- package/.nx/cache/terminalOutputs/12538607787148205787 +0 -19
- package/.nx/cache/terminalOutputs/13524438527920092277 +0 -196
- package/.nx/cache/terminalOutputs/14153928176747262656 +0 -45
- package/.nx/cache/terminalOutputs/17404566492103808557 +0 -8
- package/.nx/cache/terminalOutputs/18132311043100376919 +0 -315
- package/.nx/cache/terminalOutputs/2436781291243085315 +0 -8
- package/.nx/cache/terminalOutputs/2782605790118376385 +0 -21
- package/.nx/cache/terminalOutputs/3681975492957101833 +0 -8
- package/.nx/cache/terminalOutputs/5741611231803799383 +0 -21
- package/.nx/cache/terminalOutputs/6037166070823946880 +0 -8
- package/.nx/cache/terminalOutputs/6372470950255467653 +0 -21
- package/.nx/cache/terminalOutputs/665190206482526466 +0 -175
- package/.nx/cache/terminalOutputs/7756595539965457927 +0 -23
- package/.nx/cache/terminalOutputs/9200013119269230075 +0 -8
- /package/.nx/cache/{13524438527920092277 → 13466509747676776487}/dist/libs/africanies-core/README.md +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/README.md +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -0
- /package/.nx/cache/{18132311043100376919 → 14995846848874973576}/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -0
- /package/.nx/cache/{1275815545780424169 → 6673686859704879504}/dist/libs/africanies-theme/README.md +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@africanies/africanies-ui",
|
|
3
|
-
"version": "0.0.2",
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^22.0.0",
|
|
6
|
-
"@angular/core": "^22.0.0",
|
|
7
|
-
"@angular/cdk": "^22.0.0",
|
|
8
|
-
"@angular/forms": "^22.0.0",
|
|
9
|
-
"@angular/router": "^22.0.0",
|
|
10
|
-
"rxjs": "^7.8.0",
|
|
11
|
-
"@africanies/africanies-models": "^0.0.2",
|
|
12
|
-
"@africanies/africanies-icons": "^0.0.1",
|
|
13
|
-
"@africanies/africanies-core": "^0.0.2",
|
|
14
|
-
"@africanies/africanies-theme": "^0.0.1"
|
|
15
|
-
},
|
|
16
|
-
"sideEffects": false,
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"registry": "https://npm.pkg.github.com",
|
|
19
|
-
"access": "restricted"
|
|
20
|
-
},
|
|
21
|
-
"module": "fesm2022/africanies-africanies-ui.mjs",
|
|
22
|
-
"typings": "types/africanies-africanies-ui.d.ts",
|
|
23
|
-
"exports": {
|
|
24
|
-
"./package.json": {
|
|
25
|
-
"default": "./package.json"
|
|
26
|
-
},
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./types/africanies-africanies-ui.d.ts",
|
|
29
|
-
"default": "./fesm2022/africanies-africanies-ui.mjs"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"type": "module",
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"tslib": "^2.3.0"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# @africanies/africanies-models
|
|
2
|
-
|
|
3
|
-
Shared TypeScript **domain models** for the AFRICANIES Web SDK — API envelopes,
|
|
4
|
-
utility payloads (countries, shipment methods), shipping/mode config, filters,
|
|
5
|
-
and async UI snapshots. Types only: no Angular runtime, so apps and tooling can
|
|
6
|
-
import them safely.
|
|
7
|
-
|
|
8
|
-
## Naming
|
|
9
|
-
|
|
10
|
-
Domain interfaces use a `*Model` suffix (`CountryModel`, `ApiResponseModel`,
|
|
11
|
-
`ModeConfigDataModel`, `FilterStateModel`, …). Literal unions and small helper
|
|
12
|
-
types (e.g. `ShippingMode`, `ResourceId`, `FilterFieldType`) stay without the
|
|
13
|
-
suffix.
|
|
14
|
-
|
|
15
|
-
## Domains
|
|
16
|
-
|
|
17
|
-
- **api** — `ApiResponseModel`, `PaginationMetaModel`, `PaginationQueryParamsModel`, `ResourceId`, `ApiJsonValue`
|
|
18
|
-
- **country** — `CountryModel`, `CountryStateModel` for public country utility reads
|
|
19
|
-
- **service** — `ServiceModel` for `GET /public/service/read` (App Settings catalog)
|
|
20
|
-
- **document** — `DocumentModel` for `GET /public/document/read` (by-id preview on nested `file_ref`)
|
|
21
|
-
- **plan** — `PlanModel`, `PlanPackageModel` for `GET /public/plan/read`
|
|
22
|
-
- **currency** — `CurrencyModel`, `CurrencyPaymentMethodModel` for `/currency/read`; `CurrencyCreateRequestModel` / `CurrencyUpdateRequestModel` / `CurrencyDeleteRequestModel` for App Settings writes
|
|
23
|
-
- **payment-method** — `PaymentMethodModel`, `PaymentMethodCurrencyModel` for `/payment_method/read`; `PaymentMethodUpdateRequestModel` for App Settings active toggle (`PUT /payment_method/update`). No create/delete models.
|
|
24
|
-
- **shipment-method** — `ShipmentMethodModel`, zone link/page models for carriers
|
|
25
|
-
- **warehouse** — `WarehouseModel`, `WarehouseStateModel` (nested `CountryModel`)
|
|
26
|
-
- **zone** — `ZoneModel` for `/zone/read/records` utility reads
|
|
27
|
-
- **auth** — `ForgotPasswordRequestModel` for email-only `POST /auth/forgot/password`
|
|
28
|
-
- **user** — `UserModel` (+ nested business account / plan / subscription) for bare `GET /user` (auth); `ChangePasswordRequestModel` for first-login `POST /user/change/password`
|
|
29
|
-
- **notification** — `NotificationModel`, `NotificationPayloadModel`, inbox helpers for `GET /user/notifications/read/{id?}`
|
|
30
|
-
- **filters** — `ModuleFilterConfigModel`, `FilterStateModel`, `FilterTransport`, `toFilterParams` / `fromFilterParams` / `hasFilterParams`
|
|
31
|
-
- **mode** — `ModeConfigDataModel`, region/currency/unit config for STN and SFN
|
|
32
|
-
- **shipping** — `ShippingMode` (`'stn' | 'sfn'`)
|
|
33
|
-
- **async** — `AsyncQueryStateModel` for UI async wrappers
|
|
34
|
-
|
|
35
|
-
API wire models use **snake_case** field names to match server payloads. Filter/async
|
|
36
|
-
UI models stay camelCase.
|
|
37
|
-
|
|
38
|
-
## Usage
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
import type {
|
|
42
|
-
ApiResponseModel,
|
|
43
|
-
CountryModel,
|
|
44
|
-
CurrencyModel,
|
|
45
|
-
DocumentModel,
|
|
46
|
-
ModeConfigDataModel,
|
|
47
|
-
PaymentMethodModel,
|
|
48
|
-
PlanModel,
|
|
49
|
-
ServiceModel,
|
|
50
|
-
ShipmentMethodModel,
|
|
51
|
-
ShippingMode,
|
|
52
|
-
WarehouseModel,
|
|
53
|
-
ZoneModel,
|
|
54
|
-
UserModel,
|
|
55
|
-
} from '@africanies/africanies-models';
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Tests
|
|
59
|
-
|
|
60
|
-
Run `nx test africanies-models` (type-only library; specs optional).
|
|
@@ -1,599 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Allowed page sizes for list pagination (`size` query param).
|
|
3
|
-
*/
|
|
4
|
-
const PAGINATION_PAGE_SIZES = [5, 15, 30];
|
|
5
|
-
/** Default `size` on paginated resource GETs. */
|
|
6
|
-
const DEFAULT_PAGE_SIZE = 15;
|
|
7
|
-
/** Inbox / notification list page size. */
|
|
8
|
-
const NOTIFICATION_PAGE_SIZE = 30;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Hardcoded inbound delivery vendor slugs — same values as legacy portal forms (no API).
|
|
12
|
-
*/
|
|
13
|
-
const DELIVERY_VENDORS = [
|
|
14
|
-
{ id: 'amazon', name: 'Amazon' },
|
|
15
|
-
{ id: 'dhl', name: 'DHL' },
|
|
16
|
-
{ id: 'fedex', name: 'FedEx' },
|
|
17
|
-
{ id: 'usps', name: 'USPS' },
|
|
18
|
-
{ id: 'ups', name: 'UPS' },
|
|
19
|
-
{ id: 'others', name: 'Others' },
|
|
20
|
-
];
|
|
21
|
-
/** Export box editor only — not used on inbound receive/edit forms. */
|
|
22
|
-
const EXPORT_DELIVERY_VENDORS = [
|
|
23
|
-
...DELIVERY_VENDORS,
|
|
24
|
-
{ id: 'walk-in', name: 'Walk-In' },
|
|
25
|
-
];
|
|
26
|
-
/** @deprecated Prefer {@link DELIVERY_VENDORS}. */
|
|
27
|
-
const DELIVERY_VENDOR_OPTIONS = DELIVERY_VENDORS.map((row) => ({
|
|
28
|
-
value: row.id,
|
|
29
|
-
label: row.name,
|
|
30
|
-
}));
|
|
31
|
-
/** @deprecated Prefer {@link EXPORT_DELIVERY_VENDORS}. */
|
|
32
|
-
const BOX_DELIVERY_VENDORS = EXPORT_DELIVERY_VENDORS;
|
|
33
|
-
const VENDOR_LABELS = Object.fromEntries(DELIVERY_VENDORS.map((row) => [row.id, row.name]));
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @param value
|
|
37
|
-
*/
|
|
38
|
-
function normalizeDeliveryVendor(value) {
|
|
39
|
-
return value.trim().toLowerCase();
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @param value
|
|
44
|
-
*/
|
|
45
|
-
function isKnownDeliveryVendor(value) {
|
|
46
|
-
const normalized = normalizeDeliveryVendor(value ?? '');
|
|
47
|
-
if (!normalized) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
return DELIVERY_VENDORS.some((vendor) => vendor.id === normalized);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Lowercase known ids; keep raw string for legacy/custom stored values.
|
|
54
|
-
* @param value
|
|
55
|
-
*/
|
|
56
|
-
function normalizeDeliveryVendorForForm(value) {
|
|
57
|
-
const raw = value?.trim() ?? '';
|
|
58
|
-
if (!raw) {
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
61
|
-
const normalized = normalizeDeliveryVendor(raw);
|
|
62
|
-
if (isKnownDeliveryVendor(normalized)) {
|
|
63
|
-
return normalized;
|
|
64
|
-
}
|
|
65
|
-
return raw;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* @param value
|
|
70
|
-
*/
|
|
71
|
-
function deliveryVendorLabel(value) {
|
|
72
|
-
const normalized = normalizeDeliveryVendor(value);
|
|
73
|
-
if (!normalized || normalized === 'others') {
|
|
74
|
-
return '';
|
|
75
|
-
}
|
|
76
|
-
return VENDOR_LABELS[normalized] ?? value.trim();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Schema-driven list filter contracts for AFRICANIES modules.
|
|
81
|
-
*
|
|
82
|
-
* Modules declare a {@link ModuleFilterConfigModel}; the UI drawer renders from
|
|
83
|
-
* it and {@link toFilterParams} / {@link fromFilterParams} speak to the API.
|
|
84
|
-
*/
|
|
85
|
-
/**
|
|
86
|
-
* Backend wire format for filter query serialization.
|
|
87
|
-
*
|
|
88
|
-
* Use {@link resolveFilterTransport} when reading `config.transport` — omit the
|
|
89
|
-
* property on {@link ModuleFilterConfigModel} to default to legacy-parallel.
|
|
90
|
-
*/
|
|
91
|
-
const FilterTransport = {
|
|
92
|
-
/** Laravel-style `filterColumn` + `filterValue` CSV pairs (default). */
|
|
93
|
-
LegacyParallel: 'legacy-parallel',
|
|
94
|
-
/** Each {@link FilterFieldModel.key} is its own query param. */
|
|
95
|
-
Named: 'named',
|
|
96
|
-
};
|
|
97
|
-
/** Default when {@link ModuleFilterConfigModel.transport} is omitted. */
|
|
98
|
-
const DEFAULT_FILTER_TRANSPORT = FilterTransport.LegacyParallel;
|
|
99
|
-
/**
|
|
100
|
-
* Resolved transport for a module config (defaults to {@link DEFAULT_FILTER_TRANSPORT}).
|
|
101
|
-
* @param config
|
|
102
|
-
*/
|
|
103
|
-
function resolveFilterTransport(config) {
|
|
104
|
-
return config.transport ?? DEFAULT_FILTER_TRANSPORT;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Track shipments — payment / shipment status chips + tracking number.
|
|
109
|
-
* Transport: legacy `filterColumn` / `filterValue`.
|
|
110
|
-
*/
|
|
111
|
-
const trackShipmentsFilterConfig = {
|
|
112
|
-
id: 'track-shipments',
|
|
113
|
-
route: ['portal', 'shipment', 'track-shipments'],
|
|
114
|
-
transport: 'legacy-parallel',
|
|
115
|
-
pagination: { pageParam: 'page', sizeParam: 'size' },
|
|
116
|
-
search: {
|
|
117
|
-
param: 'search',
|
|
118
|
-
label: 'Shipment ID',
|
|
119
|
-
placeholder: 'Search',
|
|
120
|
-
},
|
|
121
|
-
date: {
|
|
122
|
-
rangeParams: { from: 'from', to: 'to' },
|
|
123
|
-
fieldParam: 'date',
|
|
124
|
-
fields: [{ value: 'created_at', label: 'Date Created' }],
|
|
125
|
-
},
|
|
126
|
-
sort: {
|
|
127
|
-
param: 'order',
|
|
128
|
-
options: [
|
|
129
|
-
{ value: 'asc', label: 'Ascending' },
|
|
130
|
-
{ value: 'desc', label: 'Descending' },
|
|
131
|
-
],
|
|
132
|
-
},
|
|
133
|
-
fields: [
|
|
134
|
-
{
|
|
135
|
-
key: 'payment_status',
|
|
136
|
-
label: 'Payment Status',
|
|
137
|
-
type: 'enum',
|
|
138
|
-
exclusive: true,
|
|
139
|
-
options: [
|
|
140
|
-
{ value: 'paid', label: 'Paid', color: '#25945c' },
|
|
141
|
-
{ value: 'unpaid', label: 'Unpaid', color: '#f48220' },
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
key: 'shipment_status',
|
|
146
|
-
label: 'Shipment Status',
|
|
147
|
-
type: 'enum',
|
|
148
|
-
exclusive: true,
|
|
149
|
-
options: [
|
|
150
|
-
{ value: 'pending', label: 'Pending', color: '#DBB316' },
|
|
151
|
-
{ value: 'in-process', label: 'In Process', color: '#3B82F6' },
|
|
152
|
-
{ value: 'completed', label: 'Completed', color: '#25945c' },
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
key: 'tracking_number',
|
|
157
|
-
label: 'Tracking Number',
|
|
158
|
-
type: 'text',
|
|
159
|
-
placeholder: 'Search',
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* Update shipments — richest legacy filter set (enums + entity selects + booleans).
|
|
165
|
-
*/
|
|
166
|
-
const updateShipmentsFilterConfig = {
|
|
167
|
-
id: 'update-shipments',
|
|
168
|
-
route: ['portal', 'shipment', 'update-shipments'],
|
|
169
|
-
transport: 'legacy-parallel',
|
|
170
|
-
pagination: { pageParam: 'page', sizeParam: 'size' },
|
|
171
|
-
search: {
|
|
172
|
-
param: 'search',
|
|
173
|
-
label: 'Shipment ID',
|
|
174
|
-
placeholder: 'Search',
|
|
175
|
-
},
|
|
176
|
-
date: {
|
|
177
|
-
rangeParams: { from: 'from', to: 'to' },
|
|
178
|
-
fieldParam: 'date',
|
|
179
|
-
fields: [
|
|
180
|
-
{ value: 'created_at', label: 'Date Created' },
|
|
181
|
-
{ value: 'paid_at', label: 'Date of Payment' },
|
|
182
|
-
{ value: 'packaged_at', label: 'Date Packaged' },
|
|
183
|
-
{ value: 'shipment_processed_at', label: 'Date Processed' },
|
|
184
|
-
],
|
|
185
|
-
},
|
|
186
|
-
sort: {
|
|
187
|
-
param: 'order',
|
|
188
|
-
options: [
|
|
189
|
-
{ value: 'asc', label: 'Ascending' },
|
|
190
|
-
{ value: 'desc', label: 'Descending' },
|
|
191
|
-
],
|
|
192
|
-
},
|
|
193
|
-
fields: [
|
|
194
|
-
{
|
|
195
|
-
key: 'payment_status',
|
|
196
|
-
label: 'Payment Status',
|
|
197
|
-
type: 'enum',
|
|
198
|
-
exclusive: true,
|
|
199
|
-
options: [
|
|
200
|
-
{ value: 'paid', label: 'Paid', color: '#25945c' },
|
|
201
|
-
{ value: 'unpaid', label: 'Unpaid', color: '#f48220' },
|
|
202
|
-
],
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
key: 'shipment_status',
|
|
206
|
-
label: 'Shipment Status',
|
|
207
|
-
type: 'enum',
|
|
208
|
-
exclusive: true,
|
|
209
|
-
options: [
|
|
210
|
-
{ value: 'pending', label: 'Pending', color: '#DBB316' },
|
|
211
|
-
{ value: 'in-process', label: 'In Process', color: '#3B82F6' },
|
|
212
|
-
{ value: 'completed', label: 'Completed', color: '#25945c' },
|
|
213
|
-
],
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
key: 'type',
|
|
217
|
-
label: 'Shipment Type',
|
|
218
|
-
type: 'enum',
|
|
219
|
-
exclusive: true,
|
|
220
|
-
options: [
|
|
221
|
-
{ value: 'shipment', label: 'Shipment', color: '#3B82F6' },
|
|
222
|
-
{ value: 'etw_shipment', label: 'ETW Shipment', color: '#8B5CF6' },
|
|
223
|
-
],
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
key: 'shipment_method_id',
|
|
227
|
-
label: 'Shipment Carrier',
|
|
228
|
-
type: 'select',
|
|
229
|
-
optionsSource: 'shipmentMethods',
|
|
230
|
-
placeholder: 'Shipment Methods',
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
key: 'type_of_user',
|
|
234
|
-
label: 'User Type',
|
|
235
|
-
type: 'select',
|
|
236
|
-
optionsSource: 'static',
|
|
237
|
-
options: [
|
|
238
|
-
{ value: 'individual', label: 'Individual' },
|
|
239
|
-
{ value: 'business', label: 'Business' },
|
|
240
|
-
],
|
|
241
|
-
placeholder: 'User Type',
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
key: 'warehouse_id',
|
|
245
|
-
label: 'Warehouse',
|
|
246
|
-
type: 'select',
|
|
247
|
-
optionsSource: 'warehouses',
|
|
248
|
-
placeholder: 'Warehouse',
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
key: 'shipment_manifest_id',
|
|
252
|
-
label: 'Shipment Manifest',
|
|
253
|
-
type: 'select',
|
|
254
|
-
optionsSource: 'shipmentManifests',
|
|
255
|
-
placeholder: 'Shipment Manifest',
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
key: 'api_request',
|
|
259
|
-
label: 'API Request',
|
|
260
|
-
type: 'boolean',
|
|
261
|
-
options: [
|
|
262
|
-
{ value: '1', label: 'Yes' },
|
|
263
|
-
{ value: '0', label: 'No' },
|
|
264
|
-
],
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
key: 'is_insured',
|
|
268
|
-
label: 'Insured',
|
|
269
|
-
type: 'boolean',
|
|
270
|
-
options: [
|
|
271
|
-
{ value: '1', label: 'Yes' },
|
|
272
|
-
{ value: '0', label: 'No' },
|
|
273
|
-
],
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* Users (customer list) — performed_action chips + user type select.
|
|
279
|
-
*/
|
|
280
|
-
const usersFilterConfig = {
|
|
281
|
-
id: 'users',
|
|
282
|
-
route: ['portal', 'customer', 'all'],
|
|
283
|
-
transport: 'legacy-parallel',
|
|
284
|
-
pagination: { pageParam: 'page', sizeParam: 'size' },
|
|
285
|
-
search: {
|
|
286
|
-
param: 'search',
|
|
287
|
-
label: 'Search',
|
|
288
|
-
placeholder: 'Search',
|
|
289
|
-
},
|
|
290
|
-
date: {
|
|
291
|
-
rangeParams: { from: 'from', to: 'to' },
|
|
292
|
-
fieldParam: 'date',
|
|
293
|
-
fields: [{ value: 'created_at', label: 'Date Created' }],
|
|
294
|
-
},
|
|
295
|
-
sort: {
|
|
296
|
-
param: 'order',
|
|
297
|
-
options: [
|
|
298
|
-
{ value: 'asc', label: 'Ascending' },
|
|
299
|
-
{ value: 'desc', label: 'Descending' },
|
|
300
|
-
],
|
|
301
|
-
},
|
|
302
|
-
fields: [
|
|
303
|
-
{
|
|
304
|
-
key: 'performed_action',
|
|
305
|
-
label: 'Performed Action',
|
|
306
|
-
type: 'enum',
|
|
307
|
-
exclusive: true,
|
|
308
|
-
options: [
|
|
309
|
-
{ value: 'pending', label: 'Pending', color: '#DBB316' },
|
|
310
|
-
{ value: 'approved', label: 'Approved', color: '#25945c' },
|
|
311
|
-
{ value: 'rejected', label: 'Rejected', color: '#FF001C' },
|
|
312
|
-
],
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
key: 'type',
|
|
316
|
-
label: 'User Type',
|
|
317
|
-
type: 'select',
|
|
318
|
-
optionsSource: 'static',
|
|
319
|
-
options: [
|
|
320
|
-
{ value: 'individual', label: 'Individual' },
|
|
321
|
-
{ value: 'business', label: 'Business' },
|
|
322
|
-
],
|
|
323
|
-
placeholder: 'User Type',
|
|
324
|
-
},
|
|
325
|
-
],
|
|
326
|
-
};
|
|
327
|
-
/**
|
|
328
|
-
* Named-transport example — newer endpoints with direct query keys.
|
|
329
|
-
*/
|
|
330
|
-
const shipmentTrackingItemFilterConfig = {
|
|
331
|
-
id: 'shipment-tracking-item-list',
|
|
332
|
-
transport: FilterTransport.Named,
|
|
333
|
-
pagination: { pageParam: 'page', sizeParam: 'size' },
|
|
334
|
-
search: {
|
|
335
|
-
param: 'search',
|
|
336
|
-
label: 'Search',
|
|
337
|
-
placeholder: 'Search',
|
|
338
|
-
},
|
|
339
|
-
date: {
|
|
340
|
-
rangeParams: { from: 'from', to: 'to' },
|
|
341
|
-
fieldParam: 'date',
|
|
342
|
-
fields: [{ value: 'created_at', label: 'Date Created' }],
|
|
343
|
-
},
|
|
344
|
-
fields: [
|
|
345
|
-
{
|
|
346
|
-
key: 'claim_status',
|
|
347
|
-
label: 'Claim Status',
|
|
348
|
-
type: 'enum',
|
|
349
|
-
exclusive: true,
|
|
350
|
-
options: [
|
|
351
|
-
{ value: 'open', label: 'Open', color: '#25945c' },
|
|
352
|
-
{ value: 'closed', label: 'Closed', color: '#667185' },
|
|
353
|
-
{ value: 'pending', label: 'Pending', color: '#DBB316' },
|
|
354
|
-
],
|
|
355
|
-
},
|
|
356
|
-
],
|
|
357
|
-
};
|
|
358
|
-
/** Seed registry — look up config by module id. */
|
|
359
|
-
const FILTER_CONFIGS = {
|
|
360
|
-
'track-shipments': trackShipmentsFilterConfig,
|
|
361
|
-
'update-shipments': updateShipmentsFilterConfig,
|
|
362
|
-
users: usersFilterConfig,
|
|
363
|
-
'shipment-tracking-item-list': shipmentTrackingItemFilterConfig,
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Empty filter state — safe default before hydrate / after reset.
|
|
368
|
-
*
|
|
369
|
-
* Sort defaults to descending (`desc`) so list screens match the usual
|
|
370
|
-
* “newest first” API contract without an explicit Apply.
|
|
371
|
-
*
|
|
372
|
-
* @returns A state with an empty `values` map and `order: 'desc'`.
|
|
373
|
-
*/
|
|
374
|
-
function emptyFilterState() {
|
|
375
|
-
return { values: {}, order: 'desc' };
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Clone state so drawer edits do not mutate the host until Apply.
|
|
379
|
-
*
|
|
380
|
-
* @param state - Current filter state (or undefined).
|
|
381
|
-
* @returns A shallow copy safe to mutate in the drawer.
|
|
382
|
-
*/
|
|
383
|
-
function cloneFilterState(state) {
|
|
384
|
-
if (state == null) {
|
|
385
|
-
return emptyFilterState();
|
|
386
|
-
}
|
|
387
|
-
return {
|
|
388
|
-
search: state.search,
|
|
389
|
-
from: state.from,
|
|
390
|
-
to: state.to,
|
|
391
|
-
date: state.date,
|
|
392
|
-
order: state.order,
|
|
393
|
-
page: state.page,
|
|
394
|
-
size: state.size,
|
|
395
|
-
values: { ...state.values },
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Serialize {@link FilterStateModel} for URL query strings and list API calls.
|
|
400
|
-
*
|
|
401
|
-
* - `legacy-parallel`: emits `filterColumn` / `filterValue` as aligned CSV.
|
|
402
|
-
* - `named`: each selected field key is its own query param.
|
|
403
|
-
*
|
|
404
|
-
* Empty strings and undefined field values are omitted.
|
|
405
|
-
*
|
|
406
|
-
* @param state - Current filter map state.
|
|
407
|
-
* @param config - Module schema (controls transport + shared params).
|
|
408
|
-
* @returns Flat query / API bag ready for HttpParams or the router.
|
|
409
|
-
*/
|
|
410
|
-
function toFilterParams(state, config) {
|
|
411
|
-
const params = {};
|
|
412
|
-
if (state.search != null && state.search !== '') {
|
|
413
|
-
params[config.search?.param ?? 'search'] = state.search;
|
|
414
|
-
}
|
|
415
|
-
if (state.from) {
|
|
416
|
-
params[config.date?.rangeParams.from ?? 'from'] = state.from;
|
|
417
|
-
}
|
|
418
|
-
if (state.to) {
|
|
419
|
-
params[config.date?.rangeParams.to ?? 'to'] = state.to;
|
|
420
|
-
}
|
|
421
|
-
if (state.date) {
|
|
422
|
-
params[config.date?.fieldParam ?? 'date'] = state.date;
|
|
423
|
-
}
|
|
424
|
-
if (state.order) {
|
|
425
|
-
params[config.sort?.param ?? 'order'] = state.order;
|
|
426
|
-
}
|
|
427
|
-
if (state.page != null) {
|
|
428
|
-
params[config.pagination?.pageParam ?? 'page'] = state.page;
|
|
429
|
-
}
|
|
430
|
-
if (state.size != null) {
|
|
431
|
-
params[config.pagination?.sizeParam ?? 'size'] = state.size;
|
|
432
|
-
}
|
|
433
|
-
if (resolveFilterTransport(config) === FilterTransport.Named) {
|
|
434
|
-
for (const field of config.fields) {
|
|
435
|
-
const v = state.values[field.key];
|
|
436
|
-
if (v != null && v !== '') {
|
|
437
|
-
params[field.key] = v;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
return params;
|
|
441
|
-
}
|
|
442
|
-
// legacy-parallel — only fields that have a value
|
|
443
|
-
const columns = [];
|
|
444
|
-
const values = [];
|
|
445
|
-
for (const field of config.fields) {
|
|
446
|
-
const v = state.values[field.key];
|
|
447
|
-
if (v === undefined || v === '') {
|
|
448
|
-
continue;
|
|
449
|
-
}
|
|
450
|
-
columns.push(field.key);
|
|
451
|
-
values.push(String(v));
|
|
452
|
-
}
|
|
453
|
-
if (columns.length) {
|
|
454
|
-
params['filterColumn'] = columns.join(',');
|
|
455
|
-
params['filterValue'] = values.join(',');
|
|
456
|
-
}
|
|
457
|
-
return params;
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Hydrate {@link FilterStateModel} from a flat query / API bag.
|
|
461
|
-
*
|
|
462
|
-
* For `legacy-parallel`, zips `filterColumn` + `filterValue` CSV pairs.
|
|
463
|
-
* Unknown column keys are still restored into `values` so round-trips survive
|
|
464
|
-
* config drift.
|
|
465
|
-
*
|
|
466
|
-
* @param params - Router query params or API query object (stringish values).
|
|
467
|
-
* @param config - Module schema.
|
|
468
|
-
* @returns Hydrated {@link FilterStateModel}.
|
|
469
|
-
*/
|
|
470
|
-
function fromFilterParams(params, config) {
|
|
471
|
-
const state = emptyFilterState();
|
|
472
|
-
const read = (key) => queryBagValue(params[key]);
|
|
473
|
-
state.search = read(config.search?.param ?? 'search');
|
|
474
|
-
state.from = read(config.date?.rangeParams.from ?? 'from');
|
|
475
|
-
state.to = read(config.date?.rangeParams.to ?? 'to');
|
|
476
|
-
state.date = read(config.date?.fieldParam ?? 'date');
|
|
477
|
-
state.order = read(config.sort?.param ?? 'order');
|
|
478
|
-
const pageRaw = read(config.pagination?.pageParam ?? 'page');
|
|
479
|
-
const sizeRaw = read(config.pagination?.sizeParam ?? 'size');
|
|
480
|
-
if (pageRaw != null) {
|
|
481
|
-
const n = Number(pageRaw);
|
|
482
|
-
if (!Number.isNaN(n)) {
|
|
483
|
-
state.page = n;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
if (sizeRaw != null) {
|
|
487
|
-
const n = Number(sizeRaw);
|
|
488
|
-
if (!Number.isNaN(n)) {
|
|
489
|
-
state.size = n;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
if (resolveFilterTransport(config) === FilterTransport.Named) {
|
|
493
|
-
for (const field of config.fields) {
|
|
494
|
-
const v = read(field.key);
|
|
495
|
-
if (v != null) {
|
|
496
|
-
state.values[field.key] = v;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
return state;
|
|
500
|
-
}
|
|
501
|
-
const columns = (read('filterColumn') ?? '')
|
|
502
|
-
.split(',')
|
|
503
|
-
.map((s) => s.trim())
|
|
504
|
-
.filter(Boolean);
|
|
505
|
-
const values = (read('filterValue') ?? '')
|
|
506
|
-
.split(',')
|
|
507
|
-
.map((s) => s.trim());
|
|
508
|
-
columns.forEach((key, i) => {
|
|
509
|
-
const v = values[i];
|
|
510
|
-
if (v != null && v !== '') {
|
|
511
|
-
state.values[key] = v;
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
return state;
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Query keys this config reads and writes (`search`, `page`, `size`, field
|
|
518
|
-
* keys or `filterColumn` / `filterValue`, etc.).
|
|
519
|
-
*
|
|
520
|
-
* @param config - Module schema.
|
|
521
|
-
* @returns Deduped list of query param names.
|
|
522
|
-
*/
|
|
523
|
-
function filterQueryKeys(config) {
|
|
524
|
-
const keys = [
|
|
525
|
-
config.search?.param ?? 'search',
|
|
526
|
-
config.date?.rangeParams.from ?? 'from',
|
|
527
|
-
config.date?.rangeParams.to ?? 'to',
|
|
528
|
-
config.date?.fieldParam ?? 'date',
|
|
529
|
-
config.sort?.param ?? 'order',
|
|
530
|
-
config.pagination?.pageParam ?? 'page',
|
|
531
|
-
config.pagination?.sizeParam ?? 'size',
|
|
532
|
-
];
|
|
533
|
-
if (resolveFilterTransport(config) === FilterTransport.Named) {
|
|
534
|
-
keys.push(...config.fields.map((field) => field.key));
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
537
|
-
keys.push('filterColumn', 'filterValue');
|
|
538
|
-
}
|
|
539
|
-
return [...new Set(keys)];
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* True when the bag contains any list-filter / pagination key this config
|
|
543
|
-
* understands. Used to decide whether to hydrate from the URL.
|
|
544
|
-
*
|
|
545
|
-
* @param params - Router query params or API query object.
|
|
546
|
-
* @param config - Module schema.
|
|
547
|
-
* @returns Whether at least one relevant non-empty param is present.
|
|
548
|
-
*/
|
|
549
|
-
function hasFilterParams(params, config) {
|
|
550
|
-
return filterQueryKeys(config).some((key) => queryBagValue(params[key]) != null);
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* @param raw - One query-bag value.
|
|
554
|
-
* @returns First non-empty string, or undefined.
|
|
555
|
-
*/
|
|
556
|
-
function queryBagValue(raw) {
|
|
557
|
-
if (raw == null) {
|
|
558
|
-
return undefined;
|
|
559
|
-
}
|
|
560
|
-
if (Array.isArray(raw)) {
|
|
561
|
-
return raw[0] != null && String(raw[0]) !== '' ? String(raw[0]) : undefined;
|
|
562
|
-
}
|
|
563
|
-
const value = String(raw);
|
|
564
|
-
return value === '' ? undefined : value;
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Drop one field value (column deselected / section clear).
|
|
568
|
-
*
|
|
569
|
-
* @param state - Mutable or immutable state to copy.
|
|
570
|
-
* @param key - {@link FilterFieldModel.key} to clear.
|
|
571
|
-
* @returns Cloned state without that field value.
|
|
572
|
-
*/
|
|
573
|
-
function clearFilterField(state, key) {
|
|
574
|
-
const next = cloneFilterState(state);
|
|
575
|
-
delete next.values[key];
|
|
576
|
-
return next;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Reset to empty values while optionally keeping pagination.
|
|
580
|
-
*
|
|
581
|
-
* @param keepPagination - When true, preserve `page` / `size`.
|
|
582
|
-
* @param state - Optional prior state for pagination retention.
|
|
583
|
-
* @returns Empty filter state, optionally retaining pagination.
|
|
584
|
-
*/
|
|
585
|
-
function resetFilterState(keepPagination = false, state) {
|
|
586
|
-
const next = emptyFilterState();
|
|
587
|
-
if (keepPagination && state) {
|
|
588
|
-
next.page = state.page;
|
|
589
|
-
next.size = state.size;
|
|
590
|
-
}
|
|
591
|
-
return next;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
/**
|
|
595
|
-
* Generated bundle index. Do not edit.
|
|
596
|
-
*/
|
|
597
|
-
|
|
598
|
-
export { BOX_DELIVERY_VENDORS, DEFAULT_FILTER_TRANSPORT, DEFAULT_PAGE_SIZE, DELIVERY_VENDORS, DELIVERY_VENDOR_OPTIONS, EXPORT_DELIVERY_VENDORS, FILTER_CONFIGS, FilterTransport, NOTIFICATION_PAGE_SIZE, PAGINATION_PAGE_SIZES, clearFilterField, cloneFilterState, deliveryVendorLabel, emptyFilterState, filterQueryKeys, fromFilterParams, hasFilterParams, isKnownDeliveryVendor, normalizeDeliveryVendor, normalizeDeliveryVendorForForm, resetFilterState, resolveFilterTransport, shipmentTrackingItemFilterConfig, toFilterParams, trackShipmentsFilterConfig, updateShipmentsFilterConfig, usersFilterConfig };
|
|
599
|
-
//# sourceMappingURL=africanies-africanies-models.mjs.map
|