Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
<labels>
<fullName>PRODUCT_CONFIG_MESSAGES</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Messages</shortDescription>
<value>Messages</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_COVERAGES</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Coverages</shortDescription>
<value>Coverages</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_LOADING</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Loading</shortDescription>
<value>Loading</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_PRODUCT_CONFIGURATION</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Product Configuration</shortDescription>
<value>Product Configuration</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_TOGGLE_MESSAGES</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Toggle Messages</shortDescription>
<value>Toggle Messages</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_ERROR</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Error</shortDescription>
<value>Error</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_DETAILS</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Details</shortDescription>
<value>Details</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_SELECT_ITEM_MESSAGE</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Select Item Message</shortDescription>
<value>Select an item from the tree to see its details.</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_PRICE_SUMMARY</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Price Summary</shortDescription>
<value>Price Summary</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_INSTANT_PRICING</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Instant Pricing</shortDescription>
<value>Instance Pricing</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_UPDATE_PRICES</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Update Prices</shortDescription>
<value>Update Prices</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_TOTAL_PREMIUM</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Total Premium</shortDescription>
<value>Total Premium</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_TAXES_FEES_SURCHARGE</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Taxes Fees Surcharge</shortDescription>
<value>Taxes, Fees and Surcharge</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_PREMIUM</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Premium</shortDescription>
<value>Premium</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_ERROR_OCCURRED</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Error Occurred</shortDescription>
<value>An error occurred</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_INVALID_DATA_RECEIVED</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Invalid Data Received</shortDescription>
<value>Invalid data received</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_SELECT_COVERAGE_FIRST</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Select Coverage First</shortDescription>
<value>Please select the coverage first.</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_DELETE</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Delete</shortDescription>
<value>Delete</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_CONFIRM_DELETE</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Confirm Delete</shortDescription>
<value>Confirm Delete</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_DELETE_CONFIRMATION_MESSAGE</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Delete Confirmation Message</shortDescription>
<value>Are you sure you want to delete?</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_CANCEL</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Cancel</shortDescription>
<value>Cancel</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_CONFIRM</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Confirm</shortDescription>
<value>Confirm</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_REQUIRED_ATTRIBUTES_MSG</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Required Attributes Message</shortDescription>
<value>Complete the required fields.</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_NO_ATTRIBUTES_MSG</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>No Attributes Message</shortDescription>
<value>No attributes to show.</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_MULTI_VALUE_DECODER_MESSAGE</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Multi Value Decoder Message</shortDescription>
<value>Shows the value in the format</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_NEXT</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Next</shortDescription>
<value>Next</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_PREVIOUS</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Previous</shortDescription>
<value>Previous</value>
</labels>
<labels>
<fullName>PRODUCT_CONFIG_TAX_AMOUNT</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Tax Amount</shortDescription>
<value>Tax Amount</value>
</labels>
</CustomLabels>

117 changes: 117 additions & 0 deletions osComponents/ProductConfiguration/lwc/productConfiguration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Product Configuration Lightning Web Component

## Overview

The `productConfiguration` Lightning Web Component (LWC) is designed for Digital Insurance Product Configuration workflows. It extends `OmniscriptBaseMixin` to integrate seamlessly with OmniScripts, and makes it easy for users to view, configure, and rate insurance products.

---

## Dependencies

- **Apex Controller**: `InsuranceRatingApexService.postRatingFromLwc`
- **Apex Controller**: `InsuranceRatingApexService.patchRatingFromLwc`
- **Mixin**: `c/omniscriptBaseMixin` (follow the steps under [Prerequisites](../../../README.md#prerequisites))
- **Helper Modules**:
- `dataManager.js` – Tree building and grid transformation utilities
- `labelsAndConstants.js` – Validation messages, labels, and constants

## Components Included

| Component | Description |
| :---- | :---- |
| `productConfiguration` | Main component for displaying, configuring and rating insurance products.|
| `productConfigurationMessageItem` | Notification component used to display validation results, configuration errors, or informational messages within the product.|

### Supporting Files

| File | Type | Description |
| :---- | :---- | :---- |
| `InsuranceRatingApexService.cls` | Apex Class | Service class that wraps the createInsuranceRating and repriceInsuranceProduct invocable action.|
| `ProductConfigurationLabels.labels` | Custom Labels | UI text labels for translation support |

---

## Public Properties (`@api`)

| Property | Type | Default | Description |
| :---- | :---- | :---- | :---- |
| `additionalFields` | `Object` | `{}` | Additional fields to include in the rating request payload. |
| `clearStateOnPrev` | `Boolean/String` | — | When `true` or `'true'`, enables custom navigation buttons and clears state when navigating to the previous step. |
| `ratingInputs` | `Array` | `[]` | Array of rating input objects containing product configuration data. Supports reusable and non-reusable inputs with `instanceKeys`. |
| `ratingOptions` | `Object` | `{}` | Rating options passed to the API. Defaults `executePricing` and `executeConfigurationRules` to `true`. |
| `transactionType` | `String` | — | The transaction type for the rating request |
| `contextId` | `String` | — | Input property for PATCH first scenario |

Rating inputs and options are based on the [Insurance Product Rating API](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/connect_resources_product_rating.htm%20%20).

## HTML Markup

### Side Panel Layout

Displays a tree navigation showing the product hierarchy, allowing users to select products/coverages to configure.

- First product selected as default
- Selected item highlights and drives the main area content

### Main Section Layout

Shows the selected product's details, attributes (read-only), and associated coverages with their configurable attributes.

**Attribute Details Card:**
- Displays product title, attributes and price with tax info.
- Product attributes grouped by category (read-only display)

**Coverages Card (conditional):**
- Displays if product has coverages
- When selected, expands to show editable coverage attributes
- Coverage attributes grouped by category in two-column layout

### Configuration Messages Layout
- Collapsible message notification area with toggle button
- Uses the product-configuration-message-item component

---

## Component Usage

Embed the productConfiguration LWC in an Omniscript by using the Custom Lightning Web Component element in a step.

### Adding to an OmniScript Step

1. Open your OmniScript in OmniStudio Designer
2. Add a **Custom Lightning Web Component** element to your step
3. Set the **LWC Component Name** to `c-product-configuration`
4. Configure the component properties (see [Public Properties](#public-properties-api))

If you set `clearStateOnPrev` to `true`, hide the standard Previous and Next buttons in the step by reducing their width to 0\. The productConfiguration LWC shows Previous and Next buttons for navigation.

### Data Output Structure

The component outputs data to OmniScript via `omniUpdateDataJson()`:

```javascript
{ contextId: "contextId-123" }
```

---

## Troubleshooting

### Common Issues

| Issue | Possible Cause | Solution |
| :---- | :---- | :---- |
| "No products are available" | Rating API returned no products or ran into error | Verify `ratingInputs` are correct. |
| OmniscriptBaseMixin not found on component deployment | Missing Omniscript customization package | Ensure `omniscriptBaseMixin` and utility modules are deployed by following the [Prerequisites](../../../README.md#prerequisites). |
| Missing context or product details on rating call response | Wrong API version | Ensure that all components and supporting files use Salesforce API version **66.0** or later. |
| State not persisting | clearStateOnPrev is not set to true | Hide step buttons by setting width to 0 and set `clearStateOnPrev` to true. |

### Debugging

1. **Debug Logs:** Enable debug logs for the `InsuranceRatingApexService` class.
2. **Browser console:** The component logs errors to the console.
3. **OmniScript data panel:** Check the data JSON for output values.

## API Version

All components and supporting files must use Salesforce API version **66.0** or later.
Loading