forstok-ui-lib 8.3.12 → 8.3.14

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.
@@ -0,0 +1,15 @@
1
+ # .agent Working Memory
2
+
3
+ Purpose: persistent, AI-friendly notes about this repo so future agents can ramp quickly without re-scanning the codebase.
4
+
5
+ How to use:
6
+ - Read `repository-summary.md` and `architecture-overview.md` first for context, then `module-map.md`, `frontend-flow.md`, `backend-flow.md` (if present), and `env-map.md` before coding.
7
+ - Consult `coding-conventions.md` to match existing style and `risk-register.md` to avoid regressions.
8
+ - For specific tasks, jump to `task-entrypoints.md`, `feature-prompts.md`, or `bugfix-prompts.md`.
9
+ - Update `change-log.md` whenever you modify code or these docs.
10
+
11
+ Update rules:
12
+ - Keep docs grounded in actual code; mark assumptions explicitly.
13
+ - Never store secrets, credentials, or tokens here.
14
+ - When adding features/fixes, refresh relevant sections (flows, module map, risks, tests) and append a dated note to `change-log.md`.
15
+ - If something is unclear, record questions in `open-questions.md`.
@@ -0,0 +1,3 @@
1
+ # API Map
2
+
3
+ Not applicable: no HTTP endpoints or API clients are defined in this library. Components expose props/callbacks only.
@@ -0,0 +1,13 @@
1
+ # App Workflows
2
+
3
+ This repository is a component library, not a runnable app. Workflows refer to component usage patterns:
4
+
5
+ - **Select flow**: `SelectComponent` wraps `react-select`/`CreatableSelect`, manages value state, supports multi-select, custom labels/options, async paginate menu lists, and guarded removals (confirm via message question). Emits `evChange` and optional form-field `evChangeCustom` callbacks.
6
+ - **Input flow**: `InputComponent` handles text/number/currency inputs with formatting (`formatNumber`), reset/force-update flags, Enter-key handlers, and form-field callbacks.
7
+ - **Date/DateTime flow**: date pickers (moment + react-datepicker/@wojtekmaj/react-daterange-picker) expose refs, typed props, and custom styles; defaults provided in `maps/common.ts`.
8
+ - **Popup & Message flow**: `PopupComponent` renders modal/question overlays with head/body/foot slots; `MessageComponent` renders toast-like notifications with timers and callbacks; helper functions generate typed message payloads.
9
+ - **Table/List flow**: components expect children annotated via `aria-label` (head/body/foot) to auto-build rows/columns; supports force-update flag for controlled rerender.
10
+ - **Upload flow**: file/image upload components manage drag/drop and thumbnail display using shared CSS patterns.
11
+ - **Emoji & Icon flow**: wraps `frimousse` emoji picker and SVG/icon usage.
12
+
13
+ Assumption: consuming apps orchestrate business logic, pass data/handlers into these components, and provide theme variables.
@@ -0,0 +1,10 @@
1
+ # Architecture Overview
2
+
3
+ - **Pattern**: Monorepo-less, single package React component library. No backend/services. All logic resides in front-end components and shared helpers.
4
+ - **Exports**: `src/index.ts` aggregates `components`, `assets`, `typeds`, and `maps` for external consumption.
5
+ - **Styling**: styled-components with heavy use of CSS variables (expects host app to define theme tokens such as `--pri-clr`, `--sec-clr-bg`). Some CSS modules imported via `rollup-plugin-import-css`.
6
+ - **State & hooks**: React functional components; some use `use-state-with-callback` for post-set callbacks. Utilities rely on browser globals (`window`, `document`, storage), implying browser-only usage (no SSR safety guards).
7
+ - **External integrations**: UI dependencies only (react-select, react-datepicker, moment, approvejs for validation, html-to-text, frimousse emoji picker). No HTTP/API layers.
8
+ - **Data/config**: `src/maps/common.ts` provides default date range presets using moment.
9
+ - **Build pipeline**: Rollup builds CJS + ESM bundles and separate DTS bundle. Peer deps externalized. Styled-components transformer injects component IDs and display names.
10
+ - **Background/queue/cron**: None.
@@ -0,0 +1,3 @@
1
+ # Backend Flow
2
+
3
+ Not applicable: this repository ships frontend components only. There is no server code, routing, middleware, database access, background jobs, or API clients. Any backend interactions occur in consuming applications, not here.
@@ -0,0 +1,19 @@
1
+ # Bugfix Prompt Templates
2
+
3
+ - **General bug investigation**
4
+ "Investigate bug in <ComponentName>. Reproduce with prop/state combo. Inspect src/components/<name>/index.tsx and related styles/helpers. Check `reset`/`isForceUpdate` handling and event callbacks."
5
+
6
+ - **Root cause analysis**
7
+ "Trace the failing behavior in <ComponentName>. Map input props → internal state → rendered output. Verify helper usage (formatNumber, generateMessageQuestion, etc.) and external deps. Document findings in .agent/change-log.md."
8
+
9
+ - **Safe fix with minimal regression**
10
+ "Implement minimal change to fix <issue> in <ComponentName>. Avoid altering public prop shapes; add guards/tests if possible. Update types and styles only where necessary."
11
+
12
+ - **Query/formatting bug fix**
13
+ "Fix data formatting or color/status mapping in src/assets/javascripts/helper.ts or function.ts. Keep return types and callers intact."
14
+
15
+ - **API (prop) bug fix**
16
+ "Adjust prop handling for <prop> in <ComponentName>. Ensure defaults and optional props are preserved. Update typed.ts if required."
17
+
18
+ - **Frontend UI bug fix**
19
+ "Correct UI glitch in <ComponentName> styles (src/components/<name>/styles.ts). Verify CSS variables and responsive rules. Keep DOM structure stable for consumers."
@@ -0,0 +1,3 @@
1
+ # Change Log
2
+
3
+ - 2026-03-09: Created .agent documentation set summarizing repository structure, architecture, workflows, risks, and task prompts. No code changes beyond docs.
@@ -0,0 +1,11 @@
1
+ # Coding Conventions
2
+
3
+ - **Language**: TypeScript with React functional components; strict mode in tsconfig.
4
+ - **Styling**: styled-components; props often prefixed with `$` to avoid DOM leakage and drive style variants. CSS variables expected from host (e.g., `--pri-clr`, `--sec-clr-bg`). Shared CSS fragments live in `src/assets/stylesheets` and `components/*/styles.ts`.
5
+ - **State**: `useState` and `use-state-with-callback` for cases needing post-set callbacks; components expose `isForceUpdate`/`setForceUpdate` and `reset/setReset` flags for parent-controlled resets.
6
+ - **Events**: callbacks prefixed with `ev*` (e.g., `evChange`, `evCreateMessage`); form-field updates use `evChangeCustom(name, value)` when `isField` is true.
7
+ - **Data typing**: shared types in `src/typeds` (`TObject`, `TState`, `TOption`, etc.). Component-specific `typed.ts` files accompany components with complex props.
8
+ - **Error handling**: UI-level guards (e.g., disable actions, prevent deletion below min count); uses helper validation via `approvejs` in utilities, but no central error boundary.
9
+ - **Logging**: none in codebase; rely on UI cues instead of console logging.
10
+ - **Formatting/number handling**: helpers like `formatNumber`, `currencyNumber`, `generateValue`, and multiple color/status mappers in `assets/javascripts`.
11
+ - **Structure**: components often rely on child `aria-label` markers to organize slots (table, popup, message).
@@ -0,0 +1,3 @@
1
+ # Database Map
2
+
3
+ Not applicable: no database, ORM, or queries exist in this UI library.
@@ -0,0 +1,8 @@
1
+ # Deployment Notes
2
+
3
+ - **Artifact**: Built with rollup into `dist/index.js` (CJS), `dist/index.mjs` (ESM), and `dist/index.d.ts` (types).
4
+ - **Build command**: `npm run build`.
5
+ - **Publish**: likely published to npm (`npm publish`) after bumping version (`npm version [patch|minor|major]`), as hinted in README.
6
+ - **CI/CD**: No CI config present in repo.
7
+ - **Runtime assumptions**: Browser environment with CSS variables defined by host app; React 19 and styled-components 6 provided as peer deps.
8
+ - **Bundling details**: Peer deps externalized; assets (images) emitted to `dist/images`; styled-components transformer enabled for better class names.
@@ -0,0 +1,4 @@
1
+ # Env Map
2
+
3
+ - No environment variables are referenced in the codebase.
4
+ - Assumptions: consuming applications provide any necessary API keys/config; this library only depends on browser globals (`window`, `document`, `localStorage`, `sessionStorage`).
@@ -0,0 +1,19 @@
1
+ # Feature Prompt Templates
2
+
3
+ - **Add new component**
4
+ "You are updating forstok-ui-lib. Goal: add a new <ComponentName> under src/components/<name>. Review coding style in src/components/<similar>/ and exports in src/components/index.ts + src/index.ts. Provide styled-components styles, typed props, and ensure no breaking API changes. Include usage notes and build updates."
5
+
6
+ - **Update existing component behavior**
7
+ "Modify <ComponentName> in src/components/<name>/ to <desired change>. Preserve existing props and `reset/isForceUpdate` patterns. Update types in typed.ts if needed and adjust styles carefully."
8
+
9
+ - **Change business/UI flow**
10
+ "Adjust component flow for <scenario> (e.g., Select removal confirmation). Identify callbacks (`evChange`, `evCreateMessageQuestion`) and update logic in index.tsx plus helper utilities if necessary. Document risks and update .agent/change-log.md."
11
+
12
+ - **Add endpoint-like utility**
13
+ "Add new helper in src/assets/javascripts/function.ts for <purpose>. Keep pure/browser-safe, add type definitions, and ensure exports."
14
+
15
+ - **Update database query**
16
+ "N/A (no DB). If needing data shaping, modify helper functions only and keep types in sync."
17
+
18
+ - **Refactor module**
19
+ "Refactor <module> for clarity/performance without changing public API. Maintain prop names, CSS variable expectations, and ensure build passes."
@@ -0,0 +1,9 @@
1
+ # Frontend Flow
2
+
3
+ - **Routing**: None defined; components are framework-agnostic React pieces for host apps to compose.
4
+ - **Component hierarchy**: Flat exports; each component encapsulates its own styles. Some components (Popup, Table, List) rely on children with specific `aria-label` markers to render sections.
5
+ - **Data fetching**: Not included. Components accept data via props (e.g., `options` for Select, `data` for lists/tables).
6
+ - **State management**: Local React state with optional externally controlled flags (`reset`, `isForceUpdate`). No global state/store included.
7
+ - **Forms**: Inputs/Selects support `isField` and `evChangeCustom(name, value)` to integrate with form management; `evEnter` for Enter-key submissions; currency/number formatting helpers used during key events.
8
+ - **UI patterns**: Styled-components for theming; extensive use of CSS variables; modal overlay pattern via Popup/Message; skeleton loaders via Loader/Loading; select dropdown custom styling consistent across modes.
9
+ - **Reusable components**: Buttons, Inputs (including OTP and ref-forwarding), Select variants, Date/Datetime pickers, Upload drag/drop, Emoji picker, Table/List layouts, Icon set, Popup/Message utilities.
@@ -0,0 +1,30 @@
1
+ # Module Map
2
+
3
+ - `src/index.ts`: central export barrel for components, assets, typeds, maps.
4
+ - `src/components/`: React components.
5
+ - `button/`: styled button variants with optional arrow indicator.
6
+ - `checkbox/`, `radio/`, `switch/`: form controls with custom styles.
7
+ - `input/`: text/number/currency input, OTP variant, ref-forwarding variant.
8
+ - `textarea/`: textarea with ref variant.
9
+ - `select/`: react-select wrappers (standard, async paginate, creatable, select-all, custom menu list, helper functions & types).
10
+ - `dropdown/`: simple dropdown container + styles.
11
+ - `date/`, `datetime/`: date/datetime pickers, refs, typed helpers, styles.
12
+ - `label/`, `text/`, `link/`: typography helpers and link styles.
13
+ - `list/`, `table/`: list/table layout components using children slots.
14
+ - `popup/`, `message/`: modal/toast messaging infrastructure with typed helpers.
15
+ - `portal/`: React portal wrapper.
16
+ - `icon/`: icon renderer with typed icon names.
17
+ - `image/`, `upload/`: image display and upload drag-drop UI.
18
+ - `emoji/`: emoji picker component.
19
+ - `loader/`, `loading/`: loading indicators/skeletons.
20
+ - `form/styles.ts`, `date/styles.ts`, `dropdown/styles.ts`, `select/styles.ts`: shared styled-components fragments exposed for consumer styling.
21
+ - `src/assets/`:
22
+ - `stylesheets/`: `bases.styles.ts` and `shares.styles.ts` reusable CSS snippets.
23
+ - `javascripts/`: helper utilities (`function.ts`, `helper.ts`).
24
+ - `images/`: placeholder assets/icons used by styles.
25
+ - `src/typeds/`: shared types (`base.typed.ts`, `shares.typed.ts`) used across components.
26
+ - `src/maps/`: `common.ts` config constants (date range defaults) exported via `index.ts`.
27
+ - `dist/`: generated build artifacts.
28
+ - `grunch`: text pointer file (non-functional).
29
+
30
+ Safe-to-change: docs in `.agent/`, new components/types under `src/components`/`src/typeds` (ensure exports added). Sensitive: existing component APIs/props used by consuming apps—avoid breaking prop names/shapes; CSS variable expectations; dist artifacts (regenerate via build instead of editing).
@@ -0,0 +1,6 @@
1
+ # Open Questions
2
+
3
+ - Are there official theming guidelines or a CSS variable contract for host apps? (CSS vars referenced but not documented here.)
4
+ - Which consuming apps rely on specific component props/modes? Lacking compatibility matrix makes API changes risky.
5
+ - Should SSR compatibility be added, or is browser-only acceptable for all consumers?
6
+ - Any plan for adding automated tests or CI before further changes?
@@ -0,0 +1,18 @@
1
+ # Repository Summary
2
+
3
+ - **Name**: forstok-ui-lib (UI component library for Forstok apps).
4
+ - **Tech stack**: React 19 + TypeScript 5, styled-components 6, react-select, react-datepicker, moment, rollup bundling. No backend/server code.
5
+ - **Purpose**: reusable UI components (inputs, selects, date pickers, loaders, popups, tables, etc.) plus helper utilities and shared types for Forstok frontends.
6
+ - **Key folders**:
7
+ - `src/components/`: React components grouped by feature (button, input, select, popup, table, etc.).
8
+ - `src/assets/`: shared styles (styled-components css fragments), helper JS utilities, images.
9
+ - `src/typeds/`: shared TypeScript types.
10
+ - `src/maps/`: common config constants (date range defaults).
11
+ - `dist/`: built output (CJS/ESM/types) — generated, do not edit.
12
+ - `grunch`: text reference file (YouTube link), unused in build.
13
+ - **Entrypoint**: `src/index.ts` re-exports components, assets, typeds, and maps for consumers.
14
+ - **Build**: `npm run build` (rollup, outputs to `dist/`).
15
+ - **Tests**: none (`npm test` exits with error placeholder).
16
+ - **Lint/format**: none configured.
17
+ - **Install**: `npm install` (preinstall rewrites lock via `npm-force-resolutions`).
18
+ - **System shape**: single-package UI library; no runtime services, APIs, or databases.
@@ -0,0 +1,9 @@
1
+ # Risk Register
2
+
3
+ - **API/prop stability**: Consumers depend on current prop names and `$`-prefixed styling flags; breaking changes will ripple across multiple apps.
4
+ - **Browser globals**: Helpers and components access `window`, `document`, and storage directly—unsafe for SSR/Node; changes should preserve browser-only assumptions or add guards.
5
+ - **CSS variable reliance**: Styling expects host-defined CSS vars; altering names/defaults can break theming.
6
+ - **Absence of tests**: No automated coverage; regressions in interactive components (Select, Input, Popup, Table, Upload) are likely if behavior changes.
7
+ - **State flags**: `reset`/`isForceUpdate` patterns used across components; incorrect handling could desync UI state.
8
+ - **Dependencies**: Third-party components (react-select, react-datepicker, moment-range) influence bundle size and behavior; updates may introduce breaking changes.
9
+ - **Accessibility**: Custom controls may not meet accessibility expectations (keyboard focus management limited); modifying markup requires care.
@@ -0,0 +1,9 @@
1
+ # Task Entrypoints
2
+
3
+ - **Add a new component**: Create under `src/components/<name>/`, add styles/typed as needed, and export from `src/components/index.ts` plus `src/index.ts` if new barrel export required.
4
+ - **Enhance existing component**: Start in its folder (e.g., `src/components/select/`), inspect `typed.ts` for props and `styles.ts` for theming contracts; consider impacts on shared helpers (`assets/javascripts`).
5
+ - **Adjust shared styles**: `src/assets/stylesheets/` for CSS fragments; `components/*/styles.ts` for component-specific styling.
6
+ - **Modify utilities**: `src/assets/javascripts/function.ts` and `helper.ts` contain formatting, storage, and color/status mappers.
7
+ - **Update shared types**: `src/typeds/` (avoid breaking API unless coordinated with consumers).
8
+ - **Change exports**: keep barrel files (`src/components/index.ts`, `src/index.ts`) in sync.
9
+ - **Build/publish**: run `npm run build`; bump version before publish.
@@ -0,0 +1,6 @@
1
+ # Testing Map
2
+
3
+ - Test framework: none configured. `npm test` exits with an error placeholder.
4
+ - Existing coverage: none.
5
+ - Gaps: all components lack automated tests; manual verification required when changing props, styles, or behavior.
6
+ - Recommended: add component-level tests (React Testing Library) and visual regression coverage for high-traffic components (Select, Input, Popup, Table) before making risky changes.
package/dist/index.d.ts CHANGED
@@ -304,6 +304,7 @@ type TChannel = {
304
304
  icon?: string | null;
305
305
  id?: number | null;
306
306
  totalStores?: number;
307
+ phone?: string | null;
307
308
  Stores?: {
308
309
  id?: number;
309
310
  storeName?: string;
@@ -396,7 +397,7 @@ type TInList = TInPart & {
396
397
  evClickCollapse?: TMouseEvent;
397
398
  isReadyQuery: boolean;
398
399
  };
399
- type TInlistPart = Omit<TInList, 'evClickTab' | 'activePageOption' | 'evSetPageOption' | 'activePage' | 'evSetPage' | 'activeCursor' | 'searchInput' | 'abortRef' | 'abortSecRef' | 'isResetSubscription' | 'isReadyQuery'> & {
400
+ type TInlistPart = Omit<TInList, "evClickTab" | "activePageOption" | "evSetPageOption" | "activePage" | "evSetPage" | "activeCursor" | "searchInput" | "abortRef" | "abortSecRef" | "isResetSubscription" | "isReadyQuery"> & {
400
401
  pageEl: JSX.Element | null;
401
402
  readyFilter?: string[];
402
403
  parseSetForceUpdate?: (value: boolean) => void;
@@ -409,7 +410,7 @@ interface TPagination {
409
410
  evSetPage: TMouseEvent;
410
411
  activePageOption?: number;
411
412
  evSetPageOption: TMouseEvent;
412
- mode?: 'noPageOption' | 'min10PageOption';
413
+ mode?: "noPageOption" | "min10PageOption";
413
414
  }
414
415
  type TObjPage = {
415
416
  cursor?: string;
@@ -467,7 +468,7 @@ type TDetailNew<TData = never> = {
467
468
  type Callback<S> = (state: S) => void | (() => void | undefined);
468
469
  type DispatchWithCallback<A, S> = (value: A, callback: Callback<S>) => void;
469
470
  type TStateCallback<TData> = DispatchWithCallback<React.SetStateAction<TData>, TData>;
470
- type ModeListTableColumn = 'item' | 'item-nocheck' | 'quantity' | 'listing' | 'listing-nocheck' | 'picklist' | 'package' | 'shipment' | 'invoice' | 'payment-receive' | 'sales-return' | 'activity' | 'putaway' | 'inbound' | 'lowstock' | 'price' | 'stock-adjustment' | 'stock-outbound' | 'stock-transfer' | 'promotion' | 'stock-history' | 'price-history' | 'turnover' | 'days-outofstock' | 'warehouses' | 'archived' | 'pos-order' | 'order' | 'order-nocheck' | 'table-customheader';
471
+ type ModeListTableColumn = "item" | "item-nocheck" | "quantity" | "listing" | "listing-nocheck" | "picklist" | "package" | "shipment" | "invoice" | "payment-receive" | "sales-return" | "activity" | "putaway" | "inbound" | "lowstock" | "price" | "stock-adjustment" | "stock-outbound" | "stock-transfer" | "promotion" | "stock-history" | "price-history" | "turnover" | "days-outofstock" | "warehouses" | "archived" | "pos-order" | "order" | "order-nocheck" | "table-customheader";
471
472
  type TInDetail = TInPart & {
472
473
  firstDispatch?: Dispatch<any>;
473
474
  resetByOption: (opt?: string | string[], callback?: () => void, noScroll?: boolean) => void;
@@ -483,9 +484,9 @@ type TInDetailProps = {
483
484
  tabDef?: string;
484
485
  hasSubscription?: boolean;
485
486
  };
486
- type modeTable = 'picklist' | 'listing' | 'price' | 'price' | 'price-full' | 'price-mid';
487
- type BodyContentStyle = 'create-return' | 'create-price' | 'create-adjustment' | 'create-outbound' | 'confirm-inbound' | 'confirm-outbound' | 'confirm-adjustment';
488
- type BodyContentMode = BodyContentStyle | 'create-promotion' | 'create-inbound' | 'create-transfer' | 'create-picklist' | 'edit-picklist' | 'create-package' | 'edit-master' | 'putaway-inbound' | 'create-paymentreceive' | 'create-master' | 'create-listing' | 'create-adjustment' | 'edit-listing';
487
+ type modeTable = "picklist" | "listing" | "price" | "price" | "price-full" | "price-mid";
488
+ type BodyContentStyle = "create-return" | "create-price" | "create-adjustment" | "create-outbound" | "confirm-inbound" | "confirm-outbound" | "confirm-adjustment";
489
+ type BodyContentMode = BodyContentStyle | "create-promotion" | "create-inbound" | "create-transfer" | "create-picklist" | "edit-picklist" | "create-package" | "edit-master" | "putaway-inbound" | "create-paymentreceive" | "create-master" | "create-listing" | "create-adjustment" | "edit-listing";
489
490
 
490
491
  declare const InputOTPComponent: ({ otpLength, value, onChange, ...props }: {
491
492
  otpLength: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forstok-ui-lib",
3
- "version": "8.3.12",
3
+ "version": "8.3.14",
4
4
  "description": "Forstok UI Components Library",
5
5
  "path": "dist",
6
6
  "main": "dist/index.js",
@@ -1,168 +1,187 @@
1
- import { Dispatch, JSX } from 'react';
2
- import { TChangeEvent, TMouseEvent, TObject, TPage, TState, TUPage } from './base.typed';
3
- import { TMessageFunction, TMessageQuestionFunction } from '../components/message/typed';
4
- import { TPopupFunction, TPopupOpenFunction } from '../components/popup/typed';
5
- import { TOption } from '../components/select/typed';
1
+ import { Dispatch, JSX } from "react";
2
+ import {
3
+ TChangeEvent,
4
+ TMouseEvent,
5
+ TObject,
6
+ TPage,
7
+ TState,
8
+ TUPage,
9
+ } from "./base.typed";
10
+ import {
11
+ TMessageFunction,
12
+ TMessageQuestionFunction,
13
+ } from "../components/message/typed";
14
+ import { TPopupFunction, TPopupOpenFunction } from "../components/popup/typed";
15
+ import { TOption } from "../components/select/typed";
6
16
 
7
- export type TCloseDropdownFunction = (currentTarget: EventTarget & HTMLElement) => void;
17
+ export type TCloseDropdownFunction = (
18
+ currentTarget: EventTarget & HTMLElement,
19
+ ) => void;
8
20
  export type TUser = {
9
- profile_id: number,
10
- profile_name: string,
11
- id: number,
12
- username: string,
13
- email: string,
14
- freshchat_restore_id: string|number | null,
21
+ profile_id: number;
22
+ profile_name: string;
23
+ id: number;
24
+ username: string;
25
+ email: string;
26
+ freshchat_restore_id: string | number | null;
15
27
  credentials: {
16
- aws_access_key: string,
17
- aws_secret_access_key: string,
18
- aws_bucket_name: string,
19
- aws_region: string,
20
- chat_token: string,
21
- shopee_partner_id: string,
22
- shopee_partner_key: string
23
- },
24
- has_access_orderV1: boolean
25
- isAI?: boolean
26
- }
28
+ aws_access_key: string;
29
+ aws_secret_access_key: string;
30
+ aws_bucket_name: string;
31
+ aws_region: string;
32
+ chat_token: string;
33
+ shopee_partner_id: string;
34
+ shopee_partner_key: string;
35
+ };
36
+ has_access_orderV1: boolean;
37
+ isAI?: boolean;
38
+ };
27
39
  export type THierarchy = {
28
- evTooglePopup?: TPopupFunction
29
- evCreateMessage?: TMessageFunction
30
- evForcePopUp?: TPopupFunction
31
- isOpenPopup: boolean
32
- modePopup: string
33
- pathPopup: string
34
- actionPopup: string
35
- detailPopup?: TObject
36
- evOpenPopup?: TPopupOpenFunction
37
- evCloseDropdown?: TCloseDropdownFunction
38
- evCreateMessageQuestion?: TMessageQuestionFunction
39
- }
40
+ evTooglePopup?: TPopupFunction;
41
+ evCreateMessage?: TMessageFunction;
42
+ evForcePopUp?: TPopupFunction;
43
+ isOpenPopup: boolean;
44
+ modePopup: string;
45
+ pathPopup: string;
46
+ actionPopup: string;
47
+ detailPopup?: TObject;
48
+ evOpenPopup?: TPopupOpenFunction;
49
+ evCloseDropdown?: TCloseDropdownFunction;
50
+ evCreateMessageQuestion?: TMessageQuestionFunction;
51
+ };
40
52
  export type TChannel = {
41
- channelName?: string
42
- channelInitials?: string
43
- channelColor?: string
44
- channelImage?: string
45
- channelId?: number
46
- name?: string | null
47
- initials?: string | null
48
- color?: string | null
49
- icon?: string | null
50
- id?: number | null
51
- totalStores?: number
53
+ channelName?: string;
54
+ channelInitials?: string;
55
+ channelColor?: string;
56
+ channelImage?: string;
57
+ channelId?: number;
58
+ name?: string | null;
59
+ initials?: string | null;
60
+ color?: string | null;
61
+ icon?: string | null;
62
+ id?: number | null;
63
+ totalStores?: number;
64
+ phone?: string | null;
52
65
  Stores?: {
53
- id?: number
54
- storeName?: string
55
- storeImage?: string
56
- storeImageName?: string
57
- }[]
58
- availableAPI?: boolean | null
59
- }
66
+ id?: number;
67
+ storeName?: string;
68
+ storeImage?: string;
69
+ storeImageName?: string;
70
+ }[];
71
+ availableAPI?: boolean | null;
72
+ };
60
73
  export type THeadProps = {
61
- key: string
62
- name: string
63
- fieldType: string
64
- validations?: TObject
65
- width: number
66
- typeData: string
67
- condition?: string
68
- type?: string
69
- bare?: boolean,
70
- multiline?: boolean
71
- options?: TOption[],
72
- isMassEditable?: boolean
73
- isMassClearable?: boolean
74
- value?: number
75
- schema?: string
76
- align?: any
77
- format?: string
78
- allowEmpty?: boolean
79
- customOptionKey?: string
80
- icon?: string
81
- initial?: string
82
- color?: string
83
- tip?: string
84
- placeholder?: string
85
- isHidden?: boolean
86
- showFormat?: string
87
- containOfType?: string[] | null
88
- }
74
+ key: string;
75
+ name: string;
76
+ fieldType: string;
77
+ validations?: TObject;
78
+ width: number;
79
+ typeData: string;
80
+ condition?: string;
81
+ type?: string;
82
+ bare?: boolean;
83
+ multiline?: boolean;
84
+ options?: TOption[];
85
+ isMassEditable?: boolean;
86
+ isMassClearable?: boolean;
87
+ value?: number;
88
+ schema?: string;
89
+ align?: any;
90
+ format?: string;
91
+ allowEmpty?: boolean;
92
+ customOptionKey?: string;
93
+ icon?: string;
94
+ initial?: string;
95
+ color?: string;
96
+ tip?: string;
97
+ placeholder?: string;
98
+ isHidden?: boolean;
99
+ showFormat?: string;
100
+ containOfType?: string[] | null;
101
+ };
89
102
 
90
103
  export type TInData<TData = never> = {
91
- loading: boolean
92
- data?: TData | null
93
- }
104
+ loading: boolean;
105
+ data?: TData | null;
106
+ };
94
107
 
95
108
  export type TInListProps = {
96
- loadName: string
97
- searchByDef: string
98
- hasCheckAll?: boolean
99
- hasSubscription?: boolean
100
- hasTab?: boolean
101
- hasSort?: boolean
102
- tabStorage?: string
103
- sortStorage?: string
104
- pageStorage?: string
105
- }
109
+ loadName: string;
110
+ searchByDef: string;
111
+ hasCheckAll?: boolean;
112
+ hasSubscription?: boolean;
113
+ hasTab?: boolean;
114
+ hasSort?: boolean;
115
+ tabStorage?: string;
116
+ sortStorage?: string;
117
+ pageStorage?: string;
118
+ };
106
119
 
107
120
  export type TInPart = {
108
- evOpenPopup?: TPopupOpenFunction
109
- evForcePopUp?: TPopupFunction
110
- evCloseDropdown?: TCloseDropdownFunction
111
- evCreateMessage?: TMessageFunction
112
- evCreateMessageQuestion?: TMessageQuestionFunction
113
- saveSubscription?: (statuses: (string | null)[], id: string | number) => void
114
- clearSubscription?: ()=> void
115
- data?: any
116
- id?: string | number
117
- evPrintReceipt?: (dataOrder: any) => void
118
- }
121
+ evOpenPopup?: TPopupOpenFunction;
122
+ evForcePopUp?: TPopupFunction;
123
+ evCloseDropdown?: TCloseDropdownFunction;
124
+ evCreateMessage?: TMessageFunction;
125
+ evCreateMessageQuestion?: TMessageQuestionFunction;
126
+ saveSubscription?: (statuses: (string | null)[], id: string | number) => void;
127
+ clearSubscription?: () => void;
128
+ data?: any;
129
+ id?: string | number;
130
+ evPrintReceipt?: (dataOrder: any) => void;
131
+ };
119
132
 
