rest endpoints

This commit is contained in:
2026-05-20 16:11:13 +05:30
parent 70c6176071
commit 434a8b6c6d
12 changed files with 886 additions and 238 deletions

Binary file not shown.

BIN
scratch/docx_content.txt Normal file

Binary file not shown.

View File

@@ -0,0 +1,233 @@
0: Nearle Mobile API Full GraphQL Documentation
1: GetCustomerLocations
2: REST Params:
3: {"customerid": 6060}
4: GraphQL Query:
5: query GetCustomerLocations($customerid: bigint!) {
6: customer_locations(where: { customerid: { _eq: $customerid } }) {
7: locationid
8: latitude
9: longitude
10: address
11: }
12: }
13: GraphQL Variables:
14: {"customerid": 6060}
15: GetCustomerOrdersV3
16: REST Params:
17: {"customerid":6060,"tenantid":1087,"moduleid":2,"fromdate":"2026-01-01T00:00:00","todate":"2026-12-31T23:59:59","orderstatus":"delivered","keyword":"%pizza%","limit":10,"offset":0}
18: GraphQL Query:
19: query GetCustomerOrders($customerid: bigint!, $tenantid: bigint!, $moduleid: bigint!, $fromdate: timestamptz!, $todate: timestamptz!, $orderstatus: String!, $keyword: String, $limit: Int!, $offset: Int!) {
20: orders(
21: where: {
22: customerid: { _eq: $customerid }
23: tenantid: { _eq: $tenantid }
24: moduleid: { _eq: $moduleid }
25: orderstatus: { _eq: $orderstatus }
26: orderdate: { _gte: $fromdate, _lte: $todate }
27: _or: [{ orderid: { _ilike: $keyword } }]
28: }
29: limit: $limit
30: offset: $offset
31: ) {
32: orderid
33: orderstatus
34: orderamount
35: }
36: }
37: GraphQL Variables:
38: {"customerid":6060,"tenantid":1087,"moduleid":2,"fromdate":"2026-01-01T00:00:00","todate":"2026-12-31T23:59:59","orderstatus":"delivered","keyword":"%pizza%","limit":10,"offset":0}
39: GetCustomer
40: REST Params:
41: {"customerid":6060}
42: GraphQL Query:
43: query GetCustomer($customerid: bigint!) {
44: customers(where: { customerid: { _eq: $customerid } }) {
45: customerid
46: name
47: contactno
48: }
49: }
50: GraphQL Variables:
51: {"customerid":6060}
52: GetCustomerRequests
53: REST Params:
54: {"customerid":6060,"limit":10,"offset":0}
55: GraphQL Query:
56: query GetCustomerRequests($customerid: bigint!, $limit: Int!, $offset: Int!) {
57: customer_requests(where: { customerid: { _eq: $customerid } }, limit: $limit, offset: $offset) {
58: requestid
59: status
60: }
61: }
62: GraphQL Variables:
63: {"customerid":6060,"limit":10,"offset":0}
64: GetProductSubcategories
65: REST Params:
66: {"categoryid":1001}
67: GraphQL Query:
68: query GetProductSubcategories($categoryid: bigint!) {
69: app_subcategory(where: { categoryid: { _eq: $categoryid } }) {
70: subcategoryid
71: subcategoryname
72: }
73: }
74: GraphQL Variables:
75: {"categoryid":1001}
76: GetAppCategories
77: REST Params:
78: {}
79: GraphQL Query:
80: query GetAppCategories {
81: app_category {
82: categoryid
83: categoryname
84: }
85: }
86: GraphQL Variables:
87: {}
88: GetProductVariants
89: REST Params:
90: {"tenantid":1087,"subcategoryid":14}
91: GraphQL Query:
92: query GetProductVariants($tenantid: bigint!, $subcategoryid: bigint!) {
93: product_variants(where: { tenantid: { _eq: $tenantid }, subcategoryid: { _eq: $subcategoryid } }) {
94: variantid
95: productname
96: price
97: }
98: }
99: GraphQL Variables:
100: {"tenantid":1087,"subcategoryid":14}
101: GetTenantPromotions
102: REST Params:
103: {"tenantid":1087,"locationid":1}
104: GraphQL Query:
105: query GetTenantPromotions($tenantid: bigint!, $locationid: bigint!) {
106: promotions(where: { tenantid: { _eq: $tenantid }, locationid: { _eq: $locationid } }) {
107: promotionid
108: title
109: }
110: }
111: GraphQL Variables:
112: {"tenantid":1087,"locationid":1}
113: GetAppConfig
114: REST Params:
115: {"configid":15}
116: GraphQL Query:
117: query GetAppConfig($configid: bigint!) {
118: app_config(where: { configid: { _eq: $configid } }) {
119: configkey
120: configvalue
121: }
122: }
123: GraphQL Variables:
124: {"configid":15}
125: searchcustomers
126: REST Params:
127: {"tenantid":1087,"keyword":"%john%"}
128: GraphQL Query:
129: query SearchCustomers($tenantid: bigint!, $keyword: String!) {
130: customers(where: { tenantid: { _eq: $tenantid }, name: { _ilike: $keyword } }) {
131: customerid
132: name
133: }
134: }
135: GraphQL Variables:
136: {"tenantid":1087,"keyword":"%john%"}
137: getTenantorders
138: REST Params:
139: {}
140: GraphQL Query:
141: query GetTenantOrders {
142: orders {
143: orderid
144: tenantid
145: }
146: }
147: GraphQL Variables:
148: {}
149: getstaff
150: REST Params:
151: {"tenantid":1087}
152: GraphQL Query:
153: query GetStaff($tenantid: bigint!) {
154: staff(where: { tenantid: { _eq: $tenantid } }) {
155: staffid
156: name
157: }
158: }
159: GraphQL Variables:
160: {"tenantid":1087}
161: GetTenantInfo
162: REST Params:
163: {"tenantid":1079}
164: GraphQL Query:
165: query GetTenantInfo($tenantid: bigint!) {
166: tenants(where: { tenantid: { _eq: $tenantid } }) {
167: tenantname
168: city
169: }
170: }
171: GraphQL Variables:
172: {"tenantid":1079}
173: getTenantlocations
174: REST Params:
175: {"tenantid":1}
176: GraphQL Query:
177: query GetTenantLocations($tenantid: bigint!) {
178: tenant_locations(where: { tenantid: { _eq: $tenantid } }) {
179: locationid
180: locationname
181: }
182: }
183: GraphQL Variables:
184: {"tenantid":1}
185: getapplocations
186: REST Params:
187: {}
188: GraphQL Query:
189: query GetAppLocations {
190: app_location {
191: applocationid
192: locationname
193: }
194: }
195: GraphQL Variables:
196: {}
197: getsubcategory
198: REST Params:
199: {"moduleid":6,"categoryid":1}
200: GraphQL Query:
201: query GetSubCategory($moduleid: bigint!, $categoryid: bigint!) {
202: app_subcategory(where: { categoryid: { _eq: $categoryid }, category: { modules: { moduleid: { _eq: $moduleid } } } }) {
203: subcategoryid
204: subcategoryname
205: }
206: }
207: GraphQL Variables:
208: {"moduleid":6,"categoryid":1}
209: GetPartners
210: REST Params:
211: {"applocationid":1,"partnerid":44,"limit":10,"offset":0}
212: GraphQL Query:
213: query GetPartners($applocationid: bigint!, $partnerid: bigint, $limit: Int!, $offset: Int!) {
214: partners(where: { applocationid: { _eq: $applocationid }, partnerid: { _eq: $partnerid } }, limit: $limit, offset: $offset) {
215: partnerid
216: name
217: }
218: }
219: GraphQL Variables:
220: {"applocationid":1,"partnerid":44,"limit":10,"offset":0}
221: GetlocationsConfig
222: REST Params:
223: {}
224: GraphQL Query:
225: query GetLocationConfig {
226: app_locationconfigs {
227: applocationid
228: configkey
229: }
230: }
231: GraphQL Variables:
232: {}

15
scratch/extract_docx.py Normal file
View File

@@ -0,0 +1,15 @@
import docx
import json
def extract_docx_content(file_path):
doc = docx.Document(file_path)
full_text = []
for para in doc.paragraphs:
full_text.append(para.text)
return "\n".join(full_text)
content = extract_docx_content('Nearle_Full_API_Documentation.docx')
with open('scratch/docx_content_utf8.txt', 'w', encoding='utf-8') as f:
lines = content.split('\n')
for i, line in enumerate(lines):
f.write(f"{i}: {line}\n")

View File

