@lookiero/checkout 12.3.0 → 12.5.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 (159) hide show
  1. package/cypress/integration/checkout.spec.ts +14 -9
  2. package/cypress/support/interceptViewCheckoutFeedbackDefinitionByCheckoutId.ts +6 -0
  3. package/dist/public/public/assets/adaptive-icon.png +0 -0
  4. package/dist/public/public/assets/favicon.png +0 -0
  5. package/dist/public/public/assets/icon.png +0 -0
  6. package/dist/public/public/assets/splash.png +0 -0
  7. package/dist/public/public/images/not-found.png +0 -0
  8. package/dist/src/ExpoRoot.js +2 -2
  9. package/dist/src/domain/checkoutItem/model/currency.d.ts +6 -0
  10. package/dist/src/domain/checkoutItem/model/currency.js +7 -0
  11. package/dist/src/domain/uiSetting/command/updateUiSetting.d.ts +15 -0
  12. package/dist/src/domain/uiSetting/command/updateUiSetting.js +10 -0
  13. package/dist/src/domain/uiSetting/model/uiSetting.d.ts +9 -0
  14. package/dist/src/domain/uiSetting/model/uiSetting.js +11 -0
  15. package/dist/src/domain/uiSetting/model/uiSettingUpdated.d.ts +15 -0
  16. package/dist/src/domain/uiSetting/model/uiSettingUpdated.js +8 -0
  17. package/dist/src/domain/uiSetting/model/uiSettings.d.ts +7 -0
  18. package/dist/src/domain/uiSetting/model/uiSettings.js +1 -0
  19. package/dist/src/infrastructure/delivery/baseBootstrap.d.ts +2 -2
  20. package/dist/src/infrastructure/delivery/baseBootstrap.js +4 -4
  21. package/dist/src/infrastructure/delivery/bootstrap.js +2 -2
  22. package/dist/src/infrastructure/delivery/bootstrap.mock.js +3 -3
  23. package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +17 -0
  24. package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.js +20 -0
  25. package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +18 -0
  26. package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +22 -0
  27. package/dist/src/infrastructure/integration/useRedirect.d.ts +7 -0
  28. package/dist/src/infrastructure/integration/useRedirect.js +1 -0
  29. package/dist/src/infrastructure/persistence/asyncStorageStorage.d.ts +5 -0
  30. package/dist/src/infrastructure/persistence/asyncStorageStorage.js +7 -0
  31. package/dist/src/infrastructure/persistence/uiSettingData.d.ts +6 -0
  32. package/dist/src/infrastructure/persistence/uiSettingData.js +1 -0
  33. package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.d.ts +3 -0
  34. package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.js +107 -0
  35. package/dist/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.d.ts +12 -0
  36. package/dist/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.js +10 -0
  37. package/dist/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.d.ts +10 -0
  38. package/dist/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.js +9 -0
  39. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +47 -58
  40. package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.d.ts +10 -0
  41. package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.js +11 -0
  42. package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.d.ts +13 -0
  43. package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.js +15 -0
  44. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.d.ts +2 -2
  45. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js +4 -2
  46. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.d.ts +2 -2
  47. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.d.ts +5 -5
  48. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.js +1 -1
  49. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.d.ts +5 -4
  50. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.d.ts +2 -1
  51. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -1
  52. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.d.ts +2 -1
  53. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +2 -1
  54. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.d.ts +2 -1
  55. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +2 -1
  56. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.d.ts +2 -3
  57. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +5 -7
  58. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.d.ts +2 -1
  59. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +2 -1
  60. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +1 -2
  61. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.d.ts +4 -0
  62. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.js +17 -0
  63. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.d.ts +11 -0
  64. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.js +16 -0
  65. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +1 -1
  66. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +3 -5
  67. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +2 -3
  68. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +2 -4
  69. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +27 -0
  70. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +97 -0
  71. package/dist/src/infrastructure/ui/routing/useBasePath.d.ts +8 -0
  72. package/dist/src/infrastructure/ui/routing/useBasePath.js +9 -0
  73. package/dist/src/infrastructure/ui/settings/UISettings.d.ts +3 -0
  74. package/dist/src/infrastructure/ui/settings/UISettings.js +4 -0
  75. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.d.ts +12 -0
  76. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +90 -0
  77. package/dist/src/infrastructure/ui/views/feedback/Feedback.js +10 -9
  78. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.d.ts +2 -3
  79. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +17 -9
  80. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +1 -0
  81. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -1
  82. package/dist/src/projection/checkoutFeedback/checkoutFeedback.constants.d.ts +11 -0
  83. package/dist/src/projection/checkoutFeedback/checkoutFeedback.constants.js +10 -0
  84. package/dist/src/projection/checkoutFeedback/checkoutFeedback.d.ts +22 -2
  85. package/dist/src/projection/checkoutFeedback/checkoutFeedback.metadata.d.ts +21 -0
  86. package/dist/src/projection/checkoutFeedback/checkoutFeedback.metadata.js +1 -0
  87. package/dist/src/projection/checkoutFeedback/checkoutFeedback.typeguards.d.ts +3 -0
  88. package/dist/src/projection/checkoutFeedback/checkoutFeedback.typeguards.js +7 -0
  89. package/dist/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.d.ts +25 -0
  90. package/dist/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.js +8 -0
  91. package/dist/src/projection/returnQuestion/returnQuestion.constants.d.ts +1 -0
  92. package/dist/src/projection/returnQuestion/returnQuestion.constants.js +1 -0
  93. package/dist/src/projection/returnQuestion/returnQuestion.d.ts +2 -2
  94. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.d.ts +2 -4
  95. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.js +2 -2
  96. package/dist/src/projection/uiSetting/viewUiSettingByKey.d.ts +29 -0
  97. package/dist/src/projection/uiSetting/viewUiSettingByKey.js +8 -0
  98. package/dist/src/version.d.ts +1 -1
  99. package/dist/src/version.js +1 -1
  100. package/package.json +1 -1
  101. package/src/ExpoRoot.tsx +2 -2
  102. package/src/infrastructure/delivery/baseBootstrap.ts +9 -9
  103. package/src/infrastructure/delivery/bootstrap.mock.ts +5 -4
  104. package/src/infrastructure/delivery/bootstrap.ts +2 -2
  105. package/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.ts +110 -0
  106. package/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.test.ts +52 -0
  107. package/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.ts +30 -0
  108. package/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.test.ts +58 -0
  109. package/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.ts +25 -0
  110. package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +47 -58
  111. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.test.tsx +25 -30
  112. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.tsx +12 -13
  113. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.test.tsx +19 -26
  114. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.tsx +3 -3
  115. package/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.test.tsx +26 -26
  116. package/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.tsx +6 -6
  117. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.ts +5 -4
  118. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.test.tsx +7 -11
  119. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +6 -4
  120. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +6 -4
  121. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultReturnQuestionItem.test.tsx +16 -10
  122. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.test.tsx +16 -22
  123. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +6 -4
  124. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.test.tsx +16 -14
  125. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.tsx +13 -14
  126. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.test.tsx +9 -19
  127. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +7 -5
  128. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +1 -2
  129. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.ts +19 -0
  130. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.tsx +36 -0
  131. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.test.tsx +46 -0
  132. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +7 -12
  133. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +6 -5
  134. package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +22 -2
  135. package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +2 -7
  136. package/src/infrastructure/ui/views/feedback/Feedback.test.tsx +11 -5
  137. package/src/infrastructure/ui/views/feedback/Feedback.tsx +10 -9
  138. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.test.tsx +2 -2
  139. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +20 -13
  140. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +1 -0
  141. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +3 -1
  142. package/src/projection/checkoutFeedback/checkoutFeedback.constants.ts +16 -0
  143. package/src/projection/checkoutFeedback/checkoutFeedback.metadata.ts +28 -0
  144. package/src/projection/checkoutFeedback/checkoutFeedback.ts +38 -2
  145. package/src/projection/checkoutFeedback/checkoutFeedback.typeguards.ts +13 -0
  146. package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.test.ts +52 -0
  147. package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.ts +61 -0
  148. package/src/projection/returnQuestion/returnQuestion.constants.ts +1 -0
  149. package/src/projection/returnQuestion/returnQuestion.ts +6 -2
  150. package/src/projection/returnQuestion/returnQuestion.typeguard.ts +3 -11
  151. package/cypress/support/interceptListCheckoutQuestionsByCheckoutId.ts +0 -9
  152. package/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.ts +0 -108
  153. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.test.ts +0 -55
  154. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.ts +0 -34
  155. package/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.test.ts +0 -38
  156. package/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.ts +0 -21
  157. package/src/projection/checkoutQuestion/checkoutQuestion.ts +0 -20
  158. package/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.test.ts +0 -31
  159. package/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.ts +0 -61