120
133
  export type TInList = TInPart & {
121
- firstDispatch: Dispatch<any>
122
- resetByOption: (opt?: string | string[], callback?: () => void, noScroll?: boolean) => void
123
- activeStatusTab?: string
124
- evClickTab?: TMouseEvent
125
- loadName?: string,
126
- activePageOption: number
127
- evSetPageOption: TMouseEvent
128
- activePage: number
129
- evSetPage: TMouseEvent
130
- activeCursor: string
131
- searchInput: string
132
- evSearchInput: TChangeEvent
133
- activeSearchBy: string
134
- evClickSearchBy: TMouseEvent
135
- abortRef: AbortController
136
- abortSecRef: AbortController
137
- isForceUpdate: boolean
138
- checkboxData?: TObject[]
139
- isCheckAll?: boolean
140
- isForceUpdateCheckAll?: boolean
141
- isResetSubscription?: boolean
142
- activeSort?: string
143
- evChangeSort?: TChangeEvent
144
- isForceUpdateSort?: boolean
145
- evClickCollapse?: TMouseEvent
146
- isReadyQuery: boolean
147
- }
134
+ firstDispatch: Dispatch<any>;
135
+ resetByOption: (
136
+ opt?: string | string[],
137
+ callback?: () => void,
138
+ noScroll?: boolean,
139
+ ) => void;
140
+ activeStatusTab?: string;
141
+ evClickTab?: TMouseEvent;
142
+ loadName?: string;
143
+ activePageOption: number;
144
+ evSetPageOption: TMouseEvent;
145
+ activePage: number;
146
+ evSetPage: TMouseEvent;
147
+ activeCursor: string;
148
+ searchInput: string;
149
+ evSearchInput: TChangeEvent;
150
+ activeSearchBy: string;
151
+ evClickSearchBy: TMouseEvent;
152
+ abortRef: AbortController;
153
+ abortSecRef: AbortController;
154
+ isForceUpdate: boolean;
155
+ checkboxData?: TObject[];
156
+ isCheckAll?: boolean;
157
+ isForceUpdateCheckAll?: boolean;
158
+ isResetSubscription?: boolean;
159
+ activeSort?: string;
160
+ evChangeSort?: TChangeEvent;
161
+ isForceUpdateSort?: boolean;
162
+ evClickCollapse?: TMouseEvent;
163
+ isReadyQuery: boolean;
164
+ };
148
165
 
