@mirai/core 0.4.16 → 0.4.18

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 (137) hide show
  1. package/README.md +259 -90
  2. package/__tests__/BookingQuery/workflows/login.workflow.js +2 -2
  3. package/__tests__/Checkout/workflows/form.workflow.js +8 -8
  4. package/__tests__/Deals/__mocks__/deals-success.json +739 -0
  5. package/__tests__/checkout.spec.jsx +10 -0
  6. package/__tests__/deals.spec.js +7 -0
  7. package/build/components/BannerLoyalty/BannerLoyalty.js +70 -63
  8. package/build/components/BannerLoyalty/BannerLoyalty.js.map +1 -1
  9. package/build/components/BannerLoyalty/BannerLoyalty.l10n.js +7 -1
  10. package/build/components/BannerLoyalty/BannerLoyalty.l10n.js.map +1 -1
  11. package/build/components/BannerLoyalty/BannerLoyalty.module.css +55 -30
  12. package/build/components/BannerLoyalty/BannerLoyalty.skeleton.js +27 -29
  13. package/build/components/BannerLoyalty/BannerLoyalty.skeleton.js.map +1 -1
  14. package/build/components/BannerLoyalty/__tests__/__snapshots__/BannerLoyalty.skeleton.test.js.snap +183 -186
  15. package/build/components/BannerLoyalty/__tests__/__snapshots__/BannerLoyalty.test.js.snap +61 -62
  16. package/build/components/Booking/Booking.module.css +3 -3
  17. package/build/components/Booking/__tests__/__snapshots__/Booking.test.js.snap +10 -10
  18. package/build/components/BookingQuery/__tests__/__snapshots__/BookingQuery.test.js.snap +12 -12
  19. package/build/components/ButtonFinder/__tests__/__snapshots__/ButtonFinder.test.js.snap +25 -15
  20. package/build/components/Chat/Chat.module.css +0 -2
  21. package/build/components/Chat/__tests__/__snapshots__/Chat.test.js.snap +4 -4
  22. package/build/components/Checkout/Checkout.module.css +3 -3
  23. package/build/components/Checkout/__tests__/__snapshots__/Checkout.test.js.snap +16 -16
  24. package/build/components/Checkout/partials/__tests__/__snapshots__/Checkout.Form.test.js.snap +20 -20
  25. package/build/components/Deals/__tests__/__snapshots__/Deals.Calendar.test.js.snap +3 -3
  26. package/build/components/Deals/__tests__/__snapshots__/Deals.test.js.snap +12 -12
  27. package/build/components/Finder/Finder.compact.js +20 -20
  28. package/build/components/Finder/Finder.compact.js.map +1 -1
  29. package/build/components/Finder/Finder.js +3 -3
  30. package/build/components/Finder/Finder.js.map +1 -1
  31. package/build/components/Finder/Finder.module.css +30 -8
  32. package/build/components/Finder/__tests__/__snapshots__/Finder.test.js.snap +68 -42
  33. package/build/components/Finder/components/Calendar/Calendar.module.css +1 -1
  34. package/build/components/Finder/components/Calendar/__tests__/__snapshots__/Calendar.test.js.snap +9 -9
  35. package/build/components/Finder/components/Places/Places.js +24 -6
  36. package/build/components/Finder/components/Places/Places.js.map +1 -1
  37. package/build/components/Finder/components/Places/Places.module.css +27 -2
  38. package/build/components/Finder/components/Places/__tests__/__snapshots__/Places.test.js.snap +5 -9
  39. package/build/components/Finder/components/Places/helpers/calcColumns.js +1 -1
  40. package/build/components/Finder/components/Places/helpers/calcColumns.js.map +1 -1
  41. package/build/components/Header/Header.js +6 -4
  42. package/build/components/Header/Header.js.map +1 -1
  43. package/build/components/Header/__tests__/__snapshots__/Header.test.js.snap +3 -3
  44. package/build/components/Header/components/BookingProcess/BookingProcess.module.css +9 -5
  45. package/build/components/Rates/Rates.Header.js +8 -11
  46. package/build/components/Rates/Rates.Header.js.map +1 -1
  47. package/build/components/Rates/Rates.RoomSelector.js +1 -1
  48. package/build/components/Rates/Rates.RoomSelector.js.map +1 -1
  49. package/build/components/Rates/Rates.Skeleton.js +2 -3
  50. package/build/components/Rates/Rates.Skeleton.js.map +1 -1
  51. package/build/components/Rates/Rates.Unavailability.js +2 -1
  52. package/build/components/Rates/Rates.Unavailability.js.map +1 -1
  53. package/build/components/Rates/Rates.js +13 -16
  54. package/build/components/Rates/Rates.js.map +1 -1
  55. package/build/components/Rates/Rates.module.css +16 -7
  56. package/build/components/Rates/__tests__/__snapshots__/Rates.Header.test.js.snap +1 -8
  57. package/build/components/Rates/__tests__/__snapshots__/Rates.test.js.snap +8042 -6319
  58. package/build/components/Rates/components/CardHotel/CardHotel.js +34 -13
  59. package/build/components/Rates/components/CardHotel/CardHotel.js.map +1 -1
  60. package/build/components/Rates/components/CardHotel/CardHotel.l10n.js +3 -0
  61. package/build/components/Rates/components/CardHotel/CardHotel.l10n.js.map +1 -1
  62. package/build/components/Rates/components/CardHotel/CardHotel.module.css +19 -2
  63. package/build/components/Rates/components/CardHotel/__tests__/__snapshots__/CardHotel.test.js.snap +51 -35
  64. package/build/components/Rates/components/Filters/Filters.Button.js +3 -4
  65. package/build/components/Rates/components/Filters/Filters.Button.js.map +1 -1
  66. package/build/components/Rates/components/Filters/Filters.js +2 -1
  67. package/build/components/Rates/components/Filters/Filters.js.map +1 -1
  68. package/build/components/Rates/components/Filters/Filters.module.css +23 -1
  69. package/build/components/Rates/components/Filters/__tests__/__snapshots__/Filters.test.js.snap +1 -1
  70. package/build/components/Rates/components/Item/Item.Preview.js +25 -9
  71. package/build/components/Rates/components/Item/Item.Preview.js.map +1 -1
  72. package/build/components/Rates/components/Item/Item.Rates.js +8 -5
  73. package/build/components/Rates/components/Item/Item.Rates.js.map +1 -1
  74. package/build/components/Rates/components/Item/Item.js +31 -2
  75. package/build/components/Rates/components/Item/Item.js.map +1 -1
  76. package/build/components/Rates/components/Item/Item.module.css +4 -0
  77. package/build/components/Rates/components/Item/__tests__/__snapshots__/Item.Preview.test.js.snap +1 -1
  78. package/build/components/Rates/components/Item/__tests__/__snapshots__/Item.test.js.snap +1 -1
  79. package/build/components/Rates/components/Item/components/Amenities/Amenities.module.css +2 -9
  80. package/build/components/Rates/components/Item/components/ModalCancellationInfo/ModalCancellationInfo.module.css +3 -7
  81. package/build/components/Rates/components/Item/components/ModalInfo/ModalInfo.module.css +5 -5
  82. package/build/components/Rates/components/Item/components/ModalInfo/__tests__/__snapshots__/ModalInfo.test.js.snap +2 -2
  83. package/build/components/Rates/components/Item/components/ModalOfferInfo/ModalOfferInfo.js +2 -15
  84. package/build/components/Rates/components/Item/components/ModalOfferInfo/ModalOfferInfo.js.map +1 -1
  85. package/build/components/Rates/components/Item/components/ModalOfferInfo/ModalOfferInfo.module.css +3 -7
  86. package/build/components/Rates/components/Item/components/ModalUrl/ModalUrl.module.css +6 -6
  87. package/build/components/Rates/components/Item/components/RateDetails/RateDetails.js +1 -1
  88. package/build/components/Rates/components/Item/components/RateDetails/RateDetails.js.map +1 -1
  89. package/build/components/Rates/components/Item/components/Slider/Slider.js +1 -1
  90. package/build/components/Rates/components/Item/components/Slider/Slider.js.map +1 -1
  91. package/build/components/Rates/components/Item/components/Slider/__tests__/__snapshots__/Slider.test.js.snap +1 -1
  92. package/build/components/Rates/components/ModalClubRate/ModalClubRate.js +6 -4
  93. package/build/components/Rates/components/ModalClubRate/ModalClubRate.js.map +1 -1
  94. package/build/components/Rates/components/ModalClubRate/ModalClubRate.module.css +4 -0
  95. package/build/components/Rates/components/ModalClubRate/__tests__/__snapshots__/ModalClubRate.test.js.snap +4 -4
  96. package/build/components/Rates/components/ModalExtras/ModalExtras.module.css +1 -1
  97. package/build/components/Rates/components/ModalExtras/__tests__/__snapshots__/ModalExtras.test.js.snap +1 -1
  98. package/build/components/Signup/Signup.module.css +1 -1
  99. package/build/components/Signup/__tests__/__snapshots__/Signup.test.js.snap +6 -6
  100. package/build/components/__shared__/BookingSummary/BookingSummary.module.css +3 -3
  101. package/build/components/__shared__/Card/Card.module.css +16 -15
  102. package/build/components/__shared__/Field/Field.js +3 -1
  103. package/build/components/__shared__/Field/Field.js.map +1 -1
  104. package/build/components/__shared__/Field/Field.module.css +11 -1
  105. package/build/components/__shared__/FieldOccupation/FieldOccupation.js +3 -6
  106. package/build/components/__shared__/FieldOccupation/FieldOccupation.js.map +1 -1
  107. package/build/components/__shared__/FieldOccupation/__tests__/__snapshots__/FieldOccupation.test.js.snap +18 -17
  108. package/build/components/__shared__/FieldPromocode/FieldPromocode.js +6 -3
  109. package/build/components/__shared__/FieldPromocode/FieldPromocode.js.map +1 -1
  110. package/build/components/__shared__/Footer/__tests__/__snapshots__/Footer.test.js.snap +8 -8
  111. package/build/components/__shared__/Occupation/Occupation.js +6 -4
  112. package/build/components/__shared__/Occupation/Occupation.js.map +1 -1
  113. package/build/components/__shared__/Occupation/Occupation.module.css +11 -11
  114. package/build/components/__shared__/Occupation/__tests__/__snapshots__/Occupation.test.js.snap +44 -44
  115. package/build/components/__shared__/Payment/__tests__/__snapshots__/Payment.test.js.snap +10 -10
  116. package/build/components/__shared__/Payment/components/Card/__tests__/__snapshots__/Card.test.js.snap +12 -12
  117. package/build/components/__shared__/PriceBreakdown/PriceBreakdown.module.css +3 -3
  118. package/build/components/helpers/ICON.AMENITIES.js +2 -2
  119. package/build/components/helpers/ICON.AMENITIES.js.map +1 -1
  120. package/build/components/helpers/__tests__/__snapshots__/parseHtml.test.js.snap +8 -8
  121. package/build/components/index.js +0 -2
  122. package/build/components/index.js.map +1 -1
  123. package/build/contexts/PerformanceManager/PerformanceManager.js +11 -4
  124. package/build/contexts/PerformanceManager/PerformanceManager.js.map +1 -1
  125. package/build/contexts/PerformanceManager/helpers/getConsentMode.js +4 -3
  126. package/build/contexts/PerformanceManager/helpers/getConsentMode.js.map +1 -1
  127. package/build/contexts/PerformanceManager/providers/analytics/bookingCancel.js +2 -1
  128. package/build/contexts/PerformanceManager/providers/analytics/bookingCancel.js.map +1 -1
  129. package/build/contexts/PerformanceManager/providers/analytics/helpers/parseItems.js +12 -5
  130. package/build/contexts/PerformanceManager/providers/analytics/helpers/parseItems.js.map +1 -1
  131. package/build/helpers/consolidateStore.js +4 -2
  132. package/build/helpers/consolidateStore.js.map +1 -1
  133. package/build/theme.css +44 -5
  134. package/package.json +1 -1
  135. package/public/performance/index.html +159 -0
  136. package/build/components/Chat/Chat.theme.module.css +0 -49
  137. package/build/components/__shared__/FieldOccupation/FieldOccupation.module.css +0 -5
