@expedite-commerce/expedite-components 0.2.57 → 0.2.59
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/LICENSE +22 -22
- package/README.md +297 -297
- package/dist/expedite-components.css +1 -1
- package/dist/expedite-components.es.js +3693 -3690
- package/dist/expedite-components.umd.js +9 -9
- package/dist/style.css +1 -1
- package/dist/vue-expedite-components.js +5479 -5476
- package/dist/vue-expedite-components.umd.cjs +31 -31
- package/package.json +103 -103
package/LICENSE
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,297 +1,297 @@
|
|
|
1
|
-
# Expedite Components
|
|
2
|
-
|
|
3
|
-
A Vue 3 component library for Expedite Commerce, providing reusable components including Configurator and GPT chat functionality.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install expedite-components
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Peer Dependencies
|
|
12
|
-
|
|
13
|
-
This library requires the following peer dependencies:
|
|
14
|
-
|
|
15
|
-
```sh
|
|
16
|
-
npm install vue@^3.4.21 pinia@^2.1.7 axios@^1.13.2 dompurify@^3.2.6 lodash.clonedeep@^4.5.0 v-click-outside@^3.2.0 vue-router-lwc@^1.0.4 vuedraggable@^4.1.0
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
### Vue 3 Application
|
|
22
|
-
|
|
23
|
-
#### Option 1: Install as a Plugin (Global Registration)
|
|
24
|
-
|
|
25
|
-
```javascript
|
|
26
|
-
import { createApp } from 'vue'
|
|
27
|
-
import { createPinia } from 'pinia'
|
|
28
|
-
import ExpediteComponents from 'expedite-components'
|
|
29
|
-
import 'expedite-components/style'
|
|
30
|
-
|
|
31
|
-
const app = createApp(App)
|
|
32
|
-
const pinia = createPinia()
|
|
33
|
-
|
|
34
|
-
app.use(pinia)
|
|
35
|
-
app.use(ExpediteComponents)
|
|
36
|
-
|
|
37
|
-
app.mount('#app')
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Then use components in your templates:
|
|
41
|
-
|
|
42
|
-
```vue
|
|
43
|
-
<template>
|
|
44
|
-
<div>
|
|
45
|
-
<!-- Expedite Configurator -->
|
|
46
|
-
<ExpediteConfigurator
|
|
47
|
-
:setup-data="setupData"
|
|
48
|
-
item-id="your-item-id"
|
|
49
|
-
qli-id="optional-qli-id"
|
|
50
|
-
quote-id="optional-quote-id"
|
|
51
|
-
api-key="API_KEY"
|
|
52
|
-
/>
|
|
53
|
-
|
|
54
|
-
<!-- Expedite GPT Chat -->
|
|
55
|
-
<ExpediteGPT
|
|
56
|
-
secret-key="API_KEY"
|
|
57
|
-
model="gpt-3.5-turbo"
|
|
58
|
-
:max-tokens="300"
|
|
59
|
-
placeholder="Enter your message..."
|
|
60
|
-
/>
|
|
61
|
-
</div>
|
|
62
|
-
</template>
|
|
63
|
-
|
|
64
|
-
<script setup>
|
|
65
|
-
const setupData = {
|
|
66
|
-
orgType: "Production",
|
|
67
|
-
orgId: "00DA0000000cDUJMA2",
|
|
68
|
-
userId: "0052G00000AtQQ9QAN",
|
|
69
|
-
accountId: "0012G000000cDUJMA2",
|
|
70
|
-
opportunityId: "0062G000000cDUJMA2",
|
|
71
|
-
userLocale: "en_US",
|
|
72
|
-
pricingSchema: "Single"
|
|
73
|
-
}
|
|
74
|
-
</script>
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
#### Option 2: Import Individual Components
|
|
78
|
-
|
|
79
|
-
```vue
|
|
80
|
-
<template>
|
|
81
|
-
<div>
|
|
82
|
-
<ExpediteConfigurator
|
|
83
|
-
:setup-data="setupData"
|
|
84
|
-
item-id="your-item-id"
|
|
85
|
-
qli-id="optional-qli-id"
|
|
86
|
-
quote-id="optional-quote-id"
|
|
87
|
-
api-key="API_KEY"
|
|
88
|
-
/>
|
|
89
|
-
<ExpediteGPT
|
|
90
|
-
secret-key="API_KEY"
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
</template>
|
|
94
|
-
|
|
95
|
-
<script setup>
|
|
96
|
-
import { ExpediteConfigurator, ExpediteGPT } from 'expedite-components'
|
|
97
|
-
import 'expedite-components/style'
|
|
98
|
-
|
|
99
|
-
const setupData = {
|
|
100
|
-
orgType: "Production",
|
|
101
|
-
orgId: "00DA0000000cDUJMA2",
|
|
102
|
-
userId: "0052G00000AtQQ9QAN",
|
|
103
|
-
accountId: "0012G000000cDUJMA2",
|
|
104
|
-
opportunityId: "0062G000000cDUJMA2",
|
|
105
|
-
userLocale: "en_US",
|
|
106
|
-
pricingSchema: "Single"
|
|
107
|
-
}
|
|
108
|
-
</script>
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
#### Option 3: Using with Composition API
|
|
112
|
-
|
|
113
|
-
```vue
|
|
114
|
-
<template>
|
|
115
|
-
<div>
|
|
116
|
-
<ExpediteConfigurator
|
|
117
|
-
:setup-data="setupData"
|
|
118
|
-
:item-id="itemId"
|
|
119
|
-
:qli-id="qliId"
|
|
120
|
-
:quote-id="quoteId"
|
|
121
|
-
api-key="API_KEY"
|
|
122
|
-
/>
|
|
123
|
-
</div>
|
|
124
|
-
</template>
|
|
125
|
-
|
|
126
|
-
<script setup>
|
|
127
|
-
import { ref } from 'vue'
|
|
128
|
-
import { ExpediteConfigurator } from 'expedite-components'
|
|
129
|
-
import 'expedite-components/style'
|
|
130
|
-
|
|
131
|
-
const setupData = {
|
|
132
|
-
orgType: "Production",
|
|
133
|
-
orgId: "00DA0000000cDUJMA2",
|
|
134
|
-
userId: "0052G00000AtQQ9QAN",
|
|
135
|
-
accountId: "0012G000000cDUJMA2",
|
|
136
|
-
opportunityId: "0062G000000cDUJMA2",
|
|
137
|
-
userLocale: "en_US",
|
|
138
|
-
pricingSchema: "Single"
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const itemId = ref('a01Kb00000aQb5VIAS')
|
|
142
|
-
const qliId = ref('a0pKb00000jxSYUIA2')
|
|
143
|
-
const quoteId = ref('a0jKb000004V2dsIAC')
|
|
144
|
-
</script>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Component Props
|
|
148
|
-
|
|
149
|
-
#### ExpediteConfigurator
|
|
150
|
-
|
|
151
|
-
| Prop | Type | Required | Default | Description |
|
|
152
|
-
|------|------|----------|---------|-------------|
|
|
153
|
-
| `setupData` | Object | Yes | - | Configuration object with the following properties:<br/>- `orgType` (String): Organization type (e.g., "Production")<br/>- `orgId` (String): Organization ID<br/>- `userId` (String): User ID<br/>- `accountId` (String): Account ID<br/>- `opportunityId` (String): Opportunity ID<br/>- `userLocale` (String): User locale (e.g., "en_US")<br/>- `pricingSchema` (String): Pricing schema (e.g., "Single" or "NRC/MRC") |
|
|
154
|
-
| `itemId` | String | Yes | - | The ID of the item to configure |
|
|
155
|
-
| `qliId` | String | No | - | Optional Quote Line Item ID |
|
|
156
|
-
| `quoteId` | String | No | - | Optional Quote ID |
|
|
157
|
-
| `apiKey` | String | Yes | - | API key for authentication |
|
|
158
|
-
|
|
159
|
-
#### ExpediteGPT
|
|
160
|
-
|
|
161
|
-
| Prop | Type | Required | Default | Description |
|
|
162
|
-
|------|------|----------|---------|-------------|
|
|
163
|
-
| `secretKey` | String | No | `""` | OpenAI API secret key |
|
|
164
|
-
| `model` | String | No | `"gpt-3.5-turbo"` | GPT model to use |
|
|
165
|
-
| `maxTokens` | Number | No | `300` | Maximum tokens for the response |
|
|
166
|
-
| `placeholder` | String | No | `"Enter your message..."` | Input placeholder text |
|
|
167
|
-
|
|
168
|
-
### Tailwind CSS Configuration
|
|
169
|
-
|
|
170
|
-
This library uses Tailwind CSS with the `ect-` prefix for all utility classes. The built CSS file (`expedite-components.css`) includes all necessary classes, including arbitrary values (e.g., `ect-w-[104px]`, `ect-h-[104px]`).
|
|
171
|
-
|
|
172
|
-
**Important for consuming projects:**
|
|
173
|
-
|
|
174
|
-
- The library's CSS is pre-built and includes all classes. You don't need to configure Tailwind to scan the library's source files.
|
|
175
|
-
- Simply import the library's CSS: `import 'expedite-components/style'`
|
|
176
|
-
- If your project also uses Tailwind, make sure your Tailwind config doesn't try to process the library's `ect-` prefixed classes. The library's classes are already compiled and included in the distributed CSS file.
|
|
177
|
-
- All arbitrary value classes (like `ect-w-[104px]`) are included in the built CSS, so they will work out of the box.
|
|
178
|
-
|
|
179
|
-
### HTML/Web Components (Framework Agnostic)
|
|
180
|
-
|
|
181
|
-
You can use the components in any HTML page without a Vue application:
|
|
182
|
-
|
|
183
|
-
```html
|
|
184
|
-
<!doctype html>
|
|
185
|
-
<html lang="en">
|
|
186
|
-
<head>
|
|
187
|
-
<meta charset="UTF-8" />
|
|
188
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
189
|
-
<title>Expedite Components</title>
|
|
190
|
-
|
|
191
|
-
<script type="module">
|
|
192
|
-
import { registerWebComponents } from 'https://unpkg.com/expedite-components@latest/dist/vue-expedite-components.js';
|
|
193
|
-
registerWebComponents();
|
|
194
|
-
</script>
|
|
195
|
-
</head>
|
|
196
|
-
<body>
|
|
197
|
-
<vue-expedite-configurator
|
|
198
|
-
setup-data='{"orgType":"Production","orgId":"00DA0000000cDUJMA2","userId":"0052G00000AtQQ9QAN","accountId":"0012G000000cDUJMA2","opportunityId":"0062G000000cDUJMA2","userLocale":"en_US","pricingSchema":"Single"}'
|
|
199
|
-
item-id="a01Kb00000aQb5VIAS"
|
|
200
|
-
qli-id="a0pKb00000jxSYUIA2" // not required
|
|
201
|
-
quote-id="a0jKb000004V2dsIAC"
|
|
202
|
-
api-key="API_KEY"
|
|
203
|
-
></vue-expedite-configurator>
|
|
204
|
-
</body>
|
|
205
|
-
</html>
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
#### Alternative: Using UMD Bundle (for non-module environments)
|
|
209
|
-
|
|
210
|
-
```html
|
|
211
|
-
<!DOCTYPE html>
|
|
212
|
-
<html lang="en">
|
|
213
|
-
<head>
|
|
214
|
-
<meta charset="UTF-8">
|
|
215
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
216
|
-
<title>Expedite Components</title>
|
|
217
|
-
|
|
218
|
-
<!-- Import the UMD bundle -->
|
|
219
|
-
<link rel="stylesheet" href="./node_modules/expedite-components/dist/style.css">
|
|
220
|
-
<script src="./node_modules/expedite-components/dist/vue-expedite-components.umd.cjs"></script>
|
|
221
|
-
</head>
|
|
222
|
-
<body>
|
|
223
|
-
<vue-expedite-configurator
|
|
224
|
-
setup-data='{"orgType":"Production","orgId":"00DA0000000cDUJMA2","userId":"0052G00000AtQQ9QAN","accountId":"0012G000000cDUJMA2","opportunityId":"0062G000000cDUJMA2","userLocale":"en_US","pricingSchema":"Single"}'
|
|
225
|
-
item-id="a01Kb00000aQb5VIAS"
|
|
226
|
-
qli-id="a0pKb00000jxSYUIA2"
|
|
227
|
-
quote-id="a0jKb000004V2dsIAC"
|
|
228
|
-
api-key="API_KEY"
|
|
229
|
-
></vue-expedite-configurator>
|
|
230
|
-
|
|
231
|
-
<vue-expedite-gpt
|
|
232
|
-
secret-key="API_KEY"
|
|
233
|
-
model="gpt-3.5-turbo"
|
|
234
|
-
max-tokens="300"
|
|
235
|
-
placeholder="Enter your message..."
|
|
236
|
-
></vue-expedite-gpt>
|
|
237
|
-
</body>
|
|
238
|
-
</html>
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
## Development
|
|
242
|
-
|
|
243
|
-
### Project Setup
|
|
244
|
-
|
|
245
|
-
```sh
|
|
246
|
-
npm install
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### Compile and Hot-Reload for Development
|
|
250
|
-
|
|
251
|
-
```sh
|
|
252
|
-
npm run dev
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Build for Production
|
|
256
|
-
|
|
257
|
-
Build both regular library and web components:
|
|
258
|
-
|
|
259
|
-
```sh
|
|
260
|
-
npm run build:all
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
Build only the regular library:
|
|
264
|
-
|
|
265
|
-
```sh
|
|
266
|
-
npm run build
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Build only web components:
|
|
270
|
-
|
|
271
|
-
```sh
|
|
272
|
-
npm run build:web-components
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
### Run Unit Tests with [Vitest](https://vitest.dev/)
|
|
276
|
-
|
|
277
|
-
```sh
|
|
278
|
-
npm run test:unit
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
### Lint with [ESLint](https://eslint.org/)
|
|
282
|
-
|
|
283
|
-
```sh
|
|
284
|
-
npm run lint
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
## Recommended IDE Setup
|
|
288
|
-
|
|
289
|
-
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
290
|
-
|
|
291
|
-
## Customize configuration
|
|
292
|
-
|
|
293
|
-
See [Vite Configuration Reference](https://vitejs.dev/config/).
|
|
294
|
-
|
|
295
|
-
## License
|
|
296
|
-
|
|
297
|
-
MIT
|
|
1
|
+
# Expedite Components
|
|
2
|
+
|
|
3
|
+
A Vue 3 component library for Expedite Commerce, providing reusable components including Configurator and GPT chat functionality.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install expedite-components
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
This library requires the following peer dependencies:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install vue@^3.4.21 pinia@^2.1.7 axios@^1.13.2 dompurify@^3.2.6 lodash.clonedeep@^4.5.0 v-click-outside@^3.2.0 vue-router-lwc@^1.0.4 vuedraggable@^4.1.0
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Vue 3 Application
|
|
22
|
+
|
|
23
|
+
#### Option 1: Install as a Plugin (Global Registration)
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
import { createApp } from 'vue'
|
|
27
|
+
import { createPinia } from 'pinia'
|
|
28
|
+
import ExpediteComponents from 'expedite-components'
|
|
29
|
+
import 'expedite-components/style'
|
|
30
|
+
|
|
31
|
+
const app = createApp(App)
|
|
32
|
+
const pinia = createPinia()
|
|
33
|
+
|
|
34
|
+
app.use(pinia)
|
|
35
|
+
app.use(ExpediteComponents)
|
|
36
|
+
|
|
37
|
+
app.mount('#app')
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then use components in your templates:
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<template>
|
|
44
|
+
<div>
|
|
45
|
+
<!-- Expedite Configurator -->
|
|
46
|
+
<ExpediteConfigurator
|
|
47
|
+
:setup-data="setupData"
|
|
48
|
+
item-id="your-item-id"
|
|
49
|
+
qli-id="optional-qli-id"
|
|
50
|
+
quote-id="optional-quote-id"
|
|
51
|
+
api-key="API_KEY"
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<!-- Expedite GPT Chat -->
|
|
55
|
+
<ExpediteGPT
|
|
56
|
+
secret-key="API_KEY"
|
|
57
|
+
model="gpt-3.5-turbo"
|
|
58
|
+
:max-tokens="300"
|
|
59
|
+
placeholder="Enter your message..."
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup>
|
|
65
|
+
const setupData = {
|
|
66
|
+
orgType: "Production",
|
|
67
|
+
orgId: "00DA0000000cDUJMA2",
|
|
68
|
+
userId: "0052G00000AtQQ9QAN",
|
|
69
|
+
accountId: "0012G000000cDUJMA2",
|
|
70
|
+
opportunityId: "0062G000000cDUJMA2",
|
|
71
|
+
userLocale: "en_US",
|
|
72
|
+
pricingSchema: "Single"
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Option 2: Import Individual Components
|
|
78
|
+
|
|
79
|
+
```vue
|
|
80
|
+
<template>
|
|
81
|
+
<div>
|
|
82
|
+
<ExpediteConfigurator
|
|
83
|
+
:setup-data="setupData"
|
|
84
|
+
item-id="your-item-id"
|
|
85
|
+
qli-id="optional-qli-id"
|
|
86
|
+
quote-id="optional-quote-id"
|
|
87
|
+
api-key="API_KEY"
|
|
88
|
+
/>
|
|
89
|
+
<ExpediteGPT
|
|
90
|
+
secret-key="API_KEY"
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script setup>
|
|
96
|
+
import { ExpediteConfigurator, ExpediteGPT } from 'expedite-components'
|
|
97
|
+
import 'expedite-components/style'
|
|
98
|
+
|
|
99
|
+
const setupData = {
|
|
100
|
+
orgType: "Production",
|
|
101
|
+
orgId: "00DA0000000cDUJMA2",
|
|
102
|
+
userId: "0052G00000AtQQ9QAN",
|
|
103
|
+
accountId: "0012G000000cDUJMA2",
|
|
104
|
+
opportunityId: "0062G000000cDUJMA2",
|
|
105
|
+
userLocale: "en_US",
|
|
106
|
+
pricingSchema: "Single"
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Option 3: Using with Composition API
|
|
112
|
+
|
|
113
|
+
```vue
|
|
114
|
+
<template>
|
|
115
|
+
<div>
|
|
116
|
+
<ExpediteConfigurator
|
|
117
|
+
:setup-data="setupData"
|
|
118
|
+
:item-id="itemId"
|
|
119
|
+
:qli-id="qliId"
|
|
120
|
+
:quote-id="quoteId"
|
|
121
|
+
api-key="API_KEY"
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
</template>
|
|
125
|
+
|
|
126
|
+
<script setup>
|
|
127
|
+
import { ref } from 'vue'
|
|
128
|
+
import { ExpediteConfigurator } from 'expedite-components'
|
|
129
|
+
import 'expedite-components/style'
|
|
130
|
+
|
|
131
|
+
const setupData = {
|
|
132
|
+
orgType: "Production",
|
|
133
|
+
orgId: "00DA0000000cDUJMA2",
|
|
134
|
+
userId: "0052G00000AtQQ9QAN",
|
|
135
|
+
accountId: "0012G000000cDUJMA2",
|
|
136
|
+
opportunityId: "0062G000000cDUJMA2",
|
|
137
|
+
userLocale: "en_US",
|
|
138
|
+
pricingSchema: "Single"
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const itemId = ref('a01Kb00000aQb5VIAS')
|
|
142
|
+
const qliId = ref('a0pKb00000jxSYUIA2')
|
|
143
|
+
const quoteId = ref('a0jKb000004V2dsIAC')
|
|
144
|
+
</script>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Component Props
|
|
148
|
+
|
|
149
|
+
#### ExpediteConfigurator
|
|
150
|
+
|
|
151
|
+
| Prop | Type | Required | Default | Description |
|
|
152
|
+
|------|------|----------|---------|-------------|
|
|
153
|
+
| `setupData` | Object | Yes | - | Configuration object with the following properties:<br/>- `orgType` (String): Organization type (e.g., "Production")<br/>- `orgId` (String): Organization ID<br/>- `userId` (String): User ID<br/>- `accountId` (String): Account ID<br/>- `opportunityId` (String): Opportunity ID<br/>- `userLocale` (String): User locale (e.g., "en_US")<br/>- `pricingSchema` (String): Pricing schema (e.g., "Single" or "NRC/MRC") |
|
|
154
|
+
| `itemId` | String | Yes | - | The ID of the item to configure |
|
|
155
|
+
| `qliId` | String | No | - | Optional Quote Line Item ID |
|
|
156
|
+
| `quoteId` | String | No | - | Optional Quote ID |
|
|
157
|
+
| `apiKey` | String | Yes | - | API key for authentication |
|
|
158
|
+
|
|
159
|
+
#### ExpediteGPT
|
|
160
|
+
|
|
161
|
+
| Prop | Type | Required | Default | Description |
|
|
162
|
+
|------|------|----------|---------|-------------|
|
|
163
|
+
| `secretKey` | String | No | `""` | OpenAI API secret key |
|
|
164
|
+
| `model` | String | No | `"gpt-3.5-turbo"` | GPT model to use |
|
|
165
|
+
| `maxTokens` | Number | No | `300` | Maximum tokens for the response |
|
|
166
|
+
| `placeholder` | String | No | `"Enter your message..."` | Input placeholder text |
|
|
167
|
+
|
|
168
|
+
### Tailwind CSS Configuration
|
|
169
|
+
|
|
170
|
+
This library uses Tailwind CSS with the `ect-` prefix for all utility classes. The built CSS file (`expedite-components.css`) includes all necessary classes, including arbitrary values (e.g., `ect-w-[104px]`, `ect-h-[104px]`).
|
|
171
|
+
|
|
172
|
+
**Important for consuming projects:**
|
|
173
|
+
|
|
174
|
+
- The library's CSS is pre-built and includes all classes. You don't need to configure Tailwind to scan the library's source files.
|
|
175
|
+
- Simply import the library's CSS: `import 'expedite-components/style'`
|
|
176
|
+
- If your project also uses Tailwind, make sure your Tailwind config doesn't try to process the library's `ect-` prefixed classes. The library's classes are already compiled and included in the distributed CSS file.
|
|
177
|
+
- All arbitrary value classes (like `ect-w-[104px]`) are included in the built CSS, so they will work out of the box.
|
|
178
|
+
|
|
179
|
+
### HTML/Web Components (Framework Agnostic)
|
|
180
|
+
|
|
181
|
+
You can use the components in any HTML page without a Vue application:
|
|
182
|
+
|
|
183
|
+
```html
|
|
184
|
+
<!doctype html>
|
|
185
|
+
<html lang="en">
|
|
186
|
+
<head>
|
|
187
|
+
<meta charset="UTF-8" />
|
|
188
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
189
|
+
<title>Expedite Components</title>
|
|
190
|
+
|
|
191
|
+
<script type="module">
|
|
192
|
+
import { registerWebComponents } from 'https://unpkg.com/expedite-components@latest/dist/vue-expedite-components.js';
|
|
193
|
+
registerWebComponents();
|
|
194
|
+
</script>
|
|
195
|
+
</head>
|
|
196
|
+
<body>
|
|
197
|
+
<vue-expedite-configurator
|
|
198
|
+
setup-data='{"orgType":"Production","orgId":"00DA0000000cDUJMA2","userId":"0052G00000AtQQ9QAN","accountId":"0012G000000cDUJMA2","opportunityId":"0062G000000cDUJMA2","userLocale":"en_US","pricingSchema":"Single"}'
|
|
199
|
+
item-id="a01Kb00000aQb5VIAS"
|
|
200
|
+
qli-id="a0pKb00000jxSYUIA2" // not required
|
|
201
|
+
quote-id="a0jKb000004V2dsIAC"
|
|
202
|
+
api-key="API_KEY"
|
|
203
|
+
></vue-expedite-configurator>
|
|
204
|
+
</body>
|
|
205
|
+
</html>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### Alternative: Using UMD Bundle (for non-module environments)
|
|
209
|
+
|
|
210
|
+
```html
|
|
211
|
+
<!DOCTYPE html>
|
|
212
|
+
<html lang="en">
|
|
213
|
+
<head>
|
|
214
|
+
<meta charset="UTF-8">
|
|
215
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
216
|
+
<title>Expedite Components</title>
|
|
217
|
+
|
|
218
|
+
<!-- Import the UMD bundle -->
|
|
219
|
+
<link rel="stylesheet" href="./node_modules/expedite-components/dist/style.css">
|
|
220
|
+
<script src="./node_modules/expedite-components/dist/vue-expedite-components.umd.cjs"></script>
|
|
221
|
+
</head>
|
|
222
|
+
<body>
|
|
223
|
+
<vue-expedite-configurator
|
|
224
|
+
setup-data='{"orgType":"Production","orgId":"00DA0000000cDUJMA2","userId":"0052G00000AtQQ9QAN","accountId":"0012G000000cDUJMA2","opportunityId":"0062G000000cDUJMA2","userLocale":"en_US","pricingSchema":"Single"}'
|
|
225
|
+
item-id="a01Kb00000aQb5VIAS"
|
|
226
|
+
qli-id="a0pKb00000jxSYUIA2"
|
|
227
|
+
quote-id="a0jKb000004V2dsIAC"
|
|
228
|
+
api-key="API_KEY"
|
|
229
|
+
></vue-expedite-configurator>
|
|
230
|
+
|
|
231
|
+
<vue-expedite-gpt
|
|
232
|
+
secret-key="API_KEY"
|
|
233
|
+
model="gpt-3.5-turbo"
|
|
234
|
+
max-tokens="300"
|
|
235
|
+
placeholder="Enter your message..."
|
|
236
|
+
></vue-expedite-gpt>
|
|
237
|
+
</body>
|
|
238
|
+
</html>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Development
|
|
242
|
+
|
|
243
|
+
### Project Setup
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
npm install
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Compile and Hot-Reload for Development
|
|
250
|
+
|
|
251
|
+
```sh
|
|
252
|
+
npm run dev
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Build for Production
|
|
256
|
+
|
|
257
|
+
Build both regular library and web components:
|
|
258
|
+
|
|
259
|
+
```sh
|
|
260
|
+
npm run build:all
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Build only the regular library:
|
|
264
|
+
|
|
265
|
+
```sh
|
|
266
|
+
npm run build
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Build only web components:
|
|
270
|
+
|
|
271
|
+
```sh
|
|
272
|
+
npm run build:web-components
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Run Unit Tests with [Vitest](https://vitest.dev/)
|
|
276
|
+
|
|
277
|
+
```sh
|
|
278
|
+
npm run test:unit
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Lint with [ESLint](https://eslint.org/)
|
|
282
|
+
|
|
283
|
+
```sh
|
|
284
|
+
npm run lint
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Recommended IDE Setup
|
|
288
|
+
|
|
289
|
+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
290
|
+
|
|
291
|
+
## Customize configuration
|
|
292
|
+
|
|
293
|
+
See [Vite Configuration Reference](https://vitejs.dev/config/).
|
|
294
|
+
|
|
295
|
+
## License
|
|
296
|
+
|
|
297
|
+
MIT
|