wineater-bot 4.24.1 → 4.24.3

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.
Files changed (59) hide show
  1. package/dist/wineater-chatbot.mjs +13 -13
  2. package/dist/wineater-chatbot.umd.js +13 -13
  3. package/package.json +5 -1
  4. package/.claude/settings.local.json +0 -10
  5. package/.prettierignore +0 -9
  6. package/.prettierrc +0 -16
  7. package/CLAUDE.md +0 -115
  8. package/docs/CUSTOMIZATION.md +0 -133
  9. package/docs/SVELTE.md +0 -146
  10. package/e2e/demo.test.ts +0 -6
  11. package/eslint.config.js +0 -41
  12. package/index.html +0 -23
  13. package/playwright.config.ts +0 -9
  14. package/pnpm-workspace.yaml +0 -2
  15. package/src/App.svelte +0 -784
  16. package/src/App.svelte.test.ts +0 -13
  17. package/src/assets/biobio.png +0 -0
  18. package/src/components/CookieConsent.svelte +0 -73
  19. package/src/components/Footer.svelte +0 -122
  20. package/src/components/Header.svelte +0 -99
  21. package/src/components/Search.svelte +0 -177
  22. package/src/components/SkeletonTiles.svelte +0 -94
  23. package/src/components/WineBottle.svelte +0 -56
  24. package/src/components/WinePopup.svelte +0 -192
  25. package/src/components/WineTile.svelte +0 -458
  26. package/src/components/icons/Budget.svelte +0 -35
  27. package/src/components/icons/Diamond.svelte +0 -35
  28. package/src/components/icons/Fish.svelte +0 -56
  29. package/src/components/icons/Heart.svelte +0 -28
  30. package/src/components/icons/Meat.svelte +0 -32
  31. package/src/components/ui/Action.svelte +0 -83
  32. package/src/demo.spec.ts +0 -13
  33. package/src/index.js +0 -7
  34. package/src/services/analytics/analytics.ts +0 -142
  35. package/src/services/analytics/constants.ts +0 -18
  36. package/src/services/api/api.ts +0 -298
  37. package/src/services/api/deserialize.ts +0 -120
  38. package/src/services/bottle/bottle.spec.ts +0 -32
  39. package/src/services/bottle/bottle.ts +0 -78
  40. package/src/services/cache.ts +0 -28
  41. package/src/services/i18n/i18n.ts +0 -146
  42. package/src/services/i18n/translations.json +0 -658
  43. package/src/services/profile/consent.svelte.ts +0 -115
  44. package/src/services/profile/events.ts +0 -73
  45. package/src/services/profile/uid.ts +0 -87
  46. package/src/services/shopify/cart.ts +0 -105
  47. package/src/services/shopify/shopify.spec.ts +0 -66
  48. package/src/services/shopify/shopify.ts +0 -150
  49. package/src/services/store/app-store.svelte.ts +0 -172
  50. package/src/services/store/deserialize.ts +0 -25
  51. package/src/services/store/types.ts +0 -12
  52. package/src/services/ui-config/get-config.ts +0 -25
  53. package/src/services/ui-config/projects-config.ts +0 -156
  54. package/src/services/ui-config/types.ts +0 -15
  55. package/src/services/ui-config/utils.ts +0 -40
  56. package/tsconfig.json +0 -23
  57. package/vite.config.js +0 -84
  58. package/vite.config.js.timestamp-1772121492941-e00587396dc48.mjs +0 -71
  59. package/vitest-setup-client.ts +0 -2
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "wineater-bot",
3
- "version": "4.24.1",
3
+ "version": "4.24.3",
4
4
  "description": "",
5
5
  "main": "dist/wineater-chatbot.mjs",
6
6
  "module": "src/index.js",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
7
11
  "type": "module",
8
12
  "scripts": {
9
13
  "dev": "vite",
@@ -1,10 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(git remote *)"
5
- ]
6
- },
7
- "disabledMcpjsonServers": [
8
- "supabase"
9
- ]
10
- }
package/.prettierignore DELETED
@@ -1,9 +0,0 @@
1
- # Package Managers
2
- package-lock.json
3
- pnpm-lock.yaml
4
- yarn.lock
5
- bun.lock
6
- bun.lockb
7
-
8
- # Miscellaneous
9
- /static/
package/.prettierrc DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "useTabs": true,
3
- "singleQuote": true,
4
- "trailingComma": "none",
5
- "printWidth": 100,
6
- "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
7
- "overrides": [
8
- {
9
- "files": "*.svelte",
10
- "options": {
11
- "parser": "svelte"
12
- }
13
- }
14
- ],
15
- "tailwindStylesheet": "./src/app.css"
16
- }
package/CLAUDE.md DELETED
@@ -1,115 +0,0 @@
1
- # Wineater Bot — Claude Context
2
-
3
- ## What is this?
4
-
5
- This is **wineater-bot** — an embeddable wine recommendation widget that is part of the larger Wineater project. It gets either embedded into client websites via a `<script>` tag or offered as a standalone page hosted by Wineater.
6
-
7
- It renders a wine grid with search, hover/click popups, and analytics, all in a self-contained JS bundle.
8
-
9
- ## Tech Stack
10
-
11
- - **Svelte 5** (runes-based reactivity: `$state`, `$derived`, `$effect`)
12
- - **TypeScript**
13
- - **Vite** (build tool, dev server on :3001)
14
- - Output: `dist/wineater-chatbot.mjs` (ESM) + `dist/wineater-chatbot.umd.js` (UMD)
15
-
16
- ## How to Run
17
-
18
- ```bash
19
- pnpm dev # dev server at localhost:3001
20
- pnpm build # produces dist/ bundles
21
- pnpm test # unit + e2e
22
- pnpm test:unit # Vitest (browser via Playwright/Chromium)
23
- pnpm test:e2e # Playwright
24
- pnpm lint # Prettier + ESLint
25
- ```
26
-
27
- ## Project Structure
28
-
29
- ```
30
- src/
31
- ├── index.js # Entry: mounts App.svelte to #wineater-widget-conteiner
32
- ├── App.svelte # Root component (419 lines, core logic)
33
- ├── components/
34
- │ ├── Header.svelte
35
- │ ├── Footer.svelte
36
- │ ├── Search.svelte # Animated placeholder cycling search bar
37
- │ ├── WineTile.svelte # Wine card: hover popup (desktop), click modal (mobile)
38
- │ ├── WinePopup.svelte # Full wine detail modal
39
- │ ├── SkeletonTiles.svelte # Placeholder cards (initial load + while searching)
40
- │ ├── ui/Action.svelte # Reusable button/link
41
- │ └── icons/ # SVG icon components (Budget, Diamond, Fish, Meat, Heart)
42
- └── services/
43
- ├── api/api.ts # WineaterApi class → Wineater backend
44
- ├── cache.ts # localStorage stale-while-revalidate helpers
45
- ├── api/deserialize.ts # API response → Wine / RecommendedWine types
46
- ├── analytics/analytics.ts # Event tracking → admin-api.wineater.com
47
- ├── analytics/constants.ts # Widget event type constants
48
- ├── store/app-store.svelte.ts # Global state (Svelte runes)
49
- ├── i18n/i18n.ts # Translations + OpenAI wine description translation
50
- └── ui-config/ # Per-project branding/CSS/translations
51
- ```
52
-
53
- ## Key Concepts
54
-
55
- ### Initialization
56
- Client page sets `window.wineaterData = { CLIENT_TOKEN, WIDGET_TYPE, COUNTRY_CODE }` before loading the script. The widget reads this on mount.
57
-
58
- ### Widget Modes
59
- - `store` — retail wine shop, hover popups
60
- - `bar` — bar/restaurant, enables AI translation of wine descriptions
61
-
62
- ### Multi-tenancy (Per-Project Config)
63
- Hardcoded in `src/services/ui-config/projects-config.ts` for projects 0, 21, 25, 26. Each project can have: custom brand color, logo, CSS, translations, button styling.
64
-
65
- CSS variables at runtime: `--wr-brand-color`, `--wr-wineater-color`, `--wineater-font-primary`
66
-
67
- ### API Endpoints Used
68
- | Service | Endpoint |
69
- |---|---|
70
- | Wineater Backend | `https://wineater-backend.vercel.app/` |
71
- | Admin API (analytics) | `https://admin-api.wineater.com/api/widget-events` |
72
- | OpenAI | `https://api.openai.com/v1/chat/completions` (gpt-3.5-turbo, wine translation) |
73
-
74
- ### Languages Supported
75
- `en, de, fr, es, it, ja, zh, ru, kk, pt`
76
-
77
- ### DOM Mount Point
78
- ```html
79
- <div id="wineater-widget-conteiner"></div>
80
- ```
81
- Note the intentional typo in "conteiner" — it is used in production, do not fix it.
82
-
83
- ## Performance Notes
84
-
85
- - Store config (24h) and instant recommendations (6h) are cached in localStorage (`wineater:v1:<token-hash>:…`); cached data paints immediately, the network response only refreshes the cache for the next visit
86
- - Config and instant requests start in parallel; search/more/similar requests start before the 220 ms card-slide animation
87
- - The `es` bundle is minified by the `minify-esm-bundle` plugin in `vite.config.js` (Vite skips whitespace minification for `es` lib builds)
88
- - `@import` in project `customCss` is converted to `<link rel="stylesheet">` by `generateInlineStyle`
89
-
90
- ## Shopify mode (4.24+)
91
-
92
- On a Shopify storefront the Wineater app embed (repo `wineater-shopify`) sets `window.wineaterData.shopify`
93
- (`shop`, `locale`, `currency`, `root`, `config`, `color`) and `mountTarget` (a div inside a shadow root), then loads
94
- this bundle. `src/services/shopify/` switches the widget to `/shopify/storefront/{instant,search,events}`, BUY becomes
95
- "Add to cart" (`Shopify.actions` → `/cart/add.js` → cart permalink, cart attribute `_wineater_session`), 429
96
- `quota_exceeded` shows instant picks + "Our sommelier is resting", no footer link, no own cookies or web fonts, consent
97
- from the Shopify Customer Privacy API. Without `wineaterData.shopify` nothing changes for existing clients.
98
-
99
- ## Important Gotchas
100
-
101
-
102
- - `#wineater-widget-conteiner` — this typo is intentional and load-bearing
103
- - Wine translations use OpenAI and require `open_ai_key` from store config (only in `bar` mode)
104
- - Analytics is only the first-party `trackWidgetEvent` (admin-api.wineater.com); OpenReplay session replay was removed
105
- - Per-project configs are hardcoded (not fetched) — changes require rebuild + redeploy
106
- - `dist/` files are committed to the repo (clients reference them directly or via npm)
107
- - Package manager: **pnpm**
108
-
109
- ## Release Process
110
-
111
- ```bash
112
- pnpm release:patch # bump patch, publish to npm
113
- pnpm release:minor # bump minor, publish to npm
114
- pnpm release:beta # beta tag
115
- ```
@@ -1,133 +0,0 @@
1
- # ADR: Widget Customization System
2
-
3
- **Date:** 26.11.2025
4
- **PR:** https://github.com/Wineater/wineater-bot/pull/2
5
-
6
- ## Context
7
-
8
- Clients increasingly request widget customization for their specific brands and use cases. Typical requests include:
9
-
10
- - Changing colors and overall color scheme.
11
- - Adjusting fonts and typography.
12
- - Tweaking styles of individual UI elements (buttons, inputs, popups, etc.).
13
- - Customizing translations and text copy.
14
-
15
- Previously, such changes were mostly implemented as one‑off, manual style overrides or ad‑hoc modifications in the codebase. This approach has several drawbacks:
16
-
17
- - Poor scalability when multiple clients require different customizations.
18
- - High risk of regressions when editing styles for a single client.
19
- - No clear system for naming, organizing, or reusing styles and components.
20
- - Limited ability to evolve towards a proper design system and reusable components.
21
-
22
- We want to move away from manual, one‑by‑one style hacking and instead provide:
23
-
24
- - A component library that can be configured at the level of components, not individual DOM elements.
25
- - A token‑based color scheme and shared design primitives.
26
- - A single configuration entry point where client‑specific overrides can be described declaratively.
27
-
28
- ## Decision
29
-
30
- We introduced a **customization system** for the widget with the following key aspects:
31
-
32
- 1. **Class naming system using BEM**
33
- - A consistent naming convention was introduced for widget elements based on the BEM methodology.
34
- - This makes it easier to:
35
- - Identify and target elements for styling.
36
- - Maintain styles over time.
37
- - Reason about component structure and responsibilities.
38
-
39
- 2. **Centralized client configuration**
40
- - Client‑specific behavior and appearance are now configured from a single configuration object.
41
- - The configuration contains:
42
- - General options that control various parts of the system (e.g. feature toggles and UI behavior flags).
43
- - A `customCss` field that allows providing custom CSS for a client.
44
-
45
- 3. **Custom CSS entry point**
46
- - The `customCss` property is designed for injecting client‑specific style overrides.
47
- - To increase specificity and avoid conflicts with default styles, all overrides must start from the `#wr-Custom` root selector.
48
- - Example pattern:
49
- - `#wr-Custom .wr-Button { /* client-specific overrides */ }`
50
-
51
- 4. **Direction towards tokens and components**
52
- - The current implementation is a first step towards:
53
- - A shared color system expressed via tokens.
54
- - A reusable set of components that can support variants (e.g. primary/secondary buttons, different input styles).
55
- - The long‑term goal is to customize **component variants and design tokens** rather than patching arbitrary DOM elements with manual CSS.
56
-
57
- ## Alternatives
58
-
59
- 1. **Styling approach: Tailwind instead of BEM**
60
- - We considered using Tailwind CSS (utility‑first classes) instead of the BEM naming convention.
61
- - Pros:
62
- - Potentially smaller final CSS payload due to tree‑shaking.
63
- - Easier merging of classes to avoid shipping unused styles.
64
- - Cons:
65
- - Would require a full rewrite of existing styles into utility classes.
66
- - Requires an additional class‑merge utility and Tailwind tooling in the build pipeline.
67
- - Makes the resulting HTML/CSS less predictable for client‑side overrides, especially when clients are not familiar with Tailwind.
68
- - Given the current state of the project and the need for predictable element names for customization, BEM was chosen over Tailwind.
69
-
70
- 2. **Configuration approach: separate CSS file per client**
71
- - We also considered storing custom styles for each client in a dedicated CSS file.
72
- - Pros:
73
- - Clear physical separation of styles per client.
74
- - Simpler for some hosting scenarios.
75
- - Cons:
76
- - Requires injecting a client identifier into the HTML to load the correct file.
77
- - Increases deployment and configuration complexity (managing many CSS files per environment).
78
- - Harder to keep styles and other configuration (translations, feature flags) in sync in a single place.
79
- - Instead, we opted for a single configuration entry with an inline `customCss` field.
80
-
81
- ## Expectations
82
-
83
- From this decision we expect the following benefits:
84
-
85
- 1. **More flexible customization for clients**
86
- - Ability to adjust translations, color schemes, and key UI elements (buttons, inputs, basic layout) per client.
87
- - A clear mechanism for styling without touching internal implementation details of the widget.
88
-
89
- 2. **Move towards a design‑system approach**
90
- - Over time, introduce configurable component variants instead of ad‑hoc overrides.
91
- - Establish color tokens and a configurable theme, instead of manually redefining colors in many places.
92
-
93
- 3. **Safer and more maintainable styling changes**
94
- - BEM class naming makes selectors more predictable and less fragile.
95
- - Centralized configuration reduces the chance of forgetting to apply a setting in some part of the system.
96
-
97
- ## Technical Debt and Planned Improvements
98
-
99
- The current customization system is intentionally minimal and leaves several areas as explicit technical debt:
100
-
101
- 1. **Global configuration shared across projects**
102
- - A single configuration model is used across multiple projects/clients, which means some unused options are shipped everywhere.
103
- - We plan to introduce a more modular configuration structure so that clients only receive relevant settings.
104
-
105
- 2. **Manual style rewrites and lack of a change strategy**
106
- - Many styles are still written and updated manually without a clear evolution path.
107
- - We need a defined process and guidelines for introducing and deprecating style rules.
108
-
109
- 3. **Missing color system**
110
- - There is no dedicated color token system yet.
111
- - Colors are not centralized, making it hard to define themes and variants.
112
-
113
- 4. **No component‑level design tokens**
114
- - Components (buttons, inputs, etc.) do not expose design tokens for spacing, radii, typography, and interaction states.
115
- - A future step is to define tokens per component and allow them to be configured per client.
116
-
117
- 5. **Lack of component variants**
118
- - Components do not yet expose standardized variants (e.g. `primary`, `secondary`, `ghost`).
119
- - Introducing variants will make customization more structured and reduce the need for one‑off overrides.
120
-
121
- 6. **Font customization limitations**
122
- - At the moment, fonts are effectively tied to Google Fonts.
123
- - There is no supported mechanism for loading custom font files or non‑Google font providers per client.
124
-
125
- 7. **Icon customization limitations**
126
- - It is not yet possible to change icon colors or replace icons via configuration.
127
- - Future work should define an icon system (e.g. via tokens or an icon registry) that can be overridden per client.
128
-
129
- 8. **No first‑class configuration for core UI elements**
130
- - Core components such as buttons and inputs are not yet configurable via a structured theme API.
131
- - Future improvements should expose configuration options for these components (sizes, radii, colors, typography, and states) instead of relying solely on `customCss`.
132
-
133
- These items are expected to be addressed iteratively as we mature the customization system and move closer to a full design‑system and token‑based theming approach.
package/docs/SVELTE.md DELETED
@@ -1,146 +0,0 @@
1
- # ADR: Migrating the Widget to Svelte
2
-
3
- **Date:** 23.11.2025
4
- **PR:** https://github.com/Wineater/wineater-bot/pull/1
5
-
6
- ## Context
7
-
8
- Historically, the Wineater widget was written in plain JavaScript. The code was rewritten multiple times while product hypotheses were being tested. As a result:
9
-
10
- - The widget became hard to maintain: the business logic was obscured by a large amount of DOM‑manipulation boilerplate.
11
- - The codebase contained a lot of legacy, unused code.
12
- - Making changes required deep knowledge of implementation details, raising the onboarding cost for new developers.
13
-
14
- To reduce project-specific knowledge and simplify maintenance, we decided to move to a framework with:
15
-
16
- - Clear documentation,
17
- - Declarative UI,
18
- - Built-in reactivity.
19
-
20
- At the time of the decision:
21
-
22
- - The widget must be embeddable on client sites (as a script) and stay very small in terms of JS bundle size.
23
- - We need to be able to quickly experiment with UI and business logic without accumulating more low-level DOM boilerplate.
24
- - Migration of services from JS to TS had already started, and a clear separation between business logic and the framework was important.
25
-
26
- Changes made as part of this migration:
27
-
28
- 1. Removed unused code that was not referenced anywhere.
29
- 2. Improved the “wine” entity handling:
30
- - Previously, the instant/search APIs returned different shapes (e.g. instant: `ID`, `Title`; search: `id`, `title`), which caused many conditional checks and branches in the code.
31
- - Introduced deserialization in the data access layer, so the UI layer always works with a consistent wine entity.
32
- 3. Language switching no longer reloads the page; state is managed via a global store and Svelte reactivity.
33
- 4. Currency formatting is now done via the standard browser `Intl` API, reducing custom code and localization bugs.
34
- 5. All services were migrated from JS to TypeScript and rewritten to not depend on the framework (Svelte is used only at the UI layer).
35
- 6. Introduced the global `app-store` for API‑loaded config and helper methods to access it.
36
-
37
- Current limitations / technical debt:
38
-
39
- - `App.svelte` is too large and holds too many responsibilities.
40
- - Popup translations and some animations (search placeholder) still manipulate the DOM directly instead of using Svelte’s reactive state.
41
- - A significant amount of code was migrated “as is” from the old codebase to avoid blocking the migration; it still needs structural refactoring.
42
-
43
- ## Alternatives
44
-
45
- Framework options considered:
46
-
47
- 1. **React**
48
- - Pros:
49
- - Already used in other products of the startup.
50
- - Large ecosystem and community.
51
- - Cons:
52
- - Relatively heavy runtime and bundle size for a small embedded widget.
53
- - DX (as of 2025) is not ideal for a lightweight embeddable widget.
54
- - Typically requires more wiring (hooks, context, styling solutions), which leads to additional boilerplate.
55
-
56
- 2. **Vue**
57
- - Pros:
58
- - Good DX, relatively low learning curve.
59
- - Lighter and faster than React at runtime.
60
- - Cons:
61
- - Still relatively heavy for a very small, embeddable widget.
62
- - Keeps a runtime library in the bundle, increasing overall JS size.
63
-
64
- 3. **Svelte** (chosen)
65
- - Pros:
66
- - Compiles to “plain” JS and effectively disappears as a framework at runtime (no heavy runtime library).
67
- - Much smaller JS payload, which is critical for a widget.
68
- - Built-in reactivity, templating, and styling support, which reduces external boilerplate.
69
- - Helps separate business logic (services, store) from the presentation layer.
70
- - Cons:
71
- - Smaller ecosystem compared to React/Vue.
72
- - Fewer developers on the market with Svelte experience.
73
-
74
- 4. **Stay on plain JS** (status quo)
75
- - Pros:
76
- - No framework dependency.
77
- - Maximum control over DOM and the bundle.
78
- - Cons:
79
- - High volume of DOM‑manipulation boilerplate.
80
- - Hard to maintain, high cost of change.
81
- - Low readability of business logic.
82
-
83
- ## Decision
84
-
85
- We decided to rewrite the widget’s client-side code using **Svelte**, while keeping:
86
-
87
- - Type‑safe business logic and services in TypeScript, independent from the framework.
88
- - A lightweight, compiled UI layer without a heavy runtime.
89
-
90
- Key aspects of the decision:
91
-
92
- - **Framework:** Svelte is chosen as the best compromise between DX, performance, and bundle size for an embeddable widget.
93
- - **Architecture:**
94
- - Introduce a global `app-store` to keep config and shared state.
95
- - Keep services (API calls, deserialization, etc.) outside of the UI layer and independent of Svelte.
96
- - **Compatibility:**
97
- - We still generate a UMD bundle for historical reasons. If UMD is no longer used in the future, this format can be removed from the build configuration.
98
- - **Functional changes within this migration:**
99
- - Unified wine data model.
100
- - Language switching without full page reload.
101
- - Currency formatting via `Intl`.
102
-
103
- ## Expectations
104
-
105
- High-level expectations from this decision:
106
-
107
- 1. **Simpler maintenance and onboarding**
108
- - Business logic is easier to understand thanks to declarative Svelte UI and reactivity.
109
- - New developers can rely on framework documentation instead of project-specific DOM patterns.
110
-
111
- 2. **Smaller bundle and better performance for an embeddable widget**
112
- - Svelte compiles away, reducing runtime overhead compared to heavier frameworks.
113
- - Unified data model and removal of unused code reduce complexity and runtime branching.
114
-
115
- 3. **Faster and safer product experimentation**
116
- - Clear separation between services, store, and UI makes it easier to iterate on features without destabilizing the widget.
117
- - Shared architecture across clients enables more customized UIs with controlled complexity.
118
-
119
- ## Technical Debt and Planned Improvements
120
-
121
- The following items are explicitly acknowledged as technical debt or future improvement areas, not as part of the initial migration scope:
122
-
123
- 1. **UI structure and DOM usage**
124
- - `App.svelte` is too large and should be decomposed into smaller, focused components.
125
- - Remaining direct DOM manipulations (popup translations, search placeholder animations, etc.) should be replaced with reactive Svelte patterns.
126
-
127
- 2. **State management**
128
- - Reduce coupling between the global state and other modules.
129
- - Split the single global store into several domain-specific stores (e.g., language, config, session, search results).
130
-
131
- 3. **Testing and typing**
132
- - Increase end-to-end (E2E) test coverage for critical flows (embedding, search, language switching, recommendations).
133
- - Gradually improve TypeScript typings at boundaries between services and UI to catch more issues at compile time.
134
-
135
- 4. **Localization**
136
- - Implement a translation mechanism that does not require passing the locale explicitly through every call, relying instead on a centralized locale context/store.
137
-
138
- 5. **Logging and observability**
139
- - Improve the logger so that events from local development do not pollute production analytics/logs (environment-aware logging).
140
-
141
- 6. **Configuration and deployment hygiene**
142
- - Move hardcoded `CLIENT_TOKEN` into environment variables, so credentials are not hardcoded in the HTML files.
143
- - Introduce project/environment configurations and store `WIDGET_TYPE` and similar parameters there instead of hardcoding them in HTML/JS.
144
- - Remove per-environment HTML files currently added for each Vercel environment and replace them with a single entry point plus configuration-driven behavior.
145
-
146
- These items should be addressed iteratively in follow-up work, once the Svelte migration is stable and validated in production.
package/e2e/demo.test.ts DELETED
@@ -1,6 +0,0 @@
1
- import { expect, test } from '@playwright/test';
2
-
3
- test('home page has expected h1', async ({ page }) => {
4
- await page.goto('/');
5
- await expect(page.locator('h1')).toBeVisible();
6
- });
package/eslint.config.js DELETED
@@ -1,41 +0,0 @@
1
- import prettier from 'eslint-config-prettier';
2
- import { fileURLToPath } from 'node:url';
3
- import { includeIgnoreFile } from '@eslint/compat';
4
- import js from '@eslint/js';
5
- import svelte from 'eslint-plugin-svelte';
6
- import { defineConfig } from 'eslint/config';
7
- import globals from 'globals';
8
- import ts from 'typescript-eslint';
9
- import svelteConfig from './svelte.config.js';
10
-
11
- const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
12
-
13
- export default defineConfig(
14
- includeIgnoreFile(gitignorePath),
15
- js.configs.recommended,
16
- ...ts.configs.recommended,
17
- ...svelte.configs.recommended,
18
- prettier,
19
- ...svelte.configs.prettier,
20
- {
21
- languageOptions: {
22
- globals: { ...globals.browser, ...globals.node }
23
- },
24
- rules: {
25
- // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
26
- // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
27
- 'no-undef': 'off'
28
- }
29
- },
30
- {
31
- files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
32
- languageOptions: {
33
- parserOptions: {
34
- projectService: true,
35
- extraFileExtensions: ['.svelte'],
36
- parser: ts.parser,
37
- svelteConfig
38
- }
39
- }
40
- }
41
- );
package/index.html DELETED
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Chatbot</title>
8
- <!-- TODO: replace later with __WINEATER_WIDGET_DATA__ -->
9
- <script>window.wineaterData = { CLIENT_TOKEN: 'emZGQHlITdVpwvK2hLXRopFS2emvorRsHadgaKbJThiVCPRWRzD0JyZrxrtgt10a', WIDGET_TYPE: 'store' };</script>
10
- <!-- Production build checks -->
11
- <!-- <script type="module" src="./dist/wineater-chatbot.mjs"></script> -->
12
- <!-- Production CDN -->
13
- <!-- <script type="module" src="https://unpkg.com/wineater-bot@beta/dist/wineater-chatbot.mjs"></script> -->
14
-
15
- <!-- Local development -->
16
- <script type="module" src="./src/index.js"></script>
17
- </head>
18
-
19
- <body style="margin: 0;">
20
- <div id="wineater-widget-conteiner"></div>
21
- </body>
22
-
23
- </html>
@@ -1,9 +0,0 @@
1
- import { defineConfig } from '@playwright/test';
2
-
3
- export default defineConfig({
4
- webServer: {
5
- command: 'npm run build && npm run preview',
6
- port: 4173
7
- },
8
- testDir: 'e2e'
9
- });
@@ -1,2 +0,0 @@
1
- onlyBuiltDependencies:
2
- - esbuild