149
- export type TInlistPart = Omit<TInList,
150
- 'evClickTab' |
151
- 'activePageOption' |
152
- 'evSetPageOption' |
153
- 'activePage' |
154
- 'evSetPage' |
155
- 'activeCursor' |
156
- 'searchInput' |
157
- 'abortRef' |
158
- 'abortSecRef' |
159
- 'isResetSubscription' |
160
- 'isReadyQuery'> & {
161
- pageEl: JSX.Element | null
162
- readyFilter?: string[]
163
- parseSetForceUpdate?: (value: boolean) => void
164
- evReload?: () => void
165
- }
166
+ export type TInlistPart = Omit<
167
+ TInList,
168
+ | "evClickTab"
169
+ | "activePageOption"
170
+ | "evSetPageOption"
171
+ | "activePage"
172
+ | "evSetPage"
173
+ | "activeCursor"
174
+ | "searchInput"
175
+ | "abortRef"
176
+ | "abortSecRef"
177
+ | "isResetSubscription"
178
+ | "isReadyQuery"
179
+ > & {
180
+ pageEl: JSX.Element | null;
181
+ readyFilter?: string[];
182
+ parseSetForceUpdate?: (value: boolean) => void;
183
+ evReload?: () => void;
184
+ };
166
185
 
167
186
  export interface TPagination {
168
187
  data?: TPage | TUPage | null;
@@ -171,153 +190,165 @@ export interface TPagination {
171
190
  evSetPage: TMouseEvent;
172
191
  activePageOption?: number;
173
192
  evSetPageOption: TMouseEvent;
174
- mode?: 'noPageOption' | 'min10PageOption';
193
+ mode?: "noPageOption" | "min10PageOption";
175
194
  }
176
195
 
177
196
  export type TObjPage = {
178
- cursor?: string
179
- page: number
180
- isCurrent: boolean
181
- }
197
+ cursor?: string;
198
+ page: number;
199
+ isCurrent: boolean;
200
+ };
182
201
 
