@marketrix.ai/widget 3.8.9 → 3.8.10
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 +42 -33
- package/dist/widget.mjs +1 -1
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,14 +152,7 @@ interface MarketrixConfig {
|
|
|
152
152
|
|
|
153
153
|
### Prerequisites
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
| -------------- | -------------------------------- | ------------------------------------------------------------------- |
|
|
157
|
-
| `validate.yml` | Push / PR to `dev`, `main` | Type check, lint, format, tests, build, visual, a11y, bundle checks |
|
|
158
|
-
| `build.yml` | Tag push (`v*`) or push to `dev` | Build Docker image, push to ACR; publish to npm on tag |
|
|
159
|
-
|
|
160
|
-
Image builds produce `marketrix.azurecr.io/widget:{version}`. Tag pushes also publish `@marketrix.ai/widget` to npm. Deployment to dev/prod is handled by the centralized deploy workflow (e.g. `deploy.yml` in infra). Dev branch pushes do not build images.
|
|
161
|
-
|
|
162
|
-
- Node.js 18+
|
|
155
|
+
- Node.js 24 (CI pins `node-version: 24`)
|
|
163
156
|
- npm
|
|
164
157
|
|
|
165
158
|
### Setup
|
|
@@ -168,8 +161,8 @@ Image builds produce `marketrix.azurecr.io/widget:{version}`. Tag pushes also pu
|
|
|
168
161
|
git clone <repository-url>
|
|
169
162
|
cd widget
|
|
170
163
|
npm install
|
|
171
|
-
npm start # dev server on port
|
|
172
|
-
npm run build # production build
|
|
164
|
+
npm start # dev server on port 9001 (widget.marketrix.localhost)
|
|
165
|
+
npm run build # production build → dist/widget.mjs
|
|
173
166
|
```
|
|
174
167
|
|
|
175
168
|
### Project Structure
|
|
@@ -177,15 +170,18 @@ npm run build # production build
|
|
|
177
170
|
```
|
|
178
171
|
widget/
|
|
179
172
|
├── src/
|
|
180
|
-
│ ├── components/ # React components (chat,
|
|
173
|
+
│ ├── components/ # React components (base, blocks, chat, navigation, ui, views)
|
|
174
|
+
│ ├── design-system/ # design tokens + primitives
|
|
181
175
|
│ ├── context/ # WidgetContext provider
|
|
182
176
|
│ ├── hooks/ # Custom React hooks
|
|
183
|
-
│ ├── services/ # Core services (
|
|
184
|
-
│ ├── sdk/ # oRPC client + contract
|
|
177
|
+
│ ├── services/ # Core services (StreamClient, ChatService, SessionRecorder, ToolService, …)
|
|
178
|
+
│ ├── sdk/ # oRPC client + scoped contract mirror (contract.ts + contracts/*)
|
|
185
179
|
│ ├── types/ # TypeScript types
|
|
186
|
-
│ ├── utils/ # Utility functions
|
|
187
|
-
│ ├── constants/ # Config constants
|
|
188
|
-
│
|
|
180
|
+
│ ├── utils/ # Utility functions (incl. bootstrap.tsx — closed Shadow DOM mount)
|
|
181
|
+
│ ├── constants/ # Config constants
|
|
182
|
+
│ ├── lib/ # shared helpers
|
|
183
|
+
│ └── index.tsx # Main entry point (public API)
|
|
184
|
+
├── public/loader.js # classic script-tag loader
|
|
189
185
|
├── vite.config.ts
|
|
190
186
|
├── tsconfig.json
|
|
191
187
|
└── package.json
|
|
@@ -202,31 +198,44 @@ Output files:
|
|
|
202
198
|
|
|
203
199
|
## CI/CD
|
|
204
200
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
|
208
|
-
|
|
|
201
|
+
Single workflow `ci.yml` with three jobs:
|
|
202
|
+
|
|
203
|
+
| Job | Trigger | Action |
|
|
204
|
+
| --------- | -------------------- | ------------------------------------------------------------------------------- |
|
|
205
|
+
| `validate` | Push / PR to `dev` | type-check, lint, build, format:check, test:run, visual/a11y/bundle checks |
|
|
206
|
+
| `build` | Tag push (`v*`) | Build Docker image → `marketrix.azurecr.io/widget:{version}` (v-prefix stripped) |
|
|
207
|
+
| `publish` | Tag push (`v*`) | `npm publish @marketrix.ai/widget` (skipped if version already on registry) |
|
|
208
|
+
|
|
209
|
+
`contract-drift.yml` fails PRs whose `src/sdk/` mirror has drifted from `Marketrix-ai/api` (needs the `CONTRACTS_READ_TOKEN` secret). Dev branch pushes do not build images. Deployment to dev/prod is handled by the centralized `deploy.yml` in `infra`.
|
|
210
|
+
|
|
211
|
+
### Release
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npm run tag <version> # bumps package.json, refreshes lockfile, builds, commits, tags vX
|
|
215
|
+
git push origin HEAD && git push origin v<version>
|
|
216
|
+
```
|
|
209
217
|
|
|
210
218
|
## Dependencies
|
|
211
219
|
|
|
212
|
-
### Production
|
|
220
|
+
### Production (peer + runtime)
|
|
213
221
|
|
|
214
|
-
- `react` / `react-dom`
|
|
215
|
-
- `@rrweb/record`
|
|
216
|
-
- `@orpc/client` / `@orpc/contract`
|
|
217
|
-
-
|
|
218
|
-
- `zod`
|
|
222
|
+
- `react` / `react-dom` ^19 — peer dependency
|
|
223
|
+
- `@rrweb/record` — session recording
|
|
224
|
+
- `@orpc/client` / `@orpc/contract` ^1 — type-safe API client (oRPC)
|
|
225
|
+
- `@base-ui/react` — UI primitives
|
|
226
|
+
- `zod` ^4 — schema validation
|
|
227
|
+
- `tailwind-merge` — class merging
|
|
219
228
|
|
|
220
229
|
### Development
|
|
221
230
|
|
|
222
|
-
- Vite
|
|
223
|
-
- Tailwind CSS
|
|
224
|
-
- TypeScript
|
|
225
|
-
- Vitest + Testing Library (unit
|
|
226
|
-
- ESLint + Prettier
|
|
231
|
+
- Vite 8
|
|
232
|
+
- Tailwind CSS 4 (via `@tailwindcss/vite` plugin)
|
|
233
|
+
- TypeScript 6
|
|
234
|
+
- Vitest + Testing Library + axe (unit, integration, a11y)
|
|
235
|
+
- ESLint 10 + Prettier
|
|
227
236
|
- Terser for production minification
|
|
228
237
|
|
|
229
|
-
**Quality gates (run before PR):** `npm run type-check
|
|
238
|
+
**Quality gates (run before PR):** `npm run code:check` (type-check + lint + format), `npm run test:run`, `npm run build`, then `npm run visual:check`, `npm run a11y:check`, `npm run bundle:check`.
|
|
230
239
|
|
|
231
240
|
## License
|
|
232
241
|
|
|
@@ -237,4 +246,4 @@ Apache License 2.0 - see LICENSE file for details.
|
|
|
237
246
|
For support and questions, please contact the Marketrix team or create an issue
|
|
238
247
|
in the repository.
|
|
239
248
|
|
|
240
|
-
[Back to top](#marketrix-
|
|
249
|
+
[Back to top](#marketrix-widget)
|
package/dist/widget.mjs
CHANGED
|
@@ -17,7 +17,7 @@ return m(rc,{position:"fixed",style:{zIndex:b,maxWidth:"420px",opacity:l?0:1,tra
|
|
|
17
17
|
return g(rc,{ref:S,className:`${O} ${I?"":T} ${C?"":"transition-transform duration-300 ease-in-out"}`,style:{zIndex:h,pointerEvents:e?"none":"auto",...R,...I},children:[/* @__PURE__ */g(rc,{className:`\n group relative w-14 h-14 overflow-visible transition-all duration-300 ease-in-out\n ${e?"scale-0 opacity-0 pointer-events-none":"scale-100 opacity-100 hover:scale-110"}\n `,children:[w&&/* @__PURE__ */m(rc,{className:v,"aria-hidden":!0}),b&&!C&&/* @__PURE__ */m(Gc,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),o?.()},className:"absolute top-1/2 z-20 -translate-y-1/2 rounded-full border border-white/25 bg-gray-900 px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wide text-white shadow-lg opacity-0 transition-opacity duration-150 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto group-focus-within:opacity-100 group-focus-within:pointer-events-auto "+(p.includes("left")?"left-full ml-2":"right-full mr-2"),style:{border:"1px solid rgba(255,255,255,0.25)"},"aria-label":"Stop running task",children:"Stop"}),
|
|
18
18
|
/* @__PURE__ */m(Gc,{type:"button",variant:"bare",onClick:()=>{Date.now()<M.current||i()},onDragStart:e=>e.preventDefault(),onPointerDown:_,onPointerMove:A,onPointerUp:E,onPointerCancel:z,className:"relative z-10 w-14 h-14 min-w-14",style:{touchAction:"none",cursor:C?"grabbing":"grab",userSelect:"none",WebkitUserSelect:"none"},"aria-label":e?"Close":"Open","aria-live":"polite",children:/* @__PURE__ */m(Yc,{className:"w-full h-full items-center justify-center relative",children:/* @__PURE__ */g(rc,{className:"\n relative w-12 h-12 overflow-hidden transition-[transform,opacity,background-color] duration-[167ms] ease-[cubic-bezier(0.33,0,0,1)]\n hover:scale-110 hover:duration-[250ms] active:scale-[0.85] active:duration-[134ms] active:ease-[cubic-bezier(0.45,0,0.2,1)]\n animate-launcher-entrance\n ",style:{borderRadius:l,backgroundColor:e?a:s,boxShadow:Wl.fab},children:[w&&/* @__PURE__ */m("svg",{className:x,viewBox:"0 0 54 54",fill:"none","aria-hidden":!0,children:/* @__PURE__ */m("rect",{x:"1.25",y:"1.25",width:"51.5",height:"51.5",rx:k+1,ry:k+1})}),
|
|
19
19
|
/* @__PURE__ */m(Yc,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(30deg) scale(0)":"rotate(0deg) scale(1)",opacity:e?0:1,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":e,children:/* @__PURE__ */m(oc,{src:nc,alt:"",className:"relative z-10 w-full h-full object-contain",draggable:!1,onDragStart:e=>e.preventDefault(),style:{borderRadius:l,border:"none",outline:"none",backgroundColor:"transparent",pointerEvents:"none",userSelect:"none"}})}),
|
|
20
|
-
/* @__PURE__ */m(Yc,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:e?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!e,children:/* @__PURE__ */m(Kc,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]}),!e&&/* @__PURE__ */g(rc,{className:`absolute bottom-16 ${p.includes("left")?"left-0":"right-0"} mb-2 px-3 py-2 text-sm rounded-lg shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-200`,style:{backgroundColor:c,color:d},children:[/* @__PURE__ */m(od,{as:"span",className:"text-inherit",children:"Support Agent"}),/* @__PURE__ */m(rc,{"aria-hidden":!0,className:`absolute top-full ${p.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:c}})]})]})},fd="3.8.
|
|
20
|
+
/* @__PURE__ */m(Yc,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:e?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!e,children:/* @__PURE__ */m(Kc,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]}),!e&&/* @__PURE__ */g(rc,{className:`absolute bottom-16 ${p.includes("left")?"left-0":"right-0"} mb-2 px-3 py-2 text-sm rounded-lg shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-200`,style:{backgroundColor:c,color:d},children:[/* @__PURE__ */m(od,{as:"span",className:"text-inherit",children:"Support Agent"}),/* @__PURE__ */m(rc,{"aria-hidden":!0,className:`absolute top-full ${p.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:c}})]})]})},fd="3.8.10";function md(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent&&!e.hasAttribute("aria-hidden"))}function gd(e){if(!e)return 360;const t=parseInt(e.replace(/px|rem|em/gi,""),10);return isNaN(t)?360:t}function yd(e,t,r){return Math.min(Math.max(e,t),r)}function wd(e,t,r,n,i){const o={"bottom-right":"nwse-resize","bottom-left":"nesw-resize","top-right":"nesw-resize","top-left":"nwse-resize"};switch(e){case"bottom-right":return{dx:n-t,dy:i-r,cursor:o[e]};case"bottom-left":return{dx:t-n,dy:i-r,cursor:o[e]};case"top-right":return{dx:n-t,dy:r-i,cursor:o[e]};case"top-left":return{dx:t-n,dy:r-i,cursor:o[e]}}}var bd={count:"inline-flex items-center rounded-full bg-muted px-1.5 py-0.5 text-[9px] font-medium text-muted-foreground",live:"inline-flex items-center gap-1",status:"inline-flex items-center text-[9px] font-medium px-1.5 py-0.5 rounded"},vd={default:"bg-muted text-muted-foreground",muted:"bg-muted text-muted-foreground",primary:"bg-chart-1/15 text-chart-1",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning"},xd=i(function({variant:e,color:t,tone:r="default",className:n,style:i,children:o,...s},a){/* @__PURE__ */
|
|
21
21
|
return g("span",{...s,ref:a,className:Zl(bd[e],"status"===e&&vd[r],n),"data-variant":e,style:{color:t,...i},children:["live"===e&&/* @__PURE__ */g("span",{className:"relative flex h-1.5 w-1.5",children:[/* @__PURE__ */m("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-75"}),/* @__PURE__ */m("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-current"})]}),o]})}),kd=i(function({background:e="card",border:t=!0,children:r,className:n,elevation:i="card",paddingPreset:o="card",radius:s="xl",style:a,...l},c){/* @__PURE__ */
|
|
22
22
|
return m(rc,{...l,ref:c,as:"div",background:e,border:t,className:n,elevation:i,paddingPreset:o,radius:s,style:a,children:r})});var Sd=r(null);function Cd(e){const t=s(Sd);if(!t)throw new Error(`${e} must be used within Dialog`);return t}function Id({children:e,defaultOpen:t,onOpenChange:r,open:n}){const{isOpen:i,setIsOpen:s}=function({defaultOpen:e=!1,onOpenChange:t,open:r}){const[n,i]=h(e),s=void 0!==r;return{isOpen:s?r:n,setIsOpen:o(e=>{s||i(e),t?.(e)},[s,t])}}({defaultOpen:t,onOpenChange:r,open:n}),a=l(),c=l(),u=l(),p=d(()=>({contentId:a,descriptionId:u,open:i,setOpen:s,titleId:c}),[a,u,i,s,c]);/* @__PURE__ */
|
|
23
23
|
return m(Sd.Provider,{value:p,children:e})}function _d({children:e,className:t,onKeyDown:r,...n}){const i=Cd("DialogContent"),{variant:o="default",style:s,...l}=n;return a(()=>{if(!i.open)return;const e=e=>{"Escape"===e.key&&i.setOpen(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i]),i.open?/* @__PURE__ */m("div",{...l,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"aria-modal":"true",className:Zl("fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[calc(var(--layer-dialog)+1)] flex flex-col w-full max-h-[85vh] overflow-auto bg-card animate-dialog-content-in","default"===o&&"max-w-[500px] rounded-lg p-6","confirm"===o&&"max-w-sm rounded-lg p-4","info"===o&&"w-64 rounded-md border border-border p-0",t),"data-state":"open",id:i.contentId,onKeyDown:e=>{r?.(e),e.defaultPrevented||"Escape"!==e.key||i.setOpen(!1)},role:"dialog",style:{...Jl("info"===o?"section":"panel"),...s},tabIndex:-1,children:e}):null}function Ad({className:e,variant:t="default",...r}){const n=Cd("DialogTitle");/* @__PURE__ */
|