@@ -2,17 +2,17 @@ import { CheckoutStatus } from "../../src/domain/checkout/model/checkout";
2
2
  import { CheckoutItemStatus } from "../../src/domain/checkoutItem/model/checkoutItem";
3
3
  import { bookedProductsVariants } from "../../src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock";
4
4
  import { checkout } from "../../src/infrastructure/projection/checkout/checkout.mock";
5
+ import { checkoutFeedbackDefinition } from "../../src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock";
5
6
  import { checkoutItem } from "../../src/infrastructure/projection/checkoutItem/checkoutItem.mock";
6
- import { checkoutQuestions } from "../../src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock";
7
7
  import { paymentFlowPayload } from "../../src/infrastructure/projection/payment/paymentFlowPayload.mock";
8
8
  import { pricing } from "../../src/infrastructure/projection/pricing/pricing.mock";
9
9
  import { returnQuestions } from "../../src/infrastructure/projection/returnQuestion/returnQuestions.mock";
10
10
  import { Routes } from "../../src/infrastructure/ui/routing/routes";
11
- import { CheckoutQuestionType } from "../../src/projection/checkoutQuestion/checkoutQuestion";
11
+ import { CheckoutFeedbackQuestionType } from "../../src/projection/checkoutFeedback/checkoutFeedback.constants";
12
+ import { checkoutFeedbackQuestionHasChildren } from "../../src/projection/checkoutFeedback/checkoutFeedback.typeguards";
12
13
  import { interceptBlockCheckoutBooking } from "../support/interceptBlockCheckoutBooking";