183
- export type TPageObj = {
184
- first: TObjPage
185
- last: TObjPage
186
- next: TObjPage
187
- prev: TObjPage
188
- around: TObjPage
189
- dot: {
190
- start: boolean
191
- end: boolean
192
- }
193
- } | TObject | null
202
+ export type TPageObj =
203
+ | {
204
+ first: TObjPage;
205
+ last: TObjPage;
206
+ next: TObjPage;
207
+ prev: TObjPage;
208
+ around: TObjPage;
209
+ dot: {
210
+ start: boolean;
211
+ end: boolean;
212
+ };
213
+ }
214
+ | TObject
215
+ | null;
194
216
 
195
217
  export type TNewFilterPartial = {
196
- firstDispatch?: Dispatch<any>
197
- activeStatusTab?: string
198
- evCloseDropdown?: TCloseDropdownFunction
199
- readyFilter?: string[]
200
- isForceUpdate: boolean
201
- setForceUpdate?: TState<boolean>
202
- localStorageName?: string
203
- loadName?: string
204
- resetByOption?: (opt?: string | string[], callback?: () => void, noScroll?: boolean) => void
205
- }
218
+ firstDispatch?: Dispatch<any>;
219
+ activeStatusTab?: string;
220
+ evCloseDropdown?: TCloseDropdownFunction;
221
+ readyFilter?: string[];
222
+ isForceUpdate: boolean;
223
+ setForceUpdate?: TState<boolean>;
224
+ localStorageName?: string;
225
+ loadName?: string;
226
+ resetByOption?: (
227
+ opt?: string | string[],
228
+ callback?: () => void,
229
+ noScroll?: boolean,
230
+ ) => void;
231
+ };
206
232
 
