@igamingcareer/igaming-components 1.0.64 → 1.0.65
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 +27 -0
- package/dist/index.js +340 -340
- package/dist/index.mjs +7524 -7466
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -177,3 +177,30 @@ Key events include:
|
|
|
177
177
|
- News Listing: search submissions/removals, filter select/clear/all-clear, date changes, category selection, pagination, view mode, items per page, article open/bookmark/share.
|
|
178
178
|
|
|
179
179
|
When embedding via `renderMultiple` (see `src/main.tsx`), a global `window.IGC_EMIT_EVENT` handler will be passed automatically if present, along with a default context using the current route and optional `data-source` attribute.
|
|
180
|
+
|
|
181
|
+
## Job Listing pagination-friendly API responses
|
|
182
|
+
|
|
183
|
+
The `<Listing />` component now understands paginated API payloads. Set `apiProvidesPagination` (or the `data-api-pagination="true"` attribute when embedding) to tell the component your endpoint returns a `{ jobs: [], pagination: { page, limit, total, total_pages } }` envelope.
|
|
184
|
+
|
|
185
|
+
- The component requests page `1` with `limit` set to the initial `itemsPerPage` value, reads the `pagination.total`/`total_pages` metadata, and then sequentially loads every remaining page to build the full `jobs[]` in memory.
|
|
186
|
+
- While those pages are fetched, the UI stays in the loading state (using the first batch size for the skeleton), and once all pages are collected it serves the same client-side pagination experience as array-based responses.
|
|
187
|
+
- If the flag is omitted, the component assumes a plain array response and paginates client-side as before.
|
|
188
|
+
|
|
189
|
+
Example response shape:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"jobs": [/* job objects for the current page */],
|
|
194
|
+
"pagination": {
|
|
195
|
+
"page": 1,
|
|
196
|
+
"limit": 5,
|
|
197
|
+
"total": 2284,
|
|
198
|
+
"total_pages": 457
|
|
199
|
+
},
|
|
200
|
+
"metadata": {
|
|
201
|
+
"cache_hit": false
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
If your API still returns a plain array, leave `apiProvidesPagination` unset and the component will paginate client-side as before.
|