@lookiero/checkout 9.8.5 → 9.9.0-beta.1

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 (144) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/pact.config.d.ts +21 -0
  3. package/dist/pact.config.js +16 -0
  4. package/dist/public/public/assets/adaptive-icon.png +0 -0
  5. package/dist/public/public/assets/favicon.png +0 -0
  6. package/dist/public/public/assets/icon.png +0 -0
  7. package/dist/public/public/assets/splash.png +0 -0
  8. package/dist/public/public/images/not-found.png +0 -0
  9. package/dist/src/ExpoRoot.js +6 -4
  10. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +1 -0
  11. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +55 -0
  12. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +1 -0
  13. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +116 -0
  14. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +1 -0
  15. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +56 -0
  16. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +1 -0
  17. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +51 -0
  18. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +1 -0
  19. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +51 -0
  20. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +1 -0
  21. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +51 -0
  22. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +13 -0
  23. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +19 -0
  24. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +1 -0
  25. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +56 -0
  26. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +1 -0
  27. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +57 -0
  28. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +1 -0
  29. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +55 -0
  30. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +1 -0
  31. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +120 -0
  32. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +1 -0
  33. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +55 -0
  34. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +1 -0
  35. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +55 -0
  36. package/dist/src/infrastructure/ui/Root.d.ts +0 -2
  37. package/dist/src/infrastructure/ui/Root.js +2 -4
  38. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +22 -0
  39. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
  40. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +7 -0
  41. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +5 -0
  42. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +7 -0
  43. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +6 -0
  44. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +4 -0
  45. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +20 -0
  46. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +4 -0
  47. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +43 -0
  48. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +12 -0
  49. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +14 -0
  50. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +1 -1
  51. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +1 -0
  52. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +1 -0
  53. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +1 -1
  54. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +1 -0
  55. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +1 -0
  56. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +7 -0
  57. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +21 -0
  58. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
  59. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
  60. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +12 -0
  61. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +64 -0
  62. package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +3 -2
  63. package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +17 -26
  64. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
  65. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +22 -55
  66. package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +10 -0
  67. package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +17 -0
  68. package/dist/src/infrastructure/ui/i18n/i18n.d.ts +1 -0
  69. package/dist/src/infrastructure/ui/i18n/i18n.js +1 -0
  70. package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +20 -0
  71. package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +27 -0
  72. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +10 -0
  73. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +27 -0
  74. package/dist/src/infrastructure/ui/views/App.style.d.ts +6 -0
  75. package/dist/src/infrastructure/ui/views/App.style.js +8 -0
  76. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +5 -2
  77. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
  78. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
  79. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +2 -2
  80. package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +7 -7
  81. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +7 -0
  82. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +11 -0
  83. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +12 -0
  84. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +64 -0
  85. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +12 -0
  86. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +16 -0
  87. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +40 -0
  88. package/dist/src/infrastructure/ui/views/return/Return.style.js +44 -0
  89. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +14 -0
  90. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +28 -0
  91. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +7 -0
  92. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +11 -0
  93. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +26 -0
  94. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +21 -0
  95. package/dist/src/projection/customer/customer.d.ts +2 -0
  96. package/dist/src/projection/shared/country.d.ts +14 -0
  97. package/dist/src/projection/shared/country.js +15 -0
  98. package/dist/src/projection/shared/customer.d.ts +9 -0
  99. package/dist/src/projection/shared/customer.js +1 -0
  100. package/dist/src/projection/shared/locale.d.ts +12 -0
  101. package/dist/src/projection/shared/locale.js +13 -0
  102. package/dist/src/projection/shared/order.d.ts +6 -0
  103. package/dist/src/projection/shared/order.js +1 -0
  104. package/dist/src/projection/shared/price.d.ts +11 -0
  105. package/dist/src/projection/shared/price.js +1 -0
  106. package/dist/src/projection/shared/size.d.ts +21 -0
  107. package/dist/src/projection/shared/size.js +4 -0
  108. package/dist/src/projection/shared/subscription.d.ts +2 -0
  109. package/dist/src/projection/shared/subscription.js +1 -0
  110. package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +15 -0
  111. package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +16 -0
  112. package/dist/src/shared/ui/components/atoms/error/Error.d.ts +11 -0
  113. package/dist/src/shared/ui/components/atoms/error/Error.js +6 -0
  114. package/dist/src/shared/ui/components/atoms/field/Field.d.ts +14 -0
  115. package/dist/src/shared/ui/components/atoms/field/Field.js +29 -0
  116. package/dist/src/shared/ui/components/atoms/field/Field.style.d.ts +16 -0
  117. package/dist/src/shared/ui/components/atoms/field/Field.style.js +19 -0
  118. package/dist/src/shared/ui/components/molecules/inputField/InputField.d.ts +24 -0
  119. package/dist/src/shared/ui/components/molecules/inputField/InputField.js +28 -0
  120. package/dist/src/shared/ui/components/molecules/inputField/InputField.style.d.ts +29 -0
  121. package/dist/src/shared/ui/components/molecules/inputField/InputField.style.js +37 -0
  122. package/dist/src/version.d.ts +1 -1
  123. package/dist/src/version.js +1 -1
  124. package/index.ts +1 -1
  125. package/package.json +3 -3
  126. package/src/ExpoRoot.tsx +6 -4
  127. package/src/infrastructure/ui/Root.tsx +17 -30
  128. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +1 -0
  129. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +0 -1
  130. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.ts +1 -0
  131. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +0 -1
  132. package/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.ts +18 -60
  133. package/src/infrastructure/ui/hooks/useSubmitCheckout.test.ts +0 -58
  134. package/src/infrastructure/ui/hooks/useSubmitCheckout.ts +33 -77
  135. package/src/infrastructure/ui/i18n/i18n.ts +1 -0
  136. package/src/infrastructure/ui/views/checkout/Checkout.style.ts +3 -0
  137. package/src/infrastructure/ui/views/checkout/Checkout.tsx +12 -3
  138. package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.tsx +2 -2
  139. package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +8 -8
  140. package/src/projection/customer/customer.ts +2 -0
  141. package/dist/src/infrastructure/ui/hooks/useQueryBus.d.ts +0 -9
  142. package/dist/src/infrastructure/ui/hooks/useQueryBus.js +0 -10
  143. package/src/infrastructure/ui/hooks/useQueryBus.test.tsx +0 -23
  144. package/src/infrastructure/ui/hooks/useQueryBus.tsx +0 -27
