@wayke-se/components-react 5.0.2 → 5.1.0-beta.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 CHANGED
@@ -167,6 +167,7 @@ const App = ({}) => {
167
167
  | onClickSearchItem | function | false | (id: string) => void |
168
168
  | modifyDocumentTitleItem | boolean | false | |
169
169
  | displayBranchName | boolean | false | |
170
+ | conversionOptions | ConversionOption[] | false | See [Conversion options](#conversion-options) |
170
171
 
171
172
  * Required
172
173
  * `id` - Guid that represents a vehicle.
@@ -179,6 +180,7 @@ const App = ({}) => {
179
180
  * `onClickSearchItem` - Function that can be provided that will be triggered once a item is clicked.
180
181
  * `modifyDocumentTitleItem` - Update document title with vehicle data
181
182
  * `displayBranchName` - Displays branch name on related product cards and using branch name in presentation of where the vehicle exist
183
+ * `conversionOptions` - Which call-to-action buttons to render on the item page, and in which order. See [Conversion options](#conversion-options).
182
184
 
183
185
  ### WaykeSearch
184
186
  | Property | Type | Values |
@@ -208,6 +210,55 @@ const App = ({}) => {
208
210
  * `modifyDocumentTitleSearch` - Set custom document title
209
211
  * `displayBranchName` - Displays branch name on product cards
210
212
 
213
+ ### Conversion options
214
+ The buttons in the item page sidebar ("Buy online", "Show email address", ...) are controlled by `conversionOptions`.
215
+ Options are rendered in array order. An option is skipped when the vehicle lacks what it needs (no e-commerce, no email, no phone number, no branch).
216
+
217
+ ```javascript
218
+ <WaykeComposite
219
+ composite={{
220
+ conversionOptions: [
221
+ { type: 'leadMessage' },
222
+ { type: 'leadCallMe' },
223
+ { type: 'ecom' },
224
+ { type: 'phone' },
225
+ // Omit 'email' to hide "Show email address" entirely
226
+ ],
227
+ }}
228
+ provider={ProviderSettings}
229
+ />
230
+ ```
231
+
232
+ | type | Button | Default style | Requires |
233
+ |---------------|--------------------------|---------------|---------------------------------------|
234
+ | `ecom` | Buy online | primary | Vehicle with e-commerce enabled |
235
+ | `leadMessage` | Send message (form) | primary | Vehicle connected to a branch |
236
+ | `leadCallMe` | Get a callback (form) | primary | Vehicle connected to a branch |
237
+ | `email` | Show email address | secondary | Branch or contact with email |
238
+ | `phone` | Show phone number | secondary | Branch or contact with phone number |
239
+
240
+ Default when `conversionOptions` is not set: `[{ type: 'ecom' }, { type: 'email' }, { type: 'phone' }]`.
241
+
242
+ Every option accepts:
243
+ * `name` - Custom button label. Defaults to the translated label for the type.
244
+ * `primary` - `true` renders a primary button, `false` a secondary one.
245
+
246
+ `leadMessage` and `leadCallMe` open a form and post the lead to Wayke, where it ends up in Wayke Dealer for the branch that owns the vehicle. The lead is tagged with the hostname of the page it was sent from (`source`), the button used (`sourceMechanism`: `cta.email` or `cta.callme`) and this package (`client`: `components-react`, `clientVersion`).
247
+
248
+ `email` opens the visitor's mail client with a pre-populated subject and body so the dealer can tell where the request came from:
249
+ > `<hostname> – I'm interested in <reg no>, <make> <model>`
250
+
251
+ Both can be customized, as a string or a function of the vehicle:
252
+ ```javascript
253
+ {
254
+ type: 'email',
255
+ subject: (vehicle) => `Inquiry from BMW.SE – ${vehicle.registrationNumber}`,
256
+ body: false, // omit body
257
+ }
258
+ ```
259
+
260
+ Events published along the way: `MailVisible`, `MailClick`, `PhonenumberVisible`, `PhonenumberCall`, `LeadOpen`, `LeadSent`. See [Subscribe to events](#subscribe-to-events).
261
+
211
262
  ### Notes on MarketCode
212
263
  `marketCode` defines what langugage that will be used (defaults to `SE` - Swedish). Other things that `marketCode` will effect:
213
264
  - `SE` will exclude the filter `odometerReadingValueInKm` and instead use `mileage`, while `NO` will do the opposite. The difference between the two filters are the unit used. For `odometerReadingValueInKm` the unit is kilometer, while `mileage` is kilometer/10 (Scandinavian miles)
@@ -355,6 +406,7 @@ WaykePubSub.unsubscribe(event);
355
406
  ### EventBase
356
407
  | eventName | callback | Data |
357
408
  |-----------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------|
409
+ | View | (data) => void | CallbackViewData |
358
410
  | HashRouteChange | (data) => void | CallbackHashRouteChangeData |
359
411
  | ItemClicked | (data) => void | CallbackItemData |
360
412
  | Ecom | (data) => void | CallbackEcomData |
@@ -363,6 +415,9 @@ WaykePubSub.unsubscribe(event);
363
415
  | PhonenumberVisible | (data) => void | CallbackItemData |
364
416
  | PhonenumberCall | (data) => void | CallbackItemData |
365
417
  | MailVisible | (data) => void | CallbackItemData |
418
+ | MailClick | (data) => void | CallbackItemData |
419
+ | LeadOpen | (data) => void | CallbackLeadData |
420
+ | LeadSent | (data) => void | CallbackLeadData |
366
421
  | InsuranceInterest | (data) => void | CallbackItemData |
367
422
  | InsuranceOpen | (data) => void | CallbackItemData |
368
423
  | InsuranceClose | (data) => void | CallbackItemData |
@@ -375,9 +430,17 @@ WaykePubSub.unsubscribe(event);
375
430
  | SearchCompleted | (data) => void | CallbackSearchCompletedData |
376
431
  | Search | (data) => void | CallbackSearchData |
377
432
  | FilterApply | (data) => void | CallbackFilterApplyData |
378
- | All | (eventName, data) => void | CallbackHashRouteChangeData \| CallbackEcomOnUserEventData \| CallbackItemData \| CallbackSearchClearQueryData \| CallbackSearchClearAllFiltersQueryData \| CallbackSearchInitiatedData \| CallbackSearchCompletedData \| CallbackSearchData \| CallbackFilterApplyData |
433
+ | All | (eventName, data) => void | CallbackViewData \| CallbackHashRouteChangeData \| CallbackEcomOnUserEventData \| CallbackItemData \| CallbackSearchClearQueryData \| CallbackSearchClearAllFiltersQueryData \| CallbackSearchInitiatedData \| CallbackSearchCompletedData \| CallbackSearchData \| CallbackFilterApplyData |
379
434
  * `All` - Subscribes to all events.
380
435
 
436
+ #### CallbackViewData
437
+ Published once when the search page or an item page is shown. Either of:
438
+
439
+ | Property | Type |
440
+ |-----------|---------------------|
441
+ | type | "search" \| "item" |
442
+ | id | string (item only) |
443
+
381
444
  #### CallbackHashRouteChangeData
382
445
  | Property | Type |
383
446
  |-----------|-----------|
@@ -390,6 +453,14 @@ WaykePubSub.unsubscribe(event);
390
453
  | branchName | string |
391
454
  | branchId | string |
392
455
 
456
+ #### CallbackLeadData
457
+ | Property | Type |
458
+ |---------------|----------------------|
459
+ | id | string |
460
+ | branchName | string |
461
+ | branchId | string |
462
+ | communication | "email" \| "callme" |
463
+
393
464
  #### CallbackEcomData
394
465
  | Property | Type |
395
466
  |---------------|-----------------------|