@igamingcareer/igaming-components 1.0.59 → 1.0.60

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.
Files changed (4) hide show
  1. package/Readme.md +32 -0
  2. package/dist/index.js +544 -544
  3. package/dist/index.mjs +8288 -8062
  4. package/package.json +1 -1
package/Readme.md CHANGED
@@ -104,3 +104,35 @@ The library can hydrate elements that carry specific classes or data attributes.
104
104
  4. Use additional class hooks such as `.group-prices-component`, `.hero-component`, `.courses-component`, `.chatbot-component`, `.faq-component`, `.videos-component`, `.testimonials-component`, and `.sliding-summary-component` to hydrate the corresponding widgets. Pass data through `data-*` attributes as illustrated in `src/main.tsx`.
105
105
 
106
106
  This approach allows teams that are not using React to embed the library’s UI on any HTML page while still benefiting from the React components under the hood.
107
+
108
+ ## Interaction events (Listing, Courses, News)
109
+
110
+ The Listing, IGamingCoursePage, and NewsPage components can now emit structured interaction events for analytics or logging. Supply an `onEmitEvent` callback and optional `eventContext` when you render the component (React or DOM embedding):
111
+
112
+ ```tsx
113
+ import { Listing } from "@igamingcareer/igaming-components"
114
+ import type { EmittedEvent } from "@igamingcareer/igaming-components"
115
+
116
+ const handleEvent = (event: EmittedEvent) => {
117
+ console.log("component event", event)
118
+ // Forward to your analytics/datastore
119
+ }
120
+
121
+ <Listing
122
+ apiUrl="/api/jobs"
123
+ filterKeys={["company", "city"]}
124
+ cardType="job"
125
+ onEmitEvent={handleEvent}
126
+ eventContext={{ route: "/jobs", source: "listing" }}
127
+ />
128
+ ```
129
+
130
+ All emitted events share the base shape `{ domain, name, payload, timestamp, context }` (see `src/types/events.ts`). Domain-specific unions live in `src/types/events.jobs.ts`, `src/types/events.courses.ts`, and `src/types/events.news.ts`.
131
+
132
+ Key events include:
133
+
134
+ - Jobs Listing: search submissions/removals, filter select/clear/all-clear, date changes, pagination, view mode, items per page, job open/save/apply, alerts/subscription steps.
135
+ - Courses Listing: search submissions, filter changes/clear, category/subcategory selection, view mode, pagination, items per page, favorites, enroll/open clicks.
136
+ - News Listing: search submissions/removals, filter select/clear/all-clear, date changes, category selection, pagination, view mode, items per page, article open/bookmark/share.
137
+
138
+ 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.