@inploi/plugin-job-search 9.0.8 → 9.1.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 +142 -0
- package/cdn/index.js +14 -14
- package/cdn/style.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +112 -3
- package/dist/index.d.ts +112 -3
- package/dist/index.js +211 -204
- package/dist/{job-search-C1jNeCI0.js → job-search-CI9kMPab.js} +3255 -2886
- package/dist/job-search-NaGE4ixy.cjs +44 -0
- package/dist/{map-BdK-wTC4.js → map-Cg3MSVPB.js} +2 -2
- package/dist/{map-CA2GQNlw.cjs → map-sXHS6vhg.cjs} +1 -1
- package/dist/{mapbox-gl-DU8p4eb-.js → mapbox-gl-B4QioMNv.js} +1 -1
- package/dist/{mapbox-gl-SSZZLm3u.cjs → mapbox-gl-DP29e0dp.cjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.cts +59 -2
- package/dist/utils.d.ts +59 -2
- package/dist/utils.js +1 -1
- package/package.json +3 -3
- package/dist/job-search-TQDgitmM.cjs +0 -44
package/README.md
CHANGED
|
@@ -75,3 +75,145 @@ MapLibre's cooperative-gesture hints use the plugin's `map_gesture_windows`, `ma
|
|
|
75
75
|
|
|
76
76
|
The dev harness uses the default renderer and hosted default style; browser tests intercept
|
|
77
77
|
`https://maps.inploi.com/**`. For local manual checks of the Mapbox renderer, use `?test_renderer=mapbox`.
|
|
78
|
+
|
|
79
|
+
## Search options
|
|
80
|
+
|
|
81
|
+
All parity options are opt in; existing hubs keep apply-on-change and API-provided filter values.
|
|
82
|
+
|
|
83
|
+
| Option | Type | Default | Behaviour |
|
|
84
|
+
| --------------------------- | -------------------------------------------------------------------------------------- | ---------- | -------------------------------------------------------------------------------- |
|
|
85
|
+
| `jobCard.accent` | `{ rules: { key: string; value: string; color: string }[]; style?: 'band' \| 'edge' }` | off | Decorative 4px top band or left edge from the first matching rule. |
|
|
86
|
+
| `jobCard.eyebrow` | `DisplayableFilterProperty` | none | Info text above the title, with the same transform support as subheading. |
|
|
87
|
+
| `savedJobs` | `{ enabled: boolean; showEntry?: boolean }` | off | Bookmark controls and a saved-only view. |
|
|
88
|
+
| `applyFiltersOn` | `'change' \| 'submit'` | `'change'` | With `'submit'`, stage keyword, filter and location edits until Search or Enter. |
|
|
89
|
+
| `properties[].pinnedValues` | `string[]` | none | Keep these values visible at zero without a keyword; never preselect them. |
|
|
90
|
+
|
|
91
|
+
With `applyFiltersOn: 'submit'`, a visible **Search** button applies the staged state. Facets follow edits,
|
|
92
|
+
using the existing debounced keyword and excluding the dropdown's own selection, so reopening Department does
|
|
93
|
+
not narrow its own counts. Results, `onStateChange` (including host URL updates), search analytics and the results
|
|
94
|
+
live region retain the applied state until Search or Enter. Reset clears staged edits and applies defaults
|
|
95
|
+
immediately, including a keyword still waiting for debounce. Sorting, paging and map navigation remain immediate;
|
|
96
|
+
map navigation also updates the staged geography so Search keeps the latest area.
|
|
97
|
+
|
|
98
|
+
For example, `{ key: 'category', label: 'Department', select: 'many', pinnedValues: ['Early Careers'] }`
|
|
99
|
+
adds an unselected **Early Careers (0)** when the API omits it and no keyword is applied to the facets. With a
|
|
100
|
+
keyword, a pin appears only with matches. Zero-count pins remain visible even with `results: 'only-available'`;
|
|
101
|
+
like other zero-count options, they are disabled. Existing API labels/counts win when a pinned value is present.
|
|
102
|
+
|
|
103
|
+
## Saved jobs (opt in)
|
|
104
|
+
|
|
105
|
+
Set `savedJobs: { enabled: true }` on `JobSearchPluginParams` to show a bookmark beside each job-card link.
|
|
106
|
+
Omitting it or setting `enabled: false` preserves the existing output. Register through `initialiseSdk` so the
|
|
107
|
+
plugin receives the tenant's publishable key. This also works with map cards.
|
|
108
|
+
|
|
109
|
+
When enabled, prerendered results show a loading state until hydration resolves the URL mode. The initial client
|
|
110
|
+
render uses the same state and resolves it before paint, so `?saved` never exposes ordinary search cards.
|
|
111
|
+
Server-rendered results remain unchanged when the option is off.
|
|
112
|
+
|
|
113
|
+
The secondary “Saved jobs” button opens the saved list and shows the saved count when nonzero.
|
|
114
|
+
Set `savedJobs.showEntry: false` to hide it when the host navigation already links to `?saved`; it defaults to true.
|
|
115
|
+
The saved view retains its “Your saved jobs” heading. The presence of the URL search parameter `saved` also opens it
|
|
116
|
+
(regardless of its value). It has no paging controls. Applying a search, resetting filters or “Search Jobs” leaves it;
|
|
117
|
+
other URL parameters and the fragment are preserved. Unticking the last saved job returns the full listing and
|
|
118
|
+
removes `saved`, returning focus to the saved-view control (or the widget when the entry is hidden).
|
|
119
|
+
Opening an empty saved view shows the “No saved jobs”
|
|
120
|
+
heading and “Search Jobs” button. Explicitly opening the saved view focuses its heading and cancels keyword edits
|
|
121
|
+
still waiting for debounce; it preserves already applied keywords, including short queries submitted with Enter.
|
|
122
|
+
A subsequent search leaves saved mode normally.
|
|
123
|
+
Removing a saved job moves focus to the next bookmark or Remove control, or the previous control at the end of a
|
|
124
|
+
nonempty list. If no control remains, focus moves to the heading before the full listing returns.
|
|
125
|
+
Saved IDs and jobs resolve before empty copy or results are shown. The result count is announced live.
|
|
126
|
+
|
|
127
|
+
The API layer loads exact IDs through the existing `GET /search/results` endpoint with `filters[id]`, in batches
|
|
128
|
+
of at most 100. It keeps the applied `custom_data.is_internal`, `segment_ids` and `segment_slugs` filters, including
|
|
129
|
+
explicit false values, so internal and segment views retain their API visibility context. It omits ordinary filters,
|
|
130
|
+
query, geography and locale grouping; the selected locale still formats card copy.
|
|
131
|
+
|
|
132
|
+
Search omissions do not delete bookmarks: an ID can be hidden in one view and available in another. After a
|
|
133
|
+
successful lookup, resolved jobs appear first in saved order, followed by a compact “No longer available” card
|
|
134
|
+
for each omitted ID, also in saved order. Each unavailable card has a Remove control that immediately removes
|
|
135
|
+
only that bookmark and logs `SAVE_JOB` with `saved: false`, through the same path as the bookmark control.
|
|
136
|
+
Removing the last unavailable card follows the same return-to-listing rule as unticking the last resolved job.
|
|
137
|
+
The live result count and `getSavedJobIds(scope).length` count every stored ID and match the cards shown.
|
|
138
|
+
Only an actually empty store shows “No saved jobs.” Network and non-2xx lookup failures show the error/retry
|
|
139
|
+
state instead of unavailable cards and retain all IDs. An omitted ID is never deleted without an explicit removal.
|
|
140
|
+
|
|
141
|
+
The package entry exports the store independently of the widget:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import {
|
|
145
|
+
getSavedJobIds,
|
|
146
|
+
getSavedJobsUrl,
|
|
147
|
+
isJobSaved,
|
|
148
|
+
subscribeSavedJobs,
|
|
149
|
+
toggleSavedJob,
|
|
150
|
+
} from '@inploi/plugin-job-search';
|
|
151
|
+
|
|
152
|
+
const scope = publishableKey; // the same key passed to initialiseSdk; never a visitor/analytics id
|
|
153
|
+
getSavedJobIds(scope); // number[] (a copy)
|
|
154
|
+
getSavedJobsUrl('https://example.com/careers#jobs'); // absolute saved-view URL
|
|
155
|
+
isJobSaved(scope, jobId); // boolean
|
|
156
|
+
toggleSavedJob(scope, jobId); // boolean: true means now saved
|
|
157
|
+
const unsubscribe = subscribeSavedJobs(scope, ids => updateCount(ids.length));
|
|
158
|
+
unsubscribe();
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Signatures: `getSavedJobIds(scope: string): number[]`, `isJobSaved(scope: string, id: number): boolean`,
|
|
162
|
+
`toggleSavedJob(scope: string, id: number): boolean`,
|
|
163
|
+
`subscribeSavedJobs(scope: string, cb: (ids: number[]) => void): () => void`.
|
|
164
|
+
Use `getSavedJobsUrl(hubUrl: string | URL): string` for navbar/job-page links; it preserves other params and the fragment.
|
|
165
|
+
The CDN exposes these same five functions under `window.inploi.savedJobs`. Subscribe to same-page and other-tab
|
|
166
|
+
changes; read the initial count separately. A job ID must be a positive safe integer. Server reads return `[]`
|
|
167
|
+
and server toggles return `false`, without browser storage.
|
|
168
|
+
|
|
169
|
+
Privacy: only a JSON array of numeric job IDs is stored, under `isdk-saved-jobs:<publishableKey>` in the host
|
|
170
|
+
origin's localStorage. Reads and subscriptions write nothing. The first explicit save creates the key; removing
|
|
171
|
+
the last job deletes it. It contains no titles, visitor/anonymous id or analytics linkage. Tenants have separate
|
|
172
|
+
keys. Storage denial falls back to memory for the current page session. Bookmarks are candidate-requested
|
|
173
|
+
functional storage, independent of analytics persistence.
|
|
174
|
+
|
|
175
|
+
Bookmark clicks call the injected `analytics.log({ event: 'SAVE_JOB', properties: { job_id, saved } })`, through
|
|
176
|
+
the same host-selected persistence/consent path as `SEARCH_JOB_CLICK`; they never open the link or log a job click.
|
|
177
|
+
The exported store itself sends no telemetry: a consuming job page owns any analytics it needs. The host owns
|
|
178
|
+
consent and SDK lifetime; the plugin adds no consent bypass. See the [SDK event catalogue](../sdk/README.md#event-catalogue-and-envelope).
|
|
179
|
+
|
|
180
|
+
Saved-jobs copy uses `terms`: `save_job` and `remove_saved_job` interpolate `{{title}}`;
|
|
181
|
+
`view_saved_jobs` (empty entry), `view_saved_jobs_count` (entry with `{{count}}`), `saved_jobs_title`,
|
|
182
|
+
`no_saved_jobs` and `search_jobs` control view copy; `saved_job_unavailable` labels unavailable cards, `remove` labels
|
|
183
|
+
their action, and `remove_unavailable_saved_job` interpolates `{{id}}` for its accessible name. `search` labels the
|
|
184
|
+
submit button. As with the plugin's other copy, the defaults are English; hosts provide translated `terms` (this package has no bundled locale dictionaries).
|
|
185
|
+
|
|
186
|
+
`SAVE_JOB` must not reach a live hub before the api `LogEventEnum` release.
|
|
187
|
+
|
|
188
|
+
## Card accents and eyebrow (opt in)
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
jobCard: {
|
|
192
|
+
subheading: { key: 'city' },
|
|
193
|
+
infoTags: [{ key: 'category' }, { key: 'custom_data.function_area' }],
|
|
194
|
+
eyebrow: { key: 'external_id' }, // e.g. 287583BR; transform is optional
|
|
195
|
+
accent: {
|
|
196
|
+
rules: [
|
|
197
|
+
{ key: 'custom_data.function_area', value: 'Digital', color: '#6246a8' },
|
|
198
|
+
{ key: 'category', value: 'Pharmacy', color: 'var(--healthcare)' },
|
|
199
|
+
],
|
|
200
|
+
style: 'band', // default; 'edge' draws the left edge instead
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Rules read dot-separated paths from the same raw job as subheading. Matching is exact and case-sensitive;
|
|
206
|
+
an array matches when any element equals the rule value. Rule order takes priority over array order.
|
|
207
|
+
The first matching rule sets `data-accent` to its value and `--ijs-card-accent` to its colour.
|
|
208
|
+
An invalid colour suppresses that match entirely, without trying later rules, and warns only in development.
|
|
209
|
+
Allowed colours are `#rgb`, `#rrggbb`, `#rrggbbaa`, numeric `rgb()`, `rgba()`, `hsl()`, `hsla()` or `oklch()`
|
|
210
|
+
(with percentages and optional alpha), and `var(--[a-z0-9-]+)` without a fallback. Hue must be a number;
|
|
211
|
+
comma-separated HSL requires percentage saturation/lightness, and comma-separated RGB requires three numbers
|
|
212
|
+
or three percentages. Space-separated forms allow the number/percentage channels defined by the
|
|
213
|
+
[CSS colour grammar](https://www.w3.org/TR/css-color-4/). Named colours, URLs,
|
|
214
|
+
CSS expressions and arbitrary CSS are rejected.
|
|
215
|
+
|
|
216
|
+
The accent is decorative and clipped inside the card's rounded corners. Keep its meaning visible in text,
|
|
217
|
+
for example through `infoTags` or `subheading`; colour must never be the only department label.
|
|
218
|
+
No matching rule adds no attribute, inline style or decoration. Omitting both options preserves the existing card.
|
|
219
|
+
The eyebrow uses the existing job-card info text style; it can read `external_id` when the API supplies it.
|