207
233
  export type TNewFunction = {
208
- checkboxData?: TObject[]
209
- evReload?: () => void
210
- evForcePopUp?: TPopupFunction
211
- evCreateMessage?: TMessageFunction
212
- evCreateMessageQuestion?: TMessageQuestionFunction
213
- type?: string
214
- data?: TObject[]
215
- evOpenPopup?: TPopupOpenFunction
216
- inboundId?: number
217
- outboundId?: number
218
- adjustmentId?: number
219
- evMarkIncomplete?: TMouseEvent
220
- source?: string
221
- portalKey?: number
222
- }
234
+ checkboxData?: TObject[];
235
+ evReload?: () => void;
236
+ evForcePopUp?: TPopupFunction;
237
+ evCreateMessage?: TMessageFunction;
238
+ evCreateMessageQuestion?: TMessageQuestionFunction;
239
+ type?: string;
240
+ data?: TObject[];
241
+ evOpenPopup?: TPopupOpenFunction;
242
+ inboundId?: number;
243
+ outboundId?: number;
244
+ adjustmentId?: number;
245
+ evMarkIncomplete?: TMouseEvent;
246
+ source?: string;
247
+ portalKey?: number;
248
+ };
223
249
 
224
250
  export type TDetailNew<TData = never> = {
225
- activeTab?: string
226
- evOpenPopup?: TPopupOpenFunction
227
- data: TData
228
- evClickTabDetail?: TMouseEvent
229
- evCreateMessage?: TMessageFunction
230
- evCreateMessageQuestion?: TMessageQuestionFunction
231
- evCloseDropdown?: TCloseDropdownFunction
232
- evReload?: () => void
233
- }
251
+ activeTab?: string;
252
+ evOpenPopup?: TPopupOpenFunction;
253
+ data: TData;
254
+ evClickTabDetail?: TMouseEvent;
255
+ evCreateMessage?: TMessageFunction;
256
+ evCreateMessageQuestion?: TMessageQuestionFunction;
257
+ evCloseDropdown?: TCloseDropdownFunction;
258
+ evReload?: () => void;
259
+ };
234
260
 