@@ -0,0 +1,55 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { checkoutQuestions } from "./checkoutQuestions.mock";
11
+ import { httpCheckoutQuestionsByCheckoutIdView } from "./httpCheckoutQuestionsByCheckoutIdView";
12
+
13
+ const provider = new PactV3({
14
+ ...DEFAULT_PACT_OPTIONS,
15
+ consumer: "STY-BOX_CHECKOUT-FRONT",
16
+ provider: "STY-BOX_CHECKOUT-BACK_ListCheckoutQuestionsByCheckoutId",
17
+ });
18
+ const checkoutId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
19
+ const checkoutQuestionsResponse = {
20
+ result: checkoutQuestions,
21
+ };
22
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
+ // @ts-ignore
24
+ const EXPECTED_BODY = MatchersV3.like(checkoutQuestionsResponse);
25
+ describe("STY-BOX_CHECKOUT-BACK_ListCheckoutQuestionsByCheckoutId API", () => {
26
+ it("returns a valid checkout questions for the given checkout id", () => {
27
+ provider
28
+ .given("a valid checkout questions for the given checkout id")
29
+ .uponReceiving("checkout questions projection")
30
+ .withRequest({
31
+ method: "POST",
32
+ path: "/api/list-checkout-questions-by-checkout-id",
33
+ headers: DEFAULT_REQUEST_HEADERS,
34
+ body: { checkoutId },
35
+ })
36
+ .willRespondWith({
37
+ status: 200,
38
+ headers: DEFAULT_RESPONSE_HEADERS,
39
+ body: EXPECTED_BODY,
40
+ });
41
+ return provider.executeTest(async (mockserver) => {
42
+ const httpPost = fetchHttpPost({
43
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
44
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
45
+ device: "web",
46
+ version: "1.0.0",
47
+ });
48
+ const response = await httpCheckoutQuestionsByCheckoutIdView({ httpPost })({
49
+ checkoutId,
50
+ signal: undefined,
51
+ });
52
+ expect(response).toStrictEqual(checkoutQuestionsResponse.result);
53
+ });
54
+ });
55
+ });
@@ -0,0 +1,120 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { httpPaymentFlowPayloadByCheckoutIdView } from "./httpPaymentFlowPayloadByCheckoutIdView";
11
+ import {
12
+ paymentFlowPayloadForKeptItems,
13
+ paymentFlowPayloadForReturnedItems,
14
+ paymentFlowPayloadForReplacedItems,
15
+ } from "./paymentFlowPayload.mock";
16
+
17
+ const provider = new PactV3({
18
+ ...DEFAULT_PACT_OPTIONS,
19
+ consumer: "STY-BOX_CHECKOUT-FRONT",
20
+ provider: "STY-BOX_CHECKOUT-BACK_ViewPaymentFlowPayloadByCheckoutId",
21
+ });
22
+ const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
23
+ const paymentFlowPayloadForKeptItemsResponse = {
24
+ result: paymentFlowPayloadForKeptItems,
25
+ };
26
+ const paymentFlowPayloadForReturnedItemsResponse = {
27
+ result: paymentFlowPayloadForReturnedItems,
28
+ };
29
+ const paymentFlowPayloadForReplacedItemsResponse = {
30
+ result: paymentFlowPayloadForReplacedItems,
31
+ };
32
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
33
+ // @ts-ignore
34
+ const EXPECTED_BODY_FOR_KEPT_ITEMS = MatchersV3.like(paymentFlowPayloadForKeptItemsResponse);
35
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
36
+ // @ts-ignore
37
+ const EXPECTED_BODY_FOR_RETURNED_ITEMS = MatchersV3.like(paymentFlowPayloadForReturnedItemsResponse);
38
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
+ // @ts-ignore
40
+ const EXPECTED_BODY_FOR_REPLACED_ITEMS = MatchersV3.like(paymentFlowPayloadForReplacedItemsResponse);
41
+ describe("STY-BOX_CHECKOUT-BACK_ViewPaymentFlowPayloadByCheckoutId API", () => {
42
+ it("returns a valid payment-flow payload for the given checkout id [KEPT items] ", () => {
43
+ provider
44
+ .given("a valid payment-flow payload for the given checkout id [KEPT items] ")
45
+ .uponReceiving("payment-flow payload projection")
46
+ .withRequest({
47
+ method: "POST",
48
+ path: "/api/view-payment-flow-payload-by-checkout-id",
49
+ headers: DEFAULT_REQUEST_HEADERS,
50
+ body: { checkoutId },
51
+ })
52
+ .willRespondWith({
53
+ status: 200,
54
+ headers: DEFAULT_RESPONSE_HEADERS,
55
+ body: EXPECTED_BODY_FOR_KEPT_ITEMS,
56
+ });
57
+ return provider.executeTest(async (mockserver) => {
58
+ const httpPost = fetchHttpPost({
59
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
60
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
61
+ device: "web",
62
+ version: "1.0.0",
63
+ });
64
+ const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
65
+ expect(response).toStrictEqual(paymentFlowPayloadForKeptItemsResponse.result);
66
+ });
67
+ });
68
+ it("returns a valid payment-flow payload for the given checkout id [RETURNED items] ", () => {
69
+ provider
70
+ .given("a valid payment-flow payload for the given checkout id [RETURNED items] ")
71
+ .uponReceiving("payment-flow payload projection")
72
+ .withRequest({
73
+ method: "POST",
74
+ path: "/api/view-payment-flow-payload-by-checkout-id",
75
+ headers: DEFAULT_REQUEST_HEADERS,
76
+ body: { checkoutId },
77
+ })
78
+ .willRespondWith({
79
+ status: 200,
80
+ headers: DEFAULT_RESPONSE_HEADERS,
81
+ body: EXPECTED_BODY_FOR_RETURNED_ITEMS,
82
+ });
83
+ return provider.executeTest(async (mockserver) => {
84
+ const httpPost = fetchHttpPost({
85
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
86
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
87
+ device: "web",
88
+ version: "1.0.0",
89
+ });
90
+ const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
91
+ expect(response).toStrictEqual(paymentFlowPayloadForReturnedItemsResponse.result);
92
+ });
93
+ });
94
+ it("returns a valid payment-flow payload for the given checkout id [REPLACED items] ", () => {
95
+ provider
96
+ .given("a valid payment-flow payload for the given checkout id [REPLACED items] ")
97
+ .uponReceiving("payment-flow payload projection")
98
+ .withRequest({
99
+ method: "POST",
100
+ path: "/api/view-payment-flow-payload-by-checkout-id",
101
+ headers: DEFAULT_REQUEST_HEADERS,
102
+ body: { checkoutId },
103
+ })
104
+ .willRespondWith({
105
+ status: 200,
106
+ headers: DEFAULT_RESPONSE_HEADERS,
107
+ body: EXPECTED_BODY_FOR_REPLACED_ITEMS,
108
+ });
109
+ return provider.executeTest(async (mockserver) => {
110
+ const httpPost = fetchHttpPost({
111
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
112
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
113
+ device: "web",
114
+ version: "1.0.0",
115
+ });
116
+ const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
117
+ expect(response).toStrictEqual(paymentFlowPayloadForReplacedItemsResponse.result);
118
+ });
119
+ });
120
+ });
@@ -0,0 +1,55 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { httpPricingByCheckoutIdView } from "./httpPricingByCheckoutIdView";
11
+ import { pricing } from "./pricing.mock";
12
+
13
+ const provider = new PactV3({
14
+ ...DEFAULT_PACT_OPTIONS,
15
+ consumer: "STY-BOX_CHECKOUT-FRONT",
16
+ provider: "STY-BOX_CHECKOUT-BACK_ViewPricingByCheckoutId",
17
+ });
18
+ const checkoutId = "6f720954-8039-4bed-9596-34fc5a02131b";
19
+ const pricingResponse = {
20
+ result: pricing(),
21
+ };
22
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
+ // @ts-ignore
24
+ const EXPECTED_BODY = MatchersV3.like(pricingResponse);
25
+ describe("STY-BOX_CHECKOUT-BACK_ViewPricingByCheckoutId API", () => {
26
+ it("returns a valid pricing for the given checkout", () => {
27
+ provider
28
+ .given("a valid pricing for the given checkout")
29
+ .uponReceiving("pricing projection")
30
+ .withRequest({
31
+ method: "POST",
32
+ path: "/api/view-pricing-by-checkout-id",
33
+ headers: DEFAULT_REQUEST_HEADERS,
34
+ body: { checkoutId },
35
+ })
36
+ .willRespondWith({
37
+ status: 200,
38
+ headers: DEFAULT_RESPONSE_HEADERS,
39
+ body: EXPECTED_BODY,
40
+ });
41
+ return provider.executeTest(async (mockserver) => {
42
+ const httpPost = fetchHttpPost({
43
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
44
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
45
+ device: "web",
46
+ version: "1.0.0",
47
+ });
48
+ const response = await httpPricingByCheckoutIdView({ httpPost })({
49
+ checkoutId,
50
+ signal: undefined,
51
+ });
52
+ expect(response).toStrictEqual(pricingResponse.result);
53
+ });
54
+ });
55
+ });
@@ -0,0 +1,55 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { httpReturnQuestionsByCheckoutItemIdView } from "./httpReturnQuestionsByCheckoutItemIdView";
11
+ import { returnQuestions } from "./returnQuestions.mock";
12
+
13
+ const provider = new PactV3({
14
+ ...DEFAULT_PACT_OPTIONS,
15
+ consumer: "STY-BOX_CHECKOUT-FRONT",
16
+ provider: "STY-BOX_CHECKOUT-BACK_ListReturnQuestionsByCheckoutItemId",
17
+ });
18
+ const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
19
+ const returnQuestionsResponse = {
20
+ result: returnQuestions,
21
+ };
22
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
+ // @ts-ignore
24
+ const EXPECTED_BODY = MatchersV3.like(returnQuestionsResponse);
25
+ describe("STY-BOX_CHECKOUT-BACK_ListReturnQuestionsByCheckoutItemId API", () => {
26
+ it("returns a valid return questions for the given checkout item id", () => {
27
+ provider
28
+ .given("a valid return questions for the given checkout item id")
29
+ .uponReceiving("return questions projection")
30
+ .withRequest({
31
+ method: "POST",
32
+ path: "/api/list-return-questions-by-checkout-item-id",
33
+ headers: DEFAULT_REQUEST_HEADERS,
34
+ body: { checkoutItemId },
35
+ })
36
+ .willRespondWith({
37
+ status: 200,
38
+ headers: DEFAULT_RESPONSE_HEADERS,
39
+ body: EXPECTED_BODY,
40
+ });
41
+ return provider.executeTest(async (mockserver) => {
42
+ const httpPost = fetchHttpPost({
43
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
44
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
45
+ device: "web",
46
+ version: "1.0.0",
47
+ });
48
+ const response = await httpReturnQuestionsByCheckoutItemIdView({ httpPost })({
49
+ checkoutItemId,
50
+ signal: undefined,
51
+ });
52
+ expect(response).toStrictEqual(returnQuestionsResponse.result);
53
+ });
54
+ });
55
+ });
@@ -1,7 +1,6 @@
1
1
  import { ComponentType } from "react";