@@ -1,41 +1,36 @@
import React, { useState, useMemo } from 'react';
import Sidebar from './components/Sidebar';
import EndpointViewer from './components/EndpointViewer';
import { topics } from './data/apiData';
import { ArrowRight, Code2, Zap, Users, ShoppingCart, Home, Box, Link2 } from 'lucide-react';
import Introduction from './components/Introduction';
import { graphqlTopics, GRAPHQL_BASE_URL } from './data/apiData';
import { restTopics, REST_BASE_URL } from './data/restTopics';
const topicIcons = {
users: Users,
orders: ShoppingCart,
tenants: Home,
products: Box,
locations: Link2,
partners: Users,
};
const processTopics = (topics, baseUrl, type) =>
topics.map(t => ({ ...t, baseUrl, type, uniqueId: `${type}-${t.id}` }));
const allGraphql = processTopics(graphqlTopics, GRAPHQL_BASE_URL, 'graphql');
const allRest = processTopics(restTopics, REST_BASE_URL, 'rest');
function filterTopics(topics, q) {
if (!q) return topics;
return topics.filter(t =>
t.name.toLowerCase().includes(q) ||
(t.description || '').toLowerCase().includes(q) ||
t.endpoints.some(e =>
e.name.toLowerCase().includes(q) ||
e.url.toLowerCase().includes(q) ||
(e.description || '').toLowerCase().includes(q)
)
);
}
function App() {
const [activeTopic, setActiveTopic] = useState(null);
const [searchQuery, setSearchQuery] = useState('');
const filteredTopics = useMemo(() => {
if (!searchQuery.trim()) return topics;
return topics.map(topic => {
const matchTopic = topic.name.toLowerCase().includes(searchQuery.toLowerCase());
const filteredEndpoints = topic.endpoints.filter(ep =>
ep.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
ep.description.toLowerCase().includes(searchQuery.toLowerCase())
);
if (matchTopic || filteredEndpoints.length > 0) {
return {
...topic,
endpoints: filteredEndpoints.length > 0 ? filteredEndpoints : topic.endpoints
};
}
return null;
}).filter(Boolean);
}, [searchQuery]);
const q = searchQuery.trim().toLowerCase();
const visibleGraphql = useMemo(() => filterTopics(allGraphql, q), [q]);
const visibleRest = useMemo(() => filterTopics(allRest, q), [q]);
return (
<div className="min-h-screen bg-slate-50 bg-grid-pattern flex relative overflow-hidden">
@@ -45,72 +40,27 @@ function App() {
<div className="absolute top-0 -right-4 w-72 h-72 bg-indigo-300 rounded-full mix-blend-multiply filter blur-3xl opacity-20 animate-blob animation-delay-2000"></div>
<div className="absolute -bottom-8 left-20 w-72 h-72 bg-pink-300 rounded-full mix-blend-multiply filter blur-3xl opacity-20 animate-blob animation-delay-4000"></div>
{/* Sidebar */}
<Sidebar
topics={filteredTopics}
graphqlTopics={visibleGraphql}
restTopics={visibleRest}
activeTopic={activeTopic}
setActiveTopic={setActiveTopic}
searchQuery={searchQuery}
setSearchQuery={setSearchQuery}
/>
{/* Main Content Area */}
<main className="ml-[280px] flex-1 min-h-screen relative z-10">
{activeTopic ? (
<div className="max-w-[1200px] mx-auto p-12 lg:p-16 opacity-0 animate-fade-in-up">
<EndpointViewer topic={activeTopic} />
</div>
) : (
<div className="max-w-[1000px] mx-auto px-12 py-20 lg:px-24 lg:py-28 opacity-0 animate-fade-in-up">
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-brand-50 border border-brand-100 text-brand-600 text-sm font-medium mb-8">
<Zap size={14} className="fill-current" />
v2.0 Developer API
</div>
<h1 className="text-4xl lg:text-5xl font-bold text-slate-900 mb-6 tracking-tight">
<span className="text-gradient">NearleDaily API</span>
</h1>
<p className="text-xl text-slate-600 mb-12 max-w-2xl leading-relaxed">
A comprehensive, lightning-fast platform designed for logistics, order management, and multi-tenant POS administration.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{topics.map((topic, index) => {
const Icon = topicIcons[topic.id] || Zap;
return (
<div
key={topic.id}
onClick={() => setActiveTopic(topic)}
className="group relative bg-white p-6 rounded-2xl border border-slate-200/60 shadow-sm hover:shadow-xl hover:shadow-brand-500/5 hover:border-brand-200 transition-all duration-300 cursor-pointer overflow-hidden"
style={{ animationDelay: `${index * 100}ms` }}
>
<div className="absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-brand-50 to-transparent rounded-bl-full opacity-0 group-hover:opacity-100 transition-opacity duration-500"></div>
<div className="relative z-10">
<h3 className="text-lg font-bold text-slate-900 mb-2 group-hover:text-brand-600 transition-colors flex items-center gap-2">
<div className="p-1.5 bg-brand-50 text-brand-600 rounded-md group-hover:bg-brand-100 transition-colors">
<Icon size={18} />
</div>
{topic.name}
<ArrowRight size={16} className="opacity-0 -translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ml-auto" />
</h3>
<p className="text-sm text-slate-500 leading-relaxed mt-3">
{topic.description}
</p>
</div>
</div>
)})}
</div>
<div className="mt-16 flex items-center gap-4 p-6 bg-slate-900 text-slate-300 rounded-2xl shadow-code">
<Code2 className="text-brand-400" size={24} />
<p className="text-sm">
Explore real-time interactive endpoints. All requests are authenticated with secure admin secrets internally for demonstration purposes.
</p>
</div>
<div className="opacity-0 animate-fade-in-up">
<Introduction
allGraphql={allGraphql}
allRest={allRest}
setActiveTopic={setActiveTopic}
/>
</div>
)}
</main>

View File

@@ -1,86 +1,120 @@
import React, { useState, useEffect } from 'react';
import { Play, FileJson, Server, CheckCircle2, AlertCircle } from 'lucide-react';
import { Play, FileJson, Server, CheckCircle2, AlertCircle, Copy, Check, Loader2 } from 'lucide-react';
import { graphqlMeta } from '../data/apiData';
import { highlightJSON } from '../lib/highlight';
function safeDecode(v) {
try { return decodeURIComponent(v); } catch { return v; }
}
function parseUrlParams(url) {
const [, query = ''] = url.split('?');
const params = {};
if (query) {
for (const pair of query.split('&')) {
const [name, value = ''] = pair.split('=');
if (name) params[name] = safeDecode(value);
}
}
return params;
}
function EndpointRow({ endpoint, topic }) {
const isRest = topic.type === 'rest';
const meta = !isRest ? graphqlMeta[endpoint.name] : null;
function EndpointRow({ endpoint }) {
const meta = graphqlMeta[endpoint.name];
const [queryText, setQueryText] = useState(meta?.query || '');
const [variablesText, setVariablesText] = useState(meta?.variables || '{}');
const parseParams = (url) => {
const parts = url.split('?');
if(parts.length < 2) return {};
const sp = new URLSearchParams(parts[1]);
const obj = {};
for(const [k, v] of sp.entries()) obj[k] = v;
return obj;
};
const [params, setParams] = useState(parseParams(endpoint.url));
const [params, setParams] = useState(() => parseUrlParams(endpoint.url));
const [result, setResult] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);
const [copied, setCopied] = useState(false);
useEffect(() => {
setQueryText(meta?.query || '');
setVariablesText(meta?.variables || '{}');
}, [meta?.query, meta?.variables]);
useEffect(() => {
setParams(parseParams(endpoint.url));
}, [endpoint.url]);
useEffect(() => {
try {
const parsed = variablesText?.trim() ? JSON.parse(variablesText) : {};
if(endpoint.method === 'GET') {
const next = {};
Object.keys(params).forEach(k => {
next[k] = parsed[k] !== undefined ? String(parsed[k]) : params[k];
});
setParams(next);
}
} catch(e) {}
setParams(parseUrlParams(endpoint.url));
setResult(null);
setError(null);
}, [endpoint.name]);
const copyResponse = async () => {
if (!result) return;
try {
await navigator.clipboard.writeText(JSON.stringify(result.data, null, 2));
setCopied(true); setTimeout(() => setCopied(false), 1500);
} catch {}
};
const execute = async () => {
setError(null);
setIsLoading(true);
setResult(null);
try {
const base = 'https://api.workolik.com';
let requestUrl = base + endpoint.url;
const options = {
method: endpoint.method,
headers: {
'x-hasura-admin-secret': 'nearle-admin-secret',
'Content-Type': 'application/json'
}
};
if (endpoint.method === 'GET' && !endpoint.useGraphql) {
const emptyKeys = Object.entries(params).filter(([k,v]) => String(v).trim() === '').map(([k])=>k);
if (emptyKeys.length) {
setError('Required parameter(s): ' + emptyKeys.join(', '));
setIsLoading(false);
return;
}
if (isRest) {
// REST: fetch directly (fiesta.nearle.app supports CORS)
const path = endpoint.url.split('?')[0];
const qs = new URLSearchParams(params).toString();
requestUrl = base + path + (qs ? '?' + qs : '');
const isGet = endpoint.method === 'GET';
let url = topic.baseUrl + endpoint.url;
if (isGet && Object.keys(params).length > 0) {
const qs = new URLSearchParams(params).toString();
url = topic.baseUrl + path + (qs ? '?' + qs : '');
}
const options = {
method: endpoint.method,
headers: { 'Content-Type': 'application/json' },
};
if (!isGet && endpoint.body) {
options.body = typeof endpoint.body === 'string'
? endpoint.body
: JSON.stringify(endpoint.body);
}
const res = await fetch(url, options);
const text = await res.text();
let data;
try { data = JSON.parse(text); } catch { data = text; }
setResult({ status: res.status, ok: res.ok, data });
} else {
const parsedVariables = variablesText?.trim() ? JSON.parse(variablesText) : {};
requestUrl = base + '/v1/graphql';
options.method = 'POST';
options.body = JSON.stringify({ query: queryText, variables: parsedVariables });
// GraphQL / Hasura
const base = topic.baseUrl;
let requestUrl = base + endpoint.url;
const options = {
method: endpoint.method,
headers: {
'x-hasura-admin-secret': 'nearle-admin-secret',
'Content-Type': 'application/json',
},
};
if (endpoint.method === 'GET' && !endpoint.useGraphql) {
const emptyKeys = Object.entries(params).filter(([, v]) => String(v).trim() === '').map(([k]) => k);
if (emptyKeys.length) {
setError('Required parameter(s): ' + emptyKeys.join(', '));
setIsLoading(false);
return;
}
const path = endpoint.url.split('?')[0];
const qs = new URLSearchParams(params).toString();
requestUrl = base + path + (qs ? '?' + qs : '');
} else {
const parsedVars = variablesText?.trim() ? JSON.parse(variablesText) : {};
requestUrl = base + '/v1/graphql';
options.method = 'POST';
options.body = JSON.stringify({ query: queryText, variables: parsedVars });
}
const res = await fetch(requestUrl, options);
const data = await res.json();
setResult({ status: res.status, ok: res.ok, data });
}
const res = await fetch(requestUrl, options);
const data = await res.json();
setResult({ status: res.status, ok: res.ok, data });
} catch(err) {
} catch (err) {
setError(String(err));
} finally {
setIsLoading(false);
@@ -88,12 +122,15 @@ function EndpointRow({ endpoint }) {
};
const methodColor = {
GET: 'bg-emerald-100/50 text-emerald-700 border-emerald-200',
POST: 'bg-blue-100/50 text-blue-700 border-blue-200',
PUT: 'bg-amber-100/50 text-amber-700 border-amber-200',
DELETE: 'bg-red-100/50 text-red-700 border-red-200'
GET: 'bg-emerald-100/50 text-emerald-700 border-emerald-200',
POST: 'bg-blue-100/50 text-blue-700 border-blue-200',
PUT: 'bg-amber-100/50 text-amber-700 border-amber-200',
DELETE: 'bg-red-100/50 text-red-700 border-red-200',
PATCH: 'bg-purple-100/50 text-purple-700 border-purple-200',
}[endpoint.method] || 'bg-slate-100/50 text-slate-700 border-slate-200';
const urlPath = endpoint.url.split('?')[0];
return (
<div className="py-16 border-t border-slate-200/60 group/row" id={endpoint.name}>
<div className="grid grid-cols-1 xl:grid-cols-12 gap-12 lg:gap-16">
@@ -114,10 +151,11 @@ function EndpointRow({ endpoint }) {
<div className="bg-white border border-slate-200/80 rounded-xl p-3.5 font-mono text-sm text-slate-600 break-all shadow-sm flex items-center gap-2 group-hover/row:border-brand-300 transition-colors">
<Server size={14} className="text-brand-400 shrink-0" />
<span className="opacity-60 hidden sm:inline">https://api.workolik.com</span>
<span className="font-semibold text-slate-800">{endpoint.url.split('?')[0]}</span>
<span className="opacity-60 hidden sm:inline">{topic.baseUrl}</span>
<span className="font-semibold text-slate-800">{urlPath}</span>
</div>
{/* Query params (GET endpoints) */}
{endpoint.method === 'GET' && Object.keys(params).length > 0 && (
<div className="pt-2">
<h4 className="text-xs font-bold text-slate-400 mb-4 uppercase tracking-widest flex items-center gap-2">
@@ -136,16 +174,15 @@ function EndpointRow({ endpoint }) {
placeholder={`Enter ${key}...`}
onChange={e => {
const newVal = e.target.value;
setParams(p => {
const next = {...p, [key]: newVal};
setParams(p => ({ ...p, [key]: newVal }));
if (!isRest) {
try {
setVariablesText(JSON.stringify({
...JSON.parse(variablesText || '{}'),
[key]: isNaN(newVal) || newVal === '' ? newVal : Number(newVal)
}, null, 2));
} catch(err) {}
return next;
});
} catch {}
}
}}
/>
</div>
@@ -155,7 +192,7 @@ function EndpointRow({ endpoint }) {
)}
</div>
{/* Right Column: Execution & Code */}
{/* Right Column: Code Panel */}
<div className="xl:col-span-7">
<div className="dark-glass rounded-2xl overflow-hidden shadow-code flex flex-col h-full min-h-[450px] transform transition-transform duration-500 group-hover/row:-translate-y-1">
@@ -167,7 +204,9 @@ function EndpointRow({ endpoint }) {
<div className="ml-4 text-xs font-mono text-slate-500">Request Payload</div>
</div>
{/* Pane content */}
{meta ? (
// GraphQL editor: query + variables
<div className="flex-1 grid grid-cols-1 md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-white/5">
<div className="p-5 flex flex-col group/pane relative">
<div className="text-[11px] font-bold text-slate-400 mb-3 uppercase tracking-wider flex items-center gap-2">
@@ -179,7 +218,6 @@ function EndpointRow({ endpoint }) {
onChange={e => setQueryText(e.target.value)}
spellCheck="false"
/>
<div className="absolute inset-0 bg-gradient-to-t from-dark-900 via-transparent to-transparent opacity-0 group-hover/pane:opacity-100 pointer-events-none transition-opacity"></div>
</div>
<div className="p-5 flex flex-col bg-white/[0.02]">
<div className="text-[11px] font-bold text-slate-400 mb-3 uppercase tracking-wider">Variables JSON</div>
@@ -191,11 +229,44 @@ function EndpointRow({ endpoint }) {
/>
</div>
</div>
) : endpoint.body ? (
// REST body JSON preview
<div className="flex-1 p-5 flex flex-col">
<div className="text-[11px] font-bold text-slate-400 mb-3 uppercase tracking-wider flex items-center gap-2">
<FileJson size={14} className="text-brand-400" /> Request Body (JSON)
</div>
<pre className="flex-1 text-slate-300 font-mono text-[13px] whitespace-pre-wrap leading-relaxed overflow-auto scrollbar-hide"
dangerouslySetInnerHTML={{ __html: highlightJSON(endpoint.body) }}
/>
</div>
) : (
<div className="flex-1 p-8 flex items-center justify-center">
<div className="text-center">
<FileJson size={32} className="mx-auto text-slate-700 mb-4" />
<p className="text-slate-500 text-sm">No specific payload configuration required.</p>
// URL preview for no-body endpoints
<div className="flex-1 p-8 flex flex-col justify-center">
<div className="text-[11px] font-bold text-slate-400 mb-4 uppercase tracking-wider flex items-center gap-2">
<Server size={14} className="text-brand-400" /> Full Request URL
</div>
<div className="font-mono text-[13px] leading-loose break-all">
<span className={`font-bold mr-2 ${
endpoint.method === 'GET' ? 'text-emerald-400' :
endpoint.method === 'POST' ? 'text-blue-400' :
endpoint.method === 'PUT' ? 'text-amber-400' :
endpoint.method === 'DELETE' ? 'text-red-400' : 'text-purple-400'
}`}>{endpoint.method}</span>
<span className="text-slate-500">{topic.baseUrl}</span>
<span className="text-slate-200">{urlPath}</span>
{Object.keys(params).length > 0 && (
<>
<span className="text-pink-400">?</span>
{Object.entries(params).map(([k, v], i, arr) => (
<span key={k}>
<span className="text-brand-300">{k}</span>
<span className="text-slate-500">=</span>
<span className="text-slate-300">{encodeURIComponent(v)}</span>
{i < arr.length - 1 && <span className="text-slate-600">&</span>}
</span>
))}
</>
)}
</div>
</div>
)}
@@ -210,11 +281,9 @@ function EndpointRow({ endpoint }) {
disabled={isLoading}
className="bg-brand-600 hover:bg-brand-500 text-white px-5 py-2 rounded-lg text-sm font-semibold transition-all flex items-center gap-2 disabled:opacity-50 shadow-[0_0_15px_rgba(2,132,199,0.4)] hover:shadow-[0_0_25px_rgba(2,132,199,0.6)] hover:-translate-y-0.5 active:translate-y-0"
>
{isLoading ? (
<div className="w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin" />
) : (
<Play size={14} className="fill-current" />
)}
{isLoading
? <div className="w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin" />
: <Play size={14} className="fill-current" />}
{isLoading ? 'Executing...' : 'Send Request'}
</button>
</div>
@@ -224,19 +293,33 @@ function EndpointRow({ endpoint }) {
<div className="border-t border-white/10 p-5 max-h-[350px] overflow-y-auto bg-black/60 relative">
<div className="sticky top-0 pb-3 mb-3 bg-black/60 backdrop-blur-md border-b border-white/5 flex items-center justify-between">
<span className="text-[11px] font-bold text-slate-400 uppercase tracking-wider">Response JSON</span>
{result && (
<span className={`text-[11px] px-2.5 py-1 rounded-md font-bold font-mono flex items-center gap-1.5 ${result.ok ? 'bg-emerald-500/20 text-emerald-400 border border-emerald-500/30' : 'bg-red-500/20 text-red-400 border border-red-500/30'}`}>
{result.ok ? <CheckCircle2 size={12} /> : <AlertCircle size={12} />}
{result.status}
</span>
)}
<div className="flex items-center gap-3">
{result && (
<>
<span className={`text-[11px] px-2.5 py-1 rounded-md font-bold font-mono flex items-center gap-1.5 ${result.ok ? 'bg-emerald-500/20 text-emerald-400 border border-emerald-500/30' : 'bg-red-500/20 text-red-400 border border-red-500/30'}`}>
{result.ok ? <CheckCircle2 size={12} /> : <AlertCircle size={12} />}
{result.status}
</span>
<button
onClick={copyResponse}
className="flex items-center gap-1.5 text-[11px] font-bold uppercase tracking-widest text-slate-400 hover:text-brand-400 transition-colors"
>
{copied ? <Check size={12} /> : <Copy size={12} />}
{copied ? 'Copied' : 'Copy'}
</button>
</>
)}
</div>
</div>
{error ? (
<div className="text-red-400 font-mono text-[13px] leading-relaxed break-all">{error}</div>
) : typeof result?.data === 'string' ? (
<pre className="text-slate-300 font-mono text-[13px] whitespace-pre-wrap leading-relaxed">{result.data}</pre>
) : (
<pre className="text-slate-300 font-mono text-[13px] whitespace-pre-wrap leading-relaxed">
{JSON.stringify(result.data, null, 2)}
</pre>
<pre
className="text-slate-300 font-mono text-[13px] whitespace-pre-wrap leading-relaxed"
dangerouslySetInnerHTML={{ __html: highlightJSON(result?.data) }}
/>
)}
</div>
)}
@@ -256,11 +339,22 @@ export default function EndpointViewer({ topic }) {
<div className="mb-12">
<h1 className="text-4xl lg:text-5xl font-bold text-slate-900 mb-4 tracking-tight">{topic.name}</h1>
<p className="text-lg text-slate-600 max-w-3xl leading-relaxed">{topic.description}</p>
<div className="mt-4 flex items-center gap-3">
<span className={`inline-flex items-center gap-1.5 text-[11px] font-bold uppercase tracking-widest px-3 py-1 rounded-full border ${
topic.type === 'graphql'
? 'bg-brand-50 text-brand-600 border-brand-100'
: 'bg-indigo-50 text-indigo-600 border-indigo-100'
}`}>
<span className="w-1.5 h-1.5 rounded-full bg-current"></span>
{topic.type === 'graphql' ? 'GraphQL' : 'REST API'}
</span>
<span className="text-sm text-slate-400">{topic.endpoints.length} endpoint{topic.endpoints.length !== 1 ? 's' : ''}</span>
</div>
</div>
<div className="space-y-4">
{topic.endpoints.map(endpoint => (
<EndpointRow key={endpoint.name} endpoint={endpoint} />
<EndpointRow key={`${topic.uniqueId}/${endpoint.name}`} endpoint={endpoint} topic={topic} />
))}
</div>
</div>

View File

@@ -0,0 +1,103 @@
import React from 'react';
import { ArrowRight, Code2, Zap, Users, ShoppingCart, Home, Box, Link2, Truck, UserCircle, Bike, FileText, CreditCard, Wrench } from 'lucide-react';
import { GRAPHQL_BASE_URL } from '../data/apiData';
import { REST_BASE_URL } from '../data/restTopics';
const topicIcons = {
users: Users,
orders: ShoppingCart,
tenants: Home,
products: Box,
locations: Link2,
partners: Bike,
deliveries: Truck,
customers: UserCircle,
invoice: FileText,
payments: CreditCard,
utils: Wrench,
mobile: Box,
};
export default function Introduction({ allGraphql, allRest, setActiveTopic }) {
const allTopics = [...allGraphql, ...allRest];
return (
<div className="max-w-[1000px] mx-auto px-12 py-20 lg:px-24 lg:py-28">
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-brand-50 border border-brand-100 text-brand-600 text-sm font-medium mb-8">
<Zap size={14} className="fill-current" />
v2.0 Developer API
</div>
<h1 className="text-4xl lg:text-5xl font-bold text-slate-900 mb-6 tracking-tight">
<span className="text-gradient">NearleDaily API</span>
</h1>
<p className="text-xl text-slate-600 mb-12 max-w-2xl leading-relaxed">
A comprehensive, lightning-fast platform designed for logistics, order management,
and multi-tenant POS administration available through both Hasura GraphQL and REST APIs.
</p>
<div className="mb-8">
<h2 className="text-xs font-bold uppercase tracking-widest text-slate-400 mb-4">Base URLs</h2>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-10">
<div className="bg-white border border-slate-200/60 rounded-xl p-4 shadow-sm">
<div className="text-[11px] text-brand-600 font-bold uppercase tracking-widest mb-1.5">Hasura GraphQL</div>
<code className="font-mono text-sm text-slate-700">{GRAPHQL_BASE_URL}</code>
</div>
<div className="bg-white border border-slate-200/60 rounded-xl p-4 shadow-sm">
<div className="text-[11px] text-indigo-600 font-bold uppercase tracking-widest mb-1.5">REST API</div>
<code className="font-mono text-sm text-slate-700">{REST_BASE_URL}</code>
</div>
</div>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{allTopics.map((topic, index) => {
const Icon = topicIcons[topic.id] || Zap;
return (
<div
key={topic.uniqueId}
onClick={() => setActiveTopic(topic)}
className="group relative bg-white p-6 rounded-2xl border border-slate-200/60 shadow-sm hover:shadow-xl hover:shadow-brand-500/5 hover:border-brand-200 transition-all duration-300 cursor-pointer overflow-hidden"
style={{ animationDelay: `${index * 80}ms` }}
>
<div className="absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-brand-50 to-transparent rounded-bl-full opacity-0 group-hover:opacity-100 transition-opacity duration-500"></div>
<div className="relative z-10">
<h3 className="text-lg font-bold text-slate-900 mb-2 group-hover:text-brand-600 transition-colors flex items-center gap-2">
<div className="p-1.5 bg-brand-50 text-brand-600 rounded-md group-hover:bg-brand-100 transition-colors">
<Icon size={18} />
</div>
{topic.name}
<ArrowRight size={16} className="opacity-0 -translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ml-auto" />
</h3>
<div className="flex items-center gap-2 mt-1 mb-2">
<span className={`text-[10px] font-bold uppercase tracking-widest px-2 py-0.5 rounded border ${
topic.type === 'graphql'
? 'bg-brand-50 text-brand-600 border-brand-100'
: 'bg-indigo-50 text-indigo-600 border-indigo-100'
}`}>
{topic.type === 'graphql' ? 'GraphQL' : 'REST'}
</span>
<span className="text-[11px] text-slate-400">{topic.endpoints.length} endpoint{topic.endpoints.length !== 1 ? 's' : ''}</span>
</div>
<p className="text-sm text-slate-500 leading-relaxed">
{topic.description}
</p>
</div>
</div>
);
})}
</div>
<div className="mt-16 flex items-center gap-4 p-6 bg-slate-900 text-slate-300 rounded-2xl shadow-code">
<Code2 className="text-brand-400 shrink-0" size={24} />
<p className="text-sm">
Explore real-time interactive endpoints. GraphQL requests are authenticated with the admin secret. REST endpoints support CORS and can be called directly from the browser.
</p>
</div>
</div>
);
}

View File

@@ -1,19 +1,56 @@
import React, { useState } from 'react';
import { Search, ChevronRight, ChevronDown, Layers, Terminal, Users, ShoppingCart, Home, Box, Link2 } from 'lucide-react';
import { Search, ChevronRight, ChevronDown, Layers, Terminal, Users, ShoppingCart, Home, Box, Link2, Truck, UserCircle, Bike, FileText, CreditCard, Wrench } from 'lucide-react';
const topicIcons = {
users: Users,
orders: ShoppingCart,
tenants: Home,
products: Box,
locations: Link2,
partners: Users,
users: Users,
orders: ShoppingCart,
tenants: Home,
products: Box,
locations: Link2,
partners: Bike,
deliveries: Truck,
customers: UserCircle,
invoice: FileText,
payments: CreditCard,
utils: Wrench,
mobile: Box,
};
export default function Sidebar({ topics, activeTopic, setActiveTopic, searchQuery, setSearchQuery }) {
const [expanded, setExpanded] = useState({ general: true, topics: true });
export default function Sidebar({ graphqlTopics, restTopics, activeTopic, setActiveTopic, searchQuery, setSearchQuery }) {
const [open, setOpen] = useState({ general: true, graphql: true, rest: true });
const toggle = (key) => setOpen(prev => ({ ...prev, [key]: !prev[key] }));
const toggle = (key) => setExpanded(prev => ({ ...prev, [key]: !prev[key] }));
const renderGroup = (topics, title, key) => (
<div>
<button
onClick={() => toggle(key)}
className="w-full flex items-center justify-between px-2 py-1.5 text-slate-800 font-semibold text-sm hover:text-brand-600 transition-colors group"
>
<span className="tracking-wide text-xs uppercase text-slate-400 group-hover:text-brand-500 transition-colors">{title}</span>
{open[key] ? <ChevronDown size={14} className="text-slate-400" /> : <ChevronRight size={14} className="text-slate-400" />}
</button>
<div className={`mt-2 space-y-1 overflow-hidden transition-all duration-500 ${open[key] ? 'max-h-[800px] opacity-100' : 'max-h-0 opacity-0'}`}>
{topics.map(topic => {
const isActive = activeTopic?.uniqueId === topic.uniqueId;
const Icon = topicIcons[topic.id] || Layers;
return (
<button
key={topic.uniqueId}
onClick={() => setActiveTopic(topic)}
className={`w-full flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm transition-all duration-200 group ${
isActive
? 'text-brand-700 bg-brand-50 shadow-sm font-medium'
: 'text-slate-600 hover:text-slate-900 hover:bg-slate-100/50'
}`}
>
<Icon size={16} className={`${isActive ? 'text-brand-500' : 'text-slate-400 group-hover:text-slate-500'} transition-colors`} />
{topic.name}
</button>
);
})}
</div>
</div>
);
return (
<div className="w-[280px] glass h-screen fixed top-0 left-0 flex flex-col z-20 transition-all">
@@ -41,16 +78,16 @@ export default function Sidebar({ topics, activeTopic, setActiveTopic, searchQue
<div className="flex-1 overflow-y-auto py-6 px-4 scrollbar-hide">
<nav className="space-y-6">
{/* General Section */}
{/* Getting Started */}
<div>
<button
onClick={() => toggle('general')}
className="w-full flex items-center justify-between px-2 py-1.5 text-slate-800 font-semibold text-sm hover:text-brand-600 transition-colors group"
>
<span className="tracking-wide text-xs uppercase text-slate-400 group-hover:text-brand-500 transition-colors">Getting Started</span>
{expanded.general ? <ChevronDown size={14} className="text-slate-400" /> : <ChevronRight size={14} className="text-slate-400" />}
{open.general ? <ChevronDown size={14} className="text-slate-400" /> : <ChevronRight size={14} className="text-slate-400" />}
</button>
<div className={`mt-2 space-y-1 overflow-hidden transition-all duration-300 ${expanded.general ? 'max-h-40 opacity-100' : 'max-h-0 opacity-0'}`}>
<div className={`mt-2 space-y-1 overflow-hidden transition-all duration-300 ${open.general ? 'max-h-40 opacity-100' : 'max-h-0 opacity-0'}`}>
<button
onClick={() => setActiveTopic(null)}
className={`w-full flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm transition-all duration-200 ${
@@ -59,42 +96,14 @@ export default function Sidebar({ topics, activeTopic, setActiveTopic, searchQue
: 'text-slate-600 hover:text-slate-900 hover:bg-slate-100/50'
}`}
>
<Terminal size={16} className={!activeTopic ? "text-brand-500" : "text-slate-400"} />
<Terminal size={16} className={!activeTopic ? 'text-brand-500' : 'text-slate-400'} />
Introduction
</button>
</div>
</div>
{/* Topics Section */}
<div>
<button
onClick={() => toggle('topics')}
className="w-full flex items-center justify-between px-2 py-1.5 text-slate-800 font-semibold text-sm hover:text-brand-600 transition-colors group"
>
<span className="tracking-wide text-xs uppercase text-slate-400 group-hover:text-brand-500 transition-colors">API Reference</span>
{expanded.topics ? <ChevronDown size={14} className="text-slate-400" /> : <ChevronRight size={14} className="text-slate-400" />}
</button>
<div className={`mt-2 space-y-1 overflow-hidden transition-all duration-500 ${expanded.topics ? 'max-h-[500px] opacity-100' : 'max-h-0 opacity-0'}`}>
{topics.map(topic => {
const isActive = activeTopic?.id === topic.id;
const Icon = topicIcons[topic.id] || Layers;
return (
<button
key={topic.id}
onClick={() => setActiveTopic(topic)}
className={`w-full flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm transition-all duration-200 group ${
isActive
? 'text-brand-700 bg-brand-50 shadow-sm font-medium'
: 'text-slate-600 hover:text-slate-900 hover:bg-slate-100/50'
}`}
>
<Icon size={16} className={`${isActive ? "text-brand-500" : "text-slate-400 group-hover:text-slate-500"} transition-colors`} />
{topic.name}
</button>
)
})}
</div>
</div>
{graphqlTopics.length > 0 && renderGroup(graphqlTopics, 'GraphQL', 'graphql')}
{restTopics.length > 0 && renderGroup(restTopics, 'REST API', 'rest')}
</nav>
</div>

View File

@@ -826,7 +826,9 @@ export const graphqlMeta = {
};
export const topics = [
export const GRAPHQL_BASE_URL = 'https://api.workolik.com';
export const graphqlTopics = [
{
id: "users",
name: "Users",

177
src/data/restTopics.js Normal file
View File

@@ -0,0 +1,177 @@
export const REST_BASE_URL = 'https://fiesta.nearle.app';
export const restTopics = [
{
"id": "utils",
"name": "Utils",
"description": "Shared lookup endpoints: app categories, subcategories, locations, app types, configs.",
"endpoints": [
{ "name": "Fetch application categories by tag (Web)", "method": "GET", "url": "/live/api/v1/web/utils/getapptypes?tag=customer", "description": "Fetch application categories by tag (Web)" },
{ "name": "Resolve subcategories (Web)", "method": "GET", "url": "/live/api/v1/web/utils/getsubcategories?moduleid=1&categoryid=2", "description": "Resolve subcategories (Web)" },
{ "name": "Fetch system active geofence details (Web)", "method": "GET", "url": "/live/api/v1/web/utils/getapplocations?applocationid=1", "description": "Fetch system active geofence details (Web)" },
{ "name": "Fetch global system categories configurations (Web)", "method": "GET", "url": "/live/api/v1/web/utils/getappcategories", "description": "Fetch global system categories configurations (Web)" },
{ "name": "Get mobile geofence configuration details (Mobile)", "method": "GET", "url": "/live/api/v1/mob/utils/getapplocationconfig?applocationid=1", "description": "Get mobile geofence configuration details (Mobile)" },
{ "name": "Get mobile active geofence details (Mobile)", "method": "GET", "url": "/live/api/v1/mob/utils/getapplocations?applocationid=1", "description": "Get mobile active geofence details (Mobile)" },
{ "name": "Fetch mobile app types by tag (Mobile)", "method": "GET", "url": "/live/api/v1/mob/utils/getapptypes?tag=rider", "description": "Fetch mobile app types by tag (Mobile)" },
{ "name": "Fetch global payment & geofence configs (Mobile)", "method": "GET", "url": "/live/api/v1/mob/utils/getappconfig?configid=1", "description": "Fetch global payment & geofence configs (Mobile)" },
{ "name": "Get mobile category subcategories list (Mobile)", "method": "GET", "url": "/live/api/v1/mob/utils/getsubcategories?moduleid=1&categoryid=2", "description": "Get mobile category subcategories list (Mobile)" },
{ "name": "Fetch mobile app categories configurations (Mobile)", "method": "GET", "url": "/live/api/v1/mob/utils/getappcategories", "description": "Fetch mobile app categories configurations (Mobile)" }
]
},
{
"id": "users",
"name": "Users",
"description": "Manage users, authentication, and roles across the platform.",
"endpoints": [
{ "name": "Get all users (Web)", "method": "GET", "url": "/live/api/v1/web/users/getallusers?roleid=2&tenantid=8&pageno=1&pagesize=10&keyword=john", "description": "Get all users (Web)" },
{ "name": "Get a specific user profile by ID (Web)", "method": "GET", "url": "/live/api/v1/web/users/getusers?userid=12", "description": "Get a specific user profile by ID (Web)" },
{ "name": "Get a specific user profile by ID (Mobile)", "method": "GET", "url": "/live/api/v1/mob/users/getusers?userid=15", "description": "Get a specific user profile by ID (Mobile)" },
{ "name": "Operator/User orders board (Web)", "method": "GET", "url": "/live/api/v1/web/orders/user/getorders?appuserid=12&status=processing&pageno=1&pagesize=10", "description": "Operator/User orders board (Web)" },
{ "name": "Tenant Web Panel Login", "method": "POST", "url": "/live/api/v1/web/users/tenant/weblogin", "description": "Tenant Web Panel Login", "body": { "authname": "merchant_admin_01", "password": "PasswordSecurityHash99!" } },
{ "name": "General Application Login", "method": "POST", "url": "/live/api/v1/web/users/applogin", "description": "General Application Login", "body": { "authname": "system_operator", "password": "OperatorSafePasswordSecret", "deviceid": "device_uuid_8828b", "devicetype": "android" } },
{ "name": "Register New Web Staff Account", "method": "POST", "url": "/live/api/v1/web/users/create", "description": "Register New Web Staff Account", "body": { "authname": "tenant_staff_steve", "firstname": "Steve", "lastname": "Rogers", "password": "SteveSecurePassword12", "email": "steve.rogers@merchant.com", "dialcode": "+61", "contactno": "412345678", "roleid": 3, "pin": 1234, "address": "100 Flinders St", "suburb": "Melbourne", "city": "Melbourne", "state": "VIC", "postcode": "3000", "tenantid": 8, "locationid": 2, "applocationid": 1, "status": "active" } },
{ "name": "Update Web Staff User Details", "method": "PUT", "url": "/live/api/v1/web/users/update", "description": "Update Web Staff User Details", "body": { "userid": 15, "firstname": "Steve", "lastname": "Captain", "email": "steve.captain@merchant.com", "contactno": "412345678", "address": "200 Flinders St", "suburb": "Melbourne", "city": "Melbourne", "state": "VIC", "postcode": "3000", "status": "active" } },
{ "name": "Rider/Merchant Mobile App Login", "method": "POST", "url": "/live/api/v1/mob/users/tenant/login", "description": "Rider/Merchant Mobile App Login", "body": { "authname": "rider_john_01", "password": "RiderSecretKey" } },
{ "name": "Create Mobile Staff User", "method": "POST", "url": "/live/api/v1/mob/users/create", "description": "Create Mobile Staff User", "body": { "authname": "tenant_staff_steve", "firstname": "Steve", "lastname": "Rogers", "password": "SteveSecurePassword12", "email": "steve.rogers@merchant.com", "dialcode": "+61", "contactno": "412345678", "roleid": 3, "pin": 1234, "tenantid": 8, "locationid": 2, "applocationid": 1, "status": "active" } },
{ "name": "Update Mobile Staff Details", "method": "PUT", "url": "/live/api/v1/mob/users/update", "description": "Update Mobile Staff Details", "body": { "userid": 15, "firstname": "Steve", "lastname": "Captain", "email": "steve.captain@merchant.com", "contactno": "412345678", "status": "active" } }
]
},
{
"id": "partners",
"name": "Partners",
"description": "Partners, riders, shifts, locations, and log sheets.",
"endpoints": [
{ "name": "Partner fleet orders board (Web)", "method": "GET", "url": "/live/api/v1/web/orders/partner/getorders?partnerid=1&status=processing&pageno=1&pagesize=10", "description": "Partner fleet orders board (Web)" },
{ "name": "Get active riders (Web)", "method": "GET", "url": "/live/api/v1/web/partners/getriders?partnerid=1&applocationid=1&userid=12&tenantid=8", "description": "Get active riders (Web)" },
{ "name": "Get partner profiles (Web)", "method": "GET", "url": "/live/api/v1/web/partners/getpartners?partnerid=1&applocationid=1&userid=12", "description": "Get partner profiles (Web)" },
{ "name": "Get rider shifts (Web)", "method": "GET", "url": "/live/api/v1/web/partners/getridershifts?applocationid=1", "description": "Get rider shifts (Web)" },
{ "name": "Get location configurations (Web)", "method": "GET", "url": "/live/api/v1/web/partners/getlocations?userid=12&configid=1", "description": "Get location configurations (Web)" },
{ "name": "Get rider log sheet (Web)", "method": "GET", "url": "/live/api/v1/web/partners/getriderlogs?partnerid=1&applocationid=1&fromdate=2026-05-20&todate=2026-05-20", "description": "Get rider log sheet (Web)" },
{ "name": "Get partner profiles (Mobile)", "method": "GET", "url": "/live/api/v1/mob/partners/getpartners?partnerid=1&applocationid=1&userid=12", "description": "Get partner profiles (Mobile)" },
{ "name": "Get rider log sheet (Mobile)", "method": "GET", "url": "/live/api/v1/mob/partners/getriderlogs?partnerid=1&applocationid=1&fromdate=2026-05-20&todate=2026-05-20", "description": "Get rider log sheet (Mobile)" },
{ "name": "Get rider operational info (Mobile)", "method": "GET", "url": "/live/api/v1/mob/partners/getriderinfo?userid=15", "description": "Get rider operational info (Mobile)" },
{ "name": "Get active riders list (Mobile)", "method": "GET", "url": "/live/api/v1/mob/partners/getriders?partnerid=1&applocationid=1&userid=15&tenantid=8", "description": "Get active riders list (Mobile)" }
]
},
{
"id": "tenants",
"name": "Tenants",
"description": "Tenant accounts, locations, customers, pricing, onboarding.",
"endpoints": [
{ "name": "Tenant orders board (Web)", "method": "GET", "url": "/live/api/v1/web/orders/tenant/getorders?tenantid=8&locationid=2&status=processing&pageno=1&pagesize=10", "description": "Tenant orders board (Web)" },
{ "name": "Get specific tenant store orders (Mobile)", "method": "GET", "url": "/live/api/v1/mob/orders/tenant/getorders?tenantid=8&locationid=2&pageno=1&pagesize=10", "description": "Get specific tenant store orders (Mobile)" },
{ "name": "Search registered tenants (Web)", "method": "GET", "url": "/live/api/v1/web/tenants/search?status=Active&keyword=Fresh", "description": "Search registered tenants (Web)" },
{ "name": "Search tenants by keyword (Web)", "method": "GET", "url": "/live/api/v1/web/tenants/searchbykeyword?keyword=daily", "description": "Search tenants by keyword (Web)" },
{ "name": "Get all active tenants catalog (Web)", "method": "GET", "url": "/live/api/v1/web/tenants/getalltenants?applocationid=1&status=Active&pageno=1&pagesize=10", "description": "Get all active tenants catalog (Web)" },
{ "name": "Get outlet locations assigned to a tenant (Web)", "method": "GET", "url": "/live/api/v1/web/tenants/gettenantlocations?tenantid=8", "description": "Get outlet locations assigned to a tenant (Web)" },
{ "name": "Retrieve delivery time slots config (Mobile)", "method": "GET", "url": "/live/api/v1/mob/tenants/gettenantslot", "description": "Retrieve delivery time slots config (Mobile)" },
{ "name": "Search tenants by keyword (Mobile)", "method": "GET", "url": "/live/api/v1/mob/tenants/searchbykeyword?keyword=grocery", "description": "Search tenants by keyword (Mobile)" },
{ "name": "Retrieve tenants associated with a customer (Mobile)", "method": "GET", "url": "/live/api/v1/mob/tenants/getcustomertenants?customerid=4082&tenant=0", "description": "Retrieve tenants associated with a customer (Mobile)" },
{ "name": "Get outlet locations linked to a tenant (Mobile)", "method": "GET", "url": "/live/api/v1/mob/tenants/gettenantlocations?tenantid=8", "description": "Get outlet locations linked to a tenant (Mobile)" },
{ "name": "Get logistics pricing slabs for a tenant (Mobile)", "method": "GET", "url": "/live/api/v1/mob/tenants/gettenantpricing?tenantid=8&applocationid=1", "description": "Get logistics pricing slabs for a tenant (Mobile)" },
{ "name": "Get staff members under a tenant store (Mobile)", "method": "GET", "url": "/live/api/v1/mob/tenants/getstaffs?tenantid=8", "description": "Get staff members under a tenant store (Mobile)" },
{ "name": "Get tenant detailed profile info (Mobile)", "method": "GET", "url": "/live/api/v1/mob/tenants/gettenantinfo?tenantid=8&locationid=2", "description": "Get tenant detailed profile info (Mobile)" },
{ "name": "Link Customer Profile to Tenant Store", "method": "POST", "url": "/live/api/v1/web/tenants/createtenantcustomer", "description": "Link Customer Profile to Tenant Store", "body": { "moduleid": 1, "tenantid": 8, "locationid": 2, "customerid": 4082, "customerlocationid": 554, "status": 1 } },
{ "name": "Create New Geofenced Store Location", "method": "POST", "url": "/live/api/v1/web/tenants/createlocation", "description": "Create New Geofenced Store Location", "body": { "tenantid": 8, "applocationid": 1, "moduleid": 1, "locationname": "Hawthorn Daily Fresh Store", "email": "hawthorn.store@merchant.com", "contactno": "399443322", "latitude": "-37.8222", "longitude": "145.0384", "address": "12 Glenferrie Rd", "suburb": "Hawthorn", "city": "Melbourne", "state": "VIC", "postcode": "3122", "opentime": "07:00:00", "closetime": "22:00:00", "partnerid": 1, "deliveryradius": 5000, "deliverymins": 30, "cancelsecs": 60, "status": "Active" } },
{ "name": "Update Store Location Configurations", "method": "PUT", "url": "/live/api/v1/web/tenants/updatelocation", "description": "Update Store Location Configurations", "body": { "locationid": 2, "tenantid": 8, "applocationid": 1, "locationname": "Richmond Daily Fresh Store", "email": "richmond.store@merchant.com", "contactno": "399887766", "latitude": "-37.8212", "longitude": "144.9984", "address": "Shop 4, 100 Church St", "suburb": "Richmond", "city": "Melbourne", "state": "VIC", "postcode": "3121", "opentime": "07:00:00", "closetime": "22:00:00", "deliveryradius": 8000, "deliverymins": 45, "cancelsecs": 120, "status": "Active" } },
{ "name": "Onboard New Tenant & Admin Profile", "method": "POST", "url": "/live/api/v1/mob/tenants/createtenantuser", "description": "Onboard New Tenant & Admin Profile (Joint Creation)", "body": { "tenantname": "Fresh Organic Greens", "configid": 1, "partnerid": 1, "moduleid": 1, "tenanttype": "Enterprise", "firstname": "Arthur", "primaryemail": "arthur@organicgreens.com", "primarycontact": "488999000", "categoryid": 2, "subcategoryid": 12, "address": "400 Chapel St", "suburb": "South Yarra", "city": "Melbourne", "state": "VIC", "postcode": "3141", "applocationid": 1, "approved": 1, "status": "Active" } }
]
},
{
"id": "customers",
"name": "Customers",
"description": "Customer accounts, addresses, support requests, and search.",
"endpoints": [
{ "name": "Fetch customer profile by ID or Contact (Mobile)", "method": "GET", "url": "/live/api/v1/mob/customers/getbyid?customerid=4082&contactno=9876543210", "description": "Fetch customer profile by ID or Contact (Mobile)" },
{ "name": "Get customer saved address locations (Mobile)", "method": "GET", "url": "/live/api/v1/mob/customers/getcustomerlocation?customerid=4082", "description": "Get customer saved address locations (Mobile)" },
{ "name": "Get customer logged support requests (Mobile)", "method": "GET", "url": "/live/api/v1/mob/customers/getcustomerrequests?customerid=4082&pageno=1&pagesize=10", "description": "Get customer logged support requests (Mobile)" },
{ "name": "Search customer names under a tenant (Mobile)", "method": "GET", "url": "/live/api/v1/mob/customers/search?keyword=Jane&tenantid=8", "description": "Search customer names under a tenant (Mobile)" },
{ "name": "Retrieve customers linked to a tenant location (Mobile)", "method": "GET", "url": "/live/api/v1/mob/customers/gettenantcustomers?tenantid=8&locationid=2&pageno=1&pagesize=10", "description": "Retrieve customers linked to a tenant location (Mobile)" },
{ "name": "Retrieve merchant customers list (Web)", "method": "GET", "url": "/live/api/v1/web/customers/gettenantcustomers?tenantid=8&locationid=2&pageno=1&pagesize=10&keyword=jane", "description": "Retrieve merchant customers list (Web)" },
{ "name": "Individual consumer invoice histories (Web)", "method": "GET", "url": "/live/api/v1/web/orders/customer/getorders?customerid=4082&status=delivered&pageno=1&pagesize=10", "description": "Individual consumer invoice histories (Web)" },
{ "name": "Passwordless OTP Login (via Phone)", "method": "POST", "url": "/live/api/v1/mob/customers/login", "description": "Passwordless OTP Login (via Phone)", "body": { "contactno": "0499888777" } },
{ "name": "Register Customer Account", "method": "POST", "url": "/live/api/v1/mob/customers/create", "description": "Register Customer Account", "body": { "firstname": "Jane", "lastname": "Smith", "gender": "Female", "dob": "1994-11-20", "dialcode": "+61", "contactno": "499888777", "email": "jane.smith@gmail.com", "deviceid": "uuid_7728b991a", "devicetype": "ios", "authmode": 1, "address": "456 Oak Avenue", "suburb": "Richmond", "city": "Melbourne", "state": "VIC", "postcode": "3121", "latitude": "-37.8212", "longitude": "144.9984", "applocationid": 1, "status": 1 } },
{ "name": "Save New Geofenced Location Address", "method": "POST", "url": "/live/api/v1/mob/customers/createlocations", "description": "Save New Geofenced Location Address", "body": { "customerid": 4082, "address": "123 High Street", "suburb": "Prahran", "city": "Melbourne", "state": "VIC", "postcode": "3181", "latitude": "-37.8502", "longitude": "144.9924", "primaryaddress": 1, "status": 1 } },
{ "name": "Log Customer Support Ticket Request", "method": "POST", "url": "/live/api/v1/mob/customers/createcustomerrequest", "description": "Log Customer Support Ticket Request", "body": { "customerid": 4082, "tenantid": 8, "apptypeid": 1, "locationid": 2, "subject": "Delay in Morning Milk Delivery", "remarks": "Order scheduled for 7:00 AM hasn't arrived.", "status": 1 } },
{ "name": "Update Customer Profile Details", "method": "PUT", "url": "/live/api/v1/mob/customers/update", "description": "Update Customer Profile Details", "body": { "customerid": 4082, "firstname": "Jane", "lastname": "Miller", "email": "jane.miller@gmail.com", "contactno": "499888777", "status": 1 } }
]
},
{
"id": "deliveries",
"name": "Deliveries",
"description": "Delivery dispatch, queues, summaries, and rider status tracking.",
"endpoints": [
{ "name": "Get deliveries performance summaries (Web)", "method": "GET", "url": "/live/api/v1/web/deliveries/deliverysummary?tenantid=8&partnerid=1&userid=12&applocationid=1&locationid=2&fromdate=2026-05-20&todate=2026-05-20", "description": "Get deliveries performance summaries (Web)" },
{ "name": "Get daily delivery insights (Web)", "method": "GET", "url": "/live/api/v1/web/deliveries/getdeliveryinsight?tenantid=8", "description": "Get daily delivery insights (Web)" },
{ "name": "Get location deliveries summary (Web)", "method": "GET", "url": "/live/api/v1/web/deliveries/getlocationsummary?tenantid=8", "description": "Get location deliveries summary (Web)" },
{ "name": "Get deliveries financial report summary (Web)", "method": "GET", "url": "/live/api/v1/web/deliveries/getreportsummary?tenantid=8&partnerid=1&userid=12&applocationid=1&fromdate=2026-05-01&todate=2026-05-20", "description": "Get deliveries financial report summary (Web)" },
{ "name": "Get fleet rider summary metrics (Web)", "method": "GET", "url": "/live/api/v1/web/deliveries/getridersummary?applocationid=1&partnerid=1&tenantid=8&fromdate=2026-05-20&todate=2026-05-20", "description": "Get fleet rider summary metrics (Web)" },
{ "name": "Get master deliveries board (Web)", "method": "GET", "url": "/live/api/v1/web/deliveries/getdeliveries?tenantid=8&fromdate=2026-05-20&todate=2026-05-20", "description": "Get master deliveries board (Web)" },
{ "name": "Get mobile dispatch summaries (Mobile)", "method": "GET", "url": "/live/api/v1/mob/deliveries/deliverysummary?userid=15&fromdate=2026-05-20&todate=2026-05-20", "description": "Get mobile dispatch summaries (Mobile)" },
{ "name": "Get mobile deliveries board (Mobile)", "method": "GET", "url": "/live/api/v1/mob/deliveries/getdeliveries?userid=15&status=assigned", "description": "Get mobile deliveries board (Mobile)" },
{ "name": "Fetch rider active shift deliveries queue (Mobile)", "method": "GET", "url": "/live/api/v1/mob/deliveries/getdeliveryqueues?userid=15&fromdate=2026-05-20&todate=2026-05-20", "description": "Fetch rider active shift deliveries queue (Mobile)" },
{ "name": "Initialize Logistics Delivery Dispatch (Assign Rider)", "method": "POST", "url": "/live/api/v1/web/deliveries/createdeliveries", "description": "Initialize Logistics Delivery Dispatch", "body": [{ "orderheaderid": 2100, "applocationid": 1, "partnerid": 1, "tenantid": 8, "moduleid": 1, "locationid": 2, "userid": 15, "orderid": "ORD-19028-4", "deliverydate": "2026-05-20", "orderstatus": "assigned", "assigntime": "2026-05-20 12:10:00", "itemcount": 2, "orderamount": 12.58, "customerid": 4082, "pickupcustomer": "Central Merchant Warehouse", "pickupcontactno": "987654321", "pickuplocationid": 2, "pickupaddress": "Shop 4, Central Plaza, Melbourne", "pickuplat": "-37.8136", "pickuplon": "144.9631", "deliverycustomerid": 4082, "deliverylocationid": 554, "deliverycustomer": "Jane Smith", "deliverycontactno": "499888777", "deliveryaddress": "456 Oak Avenue, Richmond, VIC, 3121", "droplat": "-37.8212", "droplon": "144.9984", "deliverycharges": 3, "deliveryamt": 15.58, "deliverytype": "standard", "paymenttype": 1 }] },
{ "name": "Update Rider Pickup Status", "method": "PUT", "url": "/live/api/v1/web/deliveries/updatedelivery", "description": "Update Rider Pickup Status", "body": { "deliveryid": 8871, "orderheaderid": 2100, "userid": 15, "orderstatus": "picked", "pickuptime": "2026-05-20 12:20:00", "riderslat": "-37.8140", "riderslon": "144.9640" } },
{ "name": "Rider Update Dispatch Status (Delivered)", "method": "PUT", "url": "/live/api/v1/mob/deliveries/updatedelivery", "description": "Rider Update Dispatch Status (Delivered & GPS Tracking)", "body": { "deliveryid": 8871, "orderheaderid": 2100, "userid": 15, "orderstatus": "delivered", "deliverytime": "2026-05-20 12:45:00", "riderslat": "-37.8210", "riderslon": "144.9980", "actualkms": "4.2", "feedback": "Handed over safely.", "smsdelivery": 1 } }
]
},
{
"id": "orders",
"name": "Orders",
"description": "Order boards, details, summaries, and status management.",
"endpoints": [
{ "name": "Filtered dynamic orders board (Web)", "method": "GET", "url": "/live/api/v1/web/orders/getorders?tenantid=8&locationid=2&status=processing&pageno=1&pagesize=10", "description": "Filtered dynamic orders board (Web)" },
{ "name": "System Admin orders board (Web)", "method": "GET", "url": "/live/api/v1/web/orders/admin/getorders?applocationid=1&status=processing&pageno=1&pagesize=10", "description": "System Admin orders board (Web)" },
{ "name": "Get order dashboard stats summary (Web)", "method": "GET", "url": "/live/api/v1/web/orders/getordersummary?tenantid=8&fromdate=2026-05-01&todate=2026-05-20", "description": "Get order dashboard stats summary (Web)" },
{ "name": "Get location orders summary (Web)", "method": "GET", "url": "/live/api/v1/web/orders/getlocationsummary?tenantid=8", "description": "Get location orders summary (Web)" },
{ "name": "Get annual orders insights analytics (Web)", "method": "GET", "url": "/live/api/v1/web/orders/getorderinsight?tenantid=8", "description": "Get annual orders insights analytics (Web)" },
{ "name": "Get order detailed lines (Web)", "method": "GET", "url": "/live/api/v1/web/orders/getorderdetails?orderheaderid=2099", "description": "Get order detailed lines (Web)" },
{ "name": "Get customer order history (Mobile)", "method": "GET", "url": "/live/api/v1/mob/orders/getcustomerorders?customerid=4082&pageno=1&pagesize=10", "description": "Get customer order history (Mobile)" },
{ "name": "Get mobile order detailed lines (Mobile)", "method": "GET", "url": "/live/api/v1/mob/orders/getorderdetails?orderheaderid=2099", "description": "Get mobile order detailed lines (Mobile)" },
{ "name": "Create New Web Order", "method": "POST", "url": "/live/api/v1/web/orders/createorder", "description": "Create New Web Order (Flat JSON Format)", "body": { "tenantid": 8, "locationid": 2, "applocationid": 1, "moduleid": 1, "customerid": 4082, "orderstatus": "pending", "deliverytype": "standard", "deliverytime": "2026-05-20 18:00:00", "pickupaddress": "Shop 4, Central Plaza, Melbourne", "pickuplat": "-37.8136", "pickuplong": "144.9631", "pickupcustomer": "Central Plaza Merchant", "pickupcontactno": "399887766", "deliveryaddress": "Apt 4B, Sunset Boulevard, Richmond", "deliverylat": "-37.8212", "deliverylong": "144.9984", "orderamount": 11.48, "taxamount": 1.1, "ordervalue": 12.58, "itemcount": 2, "paymenttype": 1, "paymentstatus": 0, "deliverycharge": 3, "items": [{ "productid": 105, "productname": "Organic Whole Milk 1L", "orderqty": 2, "price": 3.99, "taxpercentage": 10, "taxamount": 0.8, "productsumprice": 7.98 }] } },
{ "name": "Update Order Status & Financial Flag", "method": "PUT", "url": "/live/api/v1/web/orders/updateorder", "description": "Update Order Status & Financial Flag", "body": { "orderheaderid": 2099, "orderstatus": "ready", "paymentstatus": 1, "remarks": "Order packed and waiting for rider assignment." } },
{ "name": "Create Mobile Order", "method": "POST", "url": "/live/api/v1/mob/orders/createorder", "description": "Create Mobile Order (Wrapped JSON Format)", "body": { "orders": { "tenantid": 8, "locationid": 2, "applocationid": 1, "moduleid": 1, "customerid": 4082, "orderstatus": "pending", "deliverytype": "standard", "deliverytime": "2026-05-20 18:00:00", "pickupaddress": "Shop 4, Central Plaza, Melbourne", "orderamount": 11.48, "taxamount": 1.1, "ordervalue": 12.58, "itemcount": 2, "paymenttype": 1, "paymentstatus": 0, "deliverycharge": 3, "items": [{ "productid": 105, "productname": "Organic Whole Milk 1L", "orderqty": 2, "price": 3.99, "taxpercentage": 10, "taxamount": 0.8, "productsumprice": 7.98 }] } } },
{ "name": "Mobile Update Order Status", "method": "PUT", "url": "/live/api/v1/mob/orders/updateorder", "description": "Mobile Update Order Status", "body": { "orderheaderid": 2099, "orderstatus": "ready", "paymentstatus": 1, "remarks": "Order packed and waiting for rider assignment." } }
]
},
{
"id": "products",
"name": "Products",
"description": "Product catalog, stock management, variants, and outlet inventory.",
"endpoints": [
{ "name": "Get product subcategories (Web)", "method": "GET", "url": "/live/api/v1/web/products/getproductsubcategories?categoryid=2&tenantid=8", "description": "Get product subcategories (Web)" },
{ "name": "Get products stock counts (Web)", "method": "GET", "url": "/live/api/v1/web/products/getproductscount?tenantid=8&categoryid=2&subcategoryid=12&approve=1", "description": "Get products stock counts (Web)" },
{ "name": "Get all global categories (Web)", "method": "GET", "url": "/live/api/v1/web/products/getproductcategories", "description": "Get all global categories (Web)" },
{ "name": "Get specific product variants (Web)", "method": "GET", "url": "/live/api/v1/web/products/getproductvariants?tenantid=8&subcategoryid=12", "description": "Get specific product variants (Web)" },
{ "name": "Get master catalog listings (Web)", "method": "GET", "url": "/live/api/v1/web/products/getcatalougeproducts?tenantid=8&locationid=2&subcategoryid=12&keyword=&pageno=1&pagesize=10", "description": "Get master catalog listings (Web)" },
{ "name": "Get live stocks catalog (Web)", "method": "GET", "url": "/live/api/v1/web/products/getproductstocks?tenantid=8&locationid=2", "description": "Get live stocks catalog (Web)" },
{ "name": "Get dynamic stock statement ledger (Web)", "method": "GET", "url": "/live/api/v1/web/products/getstockstatement?tenantid=8&locationid=2&subcategoryid=12&pageno=1&pagesize=10&keyword=", "description": "Get dynamic stock statement ledger (Web)" },
{ "name": "Get outlet geofenced inventory (Web)", "method": "GET", "url": "/live/api/v1/web/products/getlocationproducts?tenantid=8&locationid=2&subcategoryid=12&pageno=1&pagesize=10", "description": "Get outlet geofenced inventory (Web)" },
{ "name": "Master products search board (Web)", "method": "GET", "url": "/live/api/v1/web/products/getallproducts?tenantid=8&locationid=2&keyword=milk&pageno=1&pagesize=10", "description": "Master products search board (Web)" },
{ "name": "Get product details by variant ID (Mobile)", "method": "GET", "url": "/live/api/v1/mob/products/getproductbyvariant?tenantid=8&variantid=4", "description": "Get product details by variant ID (Mobile)" },
{ "name": "Get product subcategories (Mobile)", "method": "GET", "url": "/live/api/v1/mob/products/getproductsubcategories?categoryid=2&tenantid=8", "description": "Get product subcategories (Mobile)" },
{ "name": "Search product catalog (Mobile)", "method": "GET", "url": "/live/api/v1/mob/products/getallproducts?keyword=milk&pageno=1&pagesize=10", "description": "Search product catalog (Mobile)" },
{ "name": "Get mobile geofenced outlet products (Mobile)", "method": "GET", "url": "/live/api/v1/mob/products/getlocationproducts?tenantid=8&locationid=2&pageno=1&pagesize=20", "description": "Get mobile geofenced outlet products (Mobile)" },
{ "name": "Add Multi-Product Stock Entry", "method": "POST", "url": "/live/api/v1/web/products/createproductstock", "description": "Add Multi-Product Stock Entry", "body": [{ "tenantid": 8, "locationid": 2, "productid": 105, "quantity": 150, "stocktype": "credit", "status": "active" }, { "tenantid": 8, "locationid": 2, "productid": 109, "quantity": 80, "stocktype": "credit", "status": "active" }] },
{ "name": "Create Master Product Catalog Item", "method": "POST", "url": "/live/api/v1/web/products/create", "description": "Create Master Product Catalog Item", "body": { "applocationid": 1, "tenantid": 8, "categoryid": 2, "subcategoryid": 12, "productname": "Fresh Cow Milk 1L", "productunit": "Litre", "unitvalue": "1", "productcost": 1.8, "retailprice": 3.5, "taxpercent": 5, "productstock": 100, "productstatus": "available", "approve": 1 } },
{ "name": "Update Master Product Details", "method": "PUT", "url": "/live/api/v1/web/products/update", "description": "Update Master Product Details", "body": { "productid": 105, "productname": "Organic Farm Cow Milk 1L", "productcost": 1.95, "retailprice": 3.75, "productstock": 120, "productstatus": "available" } },
{ "name": "Purge Master Product Catalog Entry", "method": "DELETE", "url": "/live/api/v1/web/products/delete?productid=105", "description": "Purge Master Product Catalog Entry" }
]
},
{
"id": "invoice",
"name": "Invoice",
"description": "Invoice insights and billing analytics.",
"endpoints": [
{ "name": "Get invoice insights for a tenant", "method": "GET", "url": "/live/api/v1/web/invoice/getinvoiceinsight?tenantid=8", "description": "Retrieve invoice insights and statistics for a tenant." }
]
},
{
"id": "payments",
"name": "Payments",
"description": "Payment requests and settlement records.",
"endpoints": [
{ "name": "Get payment requests for a partner", "method": "GET", "url": "/live/api/v1/web/payments/requests/getpaymentrequest?partnerid=44&status=1", "description": "List payment requests for a partner by status." }
]
}
];

26
src/lib/highlight.js Normal file
View File

@@ -0,0 +1,26 @@
const TOKEN = /("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+\-]?\d+)?)/g
function escapeHtml(s) {
return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
}
export function highlightJSON(value) {
let text
try {
text = JSON.stringify(value, null, 2)
} catch {
text = String(value)
}
if (typeof text !== 'string') text = String(text)
return escapeHtml(text).replace(TOKEN, (match) => {
let cls = 'text-amber-300'
if (/^"/.test(match)) {
cls = /:$/.test(match) ? 'text-sky-300' : 'text-emerald-300'
} else if (match === 'true' || match === 'false') {
cls = 'text-violet-300'
} else if (match === 'null') {
cls = 'text-rose-300'
}
return `<span class="${cls}">${match}</span>`
})
}

39
test_portal.py Normal file
View File

@@ -0,0 +1,39 @@
import urllib.request
import urllib.error
import time
URL = "https://developer.nearledaily.com/"
def test_portal():
print(f"Testing connectivity to {URL}...\n")
try:
start_time = time.time()
# Send a standard GET request with a user-agent
req = urllib.request.Request(URL, headers={'User-Agent': 'Mozilla/5.0'})
with urllib.request.urlopen(req) as response:
status_code = response.getcode()
html = response.read().decode('utf-8')
duration = round((time.time() - start_time) * 1000, 2)
if status_code == 200:
print(f"[SUCCESS] Server responded with HTTP 200 OK in {duration}ms!")
# Check for specific title tags or branding we added
if "NearleDaily API" in html or "nearledaily-docs" in html.lower() or "nearledaily" in html.lower():
print("[SUCCESS] Found NearleDaily branding in the page HTML. The app is serving the correct files!")
else:
print("[WARNING] Server responded with 200 OK, but couldn't find the expected React app HTML.")
else:
print(f"[ERROR] Server responded with unexpected status code: {status_code}")
except urllib.error.HTTPError as e:
print(f"[HTTP ERROR] The server responded, but returned an error status code: {e.code}")
except urllib.error.URLError as e:
print(f"[NETWORK ERROR] Failed to reach the server. Reason: {e.reason}")
print("Hint: If you just changed the DNS or Coolify port, wait a minute for it to apply/propagate.")
except Exception as e:
print(f"[UNEXPECTED ERROR] {str(e)}")
if __name__ == "__main__":
test_portal()