@lookiero/checkout 8.18.0 → 8.20.0

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 (81) hide show
  1. package/cypress/support/interceptListReturnQuestionsByCheckoutItemId.ts +1 -1
  2. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js +1 -1
  3. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +3 -1
  4. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.js +2 -1
  5. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.d.ts +3 -3
  6. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +4 -3
  7. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.d.ts +2 -1
  8. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.js +1 -0
  9. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.d.ts +2 -1
  10. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +8 -6
  11. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +2 -1
  12. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +2 -1
  13. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.d.ts +2 -1
  14. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -1
  15. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.d.ts +2 -1
  16. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.js +1 -0
  17. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.d.ts +2 -1
  18. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +5 -3
  19. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +4 -2
  20. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.d.ts +2 -1
  21. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -1
  22. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.d.ts +2 -1
  23. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +2 -1
  24. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.d.ts +2 -1
  25. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +2 -1
  26. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.d.ts +2 -1
  27. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -1
  28. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +18 -9
  29. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +1 -1
  30. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +1 -1
  31. package/dist/src/projection/returnQuestion/returnQuestion.constants.d.ts +9 -0
  32. package/dist/src/projection/returnQuestion/returnQuestion.constants.js +10 -0
  33. package/dist/src/projection/returnQuestion/returnQuestion.d.ts +23 -16
  34. package/dist/src/projection/returnQuestion/returnQuestion.js +1 -11
  35. package/dist/src/projection/returnQuestion/returnQuestion.metadata.d.ts +12 -0
  36. package/dist/src/projection/returnQuestion/returnQuestion.metadata.js +1 -0
  37. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.d.ts +5 -0
  38. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.js +10 -0
  39. package/dist/src/version.d.ts +1 -1
  40. package/dist/src/version.js +1 -1
  41. package/package.json +1 -1
  42. package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.ts +1 -1
  43. package/src/infrastructure/projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId.test.ts +4 -9
  44. package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +72 -117
  45. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.test.tsx +10 -12
  46. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.tsx +10 -8
  47. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.test.tsx +10 -9
  48. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.ts +2 -1
  49. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.test.tsx +7 -9
  50. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.tsx +3 -3
  51. package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts +4 -3
  52. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.test.tsx +7 -13
  53. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.tsx +4 -2
  54. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.test.tsx +8 -14
  55. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +13 -7
  56. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +7 -5
  57. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.test.tsx +10 -14
  58. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +7 -5
  59. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.tsx +5 -3
  60. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.test.tsx +43 -36
  61. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +10 -7
  62. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +11 -9
  63. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.test.tsx +8 -14
  64. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +6 -4
  65. package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +6 -4
  66. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.test.tsx +23 -25
  67. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +5 -3
  68. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.test.tsx +9 -29
  69. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +7 -5
  70. package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +5 -4
  71. package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +32 -18
  72. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +212 -254
  73. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +2 -4
  74. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +636 -762
  75. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +1 -1
  76. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +1169 -1211
  77. package/src/projection/returnQuestion/listReturnQuestionsByCheckoutItemId.test.ts +4 -12
  78. package/src/projection/returnQuestion/returnQuestion.constants.ts +10 -0
  79. package/src/projection/returnQuestion/returnQuestion.metadata.ts +17 -0
  80. package/src/projection/returnQuestion/returnQuestion.ts +42 -20
  81. package/src/projection/returnQuestion/returnQuestion.typeguard.ts +24 -0
@@ -1,52 +1,47 @@
1
- import { ReturnQuestionProjection, ReturnQuestionType } from "../../../projection/returnQuestion/returnQuestion";
1
+ import { ReturnQuestionProjection } from "../../../projection/returnQuestion/returnQuestion";
2
+ import { ReturnQuestionType } from "../../../projection/returnQuestion/returnQuestion.constants";
2
3
 