package/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  # 1. Installation
4
4
 
5
- The installation of the new mirai's core is very simple. You will simply have to add 2 files inside your html page.
5
+ Installing Mirai's new core is straightforward. You'll only need to include two files in your HTML page.
6
6
 
7
7
  ## 1.1 Requirements
8
8
 
9
- The first one will be our styles file for the default theme. This file only contains css variable assignments, so it will never conflict with any other css files you have. Here you have an example of how you should instantiate it:
9
+ The first file is the stylesheet for the default theme. This file contains only CSS variable assignments, ensuring that it won't conflict with any existing styles in your project. Here’s how to include it:
10
10
 
11
11
  ```html
12
12
  <head>
@@ -20,7 +20,7 @@ The first one will be our styles file for the default theme. This file only cont
20
20
  </head>
21
21
  ```
22
22
 
23
- The next file we need is our component repository file. This JavaScript file provides an asynchronous loading system for components, so it will not influence the overall loading of your html page much. Here you have an example of how you should instantiate it:
23
+ The second file is the component repository JavaScript. This file provides an asynchronous loading system for the components, so it minimally impacts your page’s loading performance. Here’s an example:
24
24
 
25
25
  ```html
26
26
  ...
@@ -30,7 +30,7 @@ The next file we need is our component repository file. This JavaScript file pro
30
30
 
31
31
  ## 1.2 Creating a data repository instance
32
32
 
33
- Once the two main files of our new core are instantiated, we need to indicate which data repository we want to load. For this we will use an html element within our html page:
33
+ Once the two core files are included, you’ll need to specify the data repository you want to load. This is done by adding an HTML element to your page:
34
34
 
35
35
  ```html