235
261
  type Callback<S> = (state: S) => void | (() => void | undefined);
236
262
 
237
- type DispatchWithCallback<A, S> = (
238
- value: A,
239
- callback: Callback<S>,
240
- ) => void;
263
+ type DispatchWithCallback<A, S> = (value: A, callback: Callback<S>) => void;
241
264
 
242
- export type TStateCallback<TData> = DispatchWithCallback<React.SetStateAction<TData>, TData>
265
+ export type TStateCallback<TData> = DispatchWithCallback<
266
+ React.SetStateAction<TData>,
267
+ TData
268
+ >;
243
269
 
244
270
  export type ModeListTableColumn =
245
- | 'item'
246
- | 'item-nocheck'
247
- | 'quantity'
248
- | 'listing'
249
- | 'listing-nocheck'
250
- | 'picklist'
251
- | 'package'
252
- | 'shipment'
253
- | 'invoice'
254
- | 'payment-receive'
255
- | 'sales-return'
256
- | 'activity'
257
- | 'putaway'
258
- | 'inbound'
259
- | 'lowstock'
260
- | 'price'
261
- | 'stock-adjustment'
262
- | 'stock-outbound'
263
- | 'stock-transfer'
264
- | 'promotion'
265
- | 'stock-history'
266
- | 'price-history'
267
- | 'turnover'
268
- | 'days-outofstock'
269
- | 'warehouses'
270
- | 'archived'
271
- | 'pos-order'
272
- | 'order'
273
- | 'order-nocheck'
274
- | 'table-customheader';
271
+ | "item"
272
+ | "item-nocheck"
273
+ | "quantity"
274
+ | "listing"
275
+ | "listing-nocheck"
276
+ | "picklist"
277
+ | "package"
278
+ | "shipment"
279
+ | "invoice"
280
+ | "payment-receive"
281
+ | "sales-return"
282
+ | "activity"
283
+ | "putaway"
284
+ | "inbound"
285
+ | "lowstock"
286
+ | "price"
287
+ | "stock-adjustment"
288
+ | "stock-outbound"
289
+ | "stock-transfer"
290
+ | "promotion"
291
+ | "stock-history"
292
+ | "price-history"
293
+ | "turnover"
294
+ | "days-outofstock"
295
+ | "warehouses"
296
+ | "archived"
297
+ | "pos-order"
298
+ | "order"
299
+ | "order-nocheck"
300
+ | "table-customheader";
275
301
 