2
2
  import { useRoutes as reactRouterUseRoutes } from "react-router-native";
3
3
  import { I18n } from "@lookiero/i18n-react";
4
- import { QueryBus } from "@lookiero/messaging";
5
4
  import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
6
5
  import { Locale } from "@lookiero/sty-psp-locale";
7
6
  import { SentryEnvironment, SentryLoggerFunctionArgs } from "@lookiero/sty-psp-logging";
@@ -13,7 +12,6 @@ import { KameleoonEnvironment } from "../ab-testing/kameleoonEnvironment";
13
12
  interface RootFunctionArgs {
14
13
  readonly Messaging: MessagingRoot;
15
14
  readonly I18n: I18n;
16
- readonly queryBus: QueryBus;
17
15
  readonly development?: boolean;
18
16
  readonly sentry: () => SentryEnvironment;
19
17
  readonly getAuthToken: () => Promise<string>;
@@ -4,17 +4,15 @@ import { Platform } from "react-native";
4
4
  import { useRoutes as reactRouterUseRoutes } from "react-router-native";
5
5
  import { Locale } from "@lookiero/sty-psp-locale";
6
6
  import { sentryLogger, sentryLoggerHOC } from "@lookiero/sty-psp-logging";
7
- import { QueryBusProvider } from "./hooks/useQueryBus";
8
7
  import { Routing } from "./routing/Routing";
9
- const root = ({ Messaging, I18n, queryBus, getAuthToken, development, sentry, kameleoon: kameleoonConfig, }) => {
8
+ const root = ({ Messaging, I18n, getAuthToken, development, sentry, kameleoon: kameleoonConfig }) => {
10
9
  const logger = sentryLogger(sentry);
11
10
  const kameleoon = kameleoonConfig();
12
11
  // eslint-disable-next-line react/display-name, react/prop-types
13
12
  const Root = ({ basePath, locale = Locale.en_GB, customer, order, subscription, layout, onNotAccessible, onCheckoutSubmitted, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
14
13
  const handleOnI18nError = useCallback((error) => logger.captureException(error), []);
15
14
  return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
16
- React.createElement(QueryBusProvider, { queryBus: queryBus },
17
- React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, kameleoon: kameleoon, layout: layout, locale: locale, order: order, subscription: subscription, useRedirect: useRedirect, useRoutes: useRoutes, onCheckoutSubmitted: onCheckoutSubmitted, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible }))));
15
+ React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, kameleoon: kameleoon, layout: layout, locale: locale, order: order, subscription: subscription, useRedirect: useRedirect, useRoutes: useRoutes, onCheckoutSubmitted: onCheckoutSubmitted, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
18
16
  };