36
36
  <body>
@@ -39,15 +39,15 @@ Once the two main files of our new core are instantiated, we need to indicate wh
39
39
  </body>
40
40
  ```
41
41
 
42
- The attributes that we can set in this instance are:
42
+ You can configure this instance with the following attributes:
43
43
 
44
- - `data-mirai-id`: the hotel or chain identifier.
45
- - `data-type`: `hotel` or `chain` instance type (default is `hotel`)
46
- - `data-hotel`: the hotel identifier (only available when `data-type=chain`)
47
- - `data-locale`: in case we want to set a different language locale than the default.
48
- - `data-currency`: in case we want to set a currency than the default.
44
+ - `data-mirai-id`: The hotel or chain identifier.
45
+ - `data-type`: Type of instance (default is `hotel`)
46
+ - `data-hotel`: Hotel identifier (only used when `data-type=chain`)
47
+ - `data-locale`: Specify a locale if different from the default language.
48
+ - `data-currency`: Specify a currency if different from the default.
49
49
 
50
- Here you have an complete example using all these attributes:
50
+ Here’s a complete example with all the attributes:
51
51
 
52
52
  ```html
53
53
  <body>
@@ -56,7 +56,7 @@ Here you have an complete example using all these attributes:
56
56
  </body>
57
57
  ```
58
58
 
59
- For testing purposes only, we can hydrate the instance via url parameters. Let's see an example:
59
+ For testing, you can also hydrate the instance using URL parameters. Here’s an example:
60
60
 
61
61
  ```
62
62
  https://hotel.com/endpoint?miraiId=10030559&type=chain&hotel=100376545
@@ -64,20 +64,20 @@ https://hotel.com/endpoint?miraiId=10030559&type=chain&hotel=100376545
64
64
 
65
65
  ## 1.3 Environments