276
302
  export type TInDetail = TInPart & {
277
- firstDispatch?: Dispatch<any>
278
- resetByOption: (opt?: string | string[], callback?: () => void, noScroll?: boolean) => void
279
- activeStatusTab?: string
280
- evClickTab?: TMouseEvent
281
- abortRef: AbortController
282
- isForceUpdate: boolean
283
- isResetSubscription?: boolean
284
- isReadyQuery: boolean
285
- }
303
+ firstDispatch?: Dispatch<any>;
304
+ resetByOption: (
305
+ opt?: string | string[],
306
+ callback?: () => void,
307
+ noScroll?: boolean,
308
+ ) => void;
309
+ activeStatusTab?: string;
310
+ evClickTab?: TMouseEvent;
311
+ abortRef: AbortController;
312
+ isForceUpdate: boolean;
313
+ isResetSubscription?: boolean;
314
+ isReadyQuery: boolean;
315
+ };
286
316
 
287
317
  export type TInDetailProps = {
288
- hasTab?: boolean
289
- tabDef?: string
290
- hasSubscription?: boolean
291
- }
318
+ hasTab?: boolean;
319
+ tabDef?: string;
320
+ hasSubscription?: boolean;
321
+ };
292
322
 
293
323
  export type modeTable =
294
- | 'picklist'
295
- | 'listing'
296
- | 'price'
297
- | 'price'
298
- | 'price-full'
299
- | 'price-mid'
324
+ | "picklist"
325
+ | "listing"
326
+ | "price"
327
+ | "price"
328
+ | "price-full"
329
+ | "price-mid";
300
330
 