19
17
  const hoc = sentryLoggerHOC({ logger });
20
18
  /**
@@ -0,0 +1,22 @@
1
+ import { FC, ReactNode, RefObject } from "react";
2
+ import { LayoutChangeEvent, ScrollView, StyleProp, ViewStyle } from "react-native";
3
+
4
+ interface LayoutStyle {
5
+ readonly safeAreaView: StyleProp<ViewStyle>;
6
+ readonly scrollView: StyleProp<ViewStyle>;
7
+ readonly header: StyleProp<ViewStyle>;
8
+ }
9
+ interface LayoutProps {
10
+ readonly children: ReactNode;
11
+ readonly header?: JSX.Element | null;
12
+ readonly footer?: JSX.Element | null;
13
+ readonly panel?: JSX.Element | null;
14
+ readonly stickyHeader?: boolean;
15
+ readonly stickyHeaderHiddenOnScroll?: boolean;
16
+ readonly scrollRef?: RefObject<ScrollView>;
17
+ readonly scrollEnabled?: boolean;
18
+ readonly style?: Partial<LayoutStyle>;
19
+ readonly onLayout?: (event: LayoutChangeEvent) => void;
20
+ }
21
+ type Layout = FC<LayoutProps>;
22
+ export type { Layout };
@@ -0,0 +1,7 @@
1
+ import { FC, ReactNode } from "react";
2
+
3
+ interface FooterProps {
4
+ readonly children: ReactNode;
5
+ }
6
+ declare const Footer: FC<FooterProps>;
7
+ export { Footer };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { Platform } from "react-native";
3
+
4
+ const Footer = ({ children }) => (Platform.OS !== "web" ? React.createElement(React.Fragment, null, children) : null);
5
+ export { Footer };
@@ -0,0 +1,7 @@
1
+ import { FC, ReactNode } from "react";
2
+
3
+ interface HeaderProps {
4
+ readonly children: ReactNode;
5
+ }
6
+ declare const Header: FC<HeaderProps>;
7
+ export { Header };
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { style } from "./Header.style";
4
+
5
+ const Header = ({ children }) => React.createElement(View, { style: style.header }, children);
6
+ export { Header };
@@ -0,0 +1,4 @@
1
+ declare const style: {
2
+ header: {};
3
+ };
4
+ export { style };
@@ -0,0 +1,20 @@
1
+ import { Platform, StyleSheet } from "react-native";
2
+ import { HEADER_HEIGHT } from "../../../../templates/header/Header.style";
3
+
4
+ const style = StyleSheet.create({
5
+ header: {
6
+ ...Platform.select({
7
+ web: {
8
+ position: "sticky",
9
+ top: 0,
10
+ zIndex: 10,
11
+ height: HEADER_HEIGHT,
12
+ },
13
+ native: {
14
+ position: "relative",
15
+ height: HEADER_HEIGHT,
16
+ },
17
+ }),
18
+ },
19
+ });
20
+ export { style };
@@ -0,0 +1,4 @@
1
+ import { Layout } from "../Layout";
2
+
3
+ declare const DummyLayout: Layout;
4
+ export { DummyLayout };
@@ -0,0 +1,43 @@
1
+ /* eslint-disable react/prop-types */
2
+ import React from "react";
3
+ import { View } from "react-native";
4
+ import { GestureHandlerRootView, ScrollView as RNGHScrollView } from "react-native-gesture-handler";
5
+ import { SafeAreaView } from "react-native-safe-area-context";
6
+ import { Footer as DefaultFooter } from "../../../templates/footer/Footer";
7
+ import { DefaultHeader } from "../../../templates/header/defaultHeader/DefaultHeader";
8
+ import { Footer } from "../components/footer/Footer";
9
+ import { Header } from "../components/header/Header";
10
+ import { style } from "./DummyLayout.style";
11
+
12
+ const DummyLayout = ({
13
+ children,
14
+ header = React.createElement(DefaultHeader, null),
15
+ footer = React.createElement(DefaultFooter, null),
16
+ panel,
17
+ style: customStyle,
18
+ scrollEnabled,
19
+ onLayout,
20
+ }) =>
21
+ React.createElement(
22
+ SafeAreaView,
23
+ { style: [style.safeAreaView, customStyle?.safeAreaView] },
24
+ React.createElement(
25
+ GestureHandlerRootView,
26
+ { style: { flex: 1 } },
27
+ React.createElement(
28
+ RNGHScrollView,
29
+ {
30
+ contentContainerStyle: [style.scrollView, customStyle?.scrollView],
31
+ scrollEnabled: scrollEnabled,
32
+ scrollEventThrottle: 16,
33
+ showsVerticalScrollIndicator: false,
34
+ stickyHeaderIndices: [0],
35
+ },
36
+ React.createElement(Header, null, header),
37
+ panel,
38
+ React.createElement(View, { style: style.children, onLayout: onLayout }, children),
39
+ ),
40
+ ),
41
+ React.createElement(Footer, null, footer),
42
+ );
43
+ export { DummyLayout };
@@ -0,0 +1,12 @@
1
+ declare const style: {
2
+ children: {
3
+ flex: number;
4
+ };
5
+ safeAreaView: {
6
+ flex: number;
7
+ };
8
+ scrollView: {
9
+ flexGrow: number;
10
+ };
11
+ };
12
+ export { style };
@@ -0,0 +1,14 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ const style = StyleSheet.create({
4
+ children: {
5
+ flex: 1,
6
+ },
7
+ safeAreaView: {
8
+ flex: 1,
9
+ },
10
+ scrollView: {
11
+ flexGrow: 1,
12
+ },
13
+ });
14
+ export { style };
@@ -8,7 +8,7 @@ const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParent
8
8
  const placeholderText = useMemo(() => (checkoutQuestion.placeholder ? formatMessage({ id: checkoutQuestion.placeholder }) : ""), [formatMessage, checkoutQuestion.placeholder]);