66
66
 
67
- Our new core has different execution enviryonments. These differ for the most part in the way they have been compiled.
67
+ Mirai’s new core supports multiple execution environments, primarily differing in how the code is compiled:
68
68
 
69
- - `production` (https://static.mirai.com) the bundle has been generated by minifying and obfuscating the largest code base possible.
70
- - `development` (https://static.mirai-int.io) the bundle has been generated in development mode with _sourceMaps_ as well as the access to the services is also in development mode.
69
+ - `Production` (https://static.mirai.com) This bundle is optimized, with code minified and obfuscated for maximum performance.
70
+ - `Development` (https://static.mirai-int.io) This bundle is generated in development mode with source maps, and services are also in development mode.
71
71
 
72
72
  # 2. Components
73
73
 
74
- To instantiate any component from the core repository we have to take into account these properties common to all components:
74
+ To instantiate any component from the core repository, there are a few common properties you need to be aware of:
75
75
 
76
- - `data-mirai-component:string`: indicates the name of the component to instantiate
77
- - `data-mobile:bool`: if you only want to instantiate the component in a mobile environment.
78
- - `data-desktop:bool`: if you only want to instantiate the component in a non mobile environment.
76
+ - `data-mirai-component:string`: Specifies the name of the component to instantiate.
77
+ - `data-mobile:bool`: Indicates if the component should only be instantiated in a mobile environment.
78
+ - `data-desktop:bool`: Indicates if the component should only be instantiated in a non-mobile environment.
79
79
 
80
- Here you have an example of how you should instantiate it:
80
+ Here’s an example of how to instantiate a component:
81
81
 
82
82
  ```html
83
83
  <div data-mirai-component="finder" data-mobile="true"></div>
@@ -85,35 +85,43 @@ Here you have an example of how you should instantiate it:
85
85
 
86
86
  ### Ghosting & Bindings
87
87
 
88
- It should also be noted that some components may offer the _ghosting_ system. This means that that component can receive different html markup than the default component provides. For that purpose, the `data-ghost` attribute must be set.
88
+ Some components support a ghosting system, which allows them to receive different HTML markup than their default configuration. To enable this, you must set the data-ghost attribute.
89
89
 
90
- The bracket binding system serves two distinct purposes: with single brackets, component state variables can be bound, enabling the incorporation of dynamic values into UI elements. On the other hand, double brackets are used to bind keys from a dictionary, facilitating the dynamic insertion of structured data, such as predefined texts, into text templates or interfaces. These two approaches offer flexibility and modularity when developing applications, allowing for the separation of presentation logic from underlying data.
90
+ Additionally, the bracket binding system provides two different functionalities:
91
+
92
+ - **Single brackets**: Used for binding component state variables, allowing dynamic values to be inserted into UI elements.
93
+ - **Double brackets**: Used to bind dictionary keys, making it easy to inject structured data, such as predefined text, into templates or UI components.
94
+
95
+
96
+ This system is useful for separating presentation logic from data and allows for more flexibility when developing components.
97
+
98
+ Example of bracket binding:
91
99
 
92
100
  ```html
93
101
  "[[common.label.greetings]], [firstName]! Welcome to our hotel."
94
102
  ```
95
103
 
96
- For instance, in the text template, when processed with this system, the value associated with the dictionary key `common.label.greetings` will replace [[common.label.greetings]] and the state variable of the component `firstName` will replace `[firstName]`.
97
-
98
- ## 2.1 `<BannerLoyalty>`
104
+ In this example, `[[common.label.greetings]]` will be replaced by the value from the dictionary associated with the key common.label.greetings, while `[firstName]` will be replaced by the component’s state variable firstName.
99
105
 
100
- @todo
106
+ ## 2.1 `<Booking>`
101
107
 
102
- ## 2.2 `<Booking>`
108
+ The `<Booking>` component provides a summary view of a specific reservation. Its implementation is very simple. You only need to add the following to your webpage:
103
109
 
104
- @todo
110
+ ```html
111
+ <div data-mirai-component="booking"></div>
112
+ ```
105
113
 
106
- ## 2.3 `<BookingQuery>`
114
+ ## 2.2 `<BookingQuery>`
107
115
 
108
- This component shows a modal in which it asks the user for the `bookingId` and `pinCode` if both fields are correct, it redirects to the page to manage the reservation.
116
+ The `<BookingQuery>` component displays a modal where the user is prompted to enter a `bookingId` and `pinCode`. If both fields are correct, the user is redirected to the reservation management page.
109
117
 
110
118
  ```html
111
119
  <div data-mirai-component="bookingQuery"></div>
112
120
  ```
113
121
 
114
- This component supports _ghosting_.
122
+ This component supports _ghosting_, allowing you to customize the HTML structure.
115
123
 
116
- Let's see a naive example:
124
+ Here’s a simple example:
117
125
 
118
126
  ```html
119
127
  <div data-mirai-component="bookingQuery">
@@ -121,99 +129,268 @@ Let's see a naive example:
121
129
  </div>
122
130
  ```
123
131
 
124
- ## 2.4 `<Checkout>`
132
+ ## 2.3 `<ButtonFinder>`
133
+
134
+ The `<ButtonFinder>` component encapsulates the finder component within a modal, which becomes visible when the button is pressed. This is ideal for scenarios where you want to display a search interface only when necessary, keeping the main interface clean and uncluttered.
135
+
136
+ ```html
137
+ <div data-mirai-component="button-finder"></div>
138
+ ```
139
+
140
+ Like other components, it supports ghosting, allowing customization of the button or other UI elements.
141
+
142
+ Here’s an example:
143
+
144
+ ```html
145
+ <div data-mirai-component="session">
146
+ <div data-ghost>
147
+ <button data-ghost>[[common.action.reserve]]</button>
148
+ </div>
149
+ </div>
150
+ ```
125
151
 
126
- @todo
152
+ Additionally, the data-text property lets you customize the button’s label, offering flexibility to adapt the button text to your needs.
153
+
154
+ ```html
155
+ <div data-mirai-component="button-finder" data-text="Start Search"></div>
156
+ ```
157
+
158
+ ## 2.4 `<Chat>`
159
+
160
+ The `<Chat>` component is one of the new additions to the Mirai library. It allows you to instantiate a chat system powered by a virtual agent using artificial intelligence. This assistant can handle most of the Mirai suite's functionalities through conversational interactions.
161
+
162
+ ```html
163
+ <div data-mirai-component="chat"></div>
164
+ ```
165
+
166
+ At Mirai, we prioritize the customization of our components to ensure they seamlessly integrate with your website's design. To facilitate this, we provide a set of CSS variables that allow you to modify most visual aspects of the `<Chat>` component.
167
+
168
+ Here’s an example of the CSS variables available for customization:
169
+
170
+ ```css
171
+ /* colors */
172
+ --mirai-chat-accent: var(--mirai-ui-accent);
173
+
174
+ /* commons */
175
+ --mirai-chat-border-color: var(--mirai-ui-content-border);
176
+ --mirai-chat-border-radius: var(--mirai-ui-space-S);
177
+ --mirai-chat-border-size: 1px;
178
+ --mirai-chat-space: var(--mirai-ui-space-M);
179
+
180
+ --mirai-chat-motion-collapse: 200ms;
181
+ --mirai-chat-motion-expand: 300ms;
182
+ --mirai-chat-motion-easing: cubic-bezier(0.1, 0.1, 0.25, 0.9);
183
+
184
+ /* text */
185
+ --mirai-chat-text-accent-color: rgba(255, 255, 255, 0.95);
186
+ --mirai-chat-text-color: #222;
187
+ --mirai-chat-text-color-light: #999;
188
+ --mirai-chat-text-font-size: var(--mirai-ui-font-size-action);
189
+ --mirai-chat-text-font-weight: 500;
190
+ --mirai-chat-text-line-height: var(--mirai-ui-line-height-action);
191
+
192
+ /* <Chat> */
193
+ --mirai-chat-base: var(--mirai-ui-base);
194
+ --mirai-chat-base-opacity: rgba(255, 255, 255, 0.8);
195
+ --mirai-chat-box-shadow: 0 0 var(--mirai-ui-space-S) rgba(0, 0, 0, 0.1);
196
+ --mirai-chat-height: 606px;
197
+ --mirai-chat-layer: var(--mirai-ui-layer-XL);
198
+ --mirai-chat-max-height: 90svh;
199
+ --mirai-chat-width: calc(var(--mirai-ui-breakpoint-S) - var(--mirai-ui-space-XXL));
200
+
201
+ /* header */
202
+ --mirai-chat-header-height: calc(var(--mirai-ui-space-XL) + var(--mirai-ui-space-M));
203
+ --mirai-chat-header-background: linear-gradient(0deg, var(--mirai-chat-base-opacity) 0%, var(--mirai-chat-base) 100%);
204
+
205
+ /* <Input> */
206
+ --mirai-chat-input-background: var(--mirai-ui-content-background);
207
+ --mirai-chat-input-border-color: var(--mirai-chat-border-color);
208
+
209
+ /* <Message> */
210
+ --mirai-chat-message-background: transparent;
211
+ --mirai-chat-message-offset: calc(var(--mirai-chat-space) / 1.5) var(--mirai-chat-border-radius);
212
+
213
+ /* <Avatar> */
214
+ --mirai-chat-avatar-background: #222;
215
+ --mirai-chat-avatar-color: #fff;
216
+ --mirai-chat-avatar-border-radius: 40%;
217
+ ```
218
+
219
+ These CSS variables offer a wide range of customization options, from changing colors and borders to adjusting text and layout. By using them, you can tailor the `<Chat>` component to fit perfectly within the design of your website.
220
+
221
+
222
+ ## 2.5 `<Checkout>`
223
+
224
+ The `<Checkout>` component is the main reservation window, where users can enter their personal details, choose payment methods, and set notifications for the hotel. It also provides a summary of the reservation before the user proceeds with the booking process.
225
+
226
+ ```html
227
+ <div data-mirai-component="checkout"></div>
228
+ ```
127
229
 
128
- ## 2.5 `<Deals>`
230
+ ## 2.6 `<Deals>`
129
231
 
130
- This component displays a form to be able to search for rooms with a certain offer. This form contains 3 fields:
232
+ The `<Deals>` component displays a form that allows users to search for rooms with a specific offer. This form contains three fields:
131
233
 
132
- - `calendar` (check-in & check-out)
133
- - `occupation`
134
- - `promocode`
234
+ - `calendar` (check-in & check-out dates)
235
+ - `occupation` (number of guests)
236
+ - `promocode` (optional promotional code)
135
237
 
136
238
  ```html
137
239
  <div data-mirai-component="deals" data-id="293842"></div>
138
240
  ```
139
241
 
140
- This component needs a `data-id` property that will contain the `id` of the offer to display.
242
+ This component requires a data-id attribute, which contains the ID of the offer to be displayed.
141
243
 
142
- ## 2.6 `<Environment>`
244
+ Additionally, like other components, the `<Deals>` component offers some light visual customization through CSS variables:
143
245
 
144
- @todo
246
+ ```css
247
+ --mirai-deals-modal-z-index: 601;
248
+ --mirai-deals-notification-max-width: calc(var(--mirai-ui-calendar-cell) * 14 + var(--mirai-ui-calendar-padding) * 2);
249
+ ```
250
+
251
+ ## 2.7 `<Environment>`
145
252
 
146
- ## 2.7 `<Finder>`
147
253
 
148
- This component displays the general accommodation search. Let's see a naive example:
254
+ The `<Environment>` component allows you to modify the environment in which the other Mirai components are running. The environment is defined as the combination of language and currency. This component lets you adjust three properties:
255
+
256
+ - `data-currency:bool`: Controls the visibility of the currency selector (true/false).
257
+ - `data-locale:bool`: Controls the visibility of the language selector (true/false).
258
+ - `data-state:bool`: Controls the visibility of the current state data (true/false).
259
+
260
+ Here’s an example of its implementation:
261
+
262
+ ```html
263
+ <div data-mirai-component="environment" data-currency="true" data-locale="true"></div>
264
+ ```
265
+
266
+ ## 2.8 `<Finder>`
267
+
268
+ The `<Finder>` component displays the general accommodation search interface. Here’s a basic example:
149
269
 
150
270
  ```html
151
271
  <div data-mirai-component="finder"></div>
152
272
  ```
153
273
 
154
- You can customize certain properties through HTML data attributes:
274
+ You can customize specific properties using HTML data attributes:
155
275
 
156
- - `data-icon="true"` displays an icon on the button instead of the search l10n copy.
157
- - `data-inline="false"` displays each of the inputs in the same format as an `<InputField>`.
158
- - `data-layout="column"` displays the component in a column layout (automatic on mobile devices).
276
+ - `data-icon="true"`: Displays an icon on the button instead of the localized search text.
277
+ - `data-inline="false"`: Displays each input in the same format as an `<InputField>`.
278
+ - `data-layout="column"`: Displays the component in a column layout (automatically applies on mobile devices).
159
279
 
160
- You can also customize certain visual properties using the CSS variables exposed by the component:
280
+ You can also adjust various visual properties using the CSS variables exposed by the component:
161
281
 
162
282
  ```css
163
283
  --mirai-finder-background: var(--mirai-ui-base);
164
284
  --mirai-finder-border: var(--mirai-ui-input-text-border);
165
285
  --mirai-finder-border-color: var(--mirai-ui-content-border);
166
286
  --mirai-finder-border-radius: var(--mirai-ui-border-radius);
287
+ --mirai-finder-button-background: var(--mirai-ui-button-background);
288
+ --mirai-finder-button-focus-color: var(--mirai-ui-button-focus-color);
289
+ --mirai-finder-button-font-family: var(--mirai-ui-font);
290
+ --mirai-finder-button-font-size: inherit;
291
+ --mirai-finder-button-font-weight: var(--mirai-ui-button-font-weight);
167
292
  --mirai-finder-gap: 0;
168
293
  --mirai-finder-field-height: calc(var(--mirai-field-height) * 1);
169
294
  --mirai-finder-padding: var(--mirai-ui-space-XS);
170
295
  --mirai-finder-column-border-radius: var(--mirai-finder-border-radius);
171
296
  --mirai-finder-column-padding: var(--mirai-finder-padding);
172
- --mirai-finder-modal-content-max-height: calc(100vh - calc(var(--mirai-ui-space-XXL) + var(--mirai-ui-space-XL)));
297
+ --mirai-modal-max-height: calc(100svh - var(--mirai-ui-space-XXL));
298
+ ```
299
+
300
+ Additionally, you can visually customize three fields within this component:
301
+
302
+ - Hotel
303
+ - Date
304
+ - Occupation
305
+
306
+ The following CSS variables are available for customization:
307
+
308
+ ```css
309
+ --mirai-places-item-height: 32px;
310
+ --mirai-places-item-width: 300px;
311
+ --mirai-places-item-background-selected: var(--mirai-ui-accent);
312
+ --mirai-places-item-color-selected: var(--mirai-ui-base);
313
+ --mirai-places-padding: var(--mirai-ui-space-M);
314
+ --mirai-places-items-per-column: 9;
315
+
316
+ --mirai-finder-calendar-padding: var(--mirai-ui-space-M);
317
+
318
+ --mirai-occupation-scrollview-max-height: 340px;
319
+ --mirai-occupation-width: 320px;
173
320
  ```
174
321
 
175
- ## 2.8 `<Header>`
322
+ These variables allow you to control the padding, dimensions, and other styling aspects of the calendar, occupation selector, and places fields, offering greater flexibility to align the component with your website’s design.
323
+
324
+ ## 2.9 `<Header>`
325
+
326
+ The `<Header>` component is another new addition to the Mirai component suite. It allows you to create a header for your pages that can include:
176
327
 
177
- @todo
328
+ - The hotel logo and/or name
329
+ - The status of the booking process (e.g., Choose, Personal Details, Confirmation)
330
+ - A language selector
331
+ - A currency selector
332
+ - Access to the user session
178
333
 
179
- ## 2.9 `<Profile>`
334
+ Some of these elements are automatically managed within the Mirai component. However, you can control certain elements using the following HTML attributes:
180
335
 
181
- This component shows two tabs, Personal information and My bookings:
336
+ - `data-currency:bool`: Displays the currency selector.
337
+ - `data-locale:bool`: Displays the language selector.
338
+ - `data-login:bool`: Displays the session login button.
339
+ - `data-name:bool`: Displays the hotel name.
182
340
 
183
- - Personal information allow to logged user to manage her personal information. Also, he can change her password and delete the user.
184
- - My bookings allow to logged user to manage her bookings, even cancel the bookings.
341
+ Here’s an example of how you might implement the component:
185
342
 
186
343
  ```html
187
- <div data-mirai-component="profile"></div>
344
+ <div data-mirai-component="header" data-currency="true" data-locale="true"></div>
188
345
  ```
189
346
 
190
- ## 2.10 `<Rates>`
347
+ ## 2.10 `<Profile>`
191
348
 
192
- @todo
349
+ The `<Profile>` component displays two tabs: Personal Information and My Bookings.
193
350
 
194
- Currently, it is in a state of WIP (Work In Progress), so a mechanism for customizing rate results via URL has been implemented. To do this, we will need to use the `features` URL parameter. The possible values it can receive are:
351
+ - **Personal Information**: Allows the logged-in user to manage their personal details, change their password, and delete their account.
352
+ - **My Bookings**: Allows the logged-in user to manage their bookings, including the option to cancel bookings.
195
353
 
196
- - `showAllBoards`: Displays all available boards (only those belonging to the active rate are active).
197
- - `showAllOffers`: Displays all available offers (only those belonging to the active cancellation are active).
198
- - `showClubDiscount`: Shows the loyalty tooltip information on the first render.
199
- - `showOffersFirst`: This feature completely changes the functionality of the card. We change the selection order to offer + board. Let's remember that the default selection process is cancellation + offer + board.
200
- - `showRateIncluded`: This feature allows displaying the inclusions of each rate without needing to be encapsulated in a tooltip.
354
+ Here’s how to implement the component:
201
355
 
202
- Here's a usage example:
356
+ ```html
357
+ <div data-mirai-component="profile"></div>a-mirai-component="profile"></div>
358
+ ```
359
+
360
+ ## 2.11 `<Rates>`
361
+
362
+ The `<Rates>` component is used for selecting rooms and rates. It includes a feature/flag system that allows you to customize the visibility and layout of various elements through URL parameters. The possible values it can receive are:
363
+
364
+ - `columnMode`: Displays the results in two columns.
365
+ - `hideRadio`: Hides the radio input and replaces it with a button.
366
+ - `hideStandaloneBoard`: If only one accommodation type is available, it will not be displayed.
367
+ - `highlightStandaloneOption`: Highlights when only one option exists per category.
368
+ - `rowMode`: Displays the results in a row layout.
369
+ - `showAllBoards`: Displays all available boards (only the boards belonging to the active rate are selectable).
370
+ - `showAllOffers`: Displays all available offers (only the offers belonging to the active cancellation are selectable).
371
+ - `showMaxOccupation`: Displays the maximum room occupancy.
372
+ - `showOffersFirst`: Changes the selection process to offer + board. The default process is cancellation + offer + board.
373
+ - `showPreviewPrice`: Displays a total price summary in the footer.
374
+ - `showPricePerNight`: Displays prices per night.
375
+ - `showRateIncluded`: Displays the inclusions of each rate without using a tooltip.
376
+
377
+ Here’s an example of how to use it:
203
378
 
204
379
  `http://....&features=showOffersFirst,showClubDiscount`
205
380
 
206
- > Note that you can combine multiple features by simply separating them within the `features` URL parameter using the comma character `,`.
381
+ > Note: You can combine multiple features by separating them in the `features` URL parameter using a comma `,`.
207
382
 
208
- ## 2.11 `<Session>`
383
+ ## 2.12 `<Session>`
209
384
 
210
- This component has two behaviors. If the user is not logged in, show an action button that displays a modal for login. If the user is logged show a menu with two options: Personal information, and My bookings.
385
+ The `<Session>` component has two behaviors. If the user is not logged in, it shows an action button that opens a login modal. If the user is logged in, it displays a menu with two options: Personal Information and My Bookings.
211
386
 
212
387
  ```html
213
388
  <div data-mirai-component="session"></div>
214
389
  ```
215
390
 
216
- This component supports _ghosting_. If we put only one html, it will be used for the Login component. In the another case, the component requires two different html files, one for the Login and another one for the Logged-in/Account.
391
+ This component supports _ghosting_. If only one HTML structure is provided, it will be used for the login component. Alternatively, two different HTML structures can be used: one for the login view and another for the logged-in/account view.
392
+
393
+ Here’s an example:
217
394
 
218
395
  ```html
219
396
  <div data-mirai-component="session">
@@ -227,7 +404,7 @@ This component supports _ghosting_. If we put only one html, it will be used for
227
404
  </div>
228
405
  ```
229
406
 
230
- > In this example we replace the html markup with a `<button>` with the content `Login Here`
407
+ In this example, we replace the default HTML markup with a button containing the text `Login Here`:
231
408
 
232
409
  ```html
233
410
  <div data-mirai-component="session">
@@ -238,9 +415,7 @@ This component supports _ghosting_. If we put only one html, it will be used for
238
415
  </div>
239
416
  ```
240
417
 
241
- > In this example we replace the html markup with 2 `<p>`, the first one for Login and the second for Account
242
-
243
- We can also bind the elements of the session. Example:
418
+ In this example, we replace the markup with two `<p>` elements, one for login and one for account:
244
419
 
245
420
  ```html
246
421
  <div data-mirai-component="session">
@@ -251,34 +426,28 @@ We can also bind the elements of the session. Example:
251
426
  </div>
252
427
  ```
253
428
 
254
- ## 2.12 `<Signup>`
255
-
256
- @todo
257
-
258
- ## 2.13 `<ButtonFinder>`
259
-
260
- This component is designed to encapsulate the finder component within a modal, which becomes visible when the button is pressed. This component is useful for situations where you want to present a search interface discreetly, without taking up space in the main interface until needed.
261
-
262
- ```html
263
- <div data-mirai-component="button-finder"></div>
264
- ```
265
-
266
- Similar to other components, supports ghosting.
429
+ You can also bind session elements to dynamic data, like this:
267
430
 
268
431
  ```html
269
432
  <div data-mirai-component="session">
270
433
  <div data-ghost>
271
- <button data-ghost>[[common.action.reserve]]</button>
434
+ <p class="login">Login</p>
435
+ <p class="account">[firstName] [lastName] - [email] - ExampleText</p>
272
436
  </div>
273
437
  </div>
274
438
  ```
275
439
 
276
- The `data-text` property allows you to change the caption of the button. This provides flexibility to customize the button text based on your needs.
440
+ This allows you to display personalized information for the logged-in user, such as their name or email.
441
+
442
+ ## 2.13 `<Signup>`
443
+
444
+ The `<Signup>` component displays the registration form for the Mirai platform.
277
445
 
278
446
  ```html
279
- <div data-mirai-component="button-finder" data-text="Start Search"></div>
447
+ <div data-mirai-component="signup"></div>
280
448
  ```
281
449
 
450
+
282
451
  # 3. Development
283
452
 
284
453
  You have to follow the next steps:
@@ -1,9 +1,9 @@
1
1
  import { expect } from '@playwright/test';
2
2
 
3
3
  export const login = async ({ id, page, pinCode, testId, wait = true } = {}) => {
4
- await expect(page.locator('form')).not.toBeVisible();
4
+ await expect(page.locator('ui-form')).not.toBeVisible();
5
5
  await page.getByTestId(`${testId}-button-open-modal`).click();
6
- await expect(page.locator('form')).toBeVisible();
6
+ await expect(page.locator('ui-form')).toBeVisible();
7
7
  await expect(page.getByTestId(`${testId}-button-cta`)).toHaveAttribute('disabled');
8
8
 
9
9
  await page.getByTestId(`${testId}-input-id`).click();
@@ -1,17 +1,17 @@
1
1
  import { USER } from '../../constants';
2
2
 
3
3
  export const form = async ({ page }) => {
4
- await page.fill('ui-checkout form input[name="firstName"]', USER.firstName);
5
- await page.fill('ui-checkout form input[name="lastName"]', USER.lastName);
6
- await page.fill('ui-checkout form input[name="email"]', USER.email);
7
- await page.locator('ui-checkout form select[name="phone-prefix"]').selectOption(USER.phone.prefix);
8
- await page.fill('ui-checkout form input[name="phone-phone"]', USER.phone.number);
9
- await page.fill('ui-checkout form textarea[name="comments"]', 'Will arrive between 1-2pm');
4
+ await page.fill('ui-checkout ui-form input[name="firstName"]', USER.firstName);
5
+ await page.fill('ui-checkout ui-form input[name="lastName"]', USER.lastName);
6
+ await page.fill('ui-checkout ui-form input[name="email"]', USER.email);
7
+ await page.locator('ui-checkout ui-form select[name="phone-prefix"]').selectOption(USER.phone.prefix);
8
+ await page.fill('ui-checkout ui-form input[name="phone-phone"]', USER.phone.number);
9
+ await page.fill('ui-checkout ui-form textarea[name="comments"]', 'Will arrive between 1-2pm');
10
10
  // additional request
11
- await page.fill('ui-checkout form input[name="additionalRequest.34486.nameKey"]', 'additionalRequest.34486');
11
+ await page.fill('ui-checkout ui-form input[name="additionalRequest.34486.nameKey"]', 'additionalRequest.34486');
12
12
 
13
13
  // User submits but forgots privacy policy
14
14
  await page.getByTestId('checkout-button').click();
15
15
  await page.waitForSelector('ui-notification-error', { state: 'visible' });
16
- await page.locator('ui-checkout form input[name="privacyPolicy"]').check();
16
+ await page.locator('ui-checkout ui-form input[name="privacyPolicy"]').check();
17
17
  };