301
- export type BodyContentStyle =
302
- | 'create-return'
303
- | 'create-price'
304
- | 'create-adjustment'
305
- | 'create-outbound'
306
- | 'confirm-inbound'
307
- | 'confirm-outbound'
308
- | 'confirm-adjustment'
331
+ export type BodyContentStyle =
332
+ | "create-return"
333
+ | "create-price"
334
+ | "create-adjustment"
335
+ | "create-outbound"
336
+ | "confirm-inbound"
337
+ | "confirm-outbound"
338
+ | "confirm-adjustment";
309
339
 
310
- export type BodyContentMode = BodyContentStyle
311
- | 'create-promotion'
312
- | 'create-inbound'
313
- | 'create-transfer'
314
- | 'create-picklist'
315
- | 'edit-picklist'
316
- | 'create-package'
317
- | 'edit-master'
318
- | 'putaway-inbound'
319
- | 'create-paymentreceive'
320
- | 'create-master'
321
- | 'create-listing'
322
- | 'create-adjustment'
323
- | 'edit-listing'
340
+ export type BodyContentMode =
341
+ | BodyContentStyle
342
+ | "create-promotion"
343
+ | "create-inbound"
344
+ | "create-transfer"
345
+ | "create-picklist"
346
+ | "edit-picklist"
347
+ | "create-package"
348
+ | "edit-master"
349
+ | "putaway-inbound"
350
+ | "create-paymentreceive"
351
+ | "create-master"
352
+ | "create-listing"
353
+ | "create-adjustment"
354
+ | "edit-listing";