9
9
  const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
10
10
  const handleOnChange = useCallback((value) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }), [onChange, checkoutQuestionParentId]);
11
- return (React.createElement(InputField, { label: placeholderText, value: feedback, input: ({ onBlur, onFocus, style }) => (React.createElement(TextInput, { placeholder: placeholderText, style: style, testID: testID, textAlignVertical: "top", value: feedback, multiline: true, onBlur: onBlur, onChange: handleOnChange, onFocus: onFocus })), style: {
11
+ return (React.createElement(InputField, { label: placeholderText, value: feedback, input: ({ onBlur, onFocus, style }) => (React.createElement(TextInput, { placeholder: placeholderText, style: style, testID: testID, value: feedback, multiline: true, onBlur: onBlur, onChange: handleOnChange, onFocus: onFocus })), style: {
12
12
  inputField: style.inputField,
13
13
  input: { container: style.inputContainer, input: style.input },
14
14
  } }));
@@ -1,6 +1,7 @@
1
1
  declare const style: {
2
2
  input: {
3
3
  paddingTop: number;
4
+ height?: "auto" | undefined;
4
5
  };
5
6
  inputContainer: {
6
7
  alignItems?: "flex-start" | undefined;
@@ -8,6 +8,7 @@ const style = StyleSheet.create({
8
8
  ...Platform.select({
9
9
  android: {
10
10
  paddingTop: space2,
11
+ height: "auto",
11
12
  },
12
13
  }),
13
14
  },
@@ -11,7 +11,7 @@ const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParent, test
11
11
  const { feedback, onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
12
12
  const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParent.id, returnQuestionFeedback: value }), [onChange, returnQuestionParent.id]);
13
13
  return (React.createElement(View, { style: style.wrapper, testID: "textarea-return-question-item" },
14
- React.createElement(InputField, { label: placeholderText, value: feedback, input: ({ onBlur, onFocus, style }) => (React.createElement(TextInput, { placeholder: placeholderText, style: style, testID: testID, textAlignVertical: "top", value: feedback, multiline: true, onBlur: onBlur, onChange: handleOnChange, onFocus: onFocus })), style: {
14
+ React.createElement(InputField, { label: placeholderText, value: feedback, input: ({ onBlur, onFocus, style }) => (React.createElement(TextInput, { placeholder: placeholderText, style: style, testID: testID, value: feedback, multiline: true, onBlur: onBlur, onChange: handleOnChange, onFocus: onFocus })), style: {
15
15
  inputField: style.inputField,
16
16
  input: { container: style.inputContainer, input: style.input },
17
17
  } })));
@@ -1,6 +1,7 @@
1
1
  declare const style: {
2
2
  input: {
3
3
  paddingTop: number;
4
+ height?: "auto" | undefined;
4
5
  };
5
6
  inputContainer: {
6
7
  alignItems?: "flex-start" | undefined;
@@ -8,6 +8,7 @@ const style = StyleSheet.create({
8
8
  ...Platform.select({
9
9
  android: {
10
10
  paddingTop: space2,
11
+ height: "auto",
11
12
  },
12
13
  }),
13
14
  },
@@ -0,0 +1,7 @@
1
+ import { FC } from "react";
2
+
3
+ interface DefaultHeaderProps {
4
+ readonly onPressMenu?: () => void;
5
+ }
6
+ declare const DefaultHeader: FC<DefaultHeaderProps>;
7
+ export { DefaultHeader };
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { ButtonIcon } from "@lookiero/aurora";
3
+ import { Header } from "../Header";
4
+ import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
5
+ import { Logo } from "../logo/Logo";
6
+ import { style } from "./DefaultHeader.style";
7
+
8
+ const DefaultHeader = ({ onPressMenu }) =>
9
+ React.createElement(
10
+ Header,
11
+ { testID: "default-header" },
12
+ React.createElement(Logo, null),
13
+ React.createElement(ButtonIconPlaceholder, null),
14
+ React.createElement(ButtonIcon, {
15
+ name: "menu",
16
+ style: style.button,
17
+ testID: "menu-button-icon",
18
+ onPress: onPressMenu,
19
+ }),
20
+ );
21
+ export { DefaultHeader };
@@ -0,0 +1,8 @@
1
+ declare const style: {
2
+ button: {
3
+ alignSelf: "auto";
4
+ height: number;
5
+ width: number;
6
+ };
7
+ };
8
+ export { style };
@@ -0,0 +1,12 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+
4
+ const { space10 } = theme();
5
+ const style = StyleSheet.create({
6
+ button: {
7
+ alignSelf: "auto",
8
+ height: space10,
9
+ width: space10,
10
+ },
11
+ });
12
+ export { style };
@@ -0,0 +1,12 @@
1
+ import { FC, ReactNode } from "react";
2
+
3
+ declare enum NewFeedbackExperimentVariation {
4
+ CONTROL = "control",
5
+ RETURN_PAGE = "return_page",
6
+ }
7
+ interface NewFeedbackExperimentProviderProps {
8
+ readonly children: ReactNode;
9
+ }
10
+ declare const NewFeedbackExperimentProvider: FC<NewFeedbackExperimentProviderProps>;
11
+ declare const useNewFeedbackExperiment: () => NewFeedbackExperimentVariation;
12
+ export { useNewFeedbackExperiment, NewFeedbackExperimentProvider, NewFeedbackExperimentVariation };