@webority/web-core 0.127.0 → 0.129.0
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/README.md +1 -0
- package/dist/formatters/currency.js +1 -1
- package/dist/formatters/formatConfig.js +1 -1
- package/dist/formatters/house.js +1 -1
- package/dist/index.js +1 -1
- package/dist/india/aadhaar.js +1 -0
- package/dist/india/financialYear.js +1 -0
- package/dist/india/gstStates.g.js +1 -0
- package/dist/india/gstin.js +1 -0
- package/dist/india/ifsc.js +1 -0
- package/dist/india/index.js +1 -0
- package/dist/india/indiaTime.js +1 -0
- package/dist/india/indianMobile.js +1 -0
- package/dist/india/nicDivisions.g.js +1 -0
- package/dist/india/paise.js +1 -0
- package/dist/india/pan.js +1 -0
- package/dist/india/pincode.js +1 -0
- package/dist/india/text.js +1 -0
- package/dist/query/index.js +1 -1
- package/dist/query/listQuery.js +1 -0
- package/dist/query/paging.js +1 -1
- package/dist/query/useListQuery.js +1 -1
- package/dist/types/formatters/currency.d.ts +5 -5
- package/dist/types/formatters/formatConfig.d.ts +3 -3
- package/dist/types/formatters/house.d.ts +39 -4
- package/dist/types/india/aadhaar.d.ts +5 -0
- package/dist/types/india/financialYear.d.ts +13 -0
- package/dist/types/india/gstStates.g.d.ts +12 -0
- package/dist/types/india/gstin.d.ts +10 -0
- package/dist/types/india/ifsc.d.ts +2 -0
- package/dist/types/india/index.d.ts +13 -0
- package/dist/types/india/indiaTime.d.ts +6 -0
- package/dist/types/india/indianMobile.d.ts +3 -0
- package/dist/types/india/nicDivisions.g.d.ts +7 -0
- package/dist/types/india/paise.d.ts +12 -0
- package/dist/types/india/pan.d.ts +3 -0
- package/dist/types/india/pincode.d.ts +2 -0
- package/dist/types/india/text.d.ts +8 -0
- package/dist/types/query/index.d.ts +4 -2
- package/dist/types/query/listQuery.d.ts +87 -0
- package/dist/types/query/paging.d.ts +0 -1
- package/dist/types/query/useListQuery.d.ts +2 -10
- package/package.json +14 -2
- package/dist/lib/devWarn.js +0 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ store.
|
|
|
18
18
|
| `config` | `setConfig`, `getConfig`, `getConfigValue`: base URL, version, commit, build number, log settings, request timeout, retry count |
|
|
19
19
|
| `errors` | `extractApiError`: any thrown value to `{ code, message, fieldErrors, status, offline, traceId, diagnostic }`, with `code` `'network'`, `'timeout'` or `'offline'` when no answer arrived (`offline` is true for all three, and `'offline'` only when the browser reports no network); `apiErrorMessage(error, fallback)`; `isNoResponse` |
|
|
20
20
|
| `formatters` | house date, time, number, percent and money (`formatMinor`) formatters; India Standard Time by default, the viewer's zone on request |
|
|
21
|
+
| `india` | the Indian value rules, imported from the subpath `@webority/web-core/india`: GSTIN, PAN, Aadhaar, IFSC, PIN code and mobile checks, GST state and NIC division tables, financial year, IST calendar day and paise; the same code runs in `@webority/mobile-core/india` |
|
|
21
22
|
| `logger` | levelled `Logger` with secret redaction, and `Logger.requestFailed` for a failed service call |
|
|
22
23
|
| `network` | `useNetworkStatus` and the online/offline listener |
|
|
23
24
|
| `query` | the RTK Query base query over `userClient`, the `createAppApi` preset, paged-list and tag helpers |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{configuredLocale as e,getFormatterConfig as t,isFormatterConfigured as n,numberSeparators as r,styledNumber as i}from"./formatConfig.js";import{numberFormat as a}from"./intlCache.js";var o=()=>typeof Intl<`u`&&typeof Intl.NumberFormat==`function`,s=(e,t)=>{let{decimal:n,group:i}=r()??{decimal:`.`,group:`,`},a=e<0?`-`:``,[o,s]=Math.abs(e).toFixed(t).split(`.`),c=o.length>3?o.slice(-3):o,l=o.length>3?o.slice(0,-3):``;return a+(l?l.replace(/\B(?=(\d{2})+(?!\d))/g,i)+i+c:c)+(s?`${n}${s}`:``)},c=e=>{if(e==null||typeof e==`string`&&e.trim()===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null},l=(e,t)=>a(e,{style:`currency`,currency:t}).resolvedOptions().maximumFractionDigits??2,u=(r,u)=>{let{currency:d,locale:f=e()??`en-IN`,minimumFractionDigits:p,maximumFractionDigits:m,stripSymbol:h=!1,empty:g=n(`locale`)||n(`empty`)?t().empty:``,..._}=u;if(!d)throw TypeError(`[@webority/web-core] formatCurrency needs options.currency, an ISO 4217 code such as "INR".`);let v=c(r);if(v===null)return g;if(o())try{let e=m??l(f,d),t=p??(Number.isInteger(v)?0:e),n=i(a(f,{..._,style:`currency`,currency:d,minimumFractionDigits:t,maximumFractionDigits:Math.max(t,e)}),v);return h?n.replace(/[^\d,.\s\-+]/g,``).trim():n}catch{}let y=s(v,p??(Number.isInteger(v)?0:2));return h?y:d===`INR`?`₹${y}`:`${d} ${y}`};export{u as formatCurrency};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={zone:`IST`,locale:`en-IN`,empty:`-`},t={PointWithCommaGroups:{decimal:`.`,group:`,`},CommaWithPointGroups:{decimal:`,`,group:`.`},CommaWithSpaceGroups:{decimal:`,`,group:`\xA0`},PointWithSpaceGroups:{decimal:`.`,group:`\xA0`}},n=[`DayMonthNameYear`,`DayMonthYear`,`MonthDayYear`,`YearMonthDay`],r={...e},i=/* @__PURE__ */ new Set,a=a=>{if(a===void 0)r={...e},i=/* @__PURE__ */ new Set;else{if(a.numberStyle!==void 0&&!Object.hasOwn(t,a.numberStyle))throw RangeError(`Unknown number style "${a.numberStyle}"; expected one of ${Object.keys(t).join(`, `)}.`);if(a.dateOrder!==void 0&&!n.includes(a.dateOrder))throw RangeError(`Unknown date order "${a.dateOrder}"; expected one of ${n.join(`, `)}.`);for(let e of Object.keys(a)){let t=a[e];t!==void 0&&(r={...r,[e]:t},i.add(e))}}},o=()=>({...r}),s=e=>i.has(e),c=()=>i.has(`locale`)?r.locale:null,l=e=>/-IN(?:-|$)/i.test(e)?`indian`:`international`,u=()=>r.numberStyle===void 0?null:t[r.numberStyle],d=(e,t)=>{let n=
|
|
1
|
+
var e={zone:`IST`,locale:`en-IN`,empty:`-`},t={PointWithCommaGroups:{decimal:`.`,group:`,`},CommaWithPointGroups:{decimal:`,`,group:`.`},CommaWithSpaceGroups:{decimal:`,`,group:`\xA0`},PointWithSpaceGroups:{decimal:`.`,group:`\xA0`}},n=[`DayMonthNameYear`,`DayMonthYear`,`MonthDayYear`,`YearMonthDay`],r={...e},i=/* @__PURE__ */ new Set,a=a=>{if(a===void 0)r={...e},i=/* @__PURE__ */ new Set;else{if(a.numberStyle!==void 0&&!Object.hasOwn(t,a.numberStyle))throw RangeError(`Unknown number style "${a.numberStyle}"; expected one of ${Object.keys(t).join(`, `)}.`);if(a.dateOrder!==void 0&&!n.includes(a.dateOrder))throw RangeError(`Unknown date order "${a.dateOrder}"; expected one of ${n.join(`, `)}.`);for(let e of Object.keys(a)){let t=a[e];t!==void 0&&(r={...r,[e]:t},i.add(e))}}},o=()=>({...r}),s=e=>i.has(e),c=()=>i.has(`locale`)?r.locale:null,l=e=>/-IN(?:-|$)/i.test(e)?`indian`:`international`,u=()=>r.numberStyle===void 0?null:t[r.numberStyle],d=/* @__PURE__ */ new Map,f=e=>{let t=new Intl.NumberFormat(e,{useGrouping:!1}),n=/* @__PURE__ */ new Set;for(let e=0;e<=9;e++)n.add(t.format(e));return n},p=(e,t)=>{let n=[],r=[],i=!1;for(let a of e)t.has(a)?(r.length>0&&(n.push(r),r=[]),i=!0):i&&r.push(a);return n},m=e=>{let t=d.get(e);if(t!==void 0)return t;let n=f(e),r=new Intl.NumberFormat(e,{useGrouping:!0,minimumFractionDigits:1,maximumFractionDigits:1}).format(11111.5),i=p(Array.from(r),n),a={digits:n,decimal:i.length>=1?i[i.length-1]:null,group:i.length>=2?i[0]:null};return d.set(e,a),a},h=(e,t,n)=>t>=0&&t<e.length&&n.has(e[t]),g=(e,t,n)=>{let r=Array.from(e),i=``,a=0;for(;a<r.length;){let e=n.find(({mark:e})=>h(r,a-1,t)&&e.every((e,t)=>r[a+t]===e)&&h(r,a+e.length,t));e===void 0?(i+=r[a],a+=1):(i+=e.to,a+=e.mark.length)}return i},_=(e,t)=>{let n=u();if(n===null)return e.format(t);let{digits:r,decimal:i,group:a}=m(e.resolvedOptions().locale),o=[];return i!==null&&o.push({mark:i,to:n.decimal}),a!==null&&o.push({mark:a,to:n.group}),g(e.format(t),r,o)};export{a as configureFormatters,c as configuredLocale,o as getFormatterConfig,l as groupingForLocale,s as isFormatterConfigured,u as numberSeparators,_ as styledNumber};
|
package/dist/formatters/house.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{configuredLocale as e,getFormatterConfig as t,groupingForLocale as n,numberSeparators as r,styledNumber as i}from"./formatConfig.js";import{dateTimeFormat as a,numberFormat as o,relativeTimeFormat as s}from"./intlCache.js";var c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=330,u=[`IST`,`Asia/Kolkata`,`Asia/Calcutta`],d=/^\d{4}-\d{2}-\d{2}$/,f=e=>e<10?`0${e}`:`${e}`,p=e=>e??t().empty,m=e=>{if(e==null||e===``)return null;let t=e instanceof Date?e:new Date(typeof e==`string`?e.trim():e);return Number.isNaN(t.getTime())?null:t},h=e=>typeof e==`string`&&d.test(e.trim()),g=e=>{if(e===0)return`GMT`;let t=e>0?`+`:`-`,n=Math.abs(e),r=n%60;return`GMT${t}${Math.floor(n/60)}${r===0?``:`:${f(r)}`}`},_=(e,t,n)=>{let r=new Date(e.getTime()+t*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth(),day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),label:n}},v=(e,t)=>{let n=a(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,hour12:!1}).formatToParts(e),r=e=>Number.parseInt(n.find(t=>t.type===e)?.value??``,10),i=r(`year`),o=r(`month`)-1,s=r(`day`),c=r(`hour`)%24,l=r(`minute`);return{year:i,month:o,day:s,hour:c,minute:l,label:g(Math.round((Date.UTC(i,o,s,c,l)-Math.floor(e.getTime()/6e4)*6e4)/6e4))}},y=(e,t)=>u.includes(t)?_(e,l,`IST`):t===`UTC`?_(e,0,`UTC`):t===`viewer`?{year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),label:g(-e.getTimezoneOffset())}:v(e,t),b=e=>e.hourCycle??12,x=e=>`${f(e.day)}-${c[e.month]}-${e.year}`,S=(e,t)=>{let n=f(e.day),r=f(e.month+1),i=String(e.year).padStart(4,`0`);return t===`DayMonthYear`?`${n}/${r}/${i}`:t===`MonthDayYear`?`${r}/${n}/${i}`:`${i}-${r}-${n}`},C=(e,t)=>t===24?`${f(e.hour)}:${f(e.minute)}`:`${e.hour%12||12}:${f(e.minute)} ${e.hour<12?`AM`:`PM`}`,w=(e,t)=>t??!u.includes(e),T=(e,t,n,r)=>w(n,r)?`${e} ${t.label}`:e,E=e=>{if(e!==`viewer`)return u.includes(e)?`Asia/Kolkata`:e},D=(e,t,n)=>{let r=a(t,{day:`2-digit`,month:`short`,year:`numeric`,timeZone:n}).formatToParts(e),i=e=>r.find(t=>t.type===e)?.value??``;return`${i(`day`)}-${i(`month`).replace(`.`,``)}-${i(`year`)}`},O=(n,r)=>{let i=t().dateOrder??`DayMonthNameYear`;if(i!==`DayMonthNameYear`)return S(y(n,r),i);let a=e();return a?D(n,a,E(r)):x(y(n,r))},k=(e,t,n,r)=>a(t,{hour:`2-digit`,minute:`2-digit`,timeZone:E(n),timeZoneName:w(n,r.zoneLabel)?`short`:void 0,hourCycle:r.hourCycle===void 0?void 0:r.hourCycle===24?`h23`:`h12`}).format(e),A=(e,n={})=>{let r=m(e);return r?O(r,h(e)?`UTC`:n.zone??t().zone):p(n.empty)},ee=(n,r={})=>{let i=m(n);if(!i)return p(r.empty);let a=r.zone??t().zone,o=e();if(o)return k(i,o,a,r);let s=y(i,a);return T(C(s,b(r)),s,a,r.zoneLabel)},te=(n,r={})=>{let i=m(n);if(!i)return p(r.empty);let a=r.zone??t().zone,o=e();if(o)return`${O(i,a)}, ${k(i,o,a,r)}`;let s=y(i,a);return T(`${O(i,a)}, ${C(s,b(r))}`,s,a,r.zoneLabel)},j=1e3,M=60*j,N=60*M,P=24*N,F=7*P,I=30*P,L=365*P,R=[[`year`,L],[`month`,I],[`day`,P],[`hour`,N],[`minute`,M]],z=(n,r={})=>{let i=m(n),a=m(r.now??Date.now());if(!i||!a)return p(r.empty);let o=i.getTime()-a.getTime(),c=Math.abs(o),l=Intl.RelativeTimeFormat,u=e();if((u!==null||r.intl===!0)&&typeof l==`function`){let e=s(l,u??t().locale),[n,r]=R.find(([,e])=>c>=e)??[`second`,j];return e.format(Math.round(o/r),n)}if(c<M)return`just now`;let[d,f]=c<N?[`minute`,M]:c<P?[`hour`,N]:c<F?[`day`,P]:c<I?[`week`,F]:c<L?[`month`,I]:[`year`,L],h=Math.floor(c/f),g=`${h} ${d}${h===1?``:`s`}`;return o<0?`${g} ago`:`in ${g}`},B=e=>{if(e==null||typeof e==`string`&&e.trim()===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null},V=e=>Math.min(20,Math.max(0,Math.trunc(e))),H=(e,t)=>/e/i.test(String(e))?e*10**t:Number(`${e}e${t}`),U=()=>r()??{decimal:`.`,group:`,`},W=(e,t,n)=>t===`none`||e.length<=3?e:t===`international`?e.replace(/\B(?=(\d{3})+(?!\d))/g,n):`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,n)}${n}${e.slice(-3)}`,G=()=>typeof Intl<`u`&&typeof Intl.NumberFormat==`function`,K=(e,t)=>{if(G())return o(`en-US`,{useGrouping:!1,minimumFractionDigits:0,maximumFractionDigits:t}).format(e);let n=Math.min(t,15);return H(Math.round(H(e,n)),-n).toFixed(n)},q=(e,t,n,r)=>{let i=Math.max(V(n),V(t)),a=V(t),o=K(Math.abs(e),i),[s=`0`,c=``]=o.split(`.`),l=c.padEnd(a,`0`);for(;l.length>a&&l.endsWith(`0`);)l=l.slice(0,-1);let u=U(),d=W(s,r,u.group)+(l?`${u.decimal}${l}`:``);return e<0&&/[1-9]/.test(o)?`-${d}`:d},J=/* @__PURE__ */ new Set([`grouping`,`minimumFractionDigits`,`maximumFractionDigits`,`locale`,`empty`,`scale`]),Y=e=>{if(!Object.entries(e).some(([e,t])=>t!==void 0&&!J.has(e)))return null;let{grouping:t,locale:n,empty:r,scale:i,...a}=e;return t===`none`&&a.useGrouping===void 0?{...a,useGrouping:!1}:a},X=e=>e.locale??t().locale,Z=t=>{let n=e();return n===null||t.grouping===`indian`||t.grouping===`international`?null:t.locale??n},Q=(e,t)=>{let n=V(e);return{minimumFractionDigits:n,maximumFractionDigits:Math.max(n,V(t))}},$=e=>e===`none`?{useGrouping:!1}:{},ne=(e,t={})=>{let r=B(e);if(r===null)return p(t.empty);let a=Y(t);if(a)return i(o(X(t),a),r);let s=Z(t);return s?i(o(s,{...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??3),...$(t.grouping)}),r):q(r,t.minimumFractionDigits??0,t.maximumFractionDigits??3,t.grouping??n(X(t)))},re=(e,t={})=>{let r=B(e);if(r===null)return p(t.empty);let a=Y(t);if(a){let e=t.scale===`percent`?H(r,-2):r;return i(o(X(t),{style:`percent`,...a}),e)}let s=Z(t);if(s){let e=t.scale===`percent`?H(r,-2):r;return i(o(s,{style:`percent`,...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0),...$(t.grouping)}),e)}return`${q(t.scale===`percent`?r:H(r,2),t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0,t.grouping??n(X(t)))}%`},ie={INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`},ae={JPY:0,KRW:0,VND:0,BHD:3,JOD:3,KWD:3,OMR:3,TND:3},oe=(e,t)=>{if(!t?.currency)throw TypeError(`formatMinor needs options.currency, an ISO 4217 code such as "INR".`);let n=B(e);if(n===null)return p(t.empty);let r=t.currency.toUpperCase(),a=ae[r]??2,s=Math.round(Math.abs(n)),c=String(s).padStart(a+1,`0`),l=c.slice(0,c.length-a),u=c.slice(c.length-a);t.dropZeroDecimals&&/^0*$/.test(u)&&(u=``);let d=Z({grouping:t.grouping});if(d)try{let e=Number(`${n<0&&s!==0?`-`:``}${l}.${c.slice(c.length-a)||`0`}`);return i(o(d,{...t.symbol===!1?{}:{style:`currency`,currency:r},...Q(u?a:0,a),...$(t.grouping)}),e)}catch{}let f=t.grouping??(r===`INR`?`indian`:`international`),m=U(),h=W(l,f,m.group)+(u?`${m.decimal}${u}`:``),g=n<0&&s!==0?`-`:``;if(t.symbol===!1)return`${g}${h}`;let _=ie[r];return _?`${g}${_}${h}`:`${g}${r} ${h}`};export{A as formatDate,te as formatDateTime,oe as formatMinor,ne as formatNumber,re as formatPercent,z as formatRelative,ee as formatTime};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_BUILD_CHECK_INTERVAL_MS as e,DEFAULT_LOG_LEVEL as t,DEFAULT_RETRIES as n,DEFAULT_TIMEOUT_MS as r,DEFAULT_VERSION_URL as i,getConfig as a,getConfigValue as o,resetConfig as s,setConfig as c}from"./config/index.js";import{TRACEPARENT_HEADER as l,applyRequestDefaults as u,newTraceparent as d}from"./api/requestDefaults.js";import{Logger as f,configureLogger as p,getDeviceContext as m,setDeviceContext as h,setRemoteLogger as g}from"./logger/logger.js";import{decodeJWT as _,getJWTExpiry as v,isJWTExpired as y}from"./auth/jwt.js";import{ACCESS_TOKEN_KEY as b,LEGACY_REFRESH_TOKEN_LIFETIME_MS as x,REFRESH_TOKEN_KEY as S,SESSION_USER_KEY as C,addSessionEndedListener as w,clearSession as T,getKeepSignedIn as E,getSessionUser as D,getToken as O,hasSession as k,hasSessionEndedInTab as A,removeSessionUser as j,removeToken as M,setKeepSignedIn as N,setLegacyTokenKeys as P,storeSessionUser as F,storeToken as I}from"./auth/authStore.js";import{addNetworkStatusListener as L,getNetworkStatus as R,setNetworkStatusImplementation as z,useNetworkStatus as B}from"./network/networkStatus.js";import{ACCOUNT_ID_HEADER as V,CLIENT_BUILD_HEADER as H,CLIENT_KIND as U,CLIENT_KIND_HEADER as W,getClientBuild as G}from"./api/clientHeaders.js";import{DESIGN_SAMPLE_HEADER as K,DESIGN_SAMPLE_QUERY_KEY as q,DESIGN_SAMPLE_STORAGE_KEY as J,applyDesignSample as Y,readDesignSampleTicket as X}from"./api/designSample.js";import{MIN_APP_VERSION_HEADER as Z,addMinAppVersionListener as Q,getMinAppVersion as $}from"./api/minAppVersion.js";import{WORKSPACE_CHANGED_CODE as ee,WorkspaceChangedError as te,isWorkspaceChangedError as ne}from"./api/workspaceChanged.js";import{IDEMPOTENCY_KEY_HEADER as re,attachRetry as ie,isNeverSentError as ae,isRetryableFailure as oe,isRetryableStatus as se,retryAfterMs as ce}from"./api/retry.js";import{REFRESH_LOCK_NAME as le,withCrossTabRefreshLock as ue}from"./api/crossTabRefreshLock.js";import de from"./api/publicClient.js";import{SESSION_EXPIRED_CODE as fe,SESSION_REVOKED_CODE as pe,injectStore as me,injectUserAuth as he,refreshAccessToken as ge,resetRefreshState as _e}from"./api/tokenRefresh.js";import ve,{RequestOfflineError as ye}from"./api/userClient.js";import{initUserAuth as be}from"./initUserAuth.js";import{CONTRACT_ERROR_CODE as xe,NETWORK_CODE as Se,OFFLINE_CODE as Ce,OFFLINE_MESSAGE as we,REQUEST_CANCELED_CODE as Te,SERVER_FAILURE_MESSAGE as Ee,TIMEOUT_CODE as De,TIMEOUT_MESSAGE as Oe,UNEXPECTED_MESSAGE as ke,UNREACHABLE_MESSAGE as Ae,apiErrorMessage as je,extractApiError as Me,isApiError as Ne,isNoResponse as Pe,toFieldPath as Fe}from"./errors/extractApiError.js";import{configureFormatters as Ie,getFormatterConfig as Le}from"./formatters/formatConfig.js";import{formatCurrency as Re}from"./formatters/currency.js";import{addDays as ze}from"./formatters/dateMath.js";import{formatDate as Be,formatDateTime as Ve,formatMinor as He,formatNumber as Ue,formatPercent as We,formatRelative as Ge,formatTime as Ke}from"./formatters/house.js";import{initWebority as qe}from"./initSDK.js";import{createApiBaseQuery as Je}from"./query/apiBaseQuery.js";import{APP_API_DEFAULTS as Ye,createAppApi as Xe}from"./query/createAppApi.js";import{setupApiListeners as Ze}from"./query/listeners.js";import{LIST_QUERY_RESERVED as Qe,SEARCH_PARAM as $e,buildListQuery as et,
|
|
1
|
+
import{DEFAULT_BUILD_CHECK_INTERVAL_MS as e,DEFAULT_LOG_LEVEL as t,DEFAULT_RETRIES as n,DEFAULT_TIMEOUT_MS as r,DEFAULT_VERSION_URL as i,getConfig as a,getConfigValue as o,resetConfig as s,setConfig as c}from"./config/index.js";import{TRACEPARENT_HEADER as l,applyRequestDefaults as u,newTraceparent as d}from"./api/requestDefaults.js";import{Logger as f,configureLogger as p,getDeviceContext as m,setDeviceContext as h,setRemoteLogger as g}from"./logger/logger.js";import{decodeJWT as _,getJWTExpiry as v,isJWTExpired as y}from"./auth/jwt.js";import{ACCESS_TOKEN_KEY as b,LEGACY_REFRESH_TOKEN_LIFETIME_MS as x,REFRESH_TOKEN_KEY as S,SESSION_USER_KEY as C,addSessionEndedListener as w,clearSession as T,getKeepSignedIn as E,getSessionUser as D,getToken as O,hasSession as k,hasSessionEndedInTab as A,removeSessionUser as j,removeToken as M,setKeepSignedIn as N,setLegacyTokenKeys as P,storeSessionUser as F,storeToken as I}from"./auth/authStore.js";import{addNetworkStatusListener as L,getNetworkStatus as R,setNetworkStatusImplementation as z,useNetworkStatus as B}from"./network/networkStatus.js";import{ACCOUNT_ID_HEADER as V,CLIENT_BUILD_HEADER as H,CLIENT_KIND as U,CLIENT_KIND_HEADER as W,getClientBuild as G}from"./api/clientHeaders.js";import{DESIGN_SAMPLE_HEADER as K,DESIGN_SAMPLE_QUERY_KEY as q,DESIGN_SAMPLE_STORAGE_KEY as J,applyDesignSample as Y,readDesignSampleTicket as X}from"./api/designSample.js";import{MIN_APP_VERSION_HEADER as Z,addMinAppVersionListener as Q,getMinAppVersion as $}from"./api/minAppVersion.js";import{WORKSPACE_CHANGED_CODE as ee,WorkspaceChangedError as te,isWorkspaceChangedError as ne}from"./api/workspaceChanged.js";import{IDEMPOTENCY_KEY_HEADER as re,attachRetry as ie,isNeverSentError as ae,isRetryableFailure as oe,isRetryableStatus as se,retryAfterMs as ce}from"./api/retry.js";import{REFRESH_LOCK_NAME as le,withCrossTabRefreshLock as ue}from"./api/crossTabRefreshLock.js";import de from"./api/publicClient.js";import{SESSION_EXPIRED_CODE as fe,SESSION_REVOKED_CODE as pe,injectStore as me,injectUserAuth as he,refreshAccessToken as ge,resetRefreshState as _e}from"./api/tokenRefresh.js";import ve,{RequestOfflineError as ye}from"./api/userClient.js";import{initUserAuth as be}from"./initUserAuth.js";import{CONTRACT_ERROR_CODE as xe,NETWORK_CODE as Se,OFFLINE_CODE as Ce,OFFLINE_MESSAGE as we,REQUEST_CANCELED_CODE as Te,SERVER_FAILURE_MESSAGE as Ee,TIMEOUT_CODE as De,TIMEOUT_MESSAGE as Oe,UNEXPECTED_MESSAGE as ke,UNREACHABLE_MESSAGE as Ae,apiErrorMessage as je,extractApiError as Me,isApiError as Ne,isNoResponse as Pe,toFieldPath as Fe}from"./errors/extractApiError.js";import{configureFormatters as Ie,getFormatterConfig as Le}from"./formatters/formatConfig.js";import{formatCurrency as Re}from"./formatters/currency.js";import{addDays as ze}from"./formatters/dateMath.js";import{formatDate as Be,formatDateTime as Ve,formatMinor as He,formatNumber as Ue,formatPercent as We,formatRelative as Ge,formatTime as Ke}from"./formatters/house.js";import{initWebority as qe}from"./initSDK.js";import{createApiBaseQuery as Je}from"./query/apiBaseQuery.js";import{APP_API_DEFAULTS as Ye,createAppApi as Xe}from"./query/createAppApi.js";import{setupApiListeners as Ze}from"./query/listeners.js";import{LIST_QUERY_RESERVED as Qe,SEARCH_PARAM as $e,buildListQuery as et,emptyFacetValue as tt,isFacetActive as nt,listQueryParamNames as rt,parseListQuery as it}from"./query/listQuery.js";import{getNextPageParam as at,getPreviousPageParam as ot,hasNextPage as st,hasPreviousPage as ct}from"./query/paging.js";import{LIST_TAG_ID as lt,itemTag as ut,listTag as dt,providesList as ft,providesPagedList as pt}from"./query/tags.js";import{useListQuery as mt}from"./query/useListQuery.js";import{errorToastMiddleware as ht,isSilentRejection as gt}from"./redux/errorToastMiddleware.js";import{createRootReducer as _t,resetState as vt}from"./redux/rootReducer.js";import{SERIALIZABLE_IGNORED_ACTION_PATHS as yt}from"./redux/serializableCheck.js";import{hasRecentlyReloaded as bt,importWithReload as xt,isChunkLoadError as St,lazyWithReload as Ct,markReloaded as wt}from"./router/chunkReload.js";import{classifyRouteError as Tt,useRouteErrorReport as Et}from"./router/routeError.js";import{ErrorBoundary as Dt}from"./router/ErrorBoundary.js";import{hasPermission as Ot}from"./router/permissions.js";import{RETURN_TO_PARAM as kt,buildLoginPath as At,getReturnTo as jt,toSafeReturnTo as Mt}from"./router/returnTo.js";import{PublicOnly as Nt,RequireAuth as Pt,RequirePermission as Ft}from"./router/guards.js";import{publicOnly as It,requireAuth as Lt,requirePermission as Rt,withGuards as zt}from"./router/loaders.js";import{staticUrl as Bt}from"./static/index.js";import{Storage as Vt,isStorageAvailable as Ht,setStorageImplementation as Ut,syncStorage as Wt}from"./storage/index.js";import{isBuildBelowMinimum as Gt,parseBuildNumber as Kt}from"./versionCheck/buildNumber.js";import{addDeployedBuildListener as qt,getNewerDeployedBuild as Jt,startDeployedBuildCheck as Yt}from"./versionCheck/deployedBuild.js";import{installReloadOnNavigate as Xt,isUpdateAvailable as Zt,useVersionCheck as Qt}from"./versionCheck/index.js";export{b as ACCESS_TOKEN_KEY,V as ACCOUNT_ID_HEADER,Ye as APP_API_DEFAULTS,H as CLIENT_BUILD_HEADER,U as CLIENT_KIND,W as CLIENT_KIND_HEADER,xe as CONTRACT_ERROR_CODE,e as DEFAULT_BUILD_CHECK_INTERVAL_MS,t as DEFAULT_LOG_LEVEL,n as DEFAULT_RETRIES,r as DEFAULT_TIMEOUT_MS,i as DEFAULT_VERSION_URL,K as DESIGN_SAMPLE_HEADER,q as DESIGN_SAMPLE_QUERY_KEY,J as DESIGN_SAMPLE_STORAGE_KEY,Dt as ErrorBoundary,re as IDEMPOTENCY_KEY_HEADER,x as LEGACY_REFRESH_TOKEN_LIFETIME_MS,Qe as LIST_QUERY_RESERVED,lt as LIST_TAG_ID,f as Logger,Z as MIN_APP_VERSION_HEADER,Se as NETWORK_CODE,Ce as OFFLINE_CODE,we as OFFLINE_MESSAGE,Nt as PublicOnly,le as REFRESH_LOCK_NAME,S as REFRESH_TOKEN_KEY,Te as REQUEST_CANCELED_CODE,kt as RETURN_TO_PARAM,ye as RequestOfflineError,Pt as RequireAuth,Ft as RequirePermission,$e as SEARCH_PARAM,yt as SERIALIZABLE_IGNORED_ACTION_PATHS,Ee as SERVER_FAILURE_MESSAGE,fe as SESSION_EXPIRED_CODE,pe as SESSION_REVOKED_CODE,C as SESSION_USER_KEY,Vt as Storage,De as TIMEOUT_CODE,Oe as TIMEOUT_MESSAGE,l as TRACEPARENT_HEADER,ke as UNEXPECTED_MESSAGE,Ae as UNREACHABLE_MESSAGE,ee as WORKSPACE_CHANGED_CODE,te as WorkspaceChangedError,ze as addDays,qt as addDeployedBuildListener,Q as addMinAppVersionListener,L as addNetworkStatusListener,w as addSessionEndedListener,je as apiErrorMessage,Y as applyDesignSample,u as applyRequestDefaults,ie as attachRetry,et as buildListQuery,At as buildLoginPath,Tt as classifyRouteError,T as clearSession,Ie as configureFormatters,p as configureLogger,Je as createApiBaseQuery,Xe as createAppApi,_t as createRootReducer,_ as decodeJWT,tt as emptyFacetValue,ht as errorToastMiddleware,Me as extractApiError,Re as formatCurrency,Be as formatDate,Ve as formatDateTime,He as formatMinor,Ue as formatNumber,We as formatPercent,Ge as formatRelative,Ke as formatTime,G as getClientBuild,a as getConfig,o as getConfigValue,m as getDeviceContext,Le as getFormatterConfig,v as getJWTExpiry,E as getKeepSignedIn,$ as getMinAppVersion,R as getNetworkStatus,Jt as getNewerDeployedBuild,at as getNextPageParam,ot as getPreviousPageParam,jt as getReturnTo,D as getSessionUser,O as getToken,st as hasNextPage,Ot as hasPermission,ct as hasPreviousPage,bt as hasRecentlyReloaded,k as hasSession,A as hasSessionEndedInTab,xt as importWithReload,be as initUserAuth,qe as initWebority,me as injectStore,he as injectUserAuth,Xt as installReloadOnNavigate,Ne as isApiError,Gt as isBuildBelowMinimum,St as isChunkLoadError,nt as isFacetActive,y as isJWTExpired,ae as isNeverSentError,Pe as isNoResponse,oe as isRetryableFailure,se as isRetryableStatus,gt as isSilentRejection,Ht as isStorageAvailable,Zt as isUpdateAvailable,ne as isWorkspaceChangedError,ut as itemTag,Ct as lazyWithReload,rt as listQueryParamNames,dt as listTag,wt as markReloaded,d as newTraceparent,Kt as parseBuildNumber,it as parseListQuery,ft as providesList,pt as providesPagedList,de as publicClient,It as publicOnly,X as readDesignSampleTicket,ge as refreshAccessToken,j as removeSessionUser,M as removeToken,Lt as requireAuth,Rt as requirePermission,s as resetConfig,_e as resetRefreshState,vt as resetState,ce as retryAfterMs,c as setConfig,h as setDeviceContext,N as setKeepSignedIn,P as setLegacyTokenKeys,z as setNetworkStatusImplementation,g as setRemoteLogger,Ut as setStorageImplementation,Ze as setupApiListeners,Yt as startDeployedBuildCheck,Bt as staticUrl,F as storeSessionUser,I as storeToken,Wt as syncStorage,Fe as toFieldPath,Mt as toSafeReturnTo,mt as useListQuery,B as useNetworkStatus,Et as useRouteErrorReport,Qt as useVersionCheck,ve as userClient,ue as withCrossTabRefreshLock,zt as withGuards};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withoutSpaces as e}from"./text.js";var t=/^[2-9][0-9]{11}$/,n=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],r=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]],i=e=>{let t=0;for(let i=0;i<e.length;i+=1){let a=Number(e.charAt(e.length-1-i));t=n[t][r[i%8][a]]}return t===0},a=t=>{let n=e(t);return n===null?null:n.replace(/-/g,``).trim()},o=e=>{let n=a(e);return n!==null&&t.test(n)&&i(n)?n:null},s=e=>o(e)!==null,c=e=>{let t=o(e);return t===null?null:`XXXX XXXX ${t.slice(-4)}`},l=e=>{let t=o(e);return t===null?null:t.slice(-4)};export{l as aadhaarLastFour,s as isAadhaar,c as maskAadhaar,a as normalizeAadhaar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{istDateOf as e}from"./indiaTime.js";var t=9998,n=e=>String(e%100).padStart(2,`0`),r=e=>String(e).padStart(4,`0`),i=e=>`${e}-${n(e+1)}`,a=e=>{let t=i(e);return{startYear:e,label:t,displayLabel:`FY ${t}`,assessmentYearLabel:i(e+1),startDate:`${r(e)}-04-01`,endDate:`${r(e+1)}-03-31`}},o=t=>{let[n,r]=e(t).split(`-`).map(Number);return a(r>=4?n:n-1)},s=(e=/* @__PURE__ */ new Date)=>o(e),c=e=>{if(typeof e!=`string`)return null;let r=e.trim();/^fy/i.test(r)&&(r=r.slice(2).trimStart());let i=r.indexOf(`-`),o=(i<0?r:r.slice(0,i)).trimEnd();if(!/^\d{4}$/.test(o))return null;let s=Number(o);if(s<1||s>t)return null;if(i<0)return a(s);let c=r.slice(i+1).trimStart(),l=s+1;return c===n(l)||c===String(l)?a(s):null},l=(e,t=/* @__PURE__ */ new Date)=>{if(!Number.isInteger(e)||e<1)throw RangeError(`A count of recent financial years must be a whole number of at least 1, got ${e}.`);let n=s(t).startYear;return Array.from({length:e},(e,t)=>a(n-t))};export{s as currentFinancialYear,i as financialYearLabel,o as financialYearOf,c as parseFinancialYear,l as recentFinancialYears};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=[{code:`01`,name:`Jammu and Kashmir`,status:`Current`,aliases:[`J&K`,`Jammu & Kashmir`]},{code:`02`,name:`Himachal Pradesh`,status:`Current`,aliases:[]},{code:`03`,name:`Punjab`,status:`Current`,aliases:[]},{code:`04`,name:`Chandigarh`,status:`Current`,aliases:[]},{code:`05`,name:`Uttarakhand`,status:`Current`,aliases:[`Uttaranchal`]},{code:`06`,name:`Haryana`,status:`Current`,aliases:[]},{code:`07`,name:`Delhi`,status:`Current`,aliases:[`New Delhi`,`NCT of Delhi`]},{code:`08`,name:`Rajasthan`,status:`Current`,aliases:[]},{code:`09`,name:`Uttar Pradesh`,status:`Current`,aliases:[]},{code:`10`,name:`Bihar`,status:`Current`,aliases:[]},{code:`11`,name:`Sikkim`,status:`Current`,aliases:[]},{code:`12`,name:`Arunachal Pradesh`,status:`Current`,aliases:[]},{code:`13`,name:`Nagaland`,status:`Current`,aliases:[]},{code:`14`,name:`Manipur`,status:`Current`,aliases:[]},{code:`15`,name:`Mizoram`,status:`Current`,aliases:[]},{code:`16`,name:`Tripura`,status:`Current`,aliases:[]},{code:`17`,name:`Meghalaya`,status:`Current`,aliases:[]},{code:`18`,name:`Assam`,status:`Current`,aliases:[]},{code:`19`,name:`West Bengal`,status:`Current`,aliases:[]},{code:`20`,name:`Jharkhand`,status:`Current`,aliases:[]},{code:`21`,name:`Odisha`,status:`Current`,aliases:[`Orissa`]},{code:`22`,name:`Chhattisgarh`,status:`Current`,aliases:[]},{code:`23`,name:`Madhya Pradesh`,status:`Current`,aliases:[]},{code:`24`,name:`Gujarat`,status:`Current`,aliases:[]},{code:`25`,name:`Daman and Diu (before 2020)`,status:`Retired`,replacedByCode:`26`,aliases:[]},{code:`26`,name:`Dadra and Nagar Haveli and Daman and Diu`,status:`Current`,aliases:[`Dadra and Nagar Haveli`,`Daman and Diu`,`Dadra & Nagar Haveli`]},{code:`27`,name:`Maharashtra`,status:`Current`,aliases:[]},{code:`28`,name:`Andhra Pradesh (before 2014)`,status:`Retired`,replacedByCode:`37`,aliases:[]},{code:`29`,name:`Karnataka`,status:`Current`,aliases:[]},{code:`30`,name:`Goa`,status:`Current`,aliases:[]},{code:`31`,name:`Lakshadweep`,status:`Current`,aliases:[]},{code:`32`,name:`Kerala`,status:`Current`,aliases:[]},{code:`33`,name:`Tamil Nadu`,status:`Current`,aliases:[]},{code:`34`,name:`Puducherry`,status:`Current`,aliases:[`Pondicherry`]},{code:`35`,name:`Andaman and Nicobar Islands`,status:`Current`,aliases:[]},{code:`36`,name:`Telangana`,status:`Current`,aliases:[]},{code:`37`,name:`Andhra Pradesh`,status:`Current`,aliases:[]},{code:`38`,name:`Ladakh`,status:`Current`,aliases:[]},{code:`97`,name:`Other Territory`,status:`Current`,aliases:[]}],t=e=>e.replace(/&/g,` and `).split(/\s+/).filter(Boolean).join(` `).toUpperCase(),n=new Map(e.map(e=>[e.code,e])),r=new Map(e.flatMap(e=>[e.name,...e.aliases].map(n=>[t(n),e]))),i=/* @__PURE__ */ new Set([`97`,`99`]),a=e=>typeof e==`string`?n.get(e.trim())??null:null,o=e=>typeof e==`string`?r.get(t(e))??null:null,s=()=>e.filter(e=>e.status===`Current`&&!i.has(e.code));export{e as GST_STATES,s as currentGstStates,a as findGstState,o as gstStateByName};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findGstState as e}from"./gstStates.g.js";import{upperAscii as t,withoutSpaces as n}from"./text.js";var r=15,i=2,a=2,o=12,s=14,c=/^\d{2}[A-Z]{5}\d{4}[A-Z][1-9A-Z]Z[0-9A-Z]$/,l=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`,u=e=>{let t=0;for(let n=0;n<s;n+=1){let r=l.indexOf(e.charAt(n))*(n%2==0?1:2);t+=Math.floor(r/36)+r%36}return l.charAt((36-t%36)%36)},d=e=>{let r=n(e);return r===null?null:t(r)},f=t=>{let n=d(t);return n===null||!c.test(n)?`pattern`:e(n.slice(0,i))===null?`stateCode`:n.charAt(s)===u(n)?null:`checkCharacter`},p=e=>f(e)===null,m=e=>typeof e==`string`?e.replace(/[^A-Za-z0-9]/g,``).toUpperCase().slice(0,r):``,h=e=>p(e)?d(e):null,g=e=>{let t=h(e);return t===null?null:t.slice(0,i)},_=t=>{let n=g(t);return n===null?null:e(n)},v=e=>{let t=h(e);return t===null?null:t.slice(a,o)};export{v as gstinHolderPan,f as gstinProblem,_ as gstinState,g as gstinStateCode,p as isGstin,d as normalizeGstin,m as sanitizeGstinInput};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{upperAscii as e,withoutSpaces as t}from"./text.js";var n=/^[A-Z]{4}0[A-Z0-9]{6}$/,r=n=>{let r=t(n);return r===null?null:e(r)},i=e=>{let t=r(e);return t!==null&&n.test(t)};export{i as isIfsc,r as normalizeIfsc};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aadhaarLastFour as e,isAadhaar as t,maskAadhaar as n,normalizeAadhaar as r}from"./aadhaar.js";import{currentFinancialYear as i,financialYearLabel as a,financialYearOf as o,parseFinancialYear as s,recentFinancialYears as c}from"./financialYear.js";import{gstinHolderPan as l,gstinProblem as u,gstinState as d,gstinStateCode as f,isGstin as p,normalizeGstin as m,sanitizeGstinInput as h}from"./gstin.js";import{isIfsc as g,normalizeIfsc as _}from"./ifsc.js";import{formatIndianMobile as v,isIndianMobile as y,normalizeIndianMobile as b}from"./indianMobile.js";import{istDateOf as x,istDayBoundsUtc as S,istToday as C}from"./indiaTime.js";import{PAISE_PER_RUPEE as w,formatPaise as T,formatRupees as E,paiseFromRupees as D}from"./paise.js";import{isPan as O,maskPan as k,normalizePan as A}from"./pan.js";import{isPincode as j,normalizePincode as M}from"./pincode.js";export{w as PAISE_PER_RUPEE,e as aadhaarLastFour,i as currentFinancialYear,a as financialYearLabel,o as financialYearOf,v as formatIndianMobile,T as formatPaise,E as formatRupees,l as gstinHolderPan,u as gstinProblem,d as gstinState,f as gstinStateCode,t as isAadhaar,p as isGstin,g as isIfsc,y as isIndianMobile,O as isPan,j as isPincode,x as istDateOf,S as istDayBoundsUtc,C as istToday,n as maskAadhaar,k as maskPan,r as normalizeAadhaar,m as normalizeGstin,_ as normalizeIfsc,b as normalizeIndianMobile,A as normalizePan,M as normalizePincode,D as paiseFromRupees,s as parseFinancialYear,c as recentFinancialYears,h as sanitizeGstinInput};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=198e5,t=/^(\d{4})-(\d{2})-(\d{2})$/,n=t=>{let n=new Date(t.getTime()+e);if(Number.isNaN(n.getTime()))throw RangeError(`Expected a valid date.`);return`${String(n.getUTCFullYear()).padStart(4,`0`)}-${String(n.getUTCMonth()+1).padStart(2,`0`)}-${String(n.getUTCDate()).padStart(2,`0`)}`},r=(e=/* @__PURE__ */ new Date)=>n(e),i=n=>{let r=t.exec(n);if(r===null)throw RangeError(`Expected a yyyy-MM-dd date, got "${n}".`);let i=Number(r[1]),a=Number(r[2])-1,o=Number(r[3]),s=/* @__PURE__ */ new Date(0);if(s.setUTCFullYear(i,a,o),s.getUTCFullYear()!==i||s.getUTCMonth()!==a||s.getUTCDate()!==o)throw RangeError(`"${n}" is not a calendar day.`);let c=s.getTime()-e;return{startUtc:new Date(c),endUtc:new Date(c+864e5)}};export{n as istDateOf,i as istDayBoundsUtc,r as istToday};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`91`,t=`+${e}`,n=12,r=`0`,i=5,a=/[ .()-]/g,o=/^[6-9][0-9]{9}$/,s=i=>{if(typeof i!=`string`)return null;let s=i.replace(a,``);return s.startsWith(t)?s=s.slice(t.length):s.length===n&&s.startsWith(e)?s=s.slice(2):s.startsWith(r)&&(s=s.slice(1)),o.test(s)?s:null},c=e=>s(e)!==null,l=e=>{let n=s(e);return n===null?null:`${t} ${n.slice(0,i)} ${n.slice(i)}`};export{l as formatIndianMobile,c as isIndianMobile,s as normalizeIndianMobile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=[{code:`01`,section:`A`,title:`Crop and animal production, hunting and related service activities`},{code:`02`,section:`A`,title:`Forestry and logging`},{code:`03`,section:`A`,title:`Fishing and aquaculture`},{code:`05`,section:`B`,title:`Mining of coal and lignite`},{code:`06`,section:`B`,title:`Extraction of crude petroleum and natural gas`},{code:`07`,section:`B`,title:`Mining of metal ores`},{code:`08`,section:`B`,title:`Other mining and quarrying`},{code:`09`,section:`B`,title:`Mining support service activities`},{code:`10`,section:`C`,title:`Manufacture of food products`},{code:`11`,section:`C`,title:`Manufacture of beverages`},{code:`12`,section:`C`,title:`Manufacture of tobacco products`},{code:`13`,section:`C`,title:`Manufacture of textiles`},{code:`14`,section:`C`,title:`Manufacture of wearing apparel`},{code:`15`,section:`C`,title:`Manufacture of leather and related products`},{code:`16`,section:`C`,title:`Manufacture of wood and of products of wood and cork, except furniture; manufacture of articles of straw and plaiting materials`},{code:`17`,section:`C`,title:`Manufacture of paper and paper products`},{code:`18`,section:`C`,title:`Printing and reproduction of recorded media`},{code:`19`,section:`C`,title:`Manufacture of coke and refined petroleum products`},{code:`20`,section:`C`,title:`Manufacture of chemicals and chemical products`},{code:`21`,section:`C`,title:`Manufacture of basic pharmaceutical products and pharmaceutical preparations`},{code:`22`,section:`C`,title:`Manufacture of rubber and plastics products`},{code:`23`,section:`C`,title:`Manufacture of other non-metallic mineral products`},{code:`24`,section:`C`,title:`Manufacture of basic metals`},{code:`25`,section:`C`,title:`Manufacture of fabricated metal products, except machinery and equipment`},{code:`26`,section:`C`,title:`Manufacture of computer, electronic and optical products`},{code:`27`,section:`C`,title:`Manufacture of electrical equipment`},{code:`28`,section:`C`,title:`Manufacture of machinery and equipment n.e.c.`},{code:`29`,section:`C`,title:`Manufacture of motor vehicles, trailers and semi-trailers`},{code:`30`,section:`C`,title:`Manufacture of other transport equipment`},{code:`31`,section:`C`,title:`Manufacture of furniture`},{code:`32`,section:`C`,title:`Other manufacturing`},{code:`33`,section:`C`,title:`Repair and installation of machinery and equipment`},{code:`35`,section:`D`,title:`Electricity, gas, steam and air conditioning supply`},{code:`36`,section:`E`,title:`Water collection, treatment and supply`},{code:`37`,section:`E`,title:`Sewerage`},{code:`38`,section:`E`,title:`Waste collection, treatment and disposal activities; materials recovery`},{code:`39`,section:`E`,title:`Remediation activities and other waste management services`},{code:`41`,section:`F`,title:`Construction of buildings`},{code:`42`,section:`F`,title:`Civil engineering`},{code:`43`,section:`F`,title:`Specialized construction activities`},{code:`45`,section:`G`,title:`Wholesale and retail trade and repair of motor vehicles and motorcycles`},{code:`46`,section:`G`,title:`Wholesale trade, except of motor vehicles and motorcycles`},{code:`47`,section:`G`,title:`Retail trade, except of motor vehicles and motorcycles`},{code:`49`,section:`H`,title:`Land transport and transport via pipelines`},{code:`50`,section:`H`,title:`Water transport`},{code:`51`,section:`H`,title:`Air transport`},{code:`52`,section:`H`,title:`Warehousing and support activities for transportation`},{code:`53`,section:`H`,title:`Postal and courier activities`},{code:`55`,section:`I`,title:`Accommodation`},{code:`56`,section:`I`,title:`Food and beverage service activities`},{code:`58`,section:`J`,title:`Publishing activities`},{code:`59`,section:`J`,title:`Motion picture, video and television programme production, sound recording and music publishing activities`},{code:`60`,section:`J`,title:`Programming and broadcasting activities`},{code:`61`,section:`J`,title:`Telecommunications`},{code:`62`,section:`J`,title:`Computer programming, consultancy and related activities`},{code:`63`,section:`J`,title:`Information service activities`},{code:`64`,section:`K`,title:`Financial service activities, except insurance and pension funding`},{code:`65`,section:`K`,title:`Insurance, reinsurance and pension funding, except compulsory social security`},{code:`66`,section:`K`,title:`Activities auxiliary to financial service and insurance activities`},{code:`68`,section:`L`,title:`Real estate activities`},{code:`69`,section:`M`,title:`Legal and accounting activities`},{code:`70`,section:`M`,title:`Activities of head offices; management consultancy activities`},{code:`71`,section:`M`,title:`Architectural and engineering activities; technical testing and analysis`},{code:`72`,section:`M`,title:`Scientific research and development`},{code:`73`,section:`M`,title:`Advertising and market research`},{code:`74`,section:`M`,title:`Other professional, scientific and technical activities`},{code:`75`,section:`M`,title:`Veterinary activities`},{code:`77`,section:`N`,title:`Rental and leasing activities`},{code:`78`,section:`N`,title:`Employment activities`},{code:`79`,section:`N`,title:`Travel agency, tour operator and other reservation service and related activities`},{code:`80`,section:`N`,title:`Security and investigation activities`},{code:`81`,section:`N`,title:`Services to buildings and landscape activities`},{code:`82`,section:`N`,title:`Office administrative, office support and other business support activities`},{code:`84`,section:`O`,title:`Public administration and defence; compulsory social security`},{code:`85`,section:`P`,title:`Education`},{code:`86`,section:`Q`,title:`Human health activities`},{code:`87`,section:`Q`,title:`Residential care activities`},{code:`88`,section:`Q`,title:`Social work activities without accommodation`},{code:`90`,section:`R`,title:`Creative, arts and entertainment activities`},{code:`91`,section:`R`,title:`Libraries, archives, museums and other cultural activities`},{code:`92`,section:`R`,title:`Gambling and betting activities`},{code:`93`,section:`R`,title:`Sports activities and amusement and recreation activities`},{code:`94`,section:`S`,title:`Activities of membership organizations`},{code:`95`,section:`S`,title:`Repair of computers and personal and household goods`},{code:`96`,section:`S`,title:`Other personal service activities`},{code:`97`,section:`T`,title:`Activities of households as employers of domestic personnel`},{code:`98`,section:`T`,title:`Undifferentiated goods- and services-producing activities of private households for own use`},{code:`99`,section:`U`,title:`Activities of extraterritorial organizations and bodies`}],t=new Map(e.map(e=>[e.code,e])),n=e=>typeof e==`string`?t.get(/^\d$/.test(e)?e.padStart(2,`0`):e)??null:null;export{e as NIC_DIVISIONS,n as findNicDivision};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=100,t=/^(-?)(\d+)(?:\.(\d{1,2}))?$/,n=e=>{if(!Number.isSafeInteger(e))throw RangeError(`${e} is not a whole number of paise within the safe integer range.`)},r=e=>{let t=String(e);return t.length<=3?t:`${t.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,`,`)},${t.slice(-3)}`},i=e=>{let r=t.exec(String(e));if(r===null)throw RangeError(`${e} is not an amount in whole paise. Round it before converting.`);let i=Number(r[2])*100+Number((r[3]??``).padEnd(2,`0`));return n(i),r[1]===`-`?-i:i},a=(e,t=!0)=>{n(e);let i=Math.abs(e),a=i%100,o=(i-a)/100;return`${e<0?`-`:``}${t?`₹`:``}${r(o)}.${String(a).padStart(2,`0`)}`},o=e=>{n(e);let t=Math.abs(e),i=t%100,a=(t-i)/100+ +(i>=50);return`${e<0&&a!==0?`-`:``}₹${r(a)}`};export{e as PAISE_PER_RUPEE,a as formatPaise,o as formatRupees,i as paiseFromRupees};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{upperAscii as e,withoutSpaces as t}from"./text.js";var n=/^[A-Z]{5}[0-9]{4}[A-Z]$/,r=n=>{let r=t(n);return r===null?null:e(r)},i=e=>{let t=r(e);return t!==null&&n.test(t)},a=e=>{let t=r(e);return t!==null&&n.test(t)?`${t.slice(0,5)}****${t.slice(9)}`:null};export{i as isPan,a as maskPan,r as normalizePan};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withoutSpaces as e}from"./text.js";var t=/^[1-9][0-9]{5}$/,n=t=>e(t),r=e=>{let r=n(e);return r!==null&&t.test(r)};export{r as isPincode,n as normalizePincode};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>typeof e!=`string`||e.trim()===``?null:e.replace(/ /g,``).trim(),t=e=>e.replace(/[a-z]/g,e=>e.toUpperCase());export{t as upperAscii,e as withoutSpaces};
|
package/dist/query/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createApiBaseQuery as e}from"./apiBaseQuery.js";import{APP_API_DEFAULTS as t,createAppApi as n}from"./createAppApi.js";import{setupApiListeners as r}from"./listeners.js";import{LIST_QUERY_RESERVED as i,SEARCH_PARAM as a,buildListQuery as o,
|
|
1
|
+
import{createApiBaseQuery as e}from"./apiBaseQuery.js";import{APP_API_DEFAULTS as t,createAppApi as n}from"./createAppApi.js";import{setupApiListeners as r}from"./listeners.js";import{LIST_QUERY_RESERVED as i,SEARCH_PARAM as a,buildListQuery as o,emptyFacetValue as s,isFacetActive as c,listQueryParamNames as l,parseListQuery as u}from"./listQuery.js";import{getNextPageParam as d,getPreviousPageParam as f,hasNextPage as p,hasPreviousPage as m}from"./paging.js";import{LIST_TAG_ID as h,itemTag as g,listTag as _,providesList as v,providesPagedList as y}from"./tags.js";import{useListQuery as b}from"./useListQuery.js";export{t as APP_API_DEFAULTS,i as LIST_QUERY_RESERVED,h as LIST_TAG_ID,a as SEARCH_PARAM,o as buildListQuery,e as createApiBaseQuery,n as createAppApi,s as emptyFacetValue,d as getNextPageParam,f as getPreviousPageParam,p as hasNextPage,m as hasPreviousPage,c as isFacetActive,g as itemTag,l as listQueryParamNames,_ as listTag,u as parseListQuery,v as providesList,y as providesPagedList,r as setupApiListeners,b as useListQuery};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.freeze([`page`,`pageSize`,`sortBy`,`sortOrder`,`search`]),t=`search`,n=[`asc`,`desc`],r=e=>n.includes(e),i=e=>e==null||e===``,a=e=>String(e).padStart(2,`0`),o=e=>e instanceof Date?`${e.getFullYear()}-${a(e.getMonth()+1)}-${a(e.getDate())}`:String(e);function s(t){if(e.includes(t))throw Error(`"${t}" is reserved by the list query (${e.join(`, `)}) and cannot name a filter.`)}var c=e=>typeof e==`object`&&!!e&&!(e instanceof Date);function l(e={}){let{page:n,pageSize:a,sortBy:l,sortOrder:u,search:d,filters:f}=e;if(!i(u)&&!r(u))throw Error(`sortOrder must be "asc" or "desc", got "${u}".`);let p=new URLSearchParams;i(n)||p.set(`page`,String(n)),i(a)||p.set(`pageSize`,String(a)),i(l)||(p.set(`sortBy`,l),p.set(`sortOrder`,u||`asc`));let m=i(d)?``:String(d).trim();m&&p.set(t,m);for(let[e,t]of Object.entries(f??{}))if(s(e),Array.isArray(t))for(let n of t)i(n)||p.append(e,o(n));else c(t)?(i(t.from)||p.set(`${e}From`,o(t.from)),i(t.to)||p.set(`${e}To`,o(t.to))):i(t)||p.set(e,o(t));return p}function u(e){return e.type===`multiEnum`?[]:e.type===`dateRange`?{from:``,to:``}:``}function d(e,t){if(t==null)return!1;if(e.type===`multiEnum`)return t.length>0;if(e.type===`dateRange`){let e=t;return!!(e.from||e.to)}return t!==``}function f(t=[]){let n=new Set(e);for(let{key:e,type:r}of t)r===`dateRange`?(n.add(`${e}From`),n.add(`${e}To`)):n.add(e);return n}var p=e=>{let t=Number(e);return Number.isInteger(t)&&t>=1?t:void 0};function m(e,t={}){let{facets:n=[],defaults:i={}}=t,a=typeof e==`string`?new URLSearchParams(e):e;for(let e of n)s(e.key);let o=f(n),c=[...a.keys()].some(e=>o.has(e)),l=a.get(`sortOrder`),d={};for(let e of n){let{key:t,type:n}=e,r;r=c?n===`multiEnum`?a.getAll(t).filter(Boolean):n===`dateRange`?{from:a.get(`${t}From`)??``,to:a.get(`${t}To`)??``}:a.get(t)??``:i.filters?.[t]??u(e),d[t]=r}return{page:p(a.get(`page`))??i.page??1,pageSize:p(a.get(`pageSize`))??i.pageSize,sortBy:a.get(`sortBy`)||i.sortBy,sortOrder:r(l)?l:i.sortOrder??`asc`,search:(a.get(`search`)??``).trim(),filters:d}}export{e as LIST_QUERY_RESERVED,t as SEARCH_PARAM,l as buildListQuery,u as emptyFacetValue,d as isFacetActive,f as listQueryParamNames,m as parseListQuery};
|
package/dist/query/paging.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=e=>e.page<e.totalPages,t=e=>e.page>1,n=t=>e(t)?t.page+1:void 0,r=e=>t(e)?e.page-1:void 0;export{n as getNextPageParam,r as getPreviousPageParam,e as hasNextPage,t as hasPreviousPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildListQuery as e,parseListQuery as
|
|
1
|
+
import{buildListQuery as e,isFacetActive as t,listQueryParamNames as n,parseListQuery as r}from"./listQuery.js";import{useEffect as i,useRef as a,useState as o}from"react";import{useSearchParams as s}from"react-router";var c=300,l=20,u=`No results match these filters.`,d=[];function f(e,t,i){let a=n(t),o=[...e.keys()].some(e=>a.has(e)),s=r(e,{facets:t,defaults:{page:i.page,pageSize:i.pageSize,sortBy:i.sortBy,sortOrder:i.sortOrder,filters:i.filters}});return{page:s.page,pageSize:s.pageSize,sortBy:s.sortBy,sortOrder:s.sortOrder,search:o?s.search:i.search??``,filters:s.filters}}function p(t){return e({page:t.page,pageSize:t.pageSize,sortBy:t.sortBy,sortOrder:t.sortOrder,search:t.search,filters:t.filters})}function m(e){let{fetchPage:n,facets:r=[],defaults:m={},debounceMs:h=c}=e,[g,_]=s(),v=f(g,r,m),[y,b]=o(v.search),[x,S]=o(),[C,w]=o(void 0),[T,E]=o(!0),[D,O]=o(0),k={...v,search:y},A=a(k);A.current=k;let j=a(n);j.current=n;let M=`${p(k)}#${D}`,N=a(M);N.current=M,i(()=>{if(v.search===y)return;let e=setTimeout(()=>b(v.search),h);return()=>clearTimeout(e)},[v.search,y,h]),i(()=>{let e=new AbortController,t=()=>e.signal.aborted||N.current!==M;return E(!0),new Promise(t=>{t(j.current(A.current,{signal:e.signal}))}).then(e=>{t()||(S(e),w(void 0),E(!1))},e=>{t()||(w(e),E(!1))}),()=>e.abort()},[M]);let P=(e,t)=>{_(p(e),{replace:!0}),t&&b(e.search)},F=e=>P({...v,page:e},!0),I=e=>P({...v,pageSize:e},!0),L=e=>P({...v,page:1,search:e},!1),R=(e,t)=>P({...v,page:1,filters:{...v.filters,[e]:t}},!0),z=(e,t=`asc`)=>P({...v,page:1,sortBy:e,sortOrder:t},!0),B=e=>z(e,e===v.sortBy&&v.sortOrder===`asc`?`desc`:`asc`),V=()=>{let e=f(new URLSearchParams,r,m);_(new URLSearchParams,{replace:!0}),b(e.search)},H=()=>O(e=>e+1),U=v.search!==``||r.some(e=>t(e,v.filters[e.key])),W=x?.totalCount??0,G=x?.totalPages??0;return{query:v,rows:x?.items??d,loading:T,error:C,totalCount:W,totalPages:G,setFilter:R,setSearch:L,setSort:z,setPage:F,setPageSize:I,reset:V,refetch:H,tableProps:{rows:x?.items??d,sort:v.sortBy?{key:v.sortBy,dir:v.sortOrder}:void 0,onSort:B,loading:T,emptyFiltered:U?u:void 0,sourceCount:U?Math.max(W,1):W},paginationProps:{page:v.page,totalPages:G,pageSize:v.pageSize??x?.pageSize??l,onPageChange:F,onPageSizeChange:I}}}export{m as useListQuery};
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* `signDisplay`, ...), passed through to Intl.NumberFormat.
|
|
4
4
|
*/
|
|
5
5
|
export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "style" | "currency"> {
|
|
6
|
-
/** ISO 4217 code
|
|
7
|
-
currency
|
|
6
|
+
/** ISO 4217 code. Required: a call without one, or with an empty one, throws a TypeError. */
|
|
7
|
+
currency: string;
|
|
8
8
|
/** BCP-47 locale tag. Defaults to the configured locale, else `'en-IN'` (Indian numbering system). */
|
|
9
9
|
locale?: string;
|
|
10
10
|
/** Minimum fraction digits. Defaults to 0 for whole amounts, else the currency's own (2 for INR, 0 for JPY). */
|
|
@@ -21,8 +21,8 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Format an amount as currency, with Indian numbering (`en-IN`), which matches the standard
|
|
24
|
-
* convention across Webority projects. Pass
|
|
25
|
-
*
|
|
24
|
+
* convention across Webority projects. Pass an ISO 4217 code on every call: a missing or empty one
|
|
25
|
+
* throws a TypeError. With currency 'INR': "₹1,50,000" for 150000, "₹1,234.50" for
|
|
26
26
|
* 1234.5, and `''` for a missing amount.
|
|
27
27
|
* Once the app configures a locale (`configureFormatters({ locale })`), the amount is
|
|
28
28
|
* written in that locale and a missing amount prints the configured placeholder ("-").
|
|
@@ -38,4 +38,4 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
38
38
|
* formatCurrency(150000, { currency: 'INR', stripSymbol: true }) // 1,50,000
|
|
39
39
|
* formatCurrency(1500000, { currency: 'INR', notation: 'compact' }) // ₹15L
|
|
40
40
|
*/
|
|
41
|
-
export declare const formatCurrency: (amount: number | string | null | undefined, options
|
|
41
|
+
export declare const formatCurrency: (amount: number | string | null | undefined, options: FormatCurrencyOptions) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* App-wide settings for the house formatters.
|
|
3
|
-
*
|
|
2
|
+
* App-wide settings for the house formatters. @webority/web-core carries a copy
|
|
3
|
+
* of this file, kept in step by its own change, so a screen formats the same
|
|
4
4
|
* instant the same way on a phone and in a browser.
|
|
5
5
|
*
|
|
6
6
|
* Zone policy: an India-market product shows every instant in IST, unlabelled
|
|
@@ -78,6 +78,6 @@ export declare const groupingForLocale: (locale: string) => NumberGrouping;
|
|
|
78
78
|
export declare const numberSeparators: () => NumberSeparators | null;
|
|
79
79
|
/**
|
|
80
80
|
* `format.format(n)`, with the configured number style's decimal mark and group separator in place
|
|
81
|
-
* of the locale's. Only those two
|
|
81
|
+
* of the locale's. Only those two marks change, so group sizes, signs and symbols stay the locale's.
|
|
82
82
|
*/
|
|
83
83
|
export declare const styledNumber: (format: Intl.NumberFormat, n: number) => string;
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The house formatters: DD-MMM-YYYY dates, IST by default or the viewer's own
|
|
3
|
+
* zone with a label, Indian digit grouping by default, money in minor units,
|
|
4
|
+
* and one empty placeholder. Byte-identical in @webority/mobile-core and
|
|
5
|
+
* @webority/web-core.
|
|
6
|
+
*
|
|
7
|
+
* Same output on Hermes and in every browser is the design constraint, so the
|
|
8
|
+
* text is assembled here rather than by Intl. Engines disagree on month
|
|
9
|
+
* abbreviations ("Sep" or "Sept"), on the space before AM/PM (a plain or a
|
|
10
|
+
* narrow no-break space), on zone names ("IST" or "GMT+5:30") and on which
|
|
11
|
+
* Intl options exist at all (Hermes has no RelativeTimeFormat and no
|
|
12
|
+
* trailingZeroDisplay). IST and the viewer's zone are therefore computed with
|
|
13
|
+
* plain Date arithmetic; Intl is used only to read the wall clock of an
|
|
14
|
+
* explicitly named IANA zone, through formatToParts with numeric fields, to
|
|
15
|
+
* read the locale's 12- or 24-hour clock, and where a caller asks for Intl
|
|
16
|
+
* output itself (Intl number options, `formatRelative({ intl: true })`).
|
|
17
|
+
*
|
|
18
|
+
* Called with no options (house defaults: zone IST, locale en-IN, empty "-"):
|
|
19
|
+
* - formatDate(v) "08-Apr-2026"; formatTime(v) "8:05 PM"; formatDateTime(v) "08-Apr-2026, 8:05 PM";
|
|
20
|
+
* - formatRelative(v) "5 minutes ago", "in 3 days", "just now";
|
|
21
|
+
* - formatNumber(v) "1,23,456.789" (Indian grouping, up to 3 decimals);
|
|
22
|
+
* - formatPercent(0.42) "42%"; formatMinor(15000000, { currency: "INR" }) "₹1,50,000.00";
|
|
23
|
+
* - a missing or unreadable value "-".
|
|
24
|
+
* formatMinor needs a currency and throws without one.
|
|
25
|
+
*
|
|
26
|
+
* With a configured locale (`configureFormatters({ locale })`), the words and separators come
|
|
27
|
+
* from Intl for that locale and the date order stays DD-MMM-YYYY. For en-IN in the viewer zone:
|
|
28
|
+
* "08-Sept-2026", "08:05 pm", "08-Sept-2026, 08:05 pm IST", "yesterday", "12,34,567.891",
|
|
29
|
+
* "₹1,50,000". For de-DE: "08-Sept-2026", "20:05", "1.234.567,891".
|
|
30
|
+
*
|
|
31
|
+
* A configured `numberStyle` puts its decimal mark and group separator in every number and amount,
|
|
32
|
+
* whichever path wrote it: "1.23.456,789" for `'CommaWithPointGroups'` with the house text. A
|
|
33
|
+
* configured `dateOrder` other than DD-MMM-YYYY writes the date as digits from the wall clock,
|
|
34
|
+
* in every locale: "08/04/2026", "04/08/2026", "2026-04-08".
|
|
35
|
+
*/
|
|
1
36
|
import { type NumberGrouping, type ZoneMode } from "./formatConfig";
|
|
2
37
|
/** A date the house formatters accept; null, undefined and "" read as missing. */
|
|
3
38
|
export type DateValue = Date | string | number | null | undefined;
|
|
@@ -62,8 +97,8 @@ export interface FormatPercentOptions extends FormatNumberOptions {
|
|
|
62
97
|
scale?: "ratio" | "percent";
|
|
63
98
|
}
|
|
64
99
|
export interface FormatMinorOptions {
|
|
65
|
-
/** ISO 4217 code
|
|
66
|
-
currency
|
|
100
|
+
/** ISO 4217 code. Required: a missing or empty one throws a TypeError. */
|
|
101
|
+
currency: string;
|
|
67
102
|
/** Defaults to Indian grouping for INR and international grouping for every other currency. */
|
|
68
103
|
grouping?: NumberGrouping;
|
|
69
104
|
/** Print a whole amount without its zero decimals: "₹1,500" instead of "₹1,500.00". */
|
|
@@ -104,10 +139,10 @@ export declare const formatNumber: (value: number | string | null | undefined, o
|
|
|
104
139
|
export declare const formatPercent: (value: number | string | null | undefined, options?: FormatPercentOptions) => string;
|
|
105
140
|
/**
|
|
106
141
|
* Money held in minor units (paise, cents), which is how every API carries
|
|
107
|
-
* it: formatMinor(15000000, { currency:
|
|
142
|
+
* it: formatMinor(15000000, { currency: 'INR' }) gives "₹1,50,000.00". The split into whole and
|
|
108
143
|
* fractional units is done on the integer's digits, so no floating-point
|
|
109
144
|
* division can shift a paisa. A fractional input is rounded to the nearest
|
|
110
145
|
* minor unit. A currency without a known symbol prints its code: "AED 1,000.00".
|
|
111
146
|
* With a configured locale, Intl writes it in that locale ("150.000,00 €" for de-DE).
|
|
112
147
|
*/
|
|
113
|
-
export declare const formatMinor: (amountMinor: number | string | null | undefined, options
|
|
148
|
+
export declare const formatMinor: (amountMinor: number | string | null | undefined, options: FormatMinorOptions) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const normalizeAadhaar: (value: unknown) => string | null;
|
|
2
|
+
export declare const isAadhaar: (value: unknown) => boolean;
|
|
3
|
+
export declare const maskAadhaar: (value: unknown) => string | null;
|
|
4
|
+
/** The last four digits of a valid Aadhaar number, or null when it is not valid. */
|
|
5
|
+
export declare const aadhaarLastFour: (value: unknown) => string | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface FinancialYear {
|
|
2
|
+
startYear: number;
|
|
3
|
+
label: string;
|
|
4
|
+
displayLabel: string;
|
|
5
|
+
assessmentYearLabel: string;
|
|
6
|
+
startDate: string;
|
|
7
|
+
endDate: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const financialYearLabel: (startYear: number) => string;
|
|
10
|
+
export declare const financialYearOf: (date: Date) => FinancialYear;
|
|
11
|
+
export declare const currentFinancialYear: (now?: Date) => FinancialYear;
|
|
12
|
+
export declare const parseFinancialYear: (value: unknown) => FinancialYear | null;
|
|
13
|
+
export declare const recentFinancialYears: (count: number, now?: Date) => FinancialYear[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type GstStateStatus = "Current" | "Retired";
|
|
2
|
+
export interface GstState {
|
|
3
|
+
code: string;
|
|
4
|
+
name: string;
|
|
5
|
+
status: GstStateStatus;
|
|
6
|
+
replacedByCode?: string;
|
|
7
|
+
aliases: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export declare const GST_STATES: readonly GstState[];
|
|
10
|
+
export declare const findGstState: (code: unknown) => GstState | null;
|
|
11
|
+
export declare const gstStateByName: (name: unknown) => GstState | null;
|
|
12
|
+
export declare const currentGstStates: () => readonly GstState[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type GstState } from "./gstStates.g";
|
|
2
|
+
export type GstinProblem = "pattern" | "stateCode" | "checkCharacter";
|
|
3
|
+
export declare const normalizeGstin: (value: unknown) => string | null;
|
|
4
|
+
export declare const gstinProblem: (value: unknown) => GstinProblem | null;
|
|
5
|
+
export declare const isGstin: (value: unknown) => boolean;
|
|
6
|
+
export declare const sanitizeGstinInput: (value: unknown) => string;
|
|
7
|
+
export declare const gstinStateCode: (value: unknown) => string | null;
|
|
8
|
+
/** The GST state row of a valid GSTIN (a retired code returns its Retired row), or null when the GSTIN is not valid. */
|
|
9
|
+
export declare const gstinState: (value: unknown) => GstState | null;
|
|
10
|
+
export declare const gstinHolderPan: (value: unknown) => string | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { aadhaarLastFour, isAadhaar, maskAadhaar, normalizeAadhaar } from "./aadhaar";
|
|
2
|
+
export type { FinancialYear } from "./financialYear";
|
|
3
|
+
export { currentFinancialYear, financialYearLabel, financialYearOf, parseFinancialYear, recentFinancialYears } from "./financialYear";
|
|
4
|
+
export type { GstinProblem } from "./gstin";
|
|
5
|
+
export { gstinHolderPan, gstinProblem, gstinState, gstinStateCode, isGstin, normalizeGstin, sanitizeGstinInput } from "./gstin";
|
|
6
|
+
export type { GstState, GstStateStatus } from "./gstStates.g";
|
|
7
|
+
export { isIfsc, normalizeIfsc } from "./ifsc";
|
|
8
|
+
export { formatIndianMobile, isIndianMobile, normalizeIndianMobile } from "./indianMobile";
|
|
9
|
+
export { istDateOf, istDayBoundsUtc, istToday } from "./indiaTime";
|
|
10
|
+
export type { NicDivision } from "./nicDivisions.g";
|
|
11
|
+
export { formatPaise, formatRupees, PAISE_PER_RUPEE, paiseFromRupees } from "./paise";
|
|
12
|
+
export { isPan, maskPan, normalizePan } from "./pan";
|
|
13
|
+
export { isPincode, normalizePincode } from "./pincode";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Paise in one rupee. */
|
|
2
|
+
export declare const PAISE_PER_RUPEE = 100;
|
|
3
|
+
/**
|
|
4
|
+
* The amount in paise of a rupee amount, read from the number's decimal text so no float multiplication can shift a paisa.
|
|
5
|
+
* Throws a RangeError for a fraction of a paisa (1.005), a non-finite number, an exponent form (1e21) or an amount beyond the safe integer range;
|
|
6
|
+
* round the amount by the rule that applies first.
|
|
7
|
+
*/
|
|
8
|
+
export declare const paiseFromRupees: (rupees: number) => number;
|
|
9
|
+
/** Two-decimal text with lakh and crore grouping: ₹1,50,000.00 and -₹12.50. The rupee sign is dropped when `symbol` is false. */
|
|
10
|
+
export declare const formatPaise: (paise: number, symbol?: boolean) => string;
|
|
11
|
+
/** Whole rupees for display, half away from zero: ₹2,50,00,000 and -₹13 for -1250. An amount that rounds to zero prints without a sign. */
|
|
12
|
+
export declare const formatRupees: (paise: number) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The value with every space (U+0020) removed and its ends trimmed, or null when it is not a string or is blank.
|
|
3
|
+
* This is the server's Normalize for GSTIN, PAN, IFSC and PIN code (Aadhaar also drops hyphens): a tab or a
|
|
4
|
+
* no-break space inside the value is NOT removed, so such a value fails the shape check as it does on the server.
|
|
5
|
+
*/
|
|
6
|
+
export declare const withoutSpaces: (value: unknown) => string | null;
|
|
7
|
+
/** Upper-cases ASCII letters only. Full Unicode upper-casing turns "ß" into "SS" and could lengthen a value into a valid shape. */
|
|
8
|
+
export declare const upperAscii: (text: string) => string;
|
|
@@ -2,9 +2,11 @@ export type { ApiBaseQuery, ApiBaseQueryMeta, ApiBaseQueryOptions, ApiExtraOptio
|
|
|
2
2
|
export { createApiBaseQuery } from "./apiBaseQuery";
|
|
3
3
|
export { APP_API_DEFAULTS, createAppApi } from "./createAppApi";
|
|
4
4
|
export { setupApiListeners } from "./listeners";
|
|
5
|
+
export type { Facet, FacetKey, FacetType, ListQueryInput, ParsedListQuery, ParseListQueryOptions } from "./listQuery";
|
|
6
|
+
export { buildListQuery, emptyFacetValue, isFacetActive, LIST_QUERY_RESERVED, listQueryParamNames, parseListQuery, SEARCH_PARAM, } from "./listQuery";
|
|
5
7
|
export type { ListFilterValue, ListQuery, PagedDataObject, PagedListRequest, SortOrder, } from "./paging";
|
|
6
|
-
export {
|
|
8
|
+
export { getNextPageParam, getPreviousPageParam, hasNextPage, hasPreviousPage } from "./paging";
|
|
7
9
|
export type { ApiTag, TagId } from "./tags";
|
|
8
10
|
export { itemTag, LIST_TAG_ID, listTag, providesList, providesPagedList } from "./tags";
|
|
9
|
-
export type {
|
|
11
|
+
export type { ListQueryState, UseListQueryOptions, UseListQueryResult } from "./useListQuery";
|
|
10
12
|
export { useListQuery } from "./useListQuery";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ListFilterValue, SortOrder } from "./paging";
|
|
2
|
+
export type FacetType = "enum" | "multiEnum" | "dateRange" | "text";
|
|
3
|
+
export interface Facet {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type: FacetType;
|
|
7
|
+
options?: {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
/** The part of a facet the URL needs; a full Facet is assignable. */
|
|
13
|
+
export type FacetKey = Pick<Facet, "key" | "type">;
|
|
14
|
+
export interface ListQueryInput {
|
|
15
|
+
page?: number;
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
sortBy?: string;
|
|
18
|
+
sortOrder?: SortOrder;
|
|
19
|
+
search?: string;
|
|
20
|
+
filters?: Record<string, ListFilterValue>;
|
|
21
|
+
}
|
|
22
|
+
export interface ParsedListQuery {
|
|
23
|
+
page: number;
|
|
24
|
+
pageSize: number | undefined;
|
|
25
|
+
sortBy: string | undefined;
|
|
26
|
+
sortOrder: SortOrder;
|
|
27
|
+
search: string;
|
|
28
|
+
filters: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export interface ParseListQueryOptions {
|
|
31
|
+
facets?: readonly FacetKey[];
|
|
32
|
+
defaults?: {
|
|
33
|
+
page?: number;
|
|
34
|
+
pageSize?: number;
|
|
35
|
+
sortBy?: string;
|
|
36
|
+
sortOrder?: SortOrder;
|
|
37
|
+
filters?: Record<string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** The list-query params the table itself owns; every other param is a filter. */
|
|
41
|
+
export declare const LIST_QUERY_RESERVED: readonly string[];
|
|
42
|
+
/** The filter param a search box writes (Webority.Ui.Razor ListQuery.SearchKey). */
|
|
43
|
+
export declare const SEARCH_PARAM = "search";
|
|
44
|
+
/**
|
|
45
|
+
* Builds the flat query string for one page of a list.
|
|
46
|
+
*
|
|
47
|
+
* A filter value is a scalar, an array (one param per item) or a date range `{ from, to }`
|
|
48
|
+
* (written as `<name>From` / `<name>To`). Empty values are left out. A `Date` is written as
|
|
49
|
+
* yyyy-MM-dd.
|
|
50
|
+
*
|
|
51
|
+
* @param query.page 1-based.
|
|
52
|
+
* @param query.pageSize
|
|
53
|
+
* @param query.sortBy
|
|
54
|
+
* @param query.sortOrder Written only with `sortBy`. Defaults to `'asc'`.
|
|
55
|
+
* @param query.search Free text, trimmed, written as the `search` param and left out when blank.
|
|
56
|
+
* @param query.filters
|
|
57
|
+
* @returns The query params for the list request.
|
|
58
|
+
* @throws When a filter is named page, pageSize, sortBy, sortOrder or search, or `sortOrder` is not asc or desc.
|
|
59
|
+
*/
|
|
60
|
+
export declare function buildListQuery(query?: ListQueryInput): URLSearchParams;
|
|
61
|
+
/** The empty value of a facet: "" (enum, text), [] (multiEnum) or { from: "", to: "" } (dateRange). */
|
|
62
|
+
export declare function emptyFacetValue(facet: FacetKey): string | string[] | {
|
|
63
|
+
from: string;
|
|
64
|
+
to: string;
|
|
65
|
+
};
|
|
66
|
+
/** True when a facet's value narrows the list. */
|
|
67
|
+
export declare function isFacetActive(facet: FacetKey, value: unknown): boolean;
|
|
68
|
+
/** Every query param name a list owns: the reserved five plus each facet's own (`<key>From`/`<key>To` for a date range). */
|
|
69
|
+
export declare function listQueryParamNames(facets?: readonly FacetKey[]): ReadonlySet<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Reads a list query back out of the URL's search params: the inverse of `buildListQuery`.
|
|
72
|
+
* Anything missing or invalid falls back to `defaults`. Every facet gets a value, empty when the
|
|
73
|
+
* URL has none, so the result is always safe to render.
|
|
74
|
+
*
|
|
75
|
+
* `defaults.filters` apply only when the URL carries no list param at all (the first landing on
|
|
76
|
+
* the page). After that the URL is the truth, so clearing a filter that has a default stays cleared.
|
|
77
|
+
*
|
|
78
|
+
* `search` is read from the URL only: trimmed, and empty when the URL has none. `pageSize` is
|
|
79
|
+
* undefined when neither the URL nor `defaults.pageSize` names one, so the request omits it and
|
|
80
|
+
* the server default applies.
|
|
81
|
+
*
|
|
82
|
+
* @param searchParams The URL's search params, or the query string itself.
|
|
83
|
+
* @param options.facets
|
|
84
|
+
* @param options.defaults
|
|
85
|
+
* @returns The list query, with every facet present.
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseListQuery(searchParams: URLSearchParams | string, options?: ParseListQueryOptions): ParsedListQuery;
|
|
@@ -27,7 +27,6 @@ export type ListFilterValue = string | number | boolean | Date | null | undefine
|
|
|
27
27
|
export interface ListQuery extends PagedListRequest {
|
|
28
28
|
filters?: Record<string, ListFilterValue>;
|
|
29
29
|
}
|
|
30
|
-
export { buildListQuery, LIST_QUERY_RESERVED, parseListQuery, SEARCH_PARAM } from "@webority/ui-elements/listQuery";
|
|
31
30
|
export declare const hasNextPage: (page: PagedDataObject<unknown>) => boolean;
|
|
32
31
|
export declare const hasPreviousPage: (page: PagedDataObject<unknown>) => boolean;
|
|
33
32
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Facet } from "./listQuery";
|
|
2
|
+
import type { PagedDataObject, SortOrder } from "./paging";
|
|
2
3
|
export interface ListQueryState {
|
|
3
4
|
page: number;
|
|
4
5
|
pageSize?: number;
|
|
@@ -7,15 +8,6 @@ export interface ListQueryState {
|
|
|
7
8
|
search: string;
|
|
8
9
|
filters: Record<string, unknown>;
|
|
9
10
|
}
|
|
10
|
-
export interface Facet {
|
|
11
|
-
key: string;
|
|
12
|
-
label: string;
|
|
13
|
-
type: "enum" | "multiEnum" | "dateRange" | "text";
|
|
14
|
-
options?: {
|
|
15
|
-
value: string;
|
|
16
|
-
label: string;
|
|
17
|
-
}[];
|
|
18
|
-
}
|
|
19
11
|
export interface UseListQueryOptions<TRow> {
|
|
20
12
|
fetchPage: (query: ListQueryState, options: {
|
|
21
13
|
signal: AbortSignal;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/web-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.129.0",
|
|
4
4
|
"description": "Platform layer for Webority React web portals: HTTP clients with single-flight token refresh, auth store, API error extraction, RTK Query base query, logger, formatters, storage, version check and route guards. No UI.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -42,6 +42,18 @@
|
|
|
42
42
|
"types": "./dist/types/formatters/index.d.ts",
|
|
43
43
|
"default": "./dist/formatters/index.js"
|
|
44
44
|
},
|
|
45
|
+
"./india": {
|
|
46
|
+
"types": "./dist/types/india/index.d.ts",
|
|
47
|
+
"default": "./dist/india/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./india/gst-states": {
|
|
50
|
+
"types": "./dist/types/india/gstStates.g.d.ts",
|
|
51
|
+
"default": "./dist/india/gstStates.g.js"
|
|
52
|
+
},
|
|
53
|
+
"./india/nic-divisions": {
|
|
54
|
+
"types": "./dist/types/india/nicDivisions.g.d.ts",
|
|
55
|
+
"default": "./dist/india/nicDivisions.g.js"
|
|
56
|
+
},
|
|
45
57
|
"./logger": {
|
|
46
58
|
"types": "./dist/types/logger/index.d.ts",
|
|
47
59
|
"default": "./dist/logger/index.js"
|
|
@@ -82,7 +94,7 @@
|
|
|
82
94
|
},
|
|
83
95
|
"sideEffects": false,
|
|
84
96
|
"dependencies": {
|
|
85
|
-
"@webority/ui-elements": "0.
|
|
97
|
+
"@webority/ui-elements": "0.129.0"
|
|
86
98
|
},
|
|
87
99
|
"peerDependencies": {
|
|
88
100
|
"@reduxjs/toolkit": "^2.12.0",
|
package/dist/lib/devWarn.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,...t){console.warn(e,...t)}export{e as devWarn};
|