@inploi/plugin-job-search 0.2.0 → 0.3.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.
@@ -1,3 +1,4 @@
1
+ import { getJobSearchResults } from './job-search.api.ts';
1
2
  import { IconName } from './components/icon.tsx';
2
3
  import { HintedString } from './lib/type-utils.ts';
3
4
  type FontSettings = {
@@ -72,11 +73,25 @@ export type JobSearchPluginParams = {
72
73
  infoTags: DisplayableFilterProperty[];
73
74
  };
74
75
  };
76
+ export interface SSRJobSearchPluginParams extends JobSearchPluginParams {
77
+ /** If true, the data needed to display the first page of results
78
+ * will be fetched from the server. This is recommended if SEO is important
79
+ * or you want your page to be progressively enhanced. */
80
+ withData: boolean;
81
+ }
82
+ export interface CSRJobSearchPluginParams extends JobSearchPluginParams {
83
+ /** When provided with initial data, the client side bundle will hydrate
84
+ * the already present SSR content, avoiding any loading.
85
+ */
86
+ initialData?: {
87
+ jobs: Awaited<ReturnType<typeof getJobSearchResults>>;
88
+ };
89
+ }
75
90
  export declare const createJobSearchDomManager: () => {
76
91
  getRenderTargetElement: () => Element;
77
92
  };
78
93
  export type ChatbotDomManager = ReturnType<typeof createJobSearchDomManager>;
79
- export declare const jobSearchPlugin: (params: JobSearchPluginParams) => ({ apiClient, logger, analytics }: {
94
+ export declare const jobSearchPlugin: () => ({ apiClient, logger, analytics }: {
80
95
  apiClient: import("@inploi/sdk").ApiClient;
81
96
  logger: import("@inploi/sdk").Logger;
82
97
  analytics: import("@inploi/sdk").AnalyticsService;
@@ -84,8 +99,65 @@ export declare const jobSearchPlugin: (params: JobSearchPluginParams) => ({ apiC
84
99
  /** Returns a string with the initial rendering state of the UI.
85
100
  * Useful when server-side rendering to avoid CLS.
86
101
  */
87
- renderToString: () => string;
102
+ prerender: (params: SSRJobSearchPluginParams) => Promise<{
103
+ html: string;
104
+ data: {
105
+ jobs: {
106
+ pagination: {
107
+ total: number;
108
+ current_page: number;
109
+ per_page: number;
110
+ last_page: number;
111
+ };
112
+ results: {
113
+ raw: {
114
+ id: number;
115
+ company_name: string;
116
+ employment_type: string;
117
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
118
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
119
+ pay_currency: string;
120
+ pay_mask: boolean;
121
+ pay_display: boolean;
122
+ pay: string | null;
123
+ pay_min: string | null;
124
+ pay_max: string | null;
125
+ description: string;
126
+ title: string;
127
+ contract_type: string | null;
128
+ created_at: string | null;
129
+ custom_data: {
130
+ [x: string]: any;
131
+ } | null;
132
+ href: string;
133
+ industry?: string | undefined;
134
+ category?: string | undefined;
135
+ skills?: string | undefined;
136
+ town?: string | undefined;
137
+ city?: string | undefined;
138
+ country?: string | undefined;
139
+ };
140
+ id: number;
141
+ isNew: boolean;
142
+ company: {
143
+ name: string;
144
+ };
145
+ employmentType: string;
146
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
147
+ pay: string | undefined;
148
+ description: string;
149
+ title: string;
150
+ contractType: string | null;
151
+ href: string;
152
+ relativePostedDate: string;
153
+ customData: {
154
+ [x: string]: any;
155
+ } | null;
156
+ }[];
157
+ };
158
+ } | undefined;
159
+ }>;
88
160
  /** Renders the Job Search Plugin inside the container element. */
89
- render: () => Promise<void>;
161
+ render: (params: CSRJobSearchPluginParams) => Promise<void>;
90
162
  };
91
163
  export {};