13
14
  import { interceptGiveCheckoutFeedback } from "../support/interceptGiveCheckoutFeedback";
14
15
  import { interceptKeepCheckoutItem } from "../support/interceptKeepCheckoutItem";
15
- import { interceptListCheckoutQuestionsByCheckoutId } from "../support/interceptListCheckoutQuestionsByCheckoutId";
16
16
  import { interceptListReturnQuestionsByCheckoutItemId } from "../support/interceptListReturnQuestionsByCheckoutItemId";
17
17
  import { interceptPayment } from "../support/interceptPayment";
18
18
  import { interceptReplaceCheckoutItem } from "../support/interceptReplaceCheckoutItem";
@@ -20,6 +20,7 @@ import { interceptReturnCheckoutItem } from "../support/interceptReturnCheckoutI
20
20
  import { interceptSubmitCheckout } from "../support/interceptSubmitCheckout";
21
21
  import { interceptViewBookedProductsVariantsForCheckoutItem } from "../support/interceptViewBookedProductsVariantsForCheckoutItem";
22
22
  import { interceptViewCheckoutById } from "../support/interceptViewCheckoutById";
23
+ import { interceptViewCheckoutFeedbackDefinitionByCheckoutId } from "../support/interceptViewCheckoutFeedbackDefinitionByCheckoutId";
23
24
  import { interceptViewFirstAvailableCheckoutByCustomerId } from "../support/interceptViewFirstAvailableCheckoutByCustomerId";
24
25
  import { interceptViewFiveItemsDiscountByCustomerId } from "../support/interceptViewFiveItemsDiscountByCustomerId";
25
26
  import { interceptViewIsSizeChangeEnabledByCheckoutId } from "../support/interceptViewIsSizeChangeEnabledByCheckoutId";