3
4
  const returnQuestions: ReturnQuestionProjection[] = [
4
5
  {
5
6
  id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
6
- name: "main_title",
7
- placeholder: "",
7
+ translationKey: "main_title",
8
8
  type: ReturnQuestionType.HOST_DEFAULT,
9
9
  children: [
10
10
  {
11
11
  id: "ed396b68-1436-48ab-842f-fbfea996fad4",
12
- name: "size",
13
- placeholder: "size_placeholder",
12
+ translationKey: "size",
14
13
  type: ReturnQuestionType.HOST_SELECT,
14
+ metadata: {
15
+ placeholder: "size_placeholder",
16
+ },
15
17
  children: [
16
18
  {
17
19
  id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
18
- name: "size_title",
19
- placeholder: "",
20
+ translationKey: "size_title",
20
21
  type: ReturnQuestionType.HOST_STACK,
21
22
  children: [
22
23
  {
23
24
  id: "9251dc2c-d76a-484d-9299-346929af932f",
24
- name: "size_large",
25
- placeholder: "",
25
+ translationKey: "size_large",
26
26
  type: ReturnQuestionType.OPTION,
27
27
  children: [
28
28
  {
29
29
  id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
30
- name: "",
31
- placeholder: "",
32
30
  type: ReturnQuestionType.HOST_STACK,
33
31
  children: [
34
32
  {
35
33
  id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
36
- name: "size_overall",
37
- placeholder: "",
34
+ translationKey: "size_overall",
38
35
  type: ReturnQuestionType.OPTION,
39
36
  },
40
37
  {
41
38
  id: "85e84a77-461c-41e6-8544-95b5294d0b80",
42
- name: "size_trousers_too_long",
43
- placeholder: "",
39
+ translationKey: "size_trousers_too_long",
44
40
  type: ReturnQuestionType.OPTION,
45
41
  },
46
42
  {
47
43
  id: "29441d25-8d9f-471e-a13e-a03f61c88091",
48
- name: "size_fit_cut_does_not_fit",
49
- placeholder: "",
44
+ translationKey: "size_fit_cut_does_not_fit",
50
45
  type: ReturnQuestionType.OPTION,
51
46
  },
52
47
  ],
@@ -55,38 +50,31 @@ const returnQuestions: ReturnQuestionProjection[] = [
55
50
  },
56
51
  {
57
52
  id: "a081c3e9-1904-4a60-8899-b72c1a3a0291",
58
- name: "size_correct",
59
- placeholder: "",
53
+ translationKey: "size_correct",
60
54
  type: ReturnQuestionType.OPTION,
61
55
  },
62
56
  {
63
57
  id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
64
- name: "size_small",
65
- placeholder: "",
58
+ translationKey: "size_small",
66
59
  type: ReturnQuestionType.OPTION,
67
60
  children: [
68
61
  {
69
62
  id: "58e5ae9a-bc0d-4d27-b267-854a51c2a79a",
70
- name: "",
71
- placeholder: "",
72
63
  type: ReturnQuestionType.HOST_STACK,
73
64
  children: [
74
65
  {
75
66
  id: "6a3d11fc-570c-4085-a850-1967228cdd4c",
76
- name: "size_overall",
77
- placeholder: "",
67
+ translationKey: "size_overall",
78
68
  type: ReturnQuestionType.OPTION,
79
69
  },
80
70
  {
81
71
  id: "c27e1936-deea-4dbe-a8f1-fe4fb8564deb",
82
- name: "size_trousers_too_short",
83
- placeholder: "",
72
+ translationKey: "size_trousers_too_short",
84
73
  type: ReturnQuestionType.OPTION,
85
74
  },
86
75
  {
87
76
  id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
88
- name: "size_fit_cut_does_not_fit",
89
- placeholder: "",
77
+ translationKey: "size_fit_cut_does_not_fit",
90
78
  type: ReturnQuestionType.OPTION,
91
79
  },
92
80
  ],
@@ -99,44 +87,39 @@ const returnQuestions: ReturnQuestionProjection[] = [
99
87
  },
100
88
  {
101
89
  id: "6a6d3878-5561-412c-96f3-7ed79ee587bb",
102
- name: "style",
103
- placeholder: "style_placeholder",
90
+ translationKey: "style",
104
91
  type: ReturnQuestionType.HOST_SELECT,
92
+ metadata: {
93
+ placeholder: "style_placeholder",
94
+ },
105
95
  children: [
106
96
  {
107
97
  id: "fd7ff4a0-78ed-4c0d-aa4d-64962739c322",
108
- name: "style_title",
109
- placeholder: "",
98
+ translationKey: "style_title",
110
99
  type: ReturnQuestionType.HOST_STACK,
111
100
  children: [
112
101
  {
113
102
  id: "56631448-d33d-49fb-b3f8-4486b68b60c3",
114
- name: "style_i_love_it_but",
115
- placeholder: "",
103
+ translationKey: "style_i_love_it_but",
116
104
  type: ReturnQuestionType.OPTION,
117
105
  children: [
118
106
  {
119
107
  id: "90329d91-bd5d-4439-bb0a-b338caaeff2b",
120
- name: "",
121
- placeholder: "",
122
108
  type: ReturnQuestionType.HOST_STACK,
123
109
  children: [
124
110
  {
125
111
  id: "a3d937b6-7499-4a3c-86bf-5c0af9ab2e23",
126
- name: "style_i_already_have_something_similar",
127
- placeholder: "",
112
+ translationKey: "style_i_already_have_something_similar",
128
113
  type: ReturnQuestionType.OPTION,
129
114
  },
130
115
  {
131
116
  id: "7970edd3-fb5c-42d3-afe3-ce31bcbb856c",
132
- name: "style_very_basic_simple",
133
- placeholder: "",
117
+ translationKey: "style_very_basic_simple",
134
118
  type: ReturnQuestionType.OPTION,
135
119
  },
136
120
  {
137
121
  id: "bab3d4f9-0227-4550-a53f-3c125d68429c",
138
- name: "style_i_dont_need_it_at_the_moment",
139
- placeholder: "",
122
+ translationKey: "style_i_dont_need_it_at_the_moment",
140
123
  type: ReturnQuestionType.OPTION,
141
124
  },
142
125
  ],
@@ -145,32 +128,26 @@ const returnQuestions: ReturnQuestionProjection[] = [
145
128
  },
146
129
  {
147
130
  id: "5287d1df-a28a-42cd-9138-01f82aeea4c2",
148
- name: "style_i_like_it_but",
149
- placeholder: "",
131
+ translationKey: "style_i_like_it_but",
150
132
  type: ReturnQuestionType.OPTION,
151
133
  children: [
152
134
  {
153
135
  id: "35b86395-6b6b-4a39-ab16-05511f58acdd",
154
- name: "",
155
- placeholder: "",
156
136
  type: ReturnQuestionType.HOST_STACK,
157
137
  children: [
158
138
  {
159
139
  id: "e1f6ac53-f203-4b32-9ff0-782c028d9e95",
160
- name: "style_i_already_have_something_similar",
161
- placeholder: "",
140
+ translationKey: "style_i_already_have_something_similar",
162
141
  type: ReturnQuestionType.OPTION,
163
142
  },
164
143
  {
165
144
  id: "12875926-b67a-4ad3-852c-1608c7dcc558",
166
- name: "style_very_basic_simple",
167
- placeholder: "",
145
+ translationKey: "style_very_basic_simple",
168
146
  type: ReturnQuestionType.OPTION,
169
147
  },
170
148
  {
171
149
  id: "a5eb96bf-73d4-4df5-8ad8-097410b24526",
172
- name: "style_i_dont_need_it_at_the_moment",
173
- placeholder: "",
150
+ translationKey: "style_i_dont_need_it_at_the_moment",
174
151
  type: ReturnQuestionType.OPTION,
175
152
  },
176
153
  ],
@@ -179,44 +156,36 @@ const returnQuestions: ReturnQuestionProjection[] = [
179
156
  },
180
157
  {
181
158
  id: "757107a9-8e2d-4194-a7fe-0d55cde49c11",
182
- name: "style_not_bad_but",
183
- placeholder: "",
159
+ translationKey: "style_not_bad_but",
184
160
  type: ReturnQuestionType.OPTION,
185
161
  children: [
186
162
  {
187
163
  id: "c6f75ee3-a445-4103-a682-f0c3a742108d",
188
- name: "",
189
- placeholder: "",
190
164
  type: ReturnQuestionType.HOST_STACK,
191
165
  children: [
192
166
  {
193
167
  id: "4f46d4b1-b103-43b2-b669-be721ab46e03",
194
- name: "style_i_dont_like_the_color",
195
- placeholder: "",
168
+ translationKey: "style_i_dont_like_the_color",
196
169
  type: ReturnQuestionType.OPTION,
197
170
  },
198
171
  {
199
172
  id: "48412165-5e05-4806-8e21-ea59c41d0479",
200
- name: "style_very_basic_simple",
201
- placeholder: "",
173
+ translationKey: "style_very_basic_simple",
202
174
  type: ReturnQuestionType.OPTION,
203
175
  },
204
176
  {
205
177
  id: "51262c01-eaa3-4d3a-aeb9-95dc8b0dd687",
206
- name: "style_i_dont_like_the_fabric",
207
- placeholder: "",
178
+ translationKey: "style_i_dont_like_the_fabric",
208
179
  type: ReturnQuestionType.OPTION,
209
180
  },
210
181
  {
211
182
  id: "9dea1c2b-4f8c-4192-a547-999df55e77e4",
212
- name: "style_i_dont_like_the_print",
213
- placeholder: "",
183
+ translationKey: "style_i_dont_like_the_print",
214
184
  type: ReturnQuestionType.OPTION,
215
185
  },
216
186
  {
217
187
  id: "b1277bf3-4bbb-487a-8e58-88efecc61c3f",
218
- name: "style_not_my_style_in_general",
219
- placeholder: "",
188
+ translationKey: "style_not_my_style_in_general",
220
189
  type: ReturnQuestionType.OPTION,
221
190
  },
222
191
  ],
@@ -225,44 +194,36 @@ const returnQuestions: ReturnQuestionProjection[] = [
225
194
  },
226
195
  {
227
196
  id: "8a9cd6f8-db4b-4904-8a48-3d9bbd6f7a69",
228
- name: "style_i_dont_like",
229
- placeholder: "",
197
+ translationKey: "style_i_dont_like",
230
198
  type: ReturnQuestionType.OPTION,
231
199
  children: [
232
200
  {
233
201
  id: "f604240d-c093-4a9e-ab85-4adc0744066a",
234
- name: "",
235
- placeholder: "",
236
202
  type: ReturnQuestionType.HOST_STACK,
237
203
  children: [
238
204
  {
239
205
  id: "42dbbb93-7808-4ac3-8431-582f812cb314",
240
- name: "style_i_dont_like_the_color",
241
- placeholder: "",
206
+ translationKey: "style_i_dont_like_the_color",
242
207
  type: ReturnQuestionType.OPTION,
243
208
  },
244
209
  {
245
210
  id: "af1ade81-7b22-4f7e-a505-2ae275a6440f",
246
- name: "style_very_basic_simple",
247
- placeholder: "",
211
+ translationKey: "style_very_basic_simple",
248
212
  type: ReturnQuestionType.OPTION,
249
213
  },
250
214
  {
251
215
  id: "26d073b4-2588-4391-9b4c-e8e4a8eba2a8",
252
- name: "style_i_dont_like_the_fabric",
253
- placeholder: "",
216
+ translationKey: "style_i_dont_like_the_fabric",
254
217
  type: ReturnQuestionType.OPTION,
255
218
  },
256
219
  {
257
220
  id: "ee50ab07-b7a6-415e-a04a-c9f350396185",
258
- name: "style_i_dont_like_the_print",
259
- placeholder: "",
221
+ translationKey: "style_i_dont_like_the_print",
260
222
  type: ReturnQuestionType.OPTION,
261
223
  },
262
224
  {
263
225
  id: "ce3227e4-851e-47b7-98c1-c63a402e8477",
264
- name: "style_not_my_style_in_general",
265
- placeholder: "",
226
+ translationKey: "style_not_my_style_in_general",
266
227
  type: ReturnQuestionType.OPTION,
267
228
  },
268
229
  ],
@@ -275,32 +236,30 @@ const returnQuestions: ReturnQuestionProjection[] = [
275
236
  },
276
237
  {
277
238
  id: "a1acdb2d-62c8-467f-b7cc-dc24d967290c",
278
- name: "quality",
279
- placeholder: "quality_placeholder",
239
+ translationKey: "quality",
280
240
  type: ReturnQuestionType.HOST_SELECT,
241
+ metadata: {
242
+ placeholder: "quality_placeholder",
243
+ },
281
244
  children: [
282
245
  {
283
246
  id: "405de847-188f-46c1-b66d-941c22a6b7a9",
284
- name: "quality_title",
285
- placeholder: "",
247
+ translationKey: "quality_title",
286
248
  type: ReturnQuestionType.HOST_STACK,
287
249
  children: [
288
250
  {
289
251
  id: "cce7851c-92c7-461b-8dcb-903c5de59ed1",
290
- name: "quality_good",
291
- placeholder: "",
252
+ translationKey: "quality_good",
292
253
  type: ReturnQuestionType.OPTION,
293
254
  },
294
255
  {
295
256
  id: "4bf8f27d-669b-4d36-8d39-b5599c671816",
296
- name: "quality_regular",
297
- placeholder: "",
257
+ translationKey: "quality_regular",
298
258
  type: ReturnQuestionType.OPTION,
299
259
  },
300
260
  {
301
261
  id: "48bfe766-92c0-4ff5-a793-e107b60786ff",
302
- name: "quality_bad",
303
- placeholder: "",
262
+ translationKey: "quality_bad",
304
263
  type: ReturnQuestionType.OPTION,
305
264
  },
306
265
  ],
@@ -309,32 +268,30 @@ const returnQuestions: ReturnQuestionProjection[] = [
309
268
  },
310
269
  {
311
270
  id: "f25ccdcf-b648-479e-b4a1-86129e3e8c0b",
312
- name: "price",
313
- placeholder: "price_placeholder",
271
+ translationKey: "price",
314
272
  type: ReturnQuestionType.HOST_SELECT,
273
+ metadata: {
274
+ placeholder: "price_placeholder",
275
+ },
315
276
  children: [
316
277
  {
317
278
  id: "b0e0463c-787f-4d6c-adf3-5151ab6fc959",
318
- name: "price_title",
319
- placeholder: "",
279
+ translationKey: "price_title",
320
280
  type: ReturnQuestionType.HOST_STACK,
321
281
  children: [
322
282
  {
323
283
  id: "9c59e396-4135-4255-9437-22555837d686",
324
- name: "price_expensive",
325
- placeholder: "",
284
+ translationKey: "price_expensive",
326
285
  type: ReturnQuestionType.OPTION,
327
286
  },
328
287
  {
329
288
  id: "10db17f8-0982-49ee-9aeb-f752d953654c",
330
- name: "price_cheap",
331
- placeholder: "",
289
+ translationKey: "price_cheap",
332
290
  type: ReturnQuestionType.OPTION,
333
291
  },
334
292
  {
335
293
  id: "acf64bb3-b91b-48e7-bba1-0541620ed1c5",
336
- name: "price_fair",
337
- placeholder: "",
294
+ translationKey: "price_fair",
338
295
  type: ReturnQuestionType.OPTION,
339
296
  },
340
297
  ],
@@ -343,38 +300,35 @@ const returnQuestions: ReturnQuestionProjection[] = [
343
300
  },
344
301
  {
345
302
  id: "b7ad1665-5e54-4ee4-b455-e7189f33083c",
346
- name: "others",
347
- placeholder: "others_placeholder",
303
+ translationKey: "others",
348
304
  type: ReturnQuestionType.HOST_SELECT,
305
+ metadata: {
306
+ placeholder: "others_placeholder",
307
+ },
349
308
  children: [
350
309
  {
351
310
  id: "32cd0ef9-78d7-4605-a279-556749b36d4a",
352
- name: "others_title",
353
- placeholder: "",
311
+ translationKey: "others_title",
354
312
  type: ReturnQuestionType.HOST_STACK,
355
313
  children: [
356
314
  {
357
315
  id: "95c4fd13-9ca3-45a6-8795-23415bbd0a5e",
358
- name: "others_i_dont_like_the_brand",
359
- placeholder: "",
316
+ translationKey: "others_i_dont_like_the_brand",
360
317
  type: ReturnQuestionType.OPTION,
361
318
  },
362
319
  {
363
320
  id: "f25c63bd-42d3-4242-9b81-927025aa9d67",
364
- name: "others_different_from_preview",
365
- placeholder: "",
321
+ translationKey: "others_different_from_preview",
366
322
  type: ReturnQuestionType.OPTION,
367
323
  },
368
324
  {
369
325
  id: "0e0b16c1-a721-4a14-aea6-e0cf5c262222",
370
- name: "others_delivery_delay",
371
- placeholder: "",
326
+ translationKey: "others_delivery_delay",
372
327
  type: ReturnQuestionType.OPTION,
373
328
  },
374
329
  {
375
330
  id: "11699ae8-325d-429c-9c05-ff2d6cc45d54",
376
- name: "others_item_is_defective",
377
- placeholder: "",
331
+ translationKey: "others_item_is_defective",
378
332
  type: ReturnQuestionType.OPTION,
379
333
  },
380
334
  ],
@@ -385,15 +339,16 @@ const returnQuestions: ReturnQuestionProjection[] = [
385
339
  },
386
340
  {
387
341
  id: "ce3e8d57-5eea-4dd3-bef4-2e811a143612",
388
- name: "comment_title",
389
- placeholder: "",
342
+ translationKey: "comment_title",
390
343
  type: ReturnQuestionType.HOST_TEXTAREA,
391
344
  children: [
392
345
  {
393
346
  id: "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
394
- name: "comment_textarea",
395
- placeholder: "comment_textarea_placeholder",
347
+ translationKey: "comment_textarea",
396
348
  type: ReturnQuestionType.TEXTAREA,
349
+ metadata: {
350
+ placeholder: "comment_textarea_placeholder",
351
+ },
397
352
  },
398
353
  ],
399
354
  },
@@ -1,10 +1,12 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import { render } from "@testing-library/react-native";
2
3
  import React, { ReactNode } from "react";
3
4
  import { Text } from "react-native";
4
- import { ReturnQuestionProjection, ReturnQuestionType } from "../../../../../projection/returnQuestion/returnQuestion";
5
+ import { ReturnQuestionProjection } from "../../../../../projection/returnQuestion/returnQuestion";
6
+ import { ReturnQuestionType } from "../../../../../projection/returnQuestion/returnQuestion.constants";
5
7
  import ReturnQuestion from "./ReturnQuestion";
6
8
  import { ReturnQuestionItemProvider, ReturnQuestionItems } from "./behaviors/useReturnQuestionItem";
7
- import { ReturnQuestionItem, ReturnQuestionItemProps } from "./components/ReturnQuestionItem";
9
+ import { ReturnQuestionItem } from "./components/ReturnQuestionItem";
8
10
 
9
11
  const mockOnChange = jest.fn();
10
12
  jest.mock("./behaviors/useReturnQuestionFeedback", () => ({
@@ -13,34 +15,30 @@ jest.mock("./behaviors/useReturnQuestionFeedback", () => ({
13
15
 
14
16
  const returnQuestion: ReturnQuestionProjection = {
15
17
  id: "9251dc2c-d76a-484d-9299-346929af932f",
16
- name: "size_large",
17
- placeholder: "",
18
+ translationKey: "size_large",
18
19
  type: ReturnQuestionType.OPTION,
19
20
  children: [
20
21
  {
21
22
  id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
22
- name: "size_overall",
23
- placeholder: "",
23
+ translationKey: "size_overall",
24
24
  type: ReturnQuestionType.OPTION,
25
25
  },
26
26
  {
27
27
  id: "85e84a77-461c-41e6-8544-95b5294d0b80",
28
- name: "size_trousers_too_long",
29
- placeholder: "",
28
+ translationKey: "size_trousers_too_long",
30
29
  type: ReturnQuestionType.OPTION,
31
30
  },
32
31
  {
33
32
  id: "29441d25-8d9f-471e-a13e-a03f61c88091",
34
- name: "size_fit_cut_does_not_fit",
35
- placeholder: "",
33
+ translationKey: "size_fit_cut_does_not_fit",
36
34
  type: ReturnQuestionType.OPTION,
37
35
  },
38
36
  ],
39
37
  };
40
38
 
41
- const Item: ReturnQuestionItem = ({ returnQuestion, children }: ReturnQuestionItemProps) => (
39
+ const Item: ReturnQuestionItem<ReturnQuestionType> = ({ returnQuestion, children }) => (
42
40
  <>
43
- <Text>{returnQuestion.name}</Text>
41
+ <Text>{returnQuestion.translationKey}</Text>
44
42
  {children}
45
43
  </>
46
44
  );
@@ -1,5 +1,6 @@
1
1
  import React, { FC, memo } from "react";
2
2
  import { ReturnQuestionProjection } from "../../../../../projection/returnQuestion/returnQuestion";
3
+ import { returnQuestionHasChildren } from "../../../../../projection/returnQuestion/returnQuestion.typeguard";
3
4
  import { useReturnQuestionItem } from "./behaviors/useReturnQuestionItem";
4
5
 
5
6
  interface ReturnQuestionProps {
@@ -19,14 +20,15 @@ const ReturnQuestion: FC<ReturnQuestionProps> = ({ returnQuestionParent, returnQ
19
20
  testID={returnQuestion.id}
20
21
  >
21
22
  <>
22
- {returnQuestion.children?.map((childReturnQuestion) => (
23
- <ReturnQuestion
24
- key={childReturnQuestion.id}
25
- portalHostName={portalHostName}
26
- returnQuestion={childReturnQuestion}
27
- returnQuestionParent={returnQuestion}
28
- />
29
- ))}
23
+ {returnQuestionHasChildren(returnQuestion) &&
24
+ returnQuestion.children?.map((childReturnQuestion) => (
25
+ <ReturnQuestion
26
+ key={childReturnQuestion.id}
27
+ portalHostName={portalHostName}
28
+ returnQuestion={childReturnQuestion}
29
+ returnQuestionParent={returnQuestion}
30
+ />
31
+ ))}
30
32
  </>
31
33
  </Item>
32
34
  );
@@ -1,34 +1,35 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import { render } from "@testing-library/react-native";
2
3
  import React, { ReactNode } from "react";
3
4
  import { Text } from "react-native";
4
- import { ReturnQuestionProjection, ReturnQuestionType } from "../../../../../projection/returnQuestion/returnQuestion";
5
+ import { ReturnQuestionProjection } from "../../../../../projection/returnQuestion/returnQuestion";
6
+ import { ReturnQuestionType } from "../../../../../projection/returnQuestion/returnQuestion.constants";
5
7
  import { ReturnQuestions } from "./ReturnQuestions";
6
8
  import { ReturnQuestionFeedbackProvider } from "./behaviors/useReturnQuestionFeedback";
7
9
  import { ReturnQuestionItemProvider, ReturnQuestionItems } from "./behaviors/useReturnQuestionItem";
8
- import { ReturnQuestionItem, ReturnQuestionItemProps } from "./components/ReturnQuestionItem";
10
+ import { ReturnQuestionItem } from "./components/ReturnQuestionItem";
9
11
 
10
12
  const returnQuestions: ReturnQuestionProjection[] = [
11
13
  {
12
14
  id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
13
- name: "size_overall",
14
- placeholder: "",
15
+ translationKey: "size_overall",
15
16
  type: ReturnQuestionType.OPTION,
16
17
  },
17
18
  {
18
19
  id: "85e84a77-461c-41e6-8544-95b5294d0b80",
19
- name: "size_trousers_too_long",
20
- placeholder: "",
20
+ translationKey: "size_trousers_too_long",
21
21
  type: ReturnQuestionType.OPTION,
22
22
  },
23
23
  {
24
24
  id: "29441d25-8d9f-471e-a13e-a03f61c88091",
25
- name: "size_fit_cut_does_not_fit",
26
- placeholder: "",
25
+ translationKey: "size_fit_cut_does_not_fit",
27
26
  type: ReturnQuestionType.OPTION,
28
27
  },
29
28
  ];
30
29
 
31
- const Item: ReturnQuestionItem = ({ returnQuestion }: ReturnQuestionItemProps) => <Text>{returnQuestion.name}</Text>;
30
+ const Item: ReturnQuestionItem<ReturnQuestionType> = ({ returnQuestion }) => (
31
+ <Text>{returnQuestion.translationKey}</Text>
32
+ );
32
33
 
33
34
  const returnQuestionItems: ReturnQuestionItems = {
34
35
  [ReturnQuestionType.HOST_DEFAULT]: Item,
@@ -1,4 +1,5 @@
1
1
  import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
2
+ import { returnQuestionHasChildren } from "../../../../../../projection/returnQuestion/returnQuestion.typeguard";
2
3
 
3
4
  interface IsChildReturnQuestionFunctionArgs {
4
5
  readonly returnQuestionId: string;
@@ -13,7 +14,7 @@ const isChildReturnQuestion: IsChildReturnQuestionFunction = ({ returnQuestionId
13
14
  return true;
14
15
  }
15
16
 
16
- const children = returnQuestion.children || [];
17
+ const children = (returnQuestionHasChildren(returnQuestion) && returnQuestion.children) || [];
17
18
 
18
19
  for (let index = 0; index < children.length; index++) {
19
20
  const isChild = isChildReturnQuestion({
@@ -1,25 +1,23 @@
1
1
  import { renderHook } from "@testing-library/react-native";
2
2
  import React from "react";
3
3
  import { Text } from "react-native";
4
- import {
5
- ReturnQuestionProjection,
6
- ReturnQuestionType,
7
- } from "../../../../../../projection/returnQuestion/returnQuestion";
4
+ import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
5
+ import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion.constants";
8
6
  import { createWrapper } from "../../../../test/createWrapper";
9
7
  import { render } from "../../../../test/render";
10
8
  import { ReturnQuestionItem } from "../components/ReturnQuestionItem";
11
9
  import { ReturnQuestionItemProvider, ReturnQuestionItems, useReturnQuestionItem as sut } from "./useReturnQuestionItem";
12
10
 
13
11
  const hostDefaultText = "host default";
14
- const HostDefault: ReturnQuestionItem = () => <Text>{hostDefaultText}</Text>;
12
+ const HostDefault: ReturnQuestionItem<ReturnQuestionType.HOST_DEFAULT> = () => <Text>{hostDefaultText}</Text>;
15
13
  const hostSelectText = "host select";
16
- const HostSelect: ReturnQuestionItem = () => <Text>{hostSelectText}</Text>;
14
+ const HostSelect: ReturnQuestionItem<ReturnQuestionType.HOST_SELECT> = () => <Text>{hostSelectText}</Text>;
17
15
  const hostStackText = "host stack";
18
- const HostStack: ReturnQuestionItem = () => <Text>{hostStackText}</Text>;
16
+ const HostStack: ReturnQuestionItem<ReturnQuestionType.HOST_STACK> = () => <Text>{hostStackText}</Text>;
19
17
  const optionText = "option";
20
- const Option: ReturnQuestionItem = () => <Text>{optionText}</Text>;
18
+ const Option: ReturnQuestionItem<ReturnQuestionType.OPTION> = () => <Text>{optionText}</Text>;
21
19
  const textareaText = "textarea";
22
- const Textarea: ReturnQuestionItem = () => <Text>{textareaText}</Text>;
20
+ const Textarea: ReturnQuestionItem<ReturnQuestionType.TEXTAREA> = () => <Text>{textareaText}</Text>;
23
21
 
24
22
  const returnQuestionItems: ReturnQuestionItems = {
25
23
  [ReturnQuestionType.HOST_DEFAULT]: HostDefault,
@@ -1,9 +1,9 @@
1
1
  import React, { createContext, FC, ReactNode, useContext, useMemo } from "react";
2
2
  import invariant from "tiny-invariant";
3
- import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion";
3
+ import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion.constants";
4
4
  import { ReturnQuestionItem } from "../components/ReturnQuestionItem";
5
5
 
6
- type ReturnQuestionItems = Record<ReturnQuestionType, ReturnQuestionItem>;
6
+ type ReturnQuestionItems = Record<ReturnQuestionType, ReturnQuestionItem<ReturnQuestionType>>;
7
7
 
8
8
  const ReturnQuestionItemContext = createContext<ReturnQuestionItems>({} as ReturnQuestionItems);
9
9
 
@@ -21,7 +21,7 @@ interface UseReturnQuestionItemFunctionArgs {
21
21
  }
22
22
 
23
23
  interface UseReturnQuestionItemFunction {
24
- (args: UseReturnQuestionItemFunctionArgs): ReturnQuestionItem;
24
+ (args: UseReturnQuestionItemFunctionArgs): ReturnQuestionItem<ReturnQuestionType>;
25
25
  }
26
26
 
27
27
  const useReturnQuestionItem: UseReturnQuestionItemFunction = ({ type }) => {