@constructor-io/constructorio-ui-pia 2.14.0 → 2.15.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 +33 -35
- package/dist/constructorio-ui-pia-bundled.js +24 -24
- package/lib/cjs/components/CioPia/CheckoutTriggerBar.js +25 -0
- package/lib/cjs/components/CioPia/CioPiaQna.js +6 -2
- package/lib/cjs/components/CioPia/CioPiaStyles.css +33 -0
- package/lib/cjs/components/PiaConversation/PiaConversation.js +2 -1
- package/lib/cjs/components/PiaConversation/PiaConversationStyles.css +5 -0
- package/lib/cjs/stories/assets/storybook-styles.css +12 -10
- package/lib/cjs/version.js +1 -1
- package/lib/mjs/components/CioPia/CheckoutTriggerBar.js +20 -0
- package/lib/mjs/components/CioPia/CioPiaQna.js +6 -2
- package/lib/mjs/components/CioPia/CioPiaStyles.css +33 -0
- package/lib/mjs/components/PiaConversation/PiaConversation.js +2 -1
- package/lib/mjs/components/PiaConversation/PiaConversationStyles.css +5 -0
- package/lib/mjs/stories/assets/storybook-styles.css +12 -10
- package/lib/mjs/version.js +1 -1
- package/lib/types/components/CioPia/CheckoutTriggerBar.d.ts +11 -0
- package/lib/types/components/CioPia/index.d.ts +1 -1
- package/lib/types/components/CioPia/types.d.ts +42 -0
- package/lib/types/components/PiaConversation/PiaConversation.d.ts +3 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,9 +47,7 @@ import CioPia from '@constructor-io/constructorio-ui-pia';
|
|
|
47
47
|
import '@constructor-io/constructorio-ui-pia/styles.css';
|
|
48
48
|
|
|
49
49
|
function YourComponent() {
|
|
50
|
-
return
|
|
51
|
-
<CioPia apiKey='YOUR_API_KEY' itemId='PRODUCT_ITEM_ID' />
|
|
52
|
-
);
|
|
50
|
+
return <CioPia apiKey='YOUR_API_KEY' itemId='PRODUCT_ITEM_ID' />;
|
|
53
51
|
}
|
|
54
52
|
```
|
|
55
53
|
|
|
@@ -118,50 +116,50 @@ omitting it would quietly put everyone in the test arm with no control group to
|
|
|
118
116
|
|
|
119
117
|
#### Configuration Options
|
|
120
118
|
|
|
121
|
-
| Prop
|
|
122
|
-
|
|
123
|
-
| `apiKey`
|
|
124
|
-
| `itemId`
|
|
125
|
-
| `variationId`
|
|
126
|
-
| `threadId`
|
|
127
|
-
| `displayConfigs`
|
|
128
|
-
| `trackingConfigs`
|
|
129
|
-
| `callbacks`
|
|
130
|
-
| `translations`
|
|
131
|
-
| `componentOverrides` | `object` | Custom component overrides
|
|
132
|
-
| `abTest`
|
|
119
|
+
| Prop | Type | Description |
|
|
120
|
+
| -------------------- | -------- | --------------------------------------------------------------------------------------------- |
|
|
121
|
+
| `apiKey` | `string` | Your Constructor.io API key (required) |
|
|
122
|
+
| `itemId` | `string` | The product item ID (required) |
|
|
123
|
+
| `variationId` | `string` | Optional variation ID |
|
|
124
|
+
| `threadId` | `string` | Optional thread ID for conversation context (must be a valid UUID) |
|
|
125
|
+
| `displayConfigs` | `object` | Display configuration options (see below) |
|
|
126
|
+
| `trackingConfigs` | `object` | Tracking configuration options (see below) |
|
|
127
|
+
| `callbacks` | `object` | Callback handlers for user interactions |
|
|
128
|
+
| `translations` | `object` | UI string translations for internationalization |
|
|
129
|
+
| `componentOverrides` | `object` | Custom component overrides |
|
|
130
|
+
| `abTest` | `object` | A/B test configuration — test cells for tracking, and a control-group placeholder (see below) |
|
|
133
131
|
|
|
134
132
|
**Display Configs:**
|
|
135
133
|
|
|
136
|
-
| Option
|
|
137
|
-
|
|
138
|
-
| `mode`
|
|
139
|
-
| `type`
|
|
140
|
-
| `showFeedback`
|
|
141
|
-
| `showPreviousItems` | `boolean`
|
|
142
|
-
| `learnMoreUrl`
|
|
134
|
+
| Option | Type | Default | Description |
|
|
135
|
+
| ------------------- | -------------------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------- |
|
|
136
|
+
| `mode` | `'default' \| 'conversation' \| 'recommendations'` | `'default'` | Display mode. `'recommendations'` is accepted by the type but not yet available — it renders nothing. |
|
|
137
|
+
| `type` | `'inline' \| 'modal'` | `'inline'` | Component type |
|
|
138
|
+
| `showFeedback` | `boolean` | `false` | Show feedback controls on answers |
|
|
139
|
+
| `showPreviousItems` | `boolean` | `true` | Show product carousels from previous conversation entries |
|
|
140
|
+
| `learnMoreUrl` | `string` | - | URL for the "Learn More" disclaimer link |
|
|
143
141
|
|
|
144
142
|
**Tracking Configs:**
|
|
145
143
|
|
|
146
|
-
| Option
|
|
147
|
-
|
|
148
|
-
| `viewThreshold` | `number` | `0.5`
|
|
144
|
+
| Option | Type | Default | Description |
|
|
145
|
+
| --------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
146
|
+
| `viewThreshold` | `number` | `0.5` | Fraction of the container (0–1) that must be visible before the `product_insights_agent.view` event fires. Lower it (e.g. `0.01`) to have the view event fire on minimal visibility. |
|
|
149
147
|
|
|
150
148
|
**AB Test:**
|
|
151
149
|
|
|
152
|
-
| Option
|
|
153
|
-
|
|
154
|
-
| `testCells` | `Record<string, string>` | -
|
|
155
|
-
| `isControl` | `boolean`
|
|
150
|
+
| Option | Type | Default | Description |
|
|
151
|
+
| ----------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
152
|
+
| `testCells` | `Record<string, string>` | - | `{ [testName]: cellName }`, each sent as an `ef-<testName>` tracking parameter. Ignored when you supply your own `cioClient`. |
|
|
153
|
+
| `isControl` | `boolean` | required | Renders an invisible, tracking-only placeholder instead of the widget, so the control arm still records a view event. Takes precedence over `displayConfigs.mode`. |
|
|
156
154
|
|
|
157
155
|
**Callbacks:**
|
|
158
156
|
|
|
159
|
-
| Option
|
|
160
|
-
|
|
161
|
-
| `onQuestionSubmit`
|
|
162
|
-
| `onProductCardClick` | `(item: Item) => void`
|
|
163
|
-
| `onAddToCart`
|
|
164
|
-
| `onFeedback`
|
|
157
|
+
| Option | Type | Description |
|
|
158
|
+
| -------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
159
|
+
| `onQuestionSubmit` | `(question: string) => void` | Called when a question is submitted (via Enter key, Send button, or suggested question click) |
|
|
160
|
+
| `onProductCardClick` | `(item: Item) => void` | Called when a product card in the carousel is clicked |
|
|
161
|
+
| `onAddToCart` | `(item: Item, event: React.MouseEvent) => void` | Called when the "Add to Cart" button on a product card is clicked. Passing this callback is what renders the button; without it no cart control is shown |
|
|
162
|
+
| `onFeedback` | `(type: 'up' \| 'down') => void` | Called when the user submits positive or negative feedback on an answer |
|
|
165
163
|
|
|
166
164
|
### Using the JavaScript Bundle
|
|
167
165
|
|