@@ -79,17 +80,21 @@ const checkoutFeedback = () => {
79
80
  cy.shouldIncludePathInUrl(`${BASEPATH}/${Routes.FEEDBACK}`);
80
81
 
81
82
  const answers = [];
82
- checkoutQuestions.map((checkoutQuestion) => {
83
- if (checkoutQuestion.children) {
83
+ checkoutFeedbackDefinition.map((checkoutQuestion) => {
84
+ if (checkoutFeedbackQuestionHasChildren(checkoutQuestion)) {
84
85
  const index = randomIndex(checkoutQuestion.children.length);
85
86
  const randomCheckoutQuestionItem = checkoutQuestion.children[index];
86
87
  answers.push(randomCheckoutQuestionItem.id);
87
88
 
88
89
  if (
89
- checkoutQuestion.showCondition.length === 0 ||
90
- checkoutQuestion.showCondition.some((condition) => answers.includes(condition))
90
+ // @ts-ignore
91
+ !checkoutQuestion?.metadata?.showCondition ||
92
+ // @ts-ignore
93
+ checkoutQuestion?.metadata?.showCondition.length === 0 ||
94
+ // @ts-ignore
95
+ checkoutQuestion?.metadata?.showCondition.some((condition) => answers.includes(condition))
91
96
  ) {
92
- if (checkoutQuestion.type === CheckoutQuestionType.HOST_TEXTAREA) {
97
+ if (checkoutQuestion.type === CheckoutFeedbackQuestionType.HOST_TEXTAREA) {
93
98
  cy.getByTestId(randomCheckoutQuestionItem.id).type("Cypress E2E test");
94
99
  } else {
95
100
  cy.getByTestId(randomCheckoutQuestionItem.id).click();
@@ -125,7 +130,7 @@ describe("Checkout", () => {
125
130
  interceptListReturnQuestionsByCheckoutItemId(returnQuestions);
126
131
  interceptViewPricingByCheckoutId(pricing());
127
132
  interceptViewPaymentFlowPayloadByCheckoutId(paymentFlowPayload);
128
- interceptListCheckoutQuestionsByCheckoutId(checkoutQuestions);
133
+ interceptViewCheckoutFeedbackDefinitionByCheckoutId(checkoutFeedbackDefinition);
129
134
 
130
135
  interceptKeepCheckoutItem();
131
136
  interceptReplaceCheckoutItem();
@@ -0,0 +1,6 @@
1
+ import { CheckoutFeedbackQuestionProjection } from "../../src/projection/checkoutFeedback/checkoutFeedback";
2
+
3
+ const interceptViewCheckoutFeedbackDefinitionByCheckoutId = (response: CheckoutFeedbackQuestionProjection[]) =>
4
+ cy.intercept({ method: "POST", url: "/local-to-dev/view-checkout-feedback-definition-by-checkout-id" }, response);
5
+
6
+ export { interceptViewCheckoutFeedbackDefinitionByCheckoutId };
@@ -28,7 +28,7 @@ const order = {
28
28
  coupon: "MYLOOKIERO",
29
29
  };
30
30
  const customer = {
31
- customerId: "5c38e826-3d01-4a4b-a3d1-8a4166dc2a31",
31
+ customerId: "c7373f39-cae1-4b6d-9711-19eaf007d6a8",
32
32
  country: Country.NL,
33
33
  segment: Segment.WOMEN,
34
34
  email: "email@example.com",
@@ -45,7 +45,7 @@ const apiUrl = Platform.OS !== "web"
45
45
  : __DEV__
46
46
  ? "/local-to-dev"
47
47
  : "/checkout/api";
48
- const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU3MDEwMTIsImV4cCI6MTc1MDMyMTgwOSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDUtMTkiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiNWMzOGU4MjYtM2QwMS00YTRiLWEzZDEtOGE0MTY2ZGMyYTMxIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDc2NDM0MDl9.-amqZAXKy9KKeo9a7bOQigWw1flM99OBlddxbMBA_PU";
48
+ const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU5OTQwMTcsImV4cCI6MTc1MjE0NDQ2MywiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDYtMTAiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiOGZjNTBkZGEtMjZiOC00YTE0LWIyYmYtN2Y0Zjk1NDFmOWJkIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDk1NTI0NjN9.xFDOdP0an_ki8_JsvTANVDxPXWs0iWpTs1EFMqCrbO8";
49
49
  const getAuthToken = () => Promise.resolve(authToken);
50
50
  const externalTranslationsUrl = Platform.OS !== "web"
51
51
  ? "https://backend-for-user.dev.envs.lookiero.tech/api/v2/translations"
@@ -0,0 +1,6 @@
1
+ declare enum Currency {
2
+ EUR = "EUR",
3
+ GBP = "GBP",
4
+ SEK = "SEK"
5
+ }
6
+ export { Currency };
@@ -0,0 +1,7 @@
1
+ var Currency;
2
+ (function (Currency) {
3
+ Currency["EUR"] = "EUR";
4
+ Currency["GBP"] = "GBP";
5
+ Currency["SEK"] = "SEK";
6
+ })(Currency || (Currency = {}));
7
+ export { Currency };
@@ -0,0 +1,15 @@
1
+ import { Command } from "@lookiero/messaging";
2
+ declare const UPDATE_UI_SETTING = "update_ui_setting";
3
+ interface UpdateUiSettingPayload {
4
+ readonly aggregateId: string;
5
+ readonly key: string;
6
+ readonly value: unknown;
7
+ }
8
+ interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {
9
+ }
10
+ interface UpdateUiSettingFunction {
11
+ (payload: UpdateUiSettingPayload): UpdateUiSetting;
12
+ }
13
+ declare const updateUiSetting: UpdateUiSettingFunction;
14
+ export type { UpdateUiSetting };
15
+ export { UPDATE_UI_SETTING, updateUiSetting };
@@ -0,0 +1,10 @@
1
+ import { command } from "@lookiero/messaging";
2
+ const UPDATE_UI_SETTING = "update_ui_setting";
3
+ const updateUiSetting = ({ aggregateId, ...payload }) => ({
4
+ ...command({
5
+ aggregateId,
6
+ name: UPDATE_UI_SETTING,
7
+ }),
8
+ ...payload,
9
+ });
10
+ export { UPDATE_UI_SETTING, updateUiSetting };
@@ -0,0 +1,9 @@
1
+ import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
2
+ import { UpdateUiSetting } from "../command/updateUiSetting";
3
+ interface UiSetting extends AggregateRoot {
4
+ readonly key: string;
5
+ readonly value: unknown;
6
+ }
7
+ declare const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting>;
8
+ export type { UiSetting };
9
+ export { updateUiSettingHandler };
@@ -0,0 +1,11 @@
1
+ import { uiSettingUpdated } from "./uiSettingUpdated";
2
+ const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
3
+ const { aggregateId, key, value } = command;
4
+ return {
5
+ ...aggregateRoot,
6
+ key,
7
+ value,
8
+ domainEvents: [uiSettingUpdated({ aggregateId, key })],
9
+ };
10
+ };
11
+ export { updateUiSettingHandler };
@@ -0,0 +1,15 @@
1
+ import { DomainEvent, MessageName } from "@lookiero/messaging";
2
+ declare const UI_SETTING_UPDATED = "ui_setting_updated";
3
+ interface UiSettingUpdatedPayload {
4
+ readonly aggregateId: string;
5
+ readonly key: string;
6
+ }
7
+ interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {
8
+ }
9
+ interface UiSettingUpdatedFunction {
10
+ (payload: UiSettingUpdatedPayload): UiSettingUpdated;
11
+ }
12
+ declare const uiSettingUpdated: UiSettingUpdatedFunction;
13
+ declare const isUiSettingUpdated: (event: DomainEvent<MessageName>) => event is UiSettingUpdated;
14
+ export type { UiSettingUpdated };
15
+ export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
@@ -0,0 +1,8 @@
1
+ import { domainEvent } from "@lookiero/messaging";
2
+ const UI_SETTING_UPDATED = "ui_setting_updated";
3
+ const uiSettingUpdated = ({ aggregateId, key }) => ({
4
+ ...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
5
+ key,
6
+ });
7
+ const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
8
+ export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
@@ -0,0 +1,7 @@
1
+ import { RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
2
+ import { UiSetting } from "./uiSetting";
3
+ interface UiSettingGetFunction<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs> extends RepositoryGetFunction<UiSetting, UiSettingGetFunctionArgs> {
4
+ }
5
+ interface UiSettingSaveFunction<UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs> extends RepositorySaveFunction<UiSetting, UiSettingSaveFunctionArgs> {
6
+ }
7
+ export type { UiSettingGetFunction, UiSettingSaveFunction };
@@ -0,0 +1 @@
1
+ export {};
@@ -15,8 +15,8 @@ import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/vie
15
15
  import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
16
16
  import { IsSizeChangeEnabledByCheckoutIdView } from "../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
17
17
  import { CheckoutBookingByIdView } from "../../projection/checkoutBooking/viewCheckoutBookingById";
18
+ import { CheckoutFeedbackDefinitionByCheckoutIdView } from "../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
18
19
  import { CheckoutItemByIdView } from "../../projection/checkoutItem/viewCheckoutItemById";
19
- import { CheckoutQuestionsByCheckoutIdView } from "../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
20
20
  import { PaymentFlowPayloadByCheckoutIdView } from "../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
21
21
  import { PricingByCheckoutIdView } from "../../projection/pricing/viewPricingByCheckoutId";
22
22
  import { ReturnQuestionsByCheckoutItemIdView } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
@@ -35,7 +35,7 @@ interface BaseBootstrapFunctionArgs<CheckoutGetFunctionArgs extends RepositoryGe
35
35
  readonly bookedProductsVariantsForCheckoutItemView: BookedProductsVariantsForCheckoutItemView;
36
36
  readonly pricingByCheckoutIdView: PricingByCheckoutIdView;
37
37
  readonly paymentFlowPayloadByCheckoutIdView: PaymentFlowPayloadByCheckoutIdView;
38
- readonly checkoutQuestionsByCheckoutIdView: CheckoutQuestionsByCheckoutIdView;
38
+ readonly checkoutFeedbackDefinitionByCheckoutIdView: CheckoutFeedbackDefinitionByCheckoutIdView;
39
39
  readonly getCheckout: CheckoutsGetFunction<CheckoutGetFunctionArgs>;
40
40
  readonly saveCheckout: CheckoutsSaveFunction<CheckoutSaveFunctionArgs>;
41
41
  readonly checkoutsDependencies: NeverWhenEmptyRecord<[
@@ -27,13 +27,13 @@ import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_C
27
27
  import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
28
28
  import { viewIsSizeChangeEnabledByCheckoutIdHandler, VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID, } from "../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
29
29
  import { viewCheckoutBookingByIdHandler, VIEW_CHECKOUT_BOOKING_BY_ID, } from "../../projection/checkoutBooking/viewCheckoutBookingById";
30
+ import { viewCheckoutFeedbackDefinitionByCheckoutIdHandler, VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID, } from "../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
30
31
  import { viewCheckoutItemByIdHandler, VIEW_CHECKOUT_ITEM_BY_ID, } from "../../projection/checkoutItem/viewCheckoutItemById";
31
- import { listCheckoutQuestionsByCheckoutIdHandler, LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID, } from "../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
32
32
  import { viewPaymentFlowPayloadByCheckoutIdHandler, VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID, } from "../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
33
33
  import { viewPricingByCheckoutIdHandler, VIEW_PRICING_BY_CHECKOUT_ID, } from "../../projection/pricing/viewPricingByCheckoutId";
34
34
  import { listReturnQuestionsByCheckoutItemIdHandler, LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID, } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
35
35
  const MESSAGING_CONTEXT_ID = "Checkout";
36
- const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, isSizeChangeEnabledByCheckoutIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutQuestionsByCheckoutIdView, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) => {
36
+ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, isSizeChangeEnabledByCheckoutIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutFeedbackDefinitionByCheckoutIdView, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) => {
37
37
  let messaging = messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
38
38
  .query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
39
39
  view: fiveItemsDiscountByCustomerIdView,
@@ -68,8 +68,8 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
68
68
  .query(VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID, viewPaymentFlowPayloadByCheckoutIdHandler, {
69
69
  view: paymentFlowPayloadByCheckoutIdView,
70
70
  })
71
- .query(LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID, listCheckoutQuestionsByCheckoutIdHandler, {
72
- view: checkoutQuestionsByCheckoutIdView,
71
+ .query(VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID, viewCheckoutFeedbackDefinitionByCheckoutIdHandler, {
72
+ view: checkoutFeedbackDefinitionByCheckoutIdView,
73
73
  })
74
74
  .query(VIEW_CHECKOUT_BOOKING_BY_ID, viewCheckoutBookingByIdHandler, {
75
75
  view: checkoutBookingByIdView,
@@ -12,8 +12,8 @@ import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/ht
12
12
  import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/checkout/httpIsCheckoutEnabledByCustomerIdView";
13
13
  import { httpIsSizeChangeEnabledByCheckoutIdView } from "../projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView";
14
14
  import { httpCheckoutBookingByIdView } from "../projection/checkoutBooking/httpCheckoutBookingByIdView";
15
+ import { httpCheckoutFeedbackDefinitionByCheckoutIdView } from "../projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView";
15
16
  import { httpCheckoutItemByIdView } from "../projection/checkoutItem/httpCheckoutItemByIdView";
16
- import { httpCheckoutQuestionsByCheckoutIdView } from "../projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView";
17
17
  import { httpPaymentFlowPayloadByCheckoutIdView } from "../projection/payment/httpPaymentFlowPayloadByCheckoutIdView";
18
18
  import { httpPricingByCheckoutIdView } from "../projection/pricing/httpPricingByCheckoutIdView";
19
19
  import { httpReturnQuestionsByCheckoutItemIdView } from "../projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView";
@@ -40,7 +40,7 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
40
40
  paymentFlowPayloadByCheckoutIdView: httpPaymentFlowPayloadByCheckoutIdView({
41
41
  httpPost,
42
42
  }),
43
- checkoutQuestionsByCheckoutIdView: httpCheckoutQuestionsByCheckoutIdView({
43
+ checkoutFeedbackDefinitionByCheckoutIdView: httpCheckoutFeedbackDefinitionByCheckoutIdView({
44
44
  httpPost,
45
45
  }),
46
46
  getCheckout,
@@ -3,7 +3,7 @@ import { bookedProductsVariants } from "../projection/bookedProductsVariants/boo
3
3
  import { checkout } from "../projection/checkout/checkout.mock";
4
4
  import { checkoutBooking as checkoutBookingMock } from "../projection/checkoutBooking/checkoutBooking.mock";
5
5
  import { checkoutFeedback as checkoutFeedbackMock } from "../projection/checkoutFeedback/checkoutFeedback.mock";
6
- import { checkoutQuestions as checkoutQuestionsMock } from "../projection/checkoutQuestion/checkoutQuestions.mock";
6
+ import { checkoutFeedbackDefinition as checkoutFeedbackDefinitionMock } from "../projection/checkoutFeedback/checkoutFeedbackDefinition.mock";
7
7
  import { feedback as feedbackMock } from "../projection/feedback/feedback.mock";
8
8
  import { paymentFlowPayload as paymentFlowPayloadMock } from "../projection/payment/paymentFlowPayload.mock";
9
9
  import { pricing as pricingMock } from "../projection/pricing/pricing.mock";
@@ -54,7 +54,7 @@ const checkoutBookingByIdView = async () => checkoutBookingMock;
54
54
  const bookedProductsVariantsForCheckoutItemView = async () => bookedProductsVariants;
55
55
  const pricingByCheckoutIdView = async () => pricingMock();
56
56
  const paymentFlowPayloadByCheckoutIdView = async () => paymentFlowPayloadMock;
57
- const checkoutQuestionsByCheckoutIdView = async () => checkoutQuestionsMock;
57
+ const checkoutFeedbackDefinitionByCheckoutIdView = async () => checkoutFeedbackDefinitionMock;
58
58
  const bootstrap = () => baseBootstrap({
59
59
  checkoutByIdView,
60
60
  firstAvailableCheckoutByCustomerIdView,
@@ -67,7 +67,7 @@ const bootstrap = () => baseBootstrap({
67
67
  bookedProductsVariantsForCheckoutItemView,
68
68
  pricingByCheckoutIdView,
69
69
  paymentFlowPayloadByCheckoutIdView,
70
- checkoutQuestionsByCheckoutIdView,
70
+ checkoutFeedbackDefinitionByCheckoutIdView,
71
71
  getCheckout,
72
72
  saveCheckout,
73
73
  checkoutsDependencies: [{ dataSource }],
@@ -0,0 +1,17 @@
1
+ import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
2
+ import { UiSettingGetFunction, UiSettingSaveFunction } from "../../../../domain/uiSetting/model/uiSettings";
3
+ import { ReadFunction, WriteFunction } from "../../../persistence/storage";
4
+ import { UiSettingDto } from "../../../persistence/uiSettingData";
5
+ interface StorageUiSettingsGetFunctionArgs extends RepositoryGetFunctionArgs {
6
+ readonly read: ReadFunction<UiSettingDto>;
7
+ }
8
+ interface StorageUiSettingsGetFunction extends UiSettingGetFunction<StorageUiSettingsGetFunctionArgs> {
9
+ }
10
+ declare const getUiSetting: StorageUiSettingsGetFunction;
11
+ interface StorageUiSettingsSaveFunctionArgs extends RepositorySaveFunctionArgs {
12
+ readonly write: WriteFunction<UiSettingDto>;
13
+ }
14
+ interface StorageUiSettingsSaveFunction extends UiSettingSaveFunction<StorageUiSettingsSaveFunctionArgs> {
15
+ }
16
+ declare const saveUiSetting: StorageUiSettingsSaveFunction;
17
+ export { getUiSetting, saveUiSetting };
@@ -0,0 +1,20 @@
1
+ const toDomain = (uiSettingDto) => ({
2
+ aggregateId: uiSettingDto.id,
3
+ key: uiSettingDto.key,
4
+ value: uiSettingDto.value,
5
+ domainEvents: [],
6
+ });
7
+ const fromDomain = (uiSetting) => ({
8
+ id: uiSetting.aggregateId,
9
+ key: uiSetting.key,
10
+ value: uiSetting.value,
11
+ });
12
+ const getUiSetting = ({ read }) => async (uiSettingKey) => {
13
+ const uiSettingDto = await read(uiSettingKey);
14
+ if (!uiSettingDto) {
15
+ throw new Error(`UiSetting not found: ${uiSettingKey}`);
16
+ }
17
+ return toDomain(uiSettingDto);
18
+ };
19
+ const saveUiSetting = ({ write }) => async (aggregateRoot) => await write(aggregateRoot.key, fromDomain(aggregateRoot));
20
+ export { getUiSetting, saveUiSetting };
@@ -0,0 +1,18 @@
1
+ import { CommandStatus } from "@lookiero/messaging-react";
2
+ import { Logger } from "@lookiero/sty-psp-logging";
3
+ interface UpdateFunctionArgs {
4
+ readonly key: string;
5
+ readonly value: unknown;
6
+ }
7
+ interface UpdateFunction {
8
+ (args: UpdateFunctionArgs): Promise<void>;
9
+ }
10
+ type UseUpdateUiSetting = [update: UpdateFunction, status: CommandStatus];
11
+ interface UseUpdateUiSettingArgs {
12
+ readonly logger: Logger;
13
+ }
14
+ interface UseUpdateUiSettingFunction {
15
+ (args: UseUpdateUiSettingArgs): UseUpdateUiSetting;
16
+ }
17
+ declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
18
+ export { useUpdateUiSetting };
@@ -0,0 +1,22 @@
1
+ import { useCallback } from "react";
2
+ import { v4 as uuid } from "uuid";
3
+ import { useCommand } from "@lookiero/messaging-react";
4
+ import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
5
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
+ const useUpdateUiSetting = ({ logger }) => {
7
+ const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
+ const update = useCallback(async ({ key, value }) => {
9
+ try {
10
+ await commandBus(updateUiSetting({
11
+ aggregateId: uuid(),
12
+ key,
13
+ value,
14
+ }));
15
+ }
16
+ catch (error) {
17
+ logger.captureException(error);
18
+ }
19
+ }, [commandBus, logger]);
20
+ return [update, status];
21
+ };
22
+ export { useUpdateUiSetting };
@@ -0,0 +1,7 @@
1
+ interface UseRedirectFunctionReturn {
2
+ readonly returnUrl: string;
3
+ }
4
+ interface UseRedirectFunction {
5
+ (): UseRedirectFunctionReturn;
6
+ }
7
+ export type { UseRedirectFunction };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ReadFunction, WriteFunction } from "./storage";
2
+ import { UiSettingDto } from "./uiSettingData";
3
+ declare const read: ReadFunction<UiSettingDto>;
4
+ declare const write: WriteFunction<UiSettingDto>;
5
+ export { read, write };
@@ -0,0 +1,7 @@
1
+ import AsyncStorage from "@react-native-async-storage/async-storage";
2
+ const read = async (key) => {
3
+ const value = await AsyncStorage.getItem(key);
4
+ return value ? JSON.parse(value) : null;
5
+ };
6
+ const write = async (key, value) => AsyncStorage.setItem(key, JSON.stringify(value));
7
+ export { read, write };
@@ -0,0 +1,6 @@
1
+ interface UiSettingDto {
2
+ readonly id: string;
3
+ readonly key: string;
4
+ readonly value: unknown;
5
+ }
6
+ export type { UiSettingDto };
@@ -0,0 +1,3 @@
1
+ import { CheckoutFeedbackQuestionProjection } from "../../../projection/checkoutFeedback/checkoutFeedback";
2
+ declare const checkoutFeedbackDefinition: CheckoutFeedbackQuestionProjection[];
3
+ export { checkoutFeedbackDefinition };
@@ -0,0 +1,107 @@
1
+ import { CheckoutFeedbackQuestionType } from "../../../projection/checkoutFeedback/checkoutFeedback.constants";
2
+ const checkoutFeedbackDefinition = [
3
+ {
4
+ id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
5
+ translationKey: "checkout_question.selection.question",
6
+ type: CheckoutFeedbackQuestionType.HOST_SELECT,
7
+ metadata: {
8
+ placeholder: "checkout_question.selection.placeholder",
9
+ showCondition: [],
10
+ },
11
+ children: [
12
+ {
13
+ id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
14
+ type: CheckoutFeedbackQuestionType.ICON,
15
+ metadata: {
16
+ icon: "checkout_feedback.icon.bad",
17
+ },
18
+ },
19
+ {
20
+ id: "85e84a77-461c-41e6-8544-95b5294d0b80",
21
+ type: CheckoutFeedbackQuestionType.ICON,
22
+ metadata: {
23
+ icon: "checkout_feedback.icon.regular",
24
+ },
25
+ },
26
+ {
27
+ id: "29441d25-8d9f-471e-a13e-a03f61c88091",
28
+ type: CheckoutFeedbackQuestionType.ICON,
29
+ metadata: {
30
+ icon: "checkout_feedback.icon.good",
31
+ },
32
+ },
33
+ ],
34
+ },
35
+ {
36
+ id: "6a6d3878-5561-412c-96f3-7ed79ee587bb",
37
+ translationKey: "checkout_question.experience.question",
38
+ type: CheckoutFeedbackQuestionType.HOST_SELECT,
39
+ metadata: {
40
+ placeholder: "checkout_question.experience.placeholder",
41
+ showCondition: [],
42
+ },
43
+ children: [
44
+ {
45
+ id: "a3d937b6-7499-4a3c-86bf-5c0af9ab2e23",
46
+ type: CheckoutFeedbackQuestionType.ICON,
47
+ metadata: {
48
+ icon: "checkout_feedback.icon.bad",
49
+ },
50
+ },
51
+ {
52
+ id: "7970edd3-fb5c-42d3-afe3-ce31bcbb856c",
53
+ type: CheckoutFeedbackQuestionType.ICON,
54
+ metadata: {
55
+ icon: "checkout_feedback.icon.regular",
56
+ },
57
+ },
58
+ {
59
+ id: "bab3d4f9-0227-4550-a53f-3c125d68429c",
60
+ type: CheckoutFeedbackQuestionType.ICON,
61
+ metadata: {
62
+ icon: "checkout_feedback.icon.good",
63
+ },
64
+ },
65
+ ],
66
+ },
67
+ {
68
+ id: "a1acdb2d-62c8-467f-b7cc-dc24d967290c",
69
+ translationKey: "checkout_question.personalshopper.question",
70
+ type: CheckoutFeedbackQuestionType.HOST_SELECT,
71
+ metadata: {
72
+ showCondition: ["68c0bb98-b00a-4b86-af43-528fe903cb69"],
73
+ placeholder: "checkout_question.personalshopper.placeholder",
74
+ },
75
+ children: [
76
+ {
77
+ id: "cce7851c-92c7-461b-8dcb-903c5de59ed1",
78
+ translationKey: "checkout_question.personalshopper.yes",
79
+ type: CheckoutFeedbackQuestionType.BUTTON,
80
+ },
81
+ {
82
+ id: "4bf8f27d-669b-4d36-8d39-b5599c671816",
83
+ translationKey: "checkout_question.personalshopper.no",
84
+ type: CheckoutFeedbackQuestionType.BUTTON,
85
+ },
86
+ ],
87
+ },
88
+ {
89
+ id: "ce3e8d57-5eea-4dd3-bef4-2e811a143612",
90
+ translationKey: "checkout_question.comment.question",
91
+ type: CheckoutFeedbackQuestionType.HOST_TEXTAREA,
92
+ metadata: {
93
+ showCondition: [],
94
+ },
95
+ children: [
96
+ {
97
+ id: "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
98
+ translationKey: "checkout_question.comment.question",
99
+ type: CheckoutFeedbackQuestionType.TEXTAREA,
100
+ metadata: {
101
+ placeholder: "checkout_question.comment.placeholder",
102
+ },
103
+ },
104
+ ],
105
+ },
106
+ ];
107
+ export { checkoutFeedbackDefinition };
@@ -0,0 +1,12 @@
1
+ import { HttpPostFunction } from "@lookiero/sty-psp-http";
2
+ import { CheckoutFeedbackDefinitionByCheckoutIdView } from "../../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
3
+ interface HttpCheckoutFeedbackDefinitionByCheckoutIdView extends CheckoutFeedbackDefinitionByCheckoutIdView {
4
+ }
5
+ interface HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunctionArgs {
6
+ readonly httpPost: HttpPostFunction;
7
+ }
8
+ interface HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunction {
9
+ (args: HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunctionArgs): HttpCheckoutFeedbackDefinitionByCheckoutIdView;
10
+ }
11
+ declare const httpCheckoutFeedbackDefinitionByCheckoutIdView: HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunction;
12
+ export { httpCheckoutFeedbackDefinitionByCheckoutIdView };
@@ -0,0 +1,10 @@
1
+ const httpCheckoutFeedbackDefinitionByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
2
+ endpoint: "/view-checkout-feedback-definition-by-checkout-id",
3
+ body: { checkoutId },
4
+ signal,
5
+ result: {
6
+ error: null,
7
+ success: (response) => response,
8
+ },
9
+ });
10
+ export { httpCheckoutFeedbackDefinitionByCheckoutIdView };
@@ -0,0 +1,10 @@
1
+ import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
+ import { CheckoutFeedbackQuestionProjection } from "../../../../projection/checkoutFeedback/checkoutFeedback";
3
+ interface UseViewCheckoutFeedbackDefinitionByCheckoutIdFunctionArgs {
4
+ readonly checkoutId: string;
5
+ }
6
+ interface UseViewCheckoutFeedbackDefinitionByCheckoutIdFunction {
7
+ (args: UseViewCheckoutFeedbackDefinitionByCheckoutIdFunctionArgs): UseQueryFunctionResult<CheckoutFeedbackQuestionProjection[]>;
8
+ }
9
+ declare const useViewCheckoutFeedbackDefinitionByCheckoutId: UseViewCheckoutFeedbackDefinitionByCheckoutIdFunction;
10
+ export { useViewCheckoutFeedbackDefinitionByCheckoutId };
@@ -0,0 +1,9 @@
1
+ import { useQuery } from "@lookiero/messaging-react";
2
+ import { viewCheckoutFeedbackDefinitionByCheckoutId } from "../../../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
3
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
4
+ const useViewCheckoutFeedbackDefinitionByCheckoutId = ({ checkoutId, }) => useQuery({
5
+ query: viewCheckoutFeedbackDefinitionByCheckoutId({ checkoutId }),
6
+ contextId: MESSAGING_CONTEXT_ID,
7
+ options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
8
+ });
9
+ export { useViewCheckoutFeedbackDefinitionByCheckoutId };