@mirai/core 0.4.649 → 0.4.651
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/build/components/Banner/__tests__/__snapshots__/Banner.skeleton.test.js.snap +278 -0
- package/build/components/Banner/__tests__/__snapshots__/Banner.test.js.snap +9 -0
- package/build/components/Booking/__tests__/__snapshots__/Booking.test.js.snap +3862 -0
- package/build/components/Booking/components/Field/__tests__/__snapshots__/Field.test.js.snap +139 -0
- package/build/components/Booking/components/Hotelverse/__tests__/__snapshots__/Hotelverse.test.js.snap +28 -0
- package/build/components/Booking/components/Summary/__tests__/__snapshots__/Summary.test.js.snap +1683 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.FormCancel.test.js.snap +586 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.FormEdit.test.js.snap +46 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.FormEditDate.test.js.snap +1822 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.FormEditOccupation.test.js.snap +326 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.FormResend.test.js.snap +170 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.Information.test.js.snap +110 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.Menu.test.js.snap +82 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.Modal.test.js.snap +208 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.ModalAgency.test.js.snap +107 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.ModalCalendar.test.js.snap +463 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.ModalCesSurvey.test.js.snap +255 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.ModalOccupation.test.js.snap +491 -0
- package/build/components/Booking/partials/__tests__/__snapshots__/Booking.Payment.test.js.snap +418 -0
- package/build/components/BookingQuery/__tests__/__snapshots__/BookingQuery.test.js.snap +92 -0
- package/build/components/ButtonFinder/__tests__/__snapshots__/ButtonFinder.test.js.snap +65 -0
- package/build/components/Chat/__tests__/__snapshots__/Chat.constants.test.js.snap +101 -0
- package/build/components/Chat/components/Input/__tests__/__snapshots__/Input.test.jsx.snap +190 -0
- package/build/components/Chat/components/Message/__tests__/__snapshots__/Message.test.jsx.snap +204 -0
- package/build/components/Chat/components/Message/components/__tests__/__snapshots__/Environment.test.js.snap +44 -0
- package/build/components/Chat/helpers/__tests__/__snapshots__/getVerboseDate.test.js.snap +9 -0
- package/build/components/Checkout/__tests__/__snapshots__/Checkout.test.js.snap +4946 -0
- package/build/components/Checkout/components/InputRadio/__tests__/__snapshots__/InputRadio.test.js.snap +371 -0
- package/build/components/Checkout/partials/__tests__/__snapshots__/Checkout.Confirmation.test.js.snap +412 -0
- package/build/components/Checkout/partials/__tests__/__snapshots__/Checkout.Form.test.js.snap +6333 -0
- package/build/components/CookieBanner/__tests__/__snapshots__/CookieBanner.test.js.snap +7 -0
- package/build/components/Deals/__tests__/__mocks__/deal.json +25 -0
- package/build/components/Deals/__tests__/__snapshots__/Deals.test.js.snap +5527 -0
- package/build/components/Environment/__tests__/__snapshots__/Environment.State.test.js.snap +120 -0
- package/build/components/Environment/__tests__/__snapshots__/Environment.test.js.snap +1088 -0
- package/build/components/Finder/__tests__/__snapshots__/Finder.constants.test.js.snap +35 -0
- package/build/components/Finder/__tests__/__snapshots__/Finder.test.js.snap +21195 -0
- package/build/components/Finder/components/Calendar/__tests__/__mocks__/prices.json +11 -0
- package/build/components/Finder/components/Calendar/__tests__/__snapshots__/Calendar.test.js.snap +8546 -0
- package/build/components/Finder/components/Places/__tests__/__mocks__/places.json +44 -0
- package/build/components/Finder/components/Places/__tests__/__snapshots__/Places.test.js.snap +324 -0
- package/build/components/Finder/helpers/__tests__/__mocks__/dataSource.json +1382 -0
- package/build/components/Finder/helpers/__tests__/__snapshots__/getForwarderUrl.test.js.snap +7 -0
- package/build/components/Header/__tests__/__snapshots__/Header.test.js.snap +1105 -0
- package/build/components/Profile/components/Bookings/__tests__/__snapshots__/Bookings.test.js.snap +19 -0
- package/build/components/Rates/__tests__/__snapshots__/Rates.Content.test.js.snap +59 -0
- package/build/components/Rates/__tests__/__snapshots__/Rates.Footer.test.js.snap +50 -0
- package/build/components/Rates/__tests__/__snapshots__/Rates.Header.test.js.snap +3 -0
- package/build/components/Rates/__tests__/__snapshots__/Rates.RoomSelector.test.js.snap +3 -0
- package/build/components/Rates/__tests__/__snapshots__/Rates.Unavailability.test.js.snap +53 -0
- package/build/components/Rates/__tests__/__snapshots__/Rates.test.js.snap +9962 -0
- package/build/components/Rates/components/CardHotel/__tests__/__snapshots__/CardHotel.test.js.snap +116 -0
- package/build/components/Rates/components/Filters/__tests__/__snapshots__/FIlters.Button.test.js.snap +32 -0
- package/build/components/Rates/components/Filters/__tests__/__snapshots__/Filters.Amenity.test.js.snap +21 -0
- package/build/components/Rates/components/Filters/__tests__/__snapshots__/Filters.BookingOption.test.js.snap +32 -0
- package/build/components/Rates/components/Filters/__tests__/__snapshots__/Filters.test.js.snap +32 -0
- package/build/components/Rates/components/Hotelverse/__tests__/__snapshots__/Hotelverse.test.js.snap +3 -0
- package/build/components/Rates/components/Item/__tests__/__snapshots__/Item.Preview.test.js.snap +93 -0
- package/build/components/Rates/components/Item/__tests__/__snapshots__/Item.Rates.test.js.snap +9 -0
- package/build/components/Rates/components/Item/__tests__/__snapshots__/Item.Summary.test.js.snap +52 -0
- package/build/components/Rates/components/Item/__tests__/__snapshots__/Item.test.js.snap +150 -0
- package/build/components/Rates/components/Item/components/Amenities/__tests__/__snapshots__/Amenities.test.js.snap +3 -0
- package/build/components/Rates/components/Item/components/Countdown/__tests__/__snapshots__/Countdown.test.js.snap +3 -0
- package/build/components/Rates/components/Item/components/Features/__tests__/__snapshots__/Features.test.js.snap +40 -0
- package/build/components/Rates/components/Item/components/ModalCancellationInfo/__tests__/__snapshots__/ModalCancellationInfo.test.js.snap +16 -0
- package/build/components/Rates/components/Item/components/ModalInfo/__tests__/__snapshots__/ModalInfo.test.js.snap +47 -0
- package/build/components/Rates/components/Item/components/ModalOfferInfo/__tests__/__snapshots__/ModalOfferInfo.test.js.snap +47 -0
- package/build/components/Rates/components/Item/components/ModalUrl/__tests__/__snapshots__/ModalUrl.test.js.snap +47 -0
- package/build/components/Rates/components/Item/components/Option/__tests__/__snapshots__/Option.test.js.snap +17 -0
- package/build/components/Rates/components/Item/components/PriceDetails/__tests__/__snapshots__/PriceDetails.test.js.snap +23 -0
- package/build/components/Rates/components/Item/components/RateDetails/__tests__/__snapshots__/RateDetails.test.js.snap +3 -0
- package/build/components/Rates/components/Item/components/Slider/__tests__/__snapshots__/Slider.test.js.snap +27 -0
- package/build/components/Rates/components/Item/components/TooltipDates/__tests__/__snapshots__/TooltipDates.test.js.snap +3 -0
- package/build/components/Rates/components/ModalExtras/__tests__/__snapshots__/ModalExtras.test.js.snap +52 -0
- package/build/components/Rates/components/ModalMapView/__tests__/__snapshots__/ModalMapView.test.js.snap +16 -0
- package/build/components/Rates/components/ModalTwin/__tests__/__snapshots__/ModalTwin.test.js.snap +374 -0
- package/build/components/Rates/components/ModalTwin/components/__tests__/__snapshots__/CardExpanded.test.js.snap +133 -0
- package/build/components/Rates/components/ModalTwin/components/__tests__/__snapshots__/CardReduced.test.js.snap +50 -0
- package/build/components/Rates/components/ModalTwin/components/__tests__/__snapshots__/Slider.test.js.snap +40 -0
- package/build/components/Rates/components/OTAPrices/__tests__/__snapshots__/OTAPrices.test.js.snap +3 -0
- package/build/components/Rooms/__tests__/__mocks__/room.json +21 -0
- package/build/components/Rooms/__tests__/__snapshots__/Rooms.test.js.snap +5527 -0
- package/build/components/Session/__tests__/__snapshots__/Session.test.js.snap +264 -0
- package/build/components/Signup/__tests__/__snapshots__/Signup.test.js.snap +1040 -0
- package/build/components/__shared__/BookingDates/__tests__/__snapshots__/BookingDates.test.js.snap +208 -0
- package/build/components/__shared__/BookingDetails/__tests__/__snapshots__/BookingDetails.test.js.snap +2355 -0
- package/build/components/__shared__/BookingTable/__tests__/__snapshots__/BookingTable.Row.test.js.snap +500 -0
- package/build/components/__shared__/BookingTable/__tests__/__snapshots__/BookingTable.test.js.snap +745 -0
- package/build/components/__shared__/BookingTerms/__tests__/__snapshots__/BookingTerms.test.js.snap +414 -0
- package/build/components/__shared__/ButtonMore/__tests__/__snapshots__/ButtonMore.test.js.snap +115 -0
- package/build/components/__shared__/ButtonPayment/__tests__/__snapshots__/ButtonPayment.test.js.snap +210 -0
- package/build/components/__shared__/ButtonPayment/components/Form/__tests__/__snapshots__/Form.test.js.snap +65 -0
- package/build/components/__shared__/ButtonPayment/components/FormAddon/__tests__/__snapshots__/FormAddon.test.js.snap +53 -0
- package/build/components/__shared__/ButtonPayment/components/FormGetnet/__tests__/__snapshots__/FormGetnet.test.js.snap +14 -0
- package/build/components/__shared__/ButtonPayment/components/FormHotelpay/__tests__/__snapshots__/FormHotelpay.test.js.snap +104 -0
- package/build/components/__shared__/ButtonPayment/components/FormNuvei/__tests__/__snapshots__/FormNuvei.test.js.snap +21 -0
- package/build/components/__shared__/ButtonPayment/components/FormPaybyrd/__tests__/__snapshots__/FormPaybyrd.test.js.snap +41 -0
- package/build/components/__shared__/ButtonPayment/components/FormPaycomet/__tests__/__snapshots__/FormPaycomet.test.js.snap +18 -0
- package/build/components/__shared__/ButtonPayment/components/FormStripe/FormStripe.js +30 -22
- package/build/components/__shared__/ButtonPayment/components/FormStripe/FormStripe.js.map +1 -1
- package/build/components/__shared__/ButtonPayment/components/InputField/__tests__/__snapshots__/InputField.test.js.snap +190 -0
- package/build/components/__shared__/Card/__tests__/__snapshots__/Card.test.js.snap +34 -0
- package/build/components/__shared__/Countdown/__tests__/__snapshots__/Countdown.test.js.snap +42 -0
- package/build/components/__shared__/Field/__tests__/__snapshots__/Field.test.js.snap +366 -0
- package/build/components/__shared__/FieldOccupation/__tests__/__snapshots__/FieldOccupation.test.js.snap +2242 -0
- package/build/components/__shared__/FieldPromocode/__tests__/__snapshots__/FieldPromocode.test.jsx.snap +308 -0
- package/build/components/__shared__/Footer/__tests__/__snapshots__/Footer.test.js.snap +186 -0
- package/build/components/__shared__/NotificationRequiredFields/__tests__/__snapshots__/NotificationRequiredFields.test.js.snap +82 -0
- package/build/components/__shared__/Occupation/__tests__/__mocks__/occupation.json +17 -0
- package/build/components/__shared__/Occupation/__tests__/__snapshots__/Occupation.test.js.snap +3754 -0
- package/build/components/__shared__/Payment/__tests__/__snapshots__/Payment.test.js.snap +1105 -0
- package/build/components/__shared__/Payment/components/Aplazame/__tests__/__snapshots__/Aplazame.test.js.snap +35 -0
- package/build/components/__shared__/Payment/components/Card/__tests__/__snapshots__/Card.test.js.snap +996 -0
- package/build/components/__shared__/Payment/components/LinkagePay/__tests__/__snapshots__/LinkagePay.test.js.snap +876 -0
- package/build/components/__shared__/Payment/components/Openpay/__tests__/__snapshots__/Openpay.test.js.snap +876 -0
- package/build/components/__shared__/Payment/components/PCI/__tests__/__snapshots__/PCI.test.js.snap +504 -0
- package/build/components/__shared__/Payment/components/Tpv/__tests__/__snapshots__/Tpv.test.js.snap +119 -0
- package/build/components/__shared__/PriceBreakdown/__tests__/__snapshots__/PriceBreakdown.Line.test.js.snap +49 -0
- package/build/components/__shared__/PriceBreakdown/__tests__/__snapshots__/PriceBreakdown.test.js.snap +337 -0
- package/build/components/__shared__/RatesExplorer/__tests__/__snapshots__/RatesExplorer.Calendar.test.js.snap +2841 -0
- package/build/components/__shared__/RatesExplorer/__tests__/__snapshots__/RatesExplorer.constants.js.snap +14 -0
- package/build/components/__shared__/RatesExplorer/__tests__/__snapshots__/RatesExplorer.test.js.snap +11053 -0
- package/build/components/__shared__/RatesExplorer/helpers/__tests__/__mocks__/deal.json +28 -0
- package/build/components/__shared__/SelectEnvironment/__tests__/__snapshots__/SelectEnvironment.test.js.snap +1352 -0
- package/build/components/__shared__/Skeleton/__tests__/__snapshots__/Skeleton.test.js.snap +67 -0
- package/build/components/__shared__/TextRequiredFields/__tests__/__snapshots__/TextRequiredFields.test.js.snap +41 -0
- package/build/components/helpers/__tests__/__mocks__/hotels.json +87 -0
- package/build/components/helpers/__tests__/__snapshots__/parseHtml.test.js.snap +331 -0
- package/build/components/helpers/escapeHtml.js +19 -0
- package/build/components/helpers/escapeHtml.js.map +1 -0
- package/build/components/helpers/template.js +5 -1
- package/build/components/helpers/template.js.map +1 -1
- package/build/helpers/fetchSession.js +13 -1
- package/build/helpers/fetchSession.js.map +1 -1
- package/package.json +4 -1
- package/.sentryclirc +0 -3
- package/AGENTS.md +0 -296
- package/Dockerfile +0 -16
- package/bitbucket-pipelines.yml +0 -12
- package/config/jest/fileMock.js +0 -1
- package/config/jest/setup.env.js +0 -20
- package/config/jest/setup.js +0 -3
- package/jest.config.js +0 -22
package/AGENTS.md
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
# AGENTS.md
|
|
2
|
-
|
|
3
|
-
## Project Overview
|
|
4
|
-
|
|
5
|
-
@mirai/core is a React component library and provider system for hotel booking interfaces. It provides a complete suite of components for finding, booking, and managing hotel reservations including rates display, checkout flows, user sessions, and promotional deals. The library uses React hooks, CSS modules, and a centralized event system for component communication.
|
|
6
|
-
|
|
7
|
-
## Architecture
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
Core Provider → Event Manager → Components → Services → External APIs
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
- Core provider wraps the application with shared context and configuration
|
|
14
|
-
- Event-driven architecture for component communication via EventManager
|
|
15
|
-
- Automatic performance monitoring and error tracking
|
|
16
|
-
- CSS modules for scoped styling with theming support
|
|
17
|
-
- PropTypes for runtime type checking
|
|
18
|
-
|
|
19
|
-
## Build and Test Commands
|
|
20
|
-
|
|
21
|
-
### Quick Start
|
|
22
|
-
```bash
|
|
23
|
-
# Install dependencies
|
|
24
|
-
yarn install
|
|
25
|
-
|
|
26
|
-
# Start development environment
|
|
27
|
-
yarn start
|
|
28
|
-
|
|
29
|
-
# Run unit tests (Jest)
|
|
30
|
-
yarn test
|
|
31
|
-
|
|
32
|
-
# Run E2E tests (Playwright)
|
|
33
|
-
yarn test:e2e
|
|
34
|
-
|
|
35
|
-
# Build for production
|
|
36
|
-
yarn build:npm
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Development Commands
|
|
40
|
-
|
|
41
|
-
#### Testing
|
|
42
|
-
```bash
|
|
43
|
-
yarn test # All unit tests with Jest
|
|
44
|
-
yarn test:watch # Watch mode for unit tests
|
|
45
|
-
yarn test:e2e # Playwright E2E tests with UI
|
|
46
|
-
yarn pipeline # Lint + test (CI pipeline)
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
#### Linting & Validation
|
|
50
|
-
```bash
|
|
51
|
-
yarn lint # ESLint check (MUST pass before commit)
|
|
52
|
-
yarn lint:fix # Auto-fix linting issues
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Code Style Guidelines
|
|
56
|
-
|
|
57
|
-
### CRITICAL: No Comments Policy
|
|
58
|
-
**ABSOLUTE RULE**: This codebase uses @mirai/eslint which FORBIDS all comments. Write self-documenting code only.
|
|
59
|
-
|
|
60
|
-
```javascript
|
|
61
|
-
// ❌ FORBIDDEN - Will fail ESLint
|
|
62
|
-
// This component renders booking rates
|
|
63
|
-
|
|
64
|
-
// ✅ REQUIRED - Self-documenting code
|
|
65
|
-
const BookingRatesDisplay = ({ rates, onRateSelect }) => {
|
|
66
|
-
return renderRateOptions({ rates, onRateSelect });
|
|
67
|
-
};
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Import Order
|
|
71
|
-
1. External packages (npm dependencies)
|
|
72
|
-
2. @mirai scoped packages
|
|
73
|
-
3. Relative imports (../components, ../helpers)
|
|
74
|
-
4. Local imports (./utils, ./constants)
|
|
75
|
-
|
|
76
|
-
Each group separated by newline and alphabetically sorted:
|
|
77
|
-
|
|
78
|
-
```javascript
|
|
79
|
-
import React, { useState, useEffect } from 'react';
|
|
80
|
-
import PropTypes from 'prop-types';
|
|
81
|
-
|
|
82
|
-
import { Event } from '@mirai/event-manager';
|
|
83
|
-
|
|
84
|
-
import { fetchConfig } from '../helpers';
|
|
85
|
-
|
|
86
|
-
import { BOOKING_STATES } from './booking.constants';
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Component Standards
|
|
90
|
-
- **Functional Components**: Always use React hooks over class components
|
|
91
|
-
- **PropTypes**: Required for all props with detailed shape definitions
|
|
92
|
-
- **CSS Modules**: Use `.module.css` files for component-specific styles
|
|
93
|
-
- **Event Communication**: Use Event.publish/subscribe for component communication
|
|
94
|
-
- **Error Boundaries**: Wrap components that might fail in Core.Error
|
|
95
|
-
- **Performance**: Use React.memo for expensive components
|
|
96
|
-
|
|
97
|
-
### File Naming Conventions
|
|
98
|
-
- Components: PascalCase directories with index files (`Finder/index.jsx`)
|
|
99
|
-
- Styles: `{Component}.module.css`
|
|
100
|
-
- Constants: `{component}.constants.js`
|
|
101
|
-
- Tests: `{Component}.test.jsx` (unit), `{component}.spec.js` (E2E)
|
|
102
|
-
- Workflows: `{action}.workflow.js` (Playwright helpers)
|
|
103
|
-
|
|
104
|
-
### Formatting
|
|
105
|
-
- Prettier: 2 spaces, single quotes, trailing commas, 120 char width
|
|
106
|
-
- Destructure props and imports
|
|
107
|
-
- Early returns for validation
|
|
108
|
-
- Template literals over string concatenation
|
|
109
|
-
|
|
110
|
-
## Testing Instructions
|
|
111
|
-
|
|
112
|
-
### Unit Tests (Jest + React Testing Library)
|
|
113
|
-
- **Location**: `src/**/__tests__/*.test.jsx`
|
|
114
|
-
- **Dependencies**: Mock external services and APIs
|
|
115
|
-
- **Run**: `yarn test`
|
|
116
|
-
- **Coverage**: Maintain 80%+ coverage
|
|
117
|
-
- **Environment**: Uses test-specific mocks in `__mocks__/`
|
|
118
|
-
|
|
119
|
-
### E2E Tests (Playwright)
|
|
120
|
-
- **Location**: `__tests__/*.spec.js`
|
|
121
|
-
- **Dependencies**: Full browser automation with real interactions
|
|
122
|
-
- **Run**: `yarn test:e2e`
|
|
123
|
-
- **Screenshots**: Automatic screenshot comparison in `__screenshots__/`
|
|
124
|
-
- **Workflows**: Reusable test helpers in `workflows/` directories
|
|
125
|
-
|
|
126
|
-
### Test File Structure
|
|
127
|
-
```
|
|
128
|
-
{Component}.test.jsx # Unit tests with RTL
|
|
129
|
-
{feature}.spec.js # E2E tests with Playwright
|
|
130
|
-
{feature}.workflow.js # Reusable E2E workflows
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## Component Architecture
|
|
134
|
-
|
|
135
|
-
### Core Provider System
|
|
136
|
-
The Core component wraps the entire application and provides:
|
|
137
|
-
- Global error handling via Core.Error
|
|
138
|
-
- Event management via EventManager context
|
|
139
|
-
- Performance monitoring via PerformanceManager
|
|
140
|
-
- Notification system via Core.Notifications
|
|
141
|
-
- Theme and locale configuration
|
|
142
|
-
|
|
143
|
-
### Event-Driven Communication
|
|
144
|
-
```javascript
|
|
145
|
-
// Publishing events
|
|
146
|
-
Event.publish('booking:rateSelected', { rateId, price });
|
|
147
|
-
|
|
148
|
-
// Subscribing to events
|
|
149
|
-
useEffect(() => {
|
|
150
|
-
const unsubscribe = Event.subscribe('booking:rateSelected', handleRateSelection);
|
|
151
|
-
return unsubscribe;
|
|
152
|
-
}, []);
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### CSS Module Patterns
|
|
156
|
-
```css
|
|
157
|
-
/* Component.module.css */
|
|
158
|
-
.container {
|
|
159
|
-
/* Base styles */
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.container--loading {
|
|
163
|
-
/* Modifier styles using BEM-like naming */
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.button {
|
|
167
|
-
/* Component-specific button styles */
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Security Considerations
|
|
172
|
-
|
|
173
|
-
- **Input Sanitization**: All user inputs sanitized before API calls
|
|
174
|
-
- **XSS Prevention**: Use dangerouslySetInnerHTML sparingly with sanitization
|
|
175
|
-
- **API Security**: Never expose API keys in client code
|
|
176
|
-
- **Session Management**: Secure cookie handling for user sessions
|
|
177
|
-
- **HTTPS Only**: All external API calls over HTTPS
|
|
178
|
-
- **Content Security Policy**: Strict CSP headers in production
|
|
179
|
-
|
|
180
|
-
## Environment Configuration
|
|
181
|
-
|
|
182
|
-
### Required Environment Variables
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
NODE_ENV=development|production|test
|
|
186
|
-
REACT_APP_API_BASE_URL=https://api.example.com
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Optional Configuration
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
REACT_APP_PERFORMANCE_MONITORING=true # Enable performance tracking
|
|
193
|
-
REACT_APP_DEBUG_EVENTS=true # Log event communications
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Never commit `.env` files to repository.
|
|
197
|
-
|
|
198
|
-
## Performance Guidelines
|
|
199
|
-
|
|
200
|
-
- **Bundle Size**: Keep individual components under 50KB
|
|
201
|
-
- **Lazy Loading**: Use React.lazy for route-level components
|
|
202
|
-
- **Memoization**: Implement React.memo for expensive renders
|
|
203
|
-
- **Event Cleanup**: Always unsubscribe from events in useEffect cleanup
|
|
204
|
-
- **Image Optimization**: Use appropriate formats and lazy loading
|
|
205
|
-
- **CSS**: Minimize unused styles, prefer CSS modules over global styles
|
|
206
|
-
|
|
207
|
-
## Debugging
|
|
208
|
-
|
|
209
|
-
### Common Issues
|
|
210
|
-
|
|
211
|
-
**Component Not Rendering:**
|
|
212
|
-
```bash
|
|
213
|
-
# Check event subscriptions
|
|
214
|
-
REACT_APP_DEBUG_EVENTS=true yarn start
|
|
215
|
-
|
|
216
|
-
# Verify CSS modules import
|
|
217
|
-
import styles from './Component.module.css';
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
**E2E Tests Failing:**
|
|
221
|
-
```bash
|
|
222
|
-
# Run with UI for debugging
|
|
223
|
-
yarn test:e2e --ui
|
|
224
|
-
|
|
225
|
-
# Generate new screenshots
|
|
226
|
-
yarn test:e2e --update-snapshots
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
**Build Issues:**
|
|
230
|
-
```bash
|
|
231
|
-
# Clear cache and reinstall
|
|
232
|
-
rm -rf node_modules yarn.lock
|
|
233
|
-
yarn install
|
|
234
|
-
|
|
235
|
-
# Check for circular dependencies
|
|
236
|
-
yarn build:npm --verbose
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
## Project Structure
|
|
240
|
-
|
|
241
|
-
```
|
|
242
|
-
src/
|
|
243
|
-
├── Core.jsx # Main provider component
|
|
244
|
-
├── Core.provider.jsx # Context providers
|
|
245
|
-
├── Core.Error.jsx # Error boundary
|
|
246
|
-
├── Core.Notifications.jsx # Global notifications
|
|
247
|
-
├── components/ # All React components
|
|
248
|
-
│ ├── __shared__/ # Shared utilities and components
|
|
249
|
-
│ ├── Booking/ # Booking flow components
|
|
250
|
-
│ ├── Checkout/ # Payment and confirmation
|
|
251
|
-
│ ├── Finder/ # Search and filtering
|
|
252
|
-
│ ├── Rates/ # Rate display and selection
|
|
253
|
-
│ └── Session/ # User authentication
|
|
254
|
-
├── contexts/ # React contexts
|
|
255
|
-
│ ├── EventManager/ # Event system
|
|
256
|
-
│ └── PerformanceManager/ # Performance monitoring
|
|
257
|
-
├── helpers/ # Utility functions
|
|
258
|
-
└── services/ # External API services
|
|
259
|
-
|
|
260
|
-
__tests__/ # E2E test suites
|
|
261
|
-
├── workflows/ # Reusable test workflows
|
|
262
|
-
├── __screenshots__/ # Visual regression tests
|
|
263
|
-
└── *.spec.js # Test specifications
|
|
264
|
-
|
|
265
|
-
public/ # Static demo pages
|
|
266
|
-
├── e2e/ # E2E test fixtures
|
|
267
|
-
└── routes/ # Demo application routes
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Contributing
|
|
271
|
-
|
|
272
|
-
1. **ESLint Compliance**: All code must pass `yarn lint` with zero warnings
|
|
273
|
-
2. **Test Coverage**: Maintain 80%+ unit test coverage
|
|
274
|
-
3. **Visual Testing**: Update E2E screenshots when UI changes
|
|
275
|
-
4. **Performance**: Monitor bundle size impact
|
|
276
|
-
5. **Documentation**: Update component PropTypes and this AGENTS.md
|
|
277
|
-
6. **Conventional Commits**: Use semantic commit messages
|
|
278
|
-
|
|
279
|
-
### Pull Request Flow
|
|
280
|
-
```bash
|
|
281
|
-
# Before commit
|
|
282
|
-
yarn lint # Must pass
|
|
283
|
-
yarn test # Must pass
|
|
284
|
-
yarn pipeline # Full validation
|
|
285
|
-
|
|
286
|
-
# PR title format
|
|
287
|
-
[core] Feature: Add new booking component
|
|
288
|
-
[core] Fix: Resolve checkout validation error
|
|
289
|
-
[core] Docs: Update component documentation
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Release Process
|
|
293
|
-
- Semantic versioning (semver)
|
|
294
|
-
- Automated builds on tag creation
|
|
295
|
-
- NPM package distribution
|
|
296
|
-
- Changelog generation from commits
|
package/Dockerfile
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
FROM mcr.microsoft.com/playwright:v1.54.1-noble
|
|
2
|
-
|
|
3
|
-
WORKDIR /app
|
|
4
|
-
|
|
5
|
-
COPY package.json /app
|
|
6
|
-
COPY yarn.lock /app
|
|
7
|
-
COPY playwright.config.js /app
|
|
8
|
-
COPY .env.production /app
|
|
9
|
-
|
|
10
|
-
RUN yarn install --network-timeout 1000000
|
|
11
|
-
|
|
12
|
-
COPY /public /app/public
|
|
13
|
-
COPY /scripts /app/scripts
|
|
14
|
-
COPY /src /app/src
|
|
15
|
-
|
|
16
|
-
RUN chmod -R 777 /app/src
|
package/bitbucket-pipelines.yml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
pipelines:
|
|
2
|
-
pull-requests:
|
|
3
|
-
'**':
|
|
4
|
-
import: template-pipeline-npm:main:pull-requests-core
|
|
5
|
-
tags:
|
|
6
|
-
'**':
|
|
7
|
-
import: template-pipeline-npm:main:core-pro
|
|
8
|
-
branches:
|
|
9
|
-
main:
|
|
10
|
-
import: template-pipeline-npm:main:release
|
|
11
|
-
pre:
|
|
12
|
-
import: template-pipeline-npm:main:core-pre
|
package/config/jest/fileMock.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = 'test-file-stub';
|
package/config/jest/setup.env.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const dotenv = require('dotenv');
|
|
4
|
-
const dotenvExpand = require('dotenv-expand');
|
|
5
|
-
|
|
6
|
-
const NODE_ENV = process.env.NODE_ENV || 'test';
|
|
7
|
-
const base = path.resolve(__dirname, '..', '..', '.env');
|
|
8
|
-
|
|
9
|
-
const dotenvFiles = [
|
|
10
|
-
`${base}.${NODE_ENV}.local`,
|
|
11
|
-
NODE_ENV !== 'test' && `${base}.local`,
|
|
12
|
-
`${base}.${NODE_ENV}`,
|
|
13
|
-
base,
|
|
14
|
-
].filter(Boolean);
|
|
15
|
-
|
|
16
|
-
dotenvFiles.forEach((file) => {
|
|
17
|
-
if (fs.existsSync(file)) {
|
|
18
|
-
dotenvExpand.expand(dotenv.config({ path: file }));
|
|
19
|
-
}
|
|
20
|
-
});
|
package/config/jest/setup.js
DELETED
package/jest.config.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
testEnvironment: 'jsdom',
|
|
3
|
-
roots: ['<rootDir>/src'],
|
|
4
|
-
testMatch: ['**/*.{spec,test}.{js,jsx}'],
|
|
5
|
-
setupFiles: ['<rootDir>/config/jest/setup.env.js', '<rootDir>/config/jest/setup.js'],
|
|
6
|
-
resetMocks: true,
|
|
7
|
-
transform: {
|
|
8
|
-
'^.+\\.(js|jsx)$': [
|
|
9
|
-
'babel-jest',
|
|
10
|
-
{
|
|
11
|
-
babelrc: false,
|
|
12
|
-
configFile: false,
|
|
13
|
-
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-react'],
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
|
-
transformIgnorePatterns: ['node_modules/(?!mirai)/'],
|
|
18
|
-
moduleNameMapper: {
|
|
19
|
-
'\\.(css|less|scss)$': 'identity-obj-proxy',
|
|
20
|
-
'\\.(png|jpg|jpeg|gif|svg|woff2?|ttf|eot)$': '<rootDir>/config/jest/fileMock.js',
|
|
21
|
-
},
|
|
22
|